SCALE-RM
scale_atmos_phy_cp_common.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
11 !-------------------------------------------------------------------------------
12 #include "scalelib.h"
14  !-----------------------------------------------------------------------------
15  !
16  !++ used modules
17  !
18  use scale_precision
19  use scale_io
20  use scale_prof
21  !-----------------------------------------------------------------------------
22  implicit none
23  private
24  !-----------------------------------------------------------------------------
25  !
26  !++ Public procedure
27  !
30 
31  !-----------------------------------------------------------------------------
32  !
33  !++ Public parameters & variables
34  !
35  !-----------------------------------------------------------------------------
36  !
37  !++ Private procedure
38  !
39  !-----------------------------------------------------------------------------
40  !
41  !++ Private parameters & variables
42  !
43  !-----------------------------------------------------------------------------
44  ! tuning parameter
45  logical, private :: param_atmos_phy_cp_wadapt = .true.
46  integer, private :: param_atmos_phy_cp_w_time = 16
47  !------------------------------------------------------------------------------
48 contains
49  !------------------------------------------------------------------------------
51  subroutine atmos_phy_cp_common_setup
52  use scale_prc, only: &
53  prc_abort
54  implicit none
55 
56  namelist / param_atmos_phy_cp_common / &
57  param_atmos_phy_cp_wadapt, &
58  param_atmos_phy_cp_w_time
59 
60  integer :: ierr
61  !---------------------------------------------------------------------------
62 
63  log_newline
64  log_info("ATMOS_PHY_CP_common_setup",*) 'Setup'
65  log_info("ATMOS_PHY_CP_common_setup",*) 'CP-COMMON'
66 
67  !--- read namelist
68  rewind(io_fid_conf)
69  read(io_fid_conf,nml=param_atmos_phy_cp_common,iostat=ierr)
70  if( ierr < 0 ) then !--- missing
71  log_info("ATMOS_PHY_CP_common_setup",*) 'Not found namelist. Default used.'
72  elseif( ierr > 0 ) then !--- fatal error
73  log_error("ATMOS_PHY_CP_common_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_CP_COMMON. Check!'
74  call prc_abort
75  endif
76  log_nml(param_atmos_phy_cp_common)
77 
78  ! output parameter lists
79  log_newline
80  log_info("ATMOS_PHY_CP_common_setup",*) "Use running mean of w in adaptive timestep? : ", param_atmos_phy_cp_wadapt
81  log_info("ATMOS_PHY_CP_common_setup",*) "Fixed time scale for running mean of w : ", param_atmos_phy_cp_w_time
82 
83  return
84  end subroutine atmos_phy_cp_common_setup
85 
86  !-----------------------------------------------------------------------------
96  !-----------------------------------------------------------------------------
97  subroutine atmos_phy_cp_common_wmean( &
98  KA, KS, KE, IA, IS, IE, JA, JS, JE, &
99  W, &
100  TIME_DTSEC, CP_DTSEC, &
101  W0_mean )
102  implicit none
103  integer, intent(in) :: KA, KS, KE
104  integer, intent(in) :: IA, IS, IE
105  integer, intent(in) :: JA, JS, JE
106 
107  real(RP), intent(in) :: W(ka,ia,ja)
108  real(DP), intent(in) :: TIME_DTSEC
109  real(DP), intent(in) :: CP_DTSEC
110 
111  real(RP), intent(inout) :: W0_mean(ka,ia,ja)
112 
113  real(RP) :: fact_W0_mean, fact_W0
114 
115  integer :: k, i, j
116  !---------------------------------------------------------------------------
117 
118  if ( param_atmos_phy_cp_wadapt ) then
119  fact_w0_mean = 2.0_rp * max(cp_dtsec,time_dtsec) - time_dtsec
120  fact_w0 = time_dtsec
121  else ! w_time is tuning parameter
122  fact_w0_mean = real(param_atmos_phy_cp_w_time,rp)
123  fact_w0 = 1.0_rp
124  endif
125 
126  do j = js, je
127  do i = is, ie
128  do k = ks, ke
129  w0_mean(k,i,j) = ( w0_mean(k,i,j) * fact_w0_mean &
130  + w(k,i,j) * fact_w0 ) / ( fact_w0_mean + fact_w0 )
131  enddo
132  enddo
133  enddo
134 
135  return
136  end subroutine atmos_phy_cp_common_wmean
137 
138 end module scale_atmos_phy_cp_common
subroutine, public atmos_phy_cp_common_setup
Setup.
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:55
module atmosphere / physics / cumulus / Common
module PROCESS
Definition: scale_prc.F90:11
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:338
module profiler
Definition: scale_prof.F90:11
subroutine, public atmos_phy_cp_common_wmean(KA, KS, KE, IA, IS, IE, JA, JS, JE, W, TIME_DTSEC, CP_DTSEC, W0_mean)
ATMOS_PHY_CP_wmean running mean vertical wind velocity comment for W0 imported from WRF...
module PRECISION
module STDIO
Definition: scale_io.F90:10
integer, parameter, public rp