Path: | dynamics/dyn_spectral_test.f90 |
Last Update: | Thu Jul 26 17:33:32 JST 2007 |
Authors: | Yasuhiro MORIKAWA |
Version: | $Id: dyn_spectral_test.f90,v 1.4 2007/07/26 08:33:32 morikawa Exp $ |
Tag Name: | $Name: dcpam4-20070731 $ |
Copyright: | Copyright (C) GFD Dennou Club, 2007. All rights reserved. |
License::
Note that Japanese and English are described in parallel.
dyn_spectral モジュールの動作テストを行うためのプログラムです. このプログラムがコンパイルできること, および実行時に プログラムが正常終了することを確認してください.
This program checks the operation of "dyn_spectral" module. Confirm compilation and execution of this program.
Main Program : |
program dyn_spectral_test use constants, only: CONST, Create, Get use dyn_spectral, only: DYNSP, Create, Close, PutLine, initialized use dc_test, only: AssertEqual use dc_types, only: DP, STRING use dc_string, only: StoA use dc_args, only: ARGS, Open, HelpMsg, Option, Debug, Help, Strict, Close implicit none !--------------------------------------------------------- ! 実験の表題, モデルの名称, 所属機関名 ! Title of a experiment, name of model, sub-organ !--------------------------------------------------------- character(*), parameter:: title = 'dyn_spectral_test $Name: dcpam4-20070731 $ :: ' // 'Test program of "dyn_spectral" module' character(*), parameter:: source = 'dcpam4 ' // '(See http://www.gfd-dennou.org/library/dcpam)' character(*), parameter:: institution = 'GFD Dennou Club (See http://www.gfd-dennou.org)' !--------------------------------------------------------- ! 作業変数 ! Work variables !--------------------------------------------------------- type(ARGS):: arg ! コマンドライン引数. ! Command line arguments logical:: OPT_namelist ! -N, --namelist オプションの有無. ! Existence of '-N', '--namelist' option character(STRING):: VAL_namelist ! -N, --namelist オプションの値. ! Value of '-N', '--namelist' option type(CONST):: const_earth real(DP):: PI ! $ \pi $ . 円周率. Circular constant real(DP):: RPlanet ! $ a $ . 惑星半径. Radius of planet real(DP):: Omega ! $ \Omega $ . 回転角速度. Angular velocity real(DP):: Grav ! $ g $ . 重力加速度. Gravitational acceleration real(DP):: Cp ! $ C_p $ . 大気定圧比熱. Specific heat of air at constant pressure real(DP):: RAir ! $ R $ . 大気気体定数. Gas constant of air real(DP):: EpsVT ! $ 1/\epsilon_v - 1 $ . integer:: VisOrder ! 超粘性の次数. Order of hyper-viscosity real(DP):: EFoldTime ! 最大波数に対する e-folding time. E-folding time for maximum wavenumber type(DYNSP) :: dyn_sp00, dyn_sp01, dyn_sp02, dyn_sp03, dyn_sp04, dyn_sp05 real(DP) :: DelTime logical :: err continue !--------------------------------------------------------- ! コマンドライン引数の処理 ! Command line arguments handling !--------------------------------------------------------- call Open( arg ) call HelpMsg( arg, 'Title', title ) call HelpMsg( arg, 'Usage', './dyn_spectral_test [Options]' ) call HelpMsg( arg, 'Source', source ) call HelpMsg( arg, 'Institution', institution ) call Option( arg, StoA('-N', '--namelist'), OPT_namelist, VAL_namelist, help = "NAMELIST filename" ) call Debug( arg ) call Help( arg ) call Strict( arg, severe = .true. ) call Close( arg ) !--------------------------------------------------------- ! 物理定数の準備 ! Prepare physical constants !--------------------------------------------------------- call Create( const_earth ) ! (inout) DelTime = 1800.0_DP call Get( constant = const_earth, PI = PI, RPlanet = RPlanet, Grav = Grav, Omega = Omega, Cp = Cp, RAir = RAir, EpsVT = EpsVT, VisOrder = VisOrder, EFoldTime = EFoldTime) ! (out) !--------------------------------------------------------- ! 初期設定テスト ! Initialization test !--------------------------------------------------------- call Create( dyn_sp00, nmax = 21, imax = 64, jmax = 32, kmax = 10, PI = PI, RPlanet = RPlanet, Grav = Grav, Omega = Omega, Cp = Cp, RAir = RAir, VisOrder = VisOrder, EFoldTime = EFoldTime, DelTime = DelTime, nmlfile = VAL_namelist ) ! (in) call AssertEqual( 'initialization test 1', answer = .true., check = initialized(dyn_sp00) ) call PutLine( dyn_sp00 ) ! (in) err = .false. call Create( dyn_sp00, nmax = 21, imax = 64, jmax = 32, kmax = 10, PI = PI, RPlanet = RPlanet, Grav = Grav, Omega = Omega, Cp = Cp, RAir = RAir, VisOrder = VisOrder, EFoldTime = EFoldTime, DelTime = DelTime, err = err ) ! (out) call AssertEqual( 'initialization test 2', answer = .true., check = err ) call Close( dyn_sp00 ) ! (inout) call AssertEqual( 'termination test 1', answer = .false., check = initialized(dyn_sp00) ) call PutLine( dyn_sp00 ) ! (in) err = .false. call Close( dyn_sp00, err ) ! (inout) call AssertEqual( 'termination test 2', answer = .true., check = err ) err = .false. call Create( dyn_sp01, nmax = 1, imax = 1, jmax = 1, kmax = 1, PI = PI, RPlanet = RPlanet, Grav = Grav, Omega = Omega, Cp = Cp, RAir = RAir, VisOrder = VisOrder, EFoldTime = EFoldTime, DelTime = DelTime ) ! (in) call AssertEqual( 'twice initialization failue test 1', answer = .false., check = initialized(dyn_sp01) ) err = .false. call Create( dyn_sp02, nmax = 0, imax = 64, jmax = 32, kmax = 10, PI = PI, RPlanet = RPlanet, Grav = Grav, Omega = Omega, Cp = Cp, RAir = RAir, VisOrder = VisOrder, EFoldTime = EFoldTime, DelTime = DelTime, err = err ) ! (out) call AssertEqual( 'invalid argument test 1', answer = .true., check = err ) err = .false. call Create( dyn_sp03, nmax = 21, imax = 0, jmax = 32, kmax = 10, PI = PI, RPlanet = RPlanet, Grav = Grav, Omega = Omega, Cp = Cp, RAir = RAir, VisOrder = VisOrder, EFoldTime = EFoldTime, DelTime = DelTime, err = err ) ! (out) call AssertEqual( 'invalid argument test 2', answer = .true., check = err ) err = .false. call Create( dyn_sp04, nmax = 21, imax = 64, jmax = 0, kmax = 10, PI = PI, RPlanet = RPlanet, Grav = Grav, Omega = Omega, Cp = Cp, RAir = RAir, VisOrder = VisOrder, EFoldTime = EFoldTime, DelTime = DelTime, err = err ) ! (out) call AssertEqual( 'invalid argument test 3', answer = .true., check = err ) err = .false. call Create( dyn_sp05, nmax = 21, imax = 64, jmax = 32, kmax = 0, PI = PI, RPlanet = RPlanet, Grav = Grav, Omega = Omega, Cp = Cp, RAir = RAir, VisOrder = VisOrder, EFoldTime = EFoldTime, DelTime = DelTime, err = err ) ! (out) call AssertEqual( 'invalid argument test 4', answer = .true., check = err ) end program dyn_spectral_test