phy_dryconv_adjust_test.f90

Path: physics/phy_dryconv_adjust_test.f90
Last Update: Sat Jun 14 20:44:15 +0900 2008

phy_dryconv_adjust モジュールのテストプログラム

Test program for "phy_dryconv_adjust"

Authors:Yukiko YAMADA, Yasuhiro MORIKAWA
Version:$Id: phy_dryconv_adjust_test.f90,v 1.3 2008-06-14 11:44:15 morikawa Exp $
Tag Name:$Name: dcpam4-20080624-1 $
Copyright:Copyright (C) GFD Dennou Club, 2007. All rights reserved.
License:See COPYRIGHT

Note that Japanese and English are described in parallel.

phy_dryconv_adjust モジュールの動作テストを行うためのプログラムです. このプログラムがコンパイルできること, および実行時に プログラムが正常終了することを確認してください.

This program checks the operation of "phy_dryconv_adjust" module. Confirm compilation and execution of this program.

Methods

Included Modules

phy_dryconv_adjust constants dc_test dc_types dc_string dc_args gt4_history

Public Instance methods

Main Program :

[Source]

program phy_dryconv_adjust_test
  use phy_dryconv_adjust, only: PHYDRYCONV, Create, Close, PutLine, initialized, DryConvectAdjust
  use constants, only: CONST, Create, Get
  use dc_test, only: AssertEqual, AssertGreaterThan, AssertLessThan
  use dc_types, only: DP, STRING
  use dc_string, only: StoA, PutLine
  use dc_args, only: ARGS, Open, HelpMsg, Option, Debug, Help, Strict, Close
  use gt4_history, only: HistoryGet
  implicit none

  !---------------------------------------------------------
  !  実験の表題, モデルの名称, 所属機関名
  !  Title of a experiment, name of model, sub-organ
  !---------------------------------------------------------
  character(*), parameter:: title = 'phy_dryconv_adjust_test $Name: dcpam4-20080624-1 $ :: ' // 'Test program of "phy_dryconv_adjust" 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)'

  !-------------------------------------------------------------------
  !  格子点数・最大全波数
  !  Grid points and maximum truncated wavenumber
  !-------------------------------------------------------------------
  integer, parameter:: imax = 32         ! 経度格子点数. 
                              ! Number of grid points in longitude
  integer, parameter:: jmax = 16         ! 緯度格子点数. 
                              ! Number of grid points in latitude
  integer, parameter:: kmax = 12         ! 鉛直層数. 
                              ! Number of vertical level

  !-----------------------------------------------------------------
  !  物理定数等の設定
  !  Configure physical constants etc.
  !-----------------------------------------------------------------
  type(CONST):: const_earth
  real(DP):: Cp        ! $ C_p $ .    大気定圧比熱.   Specific heat of air at constant pressure
  real(DP):: RAir      ! $ R $ .      大気気体定数.   Gas constant of air
  real(DP):: DelTime    ! $ \Delta t $ . タイムステップ. Time step

  !---------------------------------------------------------
  !  物理量
  !  Physical values
  !---------------------------------------------------------
  real(DP):: xyz_Temp (0:imax-1, 0:jmax-1, 0:kmax-1)
                              ! $ T $ . 温度 (整数レベル). 
                              ! Temperature (full level)
  real(DP):: xyz_Press (0:imax-1, 0:jmax-1, 0:kmax-1)
                              ! $ p_s $ . 地表面気圧 (整数レベル). 
                              ! Surface pressure (full level)
  real(DP):: xyr_Press (0:imax-1, 0:jmax-1, 0:kmax)
                              ! $ p_s $ . 地表面気圧 (半整数レベル). 
                              ! Surface pressure (half level)
  real(DP):: xyz_DTempDtDryConv (0:imax-1, 0:jmax-1, 0:kmax-1)
                              ! 乾燥対流調節による温度変化率. 
                              ! Temperature tendency by dry convective adjustment

  !---------------------------------------------------------
  !  作業変数
  !  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(PHYDRYCONV):: phy_dryconv00, phy_dryconv01, phy_dryconv02, phy_dryconv03
  logical:: err
  character(*), parameter:: subname = 'phy_dryconv_adjust_test'
continue

  !---------------------------------------------------------
  !  コマンドライン引数の処理
  !  Command line arguments handling
  !---------------------------------------------------------
  call Open( arg )
  call HelpMsg( arg, 'Title', title )
  call HelpMsg( arg, 'Usage', './phy_dryconv_adjust_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 = 600.0_DP

  call Get( constant = const_earth, Cp = Cp, RAir = RAir )          ! (out)

  !---------------------------------------------------------
  !  初期設定テスト
  !  Initialization test
  !---------------------------------------------------------
  call Create( phy_dryconv = phy_dryconv00, imax = imax, jmax = jmax, kmax = kmax, RAir = RAir, Cp = Cp, DelTime = DelTime )                      ! (in)
  call AssertEqual( 'initialization test 1', answer = .true., check = initialized(phy_dryconv00) )
  call PutLine( phy_dryconv = phy_dryconv00 ) ! (in)


  !---------------------------------------------------------
  !  DryConvectAdjust テスト
  !  DryConvectAdjust test
  !---------------------------------------------------------
  call HistoryGet( file = 'phy_dryconv_adjust_test00.nc', varname = 'Temp', array = xyz_Temp )                       ! (out)

  call HistoryGet( file = 'phy_dryconv_adjust_test00.nc', varname = 'Press', array = xyz_Press )                      ! (out)

  call HistoryGet( file = 'phy_dryconv_adjust_test00.nc', varname = 'PressM', array = xyr_Press )                      ! (out)

  call DryConvectAdjust( phy_dryconv = phy_dryconv00, xyz_Press = xyz_Press, xyr_Press = xyr_Press, xyz_Temp = xyz_Temp, xyz_DTempDt = xyz_DTempDtDryConv )                 ! (out)

  call PutLine( xyz_DTempDtDryConv, indent = ' xyz_DTempDtDryConv=' )

  !---------------------------------------------------------
  !  終了処理テスト
  !  Termination test
  !---------------------------------------------------------
  call Close( phy_dryconv = phy_dryconv00 ) ! (inout)
  call AssertEqual( 'termination test 1', answer = .false., check = initialized(phy_dryconv00) )
  call PutLine( phy_dryconv = phy_dryconv00 ) ! (in)

  call Close( phy_dryconv = phy_dryconv02, err = err )                            ! (out)
  call AssertEqual( 'termination test 2', answer = .true., check = err )

end program phy_dryconv_adjust_test

[Validate]