SCALE-RM
Data Types | Functions/Subroutines | Variables
scale_atmos_phy_cp_kf Module Reference

module ATMOSPHERE / Physics Cumulus Parameterization More...

Functions/Subroutines

subroutine, public atmos_phy_cp_kf_setup (CP_TYPE)
 Setup. More...
 
subroutine, public atmos_phy_cp_kf (DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, DENS_t_CP, MOMZ_t_CP, MOMX_t_CP, MOMY_t_CP, RHOT_t_CP, RHOQ_t_CP, MFLX_cloudbase, SFLX_convrain, cloudtop, cloudbase, cldfrac_dp, cldfrac_sh, nca, w0avg)
 
subroutine kf_wmean (W0_avg, DENS, MOMZ)
 running mean vertical wind speed More...
 
subroutine cp_kf_param (RATE_in, TRIGGER_in, FLAG_QS_in, FLAG_QI_in, KF_DT_in, DELCAPE_in, DEEPLIFETIME_in, SHALLOWLIFETIME_in, DEPTH_USL_in, KF_prec_in, KF_threshold_in, WARMRAIN_in, KF_LOG_in, stepkf_in)
 
subroutine cp_kf_main (dens, MOMZ, MOMX, MOMY, RHOT, QTRC, w0avg, nca, DENS_t_CP, DT_RHOT, DT_RHOQ, rainrate_cp, cldfrac_sh, cldfrac_dp, timecp, cloudtop, zlcl, I_convflag)
 
subroutine kf_lutab
 

Variables

real(rp), save, public kf_dt = 5._RP
 

Detailed Description

module ATMOSPHERE / Physics Cumulus Parameterization

Description
Cumulus convection by Kain-Fritsch parameterization Reference: Kain and Fritsch(1990) Kain (2004) Narita and Ohmori (2007)
Author
Team SCALE
History
  • 2016-06-27 (S.Matsugishi) [new]
This file was originally copied from WRF. The original file was published with the following notice.

WRF was developed at the National Center for Atmospheric Research (NCAR) which is operated by the University Corporation for Atmospheric Research (UCAR). NCAR and UCAR make no proprietary claims, either statutory or otherwise, to this version and release of WRF and consider WRF to be in the public domain for use by any person or entity for any purpose without any fee or charge. UCAR requests that any WRF user include this notice on any partial or full copies of WRF. WRF is provided on an "AS IS" basis and any warranties, either express or implied, including but not limited to implied warranties of non-infringement, originality, merchantability and fitness for a particular purpose, are disclaimed. In no event shall UCAR be liable for any damages, whatsoever, whether direct, indirect, consequential or special, that arise out of or in connection with the access, use or performance of WRF, including infringement actions.

WRF® is a registered trademark of the University Corporation for Atmospheric Research (UCAR).

NAMELIST
  • PARAM_ATMOS_PHY_CP_KF
    nametypedefault valuecomment
    PARAM_ATMOS_PHY_CP_KF_RATE real(RP) 0.03_RP ratio of cloud water and precipitation (Ogura and Cho 1973)
    PARAM_ATMOS_PHY_CP_KF_TRIGGER integer 1 trigger function type 1:KF2004 3:NO2007
    PARAM_ATMOS_PHY_CP_KF_QS logical .true. qs is allowed?
    PARAM_ATMOS_PHY_CP_KF_QI logical .true. qi is allowed?
    PARAM_ATMOS_PHY_CP_KF_DT real(DP) 5.0_DP KF convection check time interval [min]
    PARAM_ATMOS_PHY_CP_KF_DLCAPE real(RP) 0.1_RP cape decleace rate
    PARAM_ATMOS_PHY_CP_KF_DLIFETIME real(RP) 1800.0_RP minimum lifetime scale of deep convection [sec]
    PARAM_ATMOS_PHY_CP_KF_SLIFETIME real(RP) 2400.0_RP lifetime of shallow convection [sec]
    PARAM_ATMOS_PHY_CP_KF_DEPTH_USL real(RP) 300.0_RP depth of updraft source layer [hPa]
    PARAM_ATMOS_PHY_CP_KF_PREC integer 1 precipitation type 1:Ogura-Cho(1973) 2:Kessler
    PARAM_ATMOS_PHY_CP_KF_THRES real(RP) 1.E-3_RP autoconversion rate for Kessler
    PARAM_ATMOS_PHY_CP_KF_WARMRAIN logical .false. QQA is less equal to 3?
    PARAM_ATMOS_PHY_CP_KF_LOG logical .false. output log?
    PARAM_ATMOS_PHY_CP_KF_WADAPT logical .true.
    PARAM_ATMOS_PHY_CP_KF_W_TIME integer 16

History Output
namedescriptionunitvariable
KF_LIFETIME lifetime of KF scheme s lifetime
RP) KF_CONVFLAG CONVECTION FLAG real(I_convflag

Function/Subroutine Documentation

◆ atmos_phy_cp_kf_setup()

subroutine, public scale_atmos_phy_cp_kf::atmos_phy_cp_kf_setup ( character(len=*), intent(in)  CP_TYPE)

Setup.

Definition at line 134 of file scale_atmos_phy_cp_kf.F90.

References cp_kf_param(), scale_grid::dx, scale_grid::dy, scale_grid_index::ia, scale_grid_index::ie, scale_stdio::io_fid_conf, scale_stdio::io_fid_log, scale_stdio::io_l, scale_grid_index::is, scale_grid_index::ja, scale_grid_index::je, scale_grid_index::js, scale_grid_index::ka, scale_grid_index::ke, kf_lutab(), scale_grid_index::ks, scale_process::prc_mpistop(), scale_grid_real::real_cz, scale_time::time_dtsec, and scale_time::time_dtsec_atmos_phy_cp.

Referenced by scale_atmos_phy_cp::atmos_phy_cp_setup().

134  use scale_process, only: &
136  use scale_time , only :&
137  time_dtsec, &
139  use scale_grid_real, only: &
140  cz => real_cz
141  use scale_grid,only: &
142  dx => dx, &
143  dy => dy
144  implicit none
145 
146  character(len=*), intent(in) :: cp_type
147 
148  ! tunning parameters, original parameter set is from KF2004 and NO2007
149  real(RP) :: param_atmos_phy_cp_kf_rate = 0.03_rp ! ratio of cloud water and precipitation (Ogura and Cho 1973)
150  integer :: param_atmos_phy_cp_kf_trigger = 1 ! trigger function type 1:KF2004 3:NO2007
151  logical :: param_atmos_phy_cp_kf_qs = .true. ! qs is allowed?
152  logical :: param_atmos_phy_cp_kf_qi = .true. ! qi is allowed?
153  real(DP) :: param_atmos_phy_cp_kf_dt = 5.0_dp ! KF convection check time interval [min]
154  real(RP) :: param_atmos_phy_cp_kf_dlcape = 0.1_rp ! cape decleace rate
155  real(RP) :: param_atmos_phy_cp_kf_dlifetime = 1800.0_rp ! minimum lifetime scale of deep convection [sec]
156  real(RP) :: param_atmos_phy_cp_kf_slifetime = 2400.0_rp ! lifetime of shallow convection [sec]
157  real(RP) :: param_atmos_phy_cp_kf_depth_usl = 300.0_rp ! depth of updraft source layer [hPa]
158  integer :: param_atmos_phy_cp_kf_prec = 1 ! precipitation type 1:Ogura-Cho(1973) 2:Kessler
159  real(RP) :: param_atmos_phy_cp_kf_thres = 1.e-3_rp ! autoconversion rate for Kessler
160  logical :: param_atmos_phy_cp_kf_warmrain = .false. ! QQA is less equal to 3?
161  logical :: param_atmos_phy_cp_kf_log = .false. ! output log?
162 
163  namelist / param_atmos_phy_cp_kf / &
164  param_atmos_phy_cp_kf_rate, &
165  param_atmos_phy_cp_kf_trigger, &
166  param_atmos_phy_cp_kf_qs, &
167  param_atmos_phy_cp_kf_qi, &
168  param_atmos_phy_cp_kf_dt, &
169  param_atmos_phy_cp_kf_dlcape, &
170  param_atmos_phy_cp_kf_dlifetime, &
171  param_atmos_phy_cp_kf_slifetime, &
172  param_atmos_phy_cp_kf_depth_usl, &
173  param_atmos_phy_cp_kf_prec, &
174  param_atmos_phy_cp_kf_thres, &
175  param_atmos_phy_cp_kf_warmrain, &
176  param_atmos_phy_cp_kf_log, &
177  param_atmos_phy_cp_kf_wadapt, &
178  param_atmos_phy_cp_kf_w_time
179 
180  integer :: k, i, j
181  integer :: ierr
182  !---------------------------------------------------------------------------
183 
184  if( io_l ) write(io_fid_log,*)
185  if( io_l ) write(io_fid_log,*) '++++++ Module[CUMULUS] / Categ[ATMOS PHYSICS] / Origin[SCALElib]'
186  if( io_l ) write(io_fid_log,*) '+++ Kain-Fritsch scheme'
187 
188  if ( cp_type /= 'KF' ) then
189  write(*,*) 'xxx ATMOS_PHY_CP_TYPE is not KF. Check!'
190  call prc_mpistop
191  endif
192 
193  if ( abs(time_dtsec_atmos_phy_cp-time_dtsec) > 0.0_dp ) then
194  write(*,*) 'xxx TIME_DTSEC_ATMOS_PHY_CP should be same as TIME_DTSEC for KF scheme. STOP.'
195  call prc_mpistop
196  endif
197 
198  !--- read namelist
199  rewind(io_fid_conf)
200  read(io_fid_conf,nml=param_atmos_phy_cp_kf,iostat=ierr)
201  if( ierr < 0 ) then !--- missing
202  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
203  elseif( ierr > 0 ) then !--- fatal error
204  write(*,*) 'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_CP_KF. Check!'
205  call prc_mpistop
206  endif
207  if( io_l ) write(io_fid_log,nml=param_atmos_phy_cp_kf)
208 
209  call kf_lutab ! set kf look up table
210 
211  ! set kf convection check step
212  time_dstep_kf = nint( param_atmos_phy_cp_kf_dt * 60.0_dp / time_dtsec_atmos_phy_cp )
213  time_dstep_kf = max(time_dstep_kf,1) ! kf time interval step
214  time_res_kf = -1 ! initialize to keep consistent for below step
215  time_dokf = .true. ! initialize
216 
217  call cp_kf_param( param_atmos_phy_cp_kf_rate, &
218  param_atmos_phy_cp_kf_trigger, &
219  param_atmos_phy_cp_kf_qs, &
220  param_atmos_phy_cp_kf_qi, &
221  param_atmos_phy_cp_kf_dt, &
222  param_atmos_phy_cp_kf_dlcape, &
223  param_atmos_phy_cp_kf_dlifetime, &
224  param_atmos_phy_cp_kf_slifetime, &
225  param_atmos_phy_cp_kf_depth_usl, &
226  param_atmos_phy_cp_kf_prec, &
227  param_atmos_phy_cp_kf_thres, &
228  param_atmos_phy_cp_kf_warmrain, &
229  param_atmos_phy_cp_kf_log , &
230  time_dstep_kf )
231 
232  ! output parameter lists
233  if( io_l ) write(io_fid_log,*)
234  if( io_l ) write(io_fid_log,*) "*** Interval for check [step] : ", time_dstep_kf
235  if( io_l ) write(io_fid_log,*) "*** Ogura-Cho condense material convert rate : ", param_atmos_phy_cp_kf_rate
236  if( io_l ) write(io_fid_log,*) "*** Trigger function type, 1:KF2004 3:NO2007 : ", param_atmos_phy_cp_kf_trigger
237  if( io_l ) write(io_fid_log,*) "*** Exist qi? : ", param_atmos_phy_cp_kf_qi
238  if( io_l ) write(io_fid_log,*) "*** Exist qs? : ", param_atmos_phy_cp_kf_qs
239  if( io_l ) write(io_fid_log,*) "*** CAPE decrease rate : ", param_atmos_phy_cp_kf_dlcape
240  if( io_l ) write(io_fid_log,*) "*** Minimum lifetime scale of deep convection [sec] : ", param_atmos_phy_cp_kf_dlifetime
241  if( io_l ) write(io_fid_log,*) "*** Lifetime of shallow convection [sec] : ", param_atmos_phy_cp_kf_slifetime
242  if( io_l ) write(io_fid_log,*) "*** Updraft souce layer depth [hPa] : ", param_atmos_phy_cp_kf_depth_usl
243  if( io_l ) write(io_fid_log,*) "*** Precipitation type 1:Ogura-Cho(1973) 2:Kessler : ", param_atmos_phy_cp_kf_prec
244  if( io_l ) write(io_fid_log,*) "*** Kessler type precipitation's threshold : ", param_atmos_phy_cp_kf_thres
245  if( io_l ) write(io_fid_log,*) "*** Warm rain? : ", param_atmos_phy_cp_kf_warmrain
246  if( io_l ) write(io_fid_log,*) "*** Use running mean of w in adaptive timestep? : ", param_atmos_phy_cp_kf_wadapt
247  if( io_l ) write(io_fid_log,*) "*** Fixed time scale for running mean of w : ", param_atmos_phy_cp_kf_w_time
248  if( io_l ) write(io_fid_log,*) "*** Output log? : ", param_atmos_phy_cp_kf_log
249 
250  ! output variables
251  allocate( lifetime(ia,ja) )
252  allocate( i_convflag(ia,ja) )
253  lifetime(:,:) = 0.0_rp
254  i_convflag(:,:) = 2
255 
256  allocate( z(ka,ia,ja) )
257  z(:,:,:) = cz(:,:,:) ! becouse scale_atmos_phy_cp interface ,not use scale_grid
258 
259  allocate( deltaz(ka,ia,ja) )
260  ! deltaz is the interval of between model full levels(scalar point )
261  deltaz(:,:,:) = 0.0_rp
262  do j = js, je
263  do i = is, ie
264  do k = ks, ke
265  deltaz(k,i,j) = cz(k+1,i,j) - cz(k,i,j)
266  enddo
267  enddo
268  enddo
269  deltaz(ke,:,:) = 0.0_rp
270 
271  deltax = sqrt( dx*dy )
272 
273  return
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
real(rp), public dy
length in the main region [m]: y
subroutine, public prc_mpistop
Abort MPI.
real(rp), public dx
length in the main region [m]: x
integer, public ke
end point of inner domain: z, local
real(rp), dimension(:,:,:), allocatable, public real_cz
geopotential height [m] (cell center)
integer, public ia
of x whole cells (local, with HALO)
module GRID (real space)
real(dp), public time_dtsec
time interval of model [sec]
Definition: scale_time.F90:36
integer, public ka
of z whole cells (local, with HALO)
integer, public js
start point of inner domain: y, local
module TIME
Definition: scale_time.F90:15
module PROCESS
integer, public ks
start point of inner domain: z, local
real(dp), public time_dtsec_atmos_phy_cp
time interval of physics(cumulus ) [sec]
Definition: scale_time.F90:40
module GRID (cartesian)
integer, public ie
end point of inner domain: x, local
integer, public ja
of y whole cells (local, with HALO)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atmos_phy_cp_kf()

subroutine, public scale_atmos_phy_cp_kf::atmos_phy_cp_kf ( real(rp), dimension (ka,ia,ja), intent(in)  DENS,
real(rp), dimension (ka,ia,ja), intent(in)  MOMZ,
real(rp), dimension (ka,ia,ja), intent(in)  MOMX,
real(rp), dimension (ka,ia,ja), intent(in)  MOMY,
real(rp), dimension (ka,ia,ja), intent(in)  RHOT,
real(rp), dimension (ka,ia,ja,qa), intent(in)  QTRC,
real(rp), dimension (ka,ia,ja), intent(inout)  DENS_t_CP,
real(rp), dimension (ka,ia,ja), intent(inout)  MOMZ_t_CP,
real(rp), dimension (ka,ia,ja), intent(inout)  MOMX_t_CP,
real(rp), dimension (ka,ia,ja), intent(inout)  MOMY_t_CP,
real(rp), dimension (ka,ia,ja), intent(inout)  RHOT_t_CP,
real(rp), dimension (ka,ia,ja,qa), intent(inout)  RHOQ_t_CP,
real(rp), dimension(ia,ja), intent(inout)  MFLX_cloudbase,
real(rp), dimension (ia,ja), intent(inout)  SFLX_convrain,
real(rp), dimension (ia,ja), intent(inout)  cloudtop,
real(rp), dimension (ia,ja), intent(inout)  cloudbase,
real(rp), dimension (ka,ia,ja), intent(inout)  cldfrac_dp,
real(rp), dimension (ka,ia,ja), intent(inout)  cldfrac_sh,
real(rp), dimension (ia,ja), intent(inout)  nca,
real(rp), dimension (ka,ia,ja), intent(inout)  w0avg 
)

Definition at line 298 of file scale_atmos_phy_cp_kf.F90.

References cp_kf_main(), scale_stdio::io_fid_log, scale_stdio::io_l, kf_wmean(), scale_tracer::mp_qa, scale_prof::prof_rapend(), and scale_prof::prof_rapstart().

Referenced by scale_atmos_phy_cp::atmos_phy_cp_setup().

298  use scale_grid_index
299  use scale_tracer, only: &
300  mp_qa
301  use scale_history, only: &
302  hist_in
303  implicit none
304 
305  real(RP), intent(in) :: dens (ka,ia,ja)
306  real(RP), intent(in) :: momx (ka,ia,ja)
307  real(RP), intent(in) :: momy (ka,ia,ja)
308  real(RP), intent(in) :: momz (ka,ia,ja)
309  real(RP), intent(in) :: rhot (ka,ia,ja)
310  real(RP), intent(in) :: qtrc (ka,ia,ja,qa)
311  real(RP), intent(inout) :: dens_t_cp (ka,ia,ja)
312  real(RP), intent(inout) :: momz_t_cp (ka,ia,ja) ! not used
313  real(RP), intent(inout) :: momx_t_cp (ka,ia,ja) ! not used
314  real(RP), intent(inout) :: momy_t_cp (ka,ia,ja) ! not used
315  real(RP), intent(inout) :: rhot_t_cp (ka,ia,ja)
316  real(RP), intent(inout) :: rhoq_t_cp (ka,ia,ja,qa)
317  real(RP), intent(inout) :: mflx_cloudbase(ia,ja) ! not used
318  real(RP), intent(inout) :: sflx_convrain (ia,ja) ! convective rain rate [kg/m2/s]
319  real(RP), intent(inout) :: cloudtop (ia,ja) ! cloud top height [m]
320  real(RP), intent(inout) :: cloudbase (ia,ja) ! cloud base height [m]
321  real(RP), intent(inout) :: cldfrac_dp (ka,ia,ja) ! cloud fraction (deep convection)
322  real(RP), intent(inout) :: cldfrac_sh (ka,ia,ja) ! cloud fraction (shallow convection)
323  real(RP), intent(inout) :: nca (ia,ja) ! convection active time [sec]
324  real(RP), intent(inout) :: w0avg (ka,ia,ja) ! running mean of vertical velocity [m/s]
325 
326  real(RP) :: cldfrac(ka,2) ! 1 shallow , 2 deep
327 
328  !---------------------------------------------------------------------------
329 
330  if( io_l ) write(io_fid_log,*) '*** Physics step: Cumulus Parameterization(KF)'
331 
332  call kf_wmean( w0avg(:,:,:), & ! [OUT]
333  dens(:,:,:), & ! [IN]
334  momz(:,:,:) ) ! [IN]
335 
336  time_dokf = .false.
337  time_res_kf = time_res_kf + 1
338  if ( time_res_kf == time_dstep_kf ) then
339  time_dokf = .true.
340  time_res_kf = 0
341  endif
342 
343  if ( time_dokf ) then
344  if( io_l ) write(io_fid_log,*) '*** KF Convection Check '
345 
346  call prof_rapstart('CP_kf', 3)
347 
348  ! calc cumulus convection
349  call cp_kf_main( dens(:,:,:), & ! [IN]
350  momz(:,:,:), & ! [IN]
351  momx(:,:,:), & ! [IN]
352  momy(:,:,:), & ! [IN]
353  rhot(:,:,:), & ! [IN]
354  qtrc(:,:,:,:), & ! [IN]
355  w0avg(:,:,:), & ! [IN]
356  nca(:,:), & ! [INOUT]
357  dens_t_cp(:,:,:), & ! [OUT]
358  rhot_t_cp(:,:,:), & ! [OUT]
359  rhoq_t_cp(:,:,:,:), & ! [OUT]
360  sflx_convrain(:,:), & ! [OUT]
361  cldfrac_sh(:,:,:), & ! [OUT]
362  cldfrac_dp(:,:,:), & ! [OUT]
363  lifetime(:,:), & ! [OUT]
364  cloudtop(:,:), & ! [OUT]
365  cloudbase(:,:), & ! [OUT]
366  i_convflag(:,:) ) ! [OUT]
367 
368  call prof_rapend('CP_kf', 3)
369  endif
370 
371  call hist_in( lifetime(:,:), 'KF_LIFETIME', 'lifetime of KF scheme', 's' )
372  call hist_in( real(I_convflag(:,:),RP), 'KF_CONVFLAG', 'CONVECTION FLAG', '' )
373 
374  return
module grid index
module TRACER
integer, public ia
of x whole cells (local, with HALO)
integer, public mp_qa
integer, public ka
of z whole cells (local, with HALO)
module HISTORY
integer, public ja
of y whole cells (local, with HALO)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kf_wmean()

subroutine scale_atmos_phy_cp_kf::kf_wmean ( real(rp), dimension(ka,ia,ja), intent(inout)  W0_avg,
real(rp), dimension (ka,ia,ja), intent(in)  DENS,
real(rp), dimension (ka,ia,ja), intent(in)  MOMZ 
)

running mean vertical wind speed

Definition at line 389 of file scale_atmos_phy_cp_kf.F90.

References scale_grid_index::ie, scale_grid_index::is, scale_grid_index::je, scale_grid_index::js, scale_grid_index::ke, kf_dt, scale_grid_index::ks, and scale_time::time_dtsec.

Referenced by atmos_phy_cp_kf().

389  use scale_time , only :&
390  time_dtsec
391  implicit none
392 
393  real(RP), intent(inout) :: w0_avg(ka,ia,ja)
394  real(RP), intent(in) :: dens (ka,ia,ja)
395  real(RP), intent(in) :: momz (ka,ia,ja)
396 
397  real(RP) :: w0
398  real(RP) :: fact_w0_avg, fact_w0
399 
400  integer :: k, i, j
401  !---------------------------------------------------------------------------
402 
403  if ( param_atmos_phy_cp_kf_wadapt ) then
404  fact_w0_avg = 2.0_rp * max(kf_dt,time_dtsec) - time_dtsec
405  fact_w0 = time_dtsec
406  else ! w_time is tuning parameter
407  fact_w0_avg = real(param_atmos_phy_cp_kf_w_time,rp)
408  fact_w0 = 1.0_rp
409  endif
410 
411  do j = js, je
412  do i = is, ie
413  do k = ks, ke
414  w0 = 0.5_rp * ( momz(k,i,j) + momz(k-1,i,j) ) / dens(k,i,j)
415 
416  w0_avg(k,i,j) = ( w0_avg(k,i,j) * fact_w0_avg &
417  + w0 * fact_w0 ) / ( fact_w0_avg + fact_w0 )
418  enddo
419  enddo
420  enddo
421 
422  return
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
integer, public ke
end point of inner domain: z, local
integer, public ia
of x whole cells (local, with HALO)
real(dp), public time_dtsec
time interval of model [sec]
Definition: scale_time.F90:36
integer, public ka
of z whole cells (local, with HALO)
integer, public js
start point of inner domain: y, local
module TIME
Definition: scale_time.F90:15
integer, public ks
start point of inner domain: z, local
integer, public ie
end point of inner domain: x, local
integer, parameter, public rp
integer, public ja
of y whole cells (local, with HALO)
Here is the caller graph for this function:

◆ cp_kf_param()

subroutine scale_atmos_phy_cp_kf::cp_kf_param ( real(rp), intent(in)  RATE_in,
integer, intent(inout)  TRIGGER_in,
logical, intent(in)  FLAG_QS_in,
logical, intent(in)  FLAG_QI_in,
real(rp), intent(in)  KF_DT_in,
real(rp), intent(in)  DELCAPE_in,
real(rp), intent(in)  DEEPLIFETIME_in,
real(rp), intent(in)  SHALLOWLIFETIME_in,
real(rp), intent(in)  DEPTH_USL_in,
integer, intent(in)  KF_prec_in,
real(rp), intent(in)  KF_threshold_in,
logical, intent(in)  WARMRAIN_in,
logical, intent(in)  KF_LOG_in,
integer, intent(in)  stepkf_in 
)

Definition at line 442 of file scale_atmos_phy_cp_kf.F90.

References scale_stdio::io_fid_log, scale_stdio::io_l, kf_dt, and scale_process::prc_mpistop().

Referenced by atmos_phy_cp_kf_setup().

442  use scale_process, only: &
444  implicit none
445  real(RP),intent(in) :: rate_in
446  integer, intent(inout) :: trigger_in
447  logical, intent(in) :: flag_qs_in,flag_qi_in
448  real(RP),intent(in) :: kf_dt_in
449  real(RP),intent(in) :: delcape_in
450  real(RP),intent(in) :: deeplifetime_in
451  real(RP),intent(in) :: shallowlifetime_in
452  real(RP),intent(in) :: depth_usl_in
453  integer, intent(in) :: kf_prec_in
454  real(RP),intent(in) :: kf_threshold_in
455  logical, intent(in) :: warmrain_in
456  logical, intent(in) :: kf_log_in
457  integer, intent(in) :: stepkf_in
458  !
459  rate = rate_in
460  ! TRIGGER must be 1 or 3
461  if (trigger_in /= 1 .and. trigger_in /=3) then
462  if (io_l) write(io_fid_log,*) "TRIGGER must be 1 or 3 but now :",trigger_in
463  if (io_l) write(io_fid_log,*) "CHAGNGE ",trigger_in," to 3"
464  trigger_in = 3
465  end if
466  trigger = trigger_in
467  flag_qs = flag_qs_in
468  flag_qi = flag_qi_in
469  kf_dt = kf_dt_in
470  delcape = delcape_in
471  deeplifetime = deeplifetime_in
472  shallowlifetime = shallowlifetime_in
473  depth_usl = depth_usl_in
474  warmrain = warmrain_in
475  kf_prec = kf_prec_in
476  kf_threshold = kf_threshold_in
477  kf_log = kf_log_in
478  stepkf = stepkf_in
479  if (kf_prec == 1) then
480  p_precipitation => precipitation_oc1973 ! Ogura and Cho (1973)
481  elseif( kf_prec == 2) then
482  p_precipitation => precipitation_kessler ! Kessler type
483  else
484  write(*,*) 'xxx ERROR at KF namelist'
485  write(*,*) 'KF_prec must be 1 or 2'
486  call prc_mpistop
487  end if
488  return
subroutine, public prc_mpistop
Abort MPI.
module PROCESS
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_kf_main()

subroutine scale_atmos_phy_cp_kf::cp_kf_main ( real(rp), dimension(ka,ia,ja), intent(in)  dens,
real(rp), dimension(ka,ia,ja), intent(in)  MOMZ,
real(rp), dimension(ka,ia,ja), intent(in)  MOMX,
real(rp), dimension(ka,ia,ja), intent(in)  MOMY,
real(rp), dimension(ka,ia,ja), intent(in)  RHOT,
real(rp), dimension(ka,ia,ja,qa), intent(in)  QTRC,
real(rp), dimension(ka,ia,ja), intent(in)  w0avg,
real(rp), dimension(ia,ja), intent(inout)  nca,
real(rp), dimension(ka,ia,ja), intent(out)  DENS_t_CP,
real(rp), dimension(ka,ia,ja), intent(out)  DT_RHOT,
real(rp), dimension(ka,ia,ja,qa), intent(out)  DT_RHOQ,
real(rp), dimension(ia,ja), intent(out)  rainrate_cp,
real(rp), dimension(ka,ia,ja), intent(out)  cldfrac_sh,
real(rp), dimension(ka,ia,ja), intent(out)  cldfrac_dp,
real(rp), dimension(ia,ja), intent(out)  timecp,
real(rp), dimension(ia,ja), intent(out)  cloudtop,
real(rp), dimension(ia,ja), intent(out)  zlcl,
integer, dimension(ia,ja), intent(out)  I_convflag 
)

I_convflag = 0 ==> deep convection = 1 ==> shallow convection = 2 ==> NONE !!

Definition at line 513 of file scale_atmos_phy_cp_kf.F90.

References scale_const::const_cpdry, scale_const::const_emelt, scale_const::const_grav, scale_const::const_pre00, scale_const::const_rdry, scale_const::const_tem00, scale_tracer::i_mp2all, scale_tracer::i_qc, scale_tracer::i_qi, scale_tracer::i_qr, scale_tracer::i_qs, scale_tracer::i_qv, scale_grid_index::ie, scale_stdio::io_fid_log, scale_stdio::io_l, scale_grid_index::is, scale_grid_index::je, scale_grid_index::js, scale_grid_index::ke, kf_dt, scale_grid_index::ks, dc_log::log(), scale_tracer::mp_qa, scale_process::prc_mpistop(), scale_tracer::qa, scale_tracer::qqe, scale_tracer::qqs, scale_grid_real::real_fz, and scale_time::time_dtsec_atmos_phy_cp.

Referenced by atmos_phy_cp_kf().

513  use scale_precision
514  use scale_grid_index
515  use scale_tracer
516  use scale_const, only: &
517  grav => const_grav, &
518  r => const_rdry
519  use scale_time , only :&
521  use scale_grid_real, only: &
522  fz => real_fz
523  use scale_atmos_thermodyn, only: &
524  thermodyn_temp_pres => atmos_thermodyn_temp_pres, &
525  thermodyn_rhoe => atmos_thermodyn_rhoe, &
526  thermodyn_temp_pres_e => atmos_thermodyn_temp_pres_e, &
527  thermodyn_qd => atmos_thermodyn_qd, &
528  thermodyn_pott => atmos_thermodyn_pott
529  use scale_atmos_saturation ,only :&
530  saturation_psat_liq => atmos_saturation_psat_liq
531  implicit none
532  ![IN]
533  real(RP),intent(in) :: dens(ka,ia,ja) ! density [kg/m**3]
534  real(RP),intent(in) :: momz(ka,ia,ja) ! momentum
535  real(RP),intent(in) :: momx(ka,ia,ja) ! momentum
536  real(RP),intent(in) :: momy(ka,ia,ja) ! momentum
537  real(RP),intent(in) :: rhot(ka,ia,ja) ! density*PT
538  real(RP),intent(in) :: qtrc(ka,ia,ja,qa) ! raito of water elements
539  real(RP),intent(in) :: w0avg(ka,ia,ja) ! running mean vertical wind velocity [m/s]
540  ! [INOUT]
541  real(RP),intent(inout) :: nca(ia,ja) ! num of step convection active [step]
542  real(RP),intent(out) :: dens_t_cp(ka,ia,ja) ! dens/dt
543  real(RP),intent(out) :: dt_rhot(ka,ia,ja) ! dens*PT/dt
544  real(RP),intent(out) :: dt_rhoq(ka,ia,ja,qa) ! dens*q/dt
545  real(RP),intent(out) :: rainrate_cp(ia,ja) ! rain PPTFLX(prcp_flux)/deltax**2*dt ! convective rain
546  real(RP),intent(out) :: cldfrac_sh(ka,ia,ja) ! cloud fraction
547  real(RP),intent(out) :: cldfrac_dp(ka,ia,ja) ! cloud fraction
548  real(RP),intent(out) :: timecp(ia,ja) ! timescale of cumulus parameterization
549  real(RP),intent(out) :: cloudtop(ia,ja) ! cloud top height
550  real(RP),intent(out) :: zlcl(ia,ja) ! hight of lcl cloud bottom height[m]
551  integer, intent(out) :: i_convflag(ia,ja) ! convection type
555 
556  ! [Internal Work]
557  real(RP) :: u (ka) ! x-direction wind velocity [m/s]
558  real(RP) :: v (ka) ! y-direction wind velocity [m/s]
559  real(RP) :: temp (ka) ! temperature [K]
560  real(RP) :: pres (ka) ! pressure [Pa]
561  real(RP) :: qv (ka) ! water vapor mixing ratio[kg/kg]
562  real(RP) :: qdry (ka) ! ratio of dry air
563  real(RP) :: qes (ka) ! saturate vapor [kg/kg]
564  real(RP) :: psat (ka) ! saturation vaper pressure
565  real(RP) :: qsat (ka) ! saturate water vaper mixing ratio [kg/kg]
566  real(RP) :: rh (ka) ! saturate vapor [%]
567  real(RP) :: deltap(ka) ! delta Pressure [Pa]
568 
569  real(RP) :: q_hyd(ka,mp_qa) ! water mixing ratio [kg/kg]
570  real(RP) :: dens_nw(ka) ! density [kg/m**3]
571  integer :: nic
572  real(RP) :: time_advec ! advection timescale
573  real(RP) :: umf(ka) ! Updraft Mass Flux
574  real(RP) :: umflcl ! Updraft Mass Flux
575  real(RP) :: upent(ka) ! Updraft Mass flux ENTrainment
576  real(RP) :: updet(ka) ! Updraft Mass flux DETrainment
577  ! updraft value
578  real(RP) :: temp_u(ka) ! updraft temperature [K]
579  real(RP) :: tempv(ka) ! vertual temperature [K]
580  real(RP) :: qv_u(ka) ! updraft qv
581  real(RP) :: cape ! cape
582  ! water
583  real(RP) :: qc(ka) ! cloud water
584  real(RP) :: qi(ka) ! cloud ice
585  real(RP) :: qvdet(ka) ! vapor detrainment
586  real(RP) :: qcdet(ka) ! liquit detrainment
587  real(RP) :: qidet(ka) ! ice detrainment
588  real(RP) :: totalprcp ! total precipitation
589  real(RP) :: flux_qr(ka) ! rain flux
590  real(RP) :: flux_qs(ka) ! snow flux
591  ! upward theta
592  real(RP) :: theta_eu(ka) ! updraft equivalent PT
593  real(RP) :: theta_ee(ka) ! environment equivalent PT
594  ! convection type
595  ! index valuables
596  integer :: k_lcl ! index of LCL layer
597  integer :: k_top ! index of cloud top hight
598  integer :: k_ml ! index of melt layer (temp < tem00)
599  integer :: k_lc,k_let,k_pbl ! indexs
600  real(RP) :: zmix ! usl(up source layer) layer depth [m]
601  real(RP) :: presmix ! usl layer depth [Pa]
602  real(RP) :: umfnewdold(ka) ! umfnew/umfold
603  real(RP) :: dpthmx ! max depth of pressure
604  ! move internalwark
605  real(RP) :: ems(ka) ! box weight[kg]
606  real(RP) :: emsd(ka) ! 1/ems
607  ! [OUT]@downdraft
608  real(RP) :: wspd(3) ! horizontal wind speed 1 k_lcl, 2 k_z5,3 k_top
609  real(RP) :: dmf(ka) ! downdraft massflux
610  real(RP) :: downent(ka) ! downdraft entrainment
611  real(RP) :: downdet(ka) ! downdraft detrainment
612  real(RP) :: theta_d(ka) ! downdraft theta
613  real(RP) :: qv_d(ka) ! water vapor of downdraft
614  real(RP) :: prcp_flux ! precpitation flux
615  real(RP) :: tder ! temperature change from evap
616  real(RP) :: cpr ! all precipitation before consider cloud bottom evaporation
617  integer :: k_lfs ! LFS layer index
618  ![OUT] @ compensasional subsidence
619  real(RP) :: temp_g(ka) ! temporarly temperature -> after iteration then new variable
620  real(RP) :: qv_g(ka) ! temporarly vapor -> after iteration then new variable
621  real(RP) :: qc_nw(ka) ! new cloud water mixing ratio [kg/kg]
622  real(RP) :: qi_nw(ka) ! new cloud ice mixing ratio [kg/kg]
623  real(RP) :: qr_nw(ka) ! new rain water mixing ratio [kg/kg]
624  real(RP) :: qs_nw(ka) ! new snow water mixing ratio [kg/kg]
625  ! new variable
626  real(RP) :: rhot_nw(ka) ! rho*PT
627  real(RP) :: qtrc_nw(ka,qa) ! qv,qc,qr,qi,qs (qg not change)
628  real(RP) :: pott_nw(ka) ! new PT
629  !
630  real(RP) :: cldfrac_kf(ka,2) ! cloud fraction
631  !
632  real(RP) :: qd(ka) ! dry mixing ratio
633  ! do loop variable
634  integer :: k, i, j, iq
635 
636 
637  do j = js, je
638  do i = is, ie
639 
640  nca(i,j) = nca(i,j) - real(TIME_DSTEP_KF,RP) * dt
641 
642  ! check convection
643  if ( nca(i,j) .ge. 0.5_dp * dt ) cycle
644 
645 
646  ! convert variables
647 
648  ! calculate u(x-directin velocity ), v(y-direction velocity)
649  do k = ks, ke
650  u(k) = 0.5_rp * ( momx(k,i,j) + momx(k,i-1,j) ) / dens(k,i,j)
651  v(k) = 0.5_rp * ( momy(k,i,j) + momy(k,i,j-1) ) / dens(k,i,j)
652  enddo
653 
654  do k = ks, ke
655  call thermodyn_temp_pres( temp(k), & ! [OUT]
656  pres(k), & ! [OUT]
657  dens(k,i,j), & ! [IN]
658  rhot(k,i,j), & ! [IN]
659  qtrc(k,i,j,:) ) ! [IN]
660 
661  ! calculate water vaper and relative humidity
662  call thermodyn_qd( qdry(k), qtrc(k,i,j,:) )
663 
664  call saturation_psat_liq( psat(k), temp(k) )
665 
666  qsat(k) = 0.622_rp * psat(k) / ( pres(k) - ( 1.0_rp-0.622_rp ) * psat(k) )
667  qv(k) = qtrc(k,i,j,i_qv) / qdry(k)
668  qv(k) = max( 0.000001_rp, min( qsat(k), qv(k) ) ) ! conpare QSAT and QV, guess lower limit
669  rh(k) = qv(k) / qsat(k)
670  enddo
671 
672  ! calculate delta P by hydrostatic balance
673  ! deltap is the pressure interval between half levels(face levels) @ SCALE
674  do k = ks, ke
675  deltap(k) = dens(k,i,j) * grav * ( fz(k+1,i,j) - fz(k,i,j) ) ! rho*g*dz
676  enddo
677 
678 
679  dens_t_cp(ks:ke,i,j) = 0.0_rp
680  dt_rhot(ks:ke,i,j) = 0.0_rp
681  do iq = 1, qqs
682  dt_rhoq(ks:ke,i,j,iq) = 0.0_rp
683  end do
684  cldfrac_kf(ks:ke,:) = 0.0_rp
685  rainrate_cp(i,j) = 0.0_rp
686  timecp(i,j) = 0.0_rp
687  cloudtop(i,j) = 0.0_rp
688  zlcl(i,j) = 0.0_rp
689 
690  do iq = 1, mp_qa
691  do k = ks, ke
692  q_hyd(k,iq) = qtrc(k,i,j,i_mp2all(iq)) / qdry(k)
693  enddo
694  enddo
695 
696 
697  call cp_kf_trigger ( &
698  ! [IN]
699  deltaz(:,i,j), z(:,i,j), & ! deltaz and height[m]
700  qv(:), & ! water vapor mixing ratio [kg/kg]
701  qes(:), & ! saturation water vapor mixing ratio
702  pres(:), & ! pressure [Pa]
703  deltap(:), & ! interval of pressure [Pa]
704  temp(:), & ! temperature [K]
705  w0avg(:,i,j), & ! average w
706  ! [OUT]
707  i_convflag(i,j), & ! convection flag
708  cloudtop(i,j), & ! cloud top height [m]
709  temp_u(:), & ! updraft temperature
710  tempv(:), & ! virtual temperature
711  ! water values
712  qv_u(:), & ! updraft water vapor mixing ratio
713  qc(:), & ! cloud water mixing ratio
714  qi(:), & ! ice mixing ratio
715  qvdet(:), & ! updraft detrain vapor
716  qcdet(:), & ! updraft detrain water
717  qidet(:), & ! updraft detrain ice
718  flux_qr(:), & ! rain flux
719  flux_qs(:), & ! snow flux
720  totalprcp, & ! total precipitation(rain and snow ) fall
721  ! thermodynamics values
722  theta_eu(:), & ! updraft equivalent PT
723  theta_ee(:), & ! environment equivalent PT
724  cape, & ! cape
725  ! massflux values
726  umf(:), & ! updraft mass flux
727  umflcl, & ! updraft mass flux@lcl
728  upent(:), & ! updraft entrainment
729  updet(:), & ! updraft detrainment
730  ! layer nambers
731  k_lcl, & ! index of LCL layer
732  k_lc, & ! index of USL layer botom
733  k_pbl, & ! index of USL layer top
734  k_top, & ! index of cloud top
735  k_let, & ! index of below detrain layer
736  k_ml, & ! index of temprerure < tem00
737  ! pbl layer values
738  presmix, & ! USL layer pressure [Pa]
739  dpthmx, & ! USL layer depth ( [Pa])
740  zlcl(i,j), & ! lcl hight
741  zmix, & ! USL layer depth
742  umfnewdold(:) )
743  !------------------------------------------------------------------------
744  ! calc ems(box weight[kg])
745  !------------------------------------------------------------------------
746  if(i_convflag(i,j) /= 2) then
747  ems(k_top+1:ke) = 0._rp
748  emsd(k_top+1:ke) = 0._rp
749  do k = ks, k_top
750  ems(k) = deltap(k)*deltax*deltax/grav
751  emsd(k) = 1._rp/ems(k)
752  umfnewdold(k) = 1._rp/umfnewdold(k)
753  end do
754  end if
755  !------------------------------------------------------------------------
756  call cp_kf_downdraft ( &
757  ! [IN]
758  deltaz(:,i,j), z(:,i,j) ,& ! deltaz and height [m]
759  u(:) ,& ! u-wind m/s
760  v(:) ,& ! v-wind m/s
761  zlcl(i,j) ,& ! lcl height [m]
762  rh(:) ,& ! relative humidity
763  deltap(:) ,& ! interval of pressure [Pa]
764  pres(:) ,& ! pressure [Pa]
765  qv(:) ,& ! water vapor mixing ratio [kg/kg]
766  ems(:) ,& ! ems(box weight[kg])
767  emsd(:) ,& ! 1/ems
768  theta_ee(:) ,& ! environment theta_E
769  umf(:) ,& ! updraft mass flux
770  totalprcp ,& ! total precipitation
771  flux_qs(:) ,& ! snow flux
772  tempv(:) ,& ! vertual temperature [K]
773  i_convflag(i,j) ,& ! convection type
774  ! layer index
775  k_lcl ,& ! index of LCL layer
776  k_ml ,& ! index of melt layer
777  k_top ,& ! index of cloud top
778  k_pbl ,& ! index of USL layer top
779  k_let ,& ! index of below detrain layer
780  k_lc ,& ! index of USL layer botom
781  ! [out]
782  wspd(:) ,& ! wind speed 1 k_lcl, 2 k_z5,3 k_top
783  dmf(:) ,& ! downward mass flux
784  downent(:) ,& ! downdraft entrainment
785  downdet(:) ,& ! downdraft detrainment
786  theta_d(:) ,& ! downdraft theta
787  qv_d(:) ,& ! downdraft water vaper mixng ratio
788  prcp_flux ,& ! precipitateion
789  k_lfs ,& ! index of LFS layer
790  cpr ,& ! all precipitation before consider cloud bottom evaporation
791  tder)
792  !------------------------------------------------------------------------
793  call cp_kf_compensational ( &
794  ![IN]
795  deltaz(:,i,j),z(:,i,j) ,& ! deltaz and height [m]
796  pres(:), & ! pressure [Pa]
797  deltap(:), & ! deltap [Pa]
798  temp(:), & ! temperature [K]
799  qv(:), & ! water vapor mixing ratio
800  ! form kf_trigger
801  ems(:), & ! box weight[kg]
802  emsd(:), & ! 1/ems
803  presmix, & ! usl layer pressure depth
804  zmix, & ! usl layer pressure depth
805  dpthmx, & ! usl layer depth
806  cape, & ! CAPE
807  temp_u(:), & ! updraft temperature
808  qvdet(:), & ! detrainment water vaper mixing ratio
809  umflcl, & ! umf @LCL
810  umf(:), & ! upward mass flux (updraft)
811  upent(:), & ! updraft entrainment
812  updet(:), & ! updraft detrainment
813  qcdet(:), & ! updraft detrainment qc
814  qidet(:), & ! updraft detrainment qi
815  qc(:), & ! cloud water mixing ratio
816  qi(:), & ! cloud ice mixing ratio
817  flux_qr(:), & ! rain flux
818  flux_qs(:), & ! snow flux
819  umfnewdold(:), & ! umfnew/umfold ratio
820  ! from kf_downdraft
821  wspd(:), & ! wind speed 1. 2 is used
822  dmf(:), & ! downward mass flux (downdraft)
823  downent(:), & ! downdraft entrainment
824  downdet(:), & ! downdraft detrainment
825  qv_d(:), & ! downdraft detrainment qv
826  theta_d(:), & ! potential temperature @downdraft
827  prcp_flux, & ! precipitation
828  tder, & ! evapolation
829  cpr, & ! all precipitation before consider cloud bottom evaporation
830  i_convflag(i,j), & ! intent inout convective flag
831  ! layer index
832  ! from kf_triger
833  k_top, & ! index of cloud top hight
834  k_lcl, & ! index of LCL layer
835  k_lc , & ! index of LCL layer botoom
836  k_pbl, & ! index of USL layer top
837  k_ml, & ! index of melt layer (temp < tem00)
838  ! from kf_downdraft
839  k_lfs, & ! index of LFS layer
840  ![OUT] new valuavles after timestep
841  temp_g(:), & ! update temperature [K]
842  qv_g(:), & ! update water vapor mixing ratio
843  qc_nw(:), & ! update cloud water mixing ratio
844  qi_nw(:), & ! update cloud ice mixing ratio
845  qr_nw(:), & ! update rain water mixing ratio
846  qs_nw(:), & ! update snow water mixing ratio
847  rainrate_cp(i,j), & ! rain PPTFLX(prcp_flux)/deltax**2*dt ! convective rain
848  nic, & ! (timescale of cumulus parameterization)/dt integer
849  cldfrac_kf, & ! cloud fraction
850  timecp(i,j), & ! timescale of cumulus parameterization
851  time_advec) ! advection timescale
852 
853  !------------------------------------------------------------------------
854  ! compute tendencys
855  !------------------------------------------------------------------------
856 
857  if(i_convflag(i,j) == 2) then ! no convection
858  rainrate_cp(i,j) = 0.0_rp
859  cldfrac_kf(ks:ke,:) = 0.0_rp
860  timecp(i,j) = 0.0_rp
861  cloudtop(i,j) = 0.0_rp
862  zlcl(i,j) = 0.0_rp
863  else ! convection allowed I_convflag=0 or 1
864  ! chek
865  !
866  !...FEEDBACK TO RESOLVABLE SCALE TENDENCIES.
867  !
868  !...IF THE ADVECTIVE TIME PERIOD (time_advec) IS LESS THAN SPECIFIED MINIMUM
869  !...TIMECP, ALLOW FEEDBACK TO OCCUR ONLY DURING TADVEC...
870  !
871  if (i_convflag(i,j) == 0) then ! deep
872  if (time_advec < timecp(i,j)) nic=nint(time_advec/dt)
873  nca(i,j) = real(nic,rp)*dt ! convection feed back act this time span
874  elseif (i_convflag(i,j) == 1) then ! shallow
875  timecp(i,j) = shallowlifetime
876  nca(i,j) = kf_dt*60._rp ! convection feed back act this time span
877  end if
878  ! update qd
879  if (qa > 3) then ! assume TOMITA08
880  q_hyd(ks:ke,i_qc-1) = ( qc_nw(ks:ke) + q_hyd(ks:ke,i_qc-1) )
881  q_hyd(ks:ke,i_qr-1) = ( qr_nw(ks:ke) + q_hyd(ks:ke,i_qr-1) )
882  q_hyd(ks:ke,i_qi-1) = ( qi_nw(ks:ke) + q_hyd(ks:ke,i_qi-1) )
883  q_hyd(ks:ke,i_qs-1) = ( qs_nw(ks:ke) + q_hyd(ks:ke,i_qs-1) )
884  qd(ks:ke) = 1._rp / ( 1._rp + qv_g(ks:ke) + sum(q_hyd(ks:ke,:),2)) ! new qdry
885  qtrc_nw(ks:ke,i_qv) = qv_g(ks:ke)*qd(ks:ke)
886  ! new qtrc
887  do iq = 1,mp_qa
888  qtrc_nw(ks:ke,i_mp2all(iq)) = ( q_hyd(ks:ke,iq) )*qd(ks:ke)
889  end do
890  ! new density
891  dens_nw(ks:ke) = dens(ks:ke,i,j)
892  do iq = qqs,qqe
893  dens_nw(ks:ke) = dens_nw(ks:ke) + ( qtrc_nw(ks:ke,iq) - qtrc(ks:ke,i,j,iq) )*dens(ks:ke,i,j)
894  end do
895  ! dens_(n+1) = dens_(n) + tend_q*dens_(n)
896  else ! kessular
897  q_hyd(ks:ke,i_qc-1) = ( qc_nw(ks:ke) + q_hyd(ks:ke,i_qc-1) )
898  q_hyd(ks:ke,i_qr-1) = ( qr_nw(ks:ke) + q_hyd(ks:ke,i_qr-1) )
899  !
900  qd(ks:ke) = 1._rp / ( 1._rp + qv_g(ks:ke) + sum(q_hyd(ks:ke,:),2))
901  ! new qtrc
902  do iq = 1,mp_qa
903  qtrc_nw(ks:ke,i_mp2all(iq)) = ( q_hyd(ks:ke,iq) )*qd(ks:ke)
904  end do
905  ! new density
906  dens_nw(ks:ke) = dens(ks:ke,i,j)
907  do iq = qqs,qqe
908  dens_nw(ks:ke) = dens_nw(ks:ke) + ( qtrc_nw(ks:ke,iq) - qtrc(ks:ke,i,j,iq) )*dens(ks:ke,i,j)
909  end do
910  ! dens_(n+1) = dens_(n) + tend_q*dens_(n)
911  end if
912  ! calc new potential temperature
913  call thermodyn_pott(&
914  pott_nw(:), &
915  temp_g(:),pres(:),qtrc_nw(:,:))
916  ! update rhot
917  rhot_nw(ks:ke) = dens_nw(ks:ke)*pott_nw(ks:ke)
918  ! calc tendency
919  dens_t_cp(ks:ke,i,j) = (dens_nw(ks:ke) - dens(ks:ke,i,j))/timecp(i,j)
920  dt_rhot(ks:ke,i,j) = (rhot_nw(ks:ke) - rhot(ks:ke,i,j))/timecp(i,j)
921  do iq = qqs,qqe
922  dt_rhoq(ks:ke,i,j,iq) = (dens_nw(ks:ke)*qtrc_nw(ks:ke,iq) - dens(ks:ke,i,j)*qtrc(ks:ke,i,j,iq))/timecp(i,j)
923  end do
924  ! if noconvection then nca is same value before call. nca only modifyed convectioned
925  end if
926 
927  cldfrac_sh(ks:ke,i,j) = cldfrac_kf(ks:ke,1)
928  cldfrac_dp(ks:ke,i,j) = cldfrac_kf(ks:ke,2)
929 
930  end do
931  end do
932 
933  return
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
module ATMOSPHERE / Saturation adjustment
integer, public qqe
integer, public ke
end point of inner domain: z, local
integer, public qa
real(rp), dimension(:,:,:), allocatable, public real_fz
geopotential height [m] (cell face )
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
Definition: scale_const.F90:57
module grid index
module TRACER
integer, public ia
of x whole cells (local, with HALO)
module GRID (real space)
integer, public mp_qa
integer, public ka
of z whole cells (local, with HALO)
integer, public i_qv
integer, dimension(:), allocatable, public i_mp2all
real(rp), public const_grav
standard acceleration of gravity [m/s2]
Definition: scale_const.F90:48
integer, public js
start point of inner domain: y, local
module TIME
Definition: scale_time.F90:15
module CONSTANT
Definition: scale_const.F90:14
integer, public ks
start point of inner domain: z, local
real(dp), public time_dtsec_atmos_phy_cp
time interval of physics(cumulus ) [sec]
Definition: scale_time.F90:40
integer, public i_qs
integer, public i_qi
integer, public ie
end point of inner domain: x, local
module ATMOSPHERE / Thermodynamics
integer, public qqs
module PRECISION
integer, parameter, public rp
integer, public i_qr
integer, public i_qc
integer, public ja
of y whole cells (local, with HALO)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kf_lutab()

subroutine scale_atmos_phy_cp_kf::kf_lutab ( )

Definition at line 3496 of file scale_atmos_phy_cp_kf.F90.

References scale_const::const_cpdry, scale_const::const_grav, scale_const::const_pre00, and dc_log::log().

Referenced by atmos_phy_cp_kf_setup().

3496  !
3497  ! This subroutine is a lookup table.
3498  ! Given a series of series of saturation equivalent potential
3499  ! temperatures, the temperature is calculated.
3500  !
3501  !--------------------------------------------------------------------
3502  use scale_const, only :&
3503  cp => const_cpdry , &
3504  pre00 => const_pre00, &
3505  grav => const_grav
3506  IMPLICIT NONE
3507  !--------------------------------------------------------------------
3508  ! Lookup table variables
3509  ! INTEGER, SAVE, PARAMETER :: KFNT=250,KFNP=220
3510  ! REAL, SAVE, DIMENSION(1:KFNT,1:KFNP) :: TTAB,QSTAB
3511  ! REAL, SAVE, DIMENSION(1:KFNP) :: THE0K
3512  ! REAL, SAVE, DIMENSION(1:200) :: ALU
3513  ! REAL, SAVE :: RDPR,RDTHK,PLUTOP
3514  ! End of Lookup table variables
3515  !! use scale_const, only : &
3516  !! SVPT0 -> CONST_TEM00,&
3517  integer :: kp,it,itcnt,i
3518  real(RP) :: dth=1._rp,tmin=150._rp,toler=0.001_rp
3519  real(RP) :: pbot,dpr, &
3520  temp,p,es,qs,pi,thes,tgues,thgues,f0,t1,t0,thgs,f1,dt, &
3521  astrt,ainc,a1,thtgs
3522  ! REAL :: ALIQ,BLIQ,CLIQ,DLIQ,SVP1,SVP2,SVP3,SVPT0
3523  !! to module variables
3524  ! real(RP) :: ALIQ,BLIQ,CLIQ,DLIQ
3525  !! real(RP), INTENT(IN) :: SVP1,SVP2,SVP3,SVPT0
3526  !
3527  ! equivalent potential temperature increment
3528  ! data dth/1._RP/
3529  ! minimum starting temp
3530  ! data tmin/150._RP/
3531  ! tolerance for accuracy of temperature
3532  ! data toler/0.001_RP/
3533  ! top pressure (pascals)
3534  plutop=5000.0_rp
3535  ! bottom pressure (pascals)
3536  pbot=110000.0_rp
3537  !! to module variable
3538  !! ALIQ = SVP1*1000.
3539  !! BLIQ = SVP2
3540  !! CLIQ = SVP2*SVPT0
3541  !! DLIQ = SVP3
3542 
3543  !
3544  ! compute parameters
3545  !
3546  ! 1._over_(sat. equiv. theta increment)
3547  rdthk=1._rp/dth
3548  ! pressure increment
3549  !
3550  dpr=(pbot-plutop)/REAL(kfnp-1)
3551  ! dpr=(pbot-plutop)/REAL(kfnp-1)
3552  ! 1._over_(pressure increment)
3553  rdpr=1._rp/dpr
3554  ! compute the spread of thes
3555  ! thespd=dth*(kfnt-1)
3556  !
3557  ! calculate the starting sat. equiv. theta
3558  !
3559  temp=tmin
3560  p=plutop-dpr
3561  do kp=1,kfnp
3562  p=p+dpr
3563  es=aliq*exp((bliq*temp-cliq)/(temp-dliq))
3564  qs=0.622_rp*es/(p-es)
3565  pi=(1.e5_rp/p)**(0.2854_rp*(1.-0.28_rp*qs))
3566  the0k(kp)=temp*pi*exp((3374.6525_rp/temp-2.5403_rp)*qs* &
3567  (1._rp+0.81_rp*qs))
3568  enddo
3569  !
3570  ! compute temperatures for each sat. equiv. potential temp.
3571  !
3572  p=plutop-dpr
3573  do kp=1,kfnp
3574  thes=the0k(kp)-dth
3575  p=p+dpr
3576  do it=1,kfnt
3577  ! define sat. equiv. pot. temp.
3578  thes=thes+dth
3579  ! iterate to find temperature
3580  ! find initial guess
3581  if(it.eq.1) then
3582  tgues=tmin
3583  else
3584  tgues=ttab(it-1,kp)
3585  endif
3586  es=aliq*exp((bliq*tgues-cliq)/(tgues-dliq))
3587  qs=0.622_rp*es/(p-es)
3588  pi=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qs))
3589  thgues=tgues*pi*exp((3374.6525_rp/tgues-2.5403_rp)*qs* &
3590  (1._rp + 0.81_rp*qs))
3591  f0=thgues-thes
3592  t1=tgues-0.5_rp*f0
3593  t0=tgues
3594  itcnt=0
3595  ! iteration loop
3596  do itcnt=1,11
3597  es=aliq*exp((bliq*t1-cliq)/(t1-dliq))
3598  qs=0.622_rp*es/(p-es)
3599  pi=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qs))
3600  thtgs=t1*pi*exp((3374.6525_rp/t1-2.5403_rp)*qs*(1._rp + 0.81_rp*qs))
3601  f1=thtgs-thes
3602  if(abs(f1).lt.toler)then
3603  exit
3604  endif
3605  ! itcnt=itcnt+1
3606  dt=f1*(t1-t0)/(f1-f0)
3607  t0=t1
3608  f0=f1
3609  t1=t1-dt
3610  enddo
3611  ttab(it,kp)=t1
3612  qstab(it,kp)=qs
3613  enddo
3614  enddo
3615  !
3616  ! lookup table for tlog(emix/aliq)
3617  !
3618  ! set up intial variable for lookup tables
3619  !
3620  astrt=1.e-3_rp
3621  ainc=0.075_rp
3622  !
3623  a1=astrt-ainc
3624  do i=1,200
3625  a1=a1+ainc
3626  alu(i)=log(a1)
3627  enddo
3628  !GdCP is g/cp add for SCALE
3629  gdcp = - grav/cp ! inital set
3630  return
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
Definition: scale_const.F90:58
real(rp), public const_pre00
pressure reference [Pa]
Definition: scale_const.F90:93
real(rp), public const_grav
standard acceleration of gravity [m/s2]
Definition: scale_const.F90:48
subroutine, public log(type, message)
Definition: dc_log.f90:133
module CONSTANT
Definition: scale_const.F90:14
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ kf_dt

real(rp), save, public scale_atmos_phy_cp_kf::kf_dt = 5._RP

Definition at line 51 of file scale_atmos_phy_cp_kf.F90.

Referenced by cp_kf_main(), cp_kf_param(), and kf_wmean().

51  real(RP), public, save :: kf_dt = 5._rp ! kf time scale [min!!!!!]