SCALE-RM
mod_atmos_phy_cp_vars.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
10 !-------------------------------------------------------------------------------
11 #include "scalelib.h"
13  !-----------------------------------------------------------------------------
14  !
15  !++ used modules
16  !
17  use scale_precision
18  use scale_io
19  use scale_prof
21  use scale_tracer
22  !-----------------------------------------------------------------------------
23  implicit none
24  private
25  !-----------------------------------------------------------------------------
26  !
27  !++ Public procedure
28  !
29  public :: atmos_phy_cp_vars_setup
33 
39 
40  !-----------------------------------------------------------------------------
41  !
42  !++ Public parameters & variables
43  !
44  logical, public :: atmos_phy_cp_restart_output = .false.
45 
46  character(len=H_LONG), public :: atmos_phy_cp_restart_in_basename = ''
47  logical, public :: atmos_phy_cp_restart_in_postfix_timelabel = .false.
49  character(len=H_LONG), public :: atmos_phy_cp_restart_out_basename = ''
51  logical, public :: atmos_phy_cp_restart_out_postfix_timelabel = .true.
52  character(len=H_MID), public :: atmos_phy_cp_restart_out_title = 'ATMOS_PHY_CP restart'
53  character(len=H_SHORT), public :: atmos_phy_cp_restart_out_dtype = 'DEFAULT'
54 
55  real(RP), public, allocatable :: atmos_phy_cp_dens_t (:,:,:) ! tendency DENS [kg/m3/s]
56  real(RP), public, allocatable :: atmos_phy_cp_momz_t (:,:,:) ! tendency MOMZ [kg/m2/s2]
57  real(RP), public, allocatable :: atmos_phy_cp_rhot_t (:,:,:) ! tendency RHOT [K*kg/m3/s]
58  real(RP), public, allocatable :: atmos_phy_cp_rhoqv_t (:,:,:) ! tendency rho*QV [kg/kg/s]
59  real(RP), public, allocatable :: atmos_phy_cp_rhohyd_t(:,:,:,:) ! tendency rho*QHYD [kg/kg/s]
60 
61  real(RP), public, allocatable :: atmos_phy_cp_mflx_cloudbase(:,:) ! cloud base mass flux [kg/m2/s]
62  real(RP), public, allocatable :: atmos_phy_cp_sflx_rain (:,:) ! convective rain [kg/m2/s]
63  real(RP), public, allocatable :: atmos_phy_cp_cloudtop (:,:) ! cloud top height [m]
64  real(RP), public, allocatable :: atmos_phy_cp_cloudbase (:,:) ! cloud base height [m]
65  real(RP), public, allocatable :: atmos_phy_cp_cldfrac_dp (:,:,:) ! cloud fraction (deep convection) (0-1)
66  real(RP), public, allocatable :: atmos_phy_cp_cldfrac_sh (:,:,:) ! cloud fraction (shallow convection) (0-1)
67  real(RP), public, allocatable :: atmos_phy_cp_w0mean (:,:,:) ! running mean vertical wind velocity [m/s]
68  ! only for K-F scheme
69  real(RP), public, allocatable :: atmos_phy_cp_kf_nca (:,:) ! advection/cumulus convection timescale/dt for KF[step]
70 
71  !-----------------------------------------------------------------------------
72  !
73  !++ Private procedure
74  !
75  !-----------------------------------------------------------------------------
76  !
77  !++ Private parameters & variables
78  !
79  integer, private, parameter :: vmax = 8
80  integer, private, parameter :: i_mflx_cloudbase = 1
81  integer, private, parameter :: i_sflx_convrain = 2
82  integer, private, parameter :: i_cloudtop = 3
83  integer, private, parameter :: i_cloudbase = 4
84  integer, private, parameter :: i_cldfrac_dp = 5
85  integer, private, parameter :: i_cldfrac_sh = 6
86  integer, private, parameter :: i_w0mean = 7
87  integer, private, parameter :: i_kf_nca = 8
88 
89 
90  character(len=H_SHORT), private :: var_name(vmax)
91  character(len=H_MID), private :: var_desc(vmax)
92  character(len=H_SHORT), private :: var_unit(vmax)
93  character(len=H_SHORT), private :: var_dim (vmax)
94  integer, private :: var_id (vmax)
95  integer, private :: restart_fid = -1 ! file ID
96 
97  data var_name / 'MFLX_cloudbase', &
98  'SFLX_convrain', &
99  'cloudtop', &
100  'cloudbase', &
101  'cldfrac_dp', &
102  'cldfrac_sh', &
103  'w0mean', &
104  'kf_nca' /
105  data var_desc / 'cloud base mass flux', &
106  'convective rain', &
107  'cloud top height', &
108  'cloud base height', &
109  'cloud fraction (deep convection)', &
110  'cloud fraction (shallow convection)', &
111  'running mean vertical wind velocity', &
112  'advection/cumulus convection timescale/dt for KF' /
113  data var_unit / 'kg/m2/s', &
114  'kg/m2/s', &
115  'm', &
116  'm', &
117  '1', &
118  '1', &
119  'm/s', &
120  'step' /
121  data var_dim / 'XY', &
122  'XY', &
123  'XY', &
124  'XY', &
125  'ZXY', &
126  'ZXY', &
127  'ZXY', &
128  'XY' /
129 
130  ! tendency names
131  integer, private :: vmax_t
132  integer, private :: i_cp_dens_t = 1
133  integer, private :: i_cp_rhot_t = 2
134  integer, private :: i_cp_qv_t = 3
135 
136  character(len=H_SHORT), private, allocatable :: var_t_name(:)
137  character(len=H_MID), private, allocatable :: var_t_desc(:)
138  character(len=H_SHORT), private, allocatable :: var_t_unit(:)
139  integer, private, allocatable :: var_t_id (:)
140 
141  !-----------------------------------------------------------------------------
142 contains
143  !-----------------------------------------------------------------------------
145  subroutine atmos_phy_cp_vars_setup
146  use scale_prc, only: &
147  prc_abort
148  use scale_const, only: &
149  undef => const_undef
150  use scale_atmos_hydrometeor, only: &
151  n_hyd, &
152  hyd_name
153  implicit none
154 
155  namelist / param_atmos_phy_cp_vars / &
165 
166  integer :: ierr
167  integer :: iv
168  integer :: iq
169  !---------------------------------------------------------------------------
170 
171  log_newline
172  log_info("ATMOS_PHY_CP_vars_setup",*) 'Setup'
173 
174  allocate( atmos_phy_cp_dens_t(ka,ia,ja) )
175  allocate( atmos_phy_cp_momz_t(ka,ia,ja) )
176  allocate( atmos_phy_cp_rhot_t(ka,ia,ja) )
177  allocate( atmos_phy_cp_rhoqv_t(ka,ia,ja) )
178  allocate( atmos_phy_cp_rhohyd_t(ka,ia,ja,n_hyd) )
179  atmos_phy_cp_dens_t(:,:,:) = 0.0_rp
180  atmos_phy_cp_momz_t(:,:,:) = undef
181  atmos_phy_cp_rhot_t(:,:,:) = 0.0_rp
182  atmos_phy_cp_rhoqv_t(:,:,:) = 0.0_rp
183  atmos_phy_cp_rhohyd_t(:,:,:,:) = 0.0_rp
184 
185  allocate( atmos_phy_cp_mflx_cloudbase(ia,ja) )
186  allocate( atmos_phy_cp_sflx_rain(ia,ja) )
187  allocate( atmos_phy_cp_cloudtop(ia,ja) )
188  allocate( atmos_phy_cp_cloudbase(ia,ja) )
189  allocate( atmos_phy_cp_cldfrac_dp(ka,ia,ja) )
190  allocate( atmos_phy_cp_cldfrac_sh(ka,ia,ja) )
191  allocate( atmos_phy_cp_w0mean(ka,ia,ja) )
192  allocate( atmos_phy_cp_kf_nca(ia,ja) )
193  atmos_phy_cp_mflx_cloudbase(:,:) = 0.0_rp
194  atmos_phy_cp_sflx_rain(:,:) = 0.0_rp
195  atmos_phy_cp_cloudtop(:,:) = 0.0_rp
196  atmos_phy_cp_cloudbase(:,:) = 0.0_rp
197  atmos_phy_cp_cldfrac_dp(:,:,:) = 0.0_rp
198  atmos_phy_cp_cldfrac_sh(:,:,:) = 0.0_rp
199  atmos_phy_cp_w0mean(:,:,:) = 0.0_rp
200  atmos_phy_cp_kf_nca(:,:) = -100.0_rp
201 
202  ! for tendency restart
203  vmax_t = 3 + n_hyd
204  allocate( var_t_name(vmax_t) )
205  allocate( var_t_desc(vmax_t) )
206  allocate( var_t_unit(vmax_t) )
207  allocate( var_t_id(vmax_t) )
208 
209  var_t_name(i_cp_dens_t) = 'DENS_t_CP'
210  var_t_desc(i_cp_dens_t) = 'tendency DENS in CP'
211  var_t_unit(i_cp_dens_t) = 'kg/m3/s'
212  var_t_name(i_cp_rhot_t) = 'RHOT_t_CP'
213  var_t_desc(i_cp_rhot_t) = 'tendency RHOT in CP'
214  var_t_unit(i_cp_rhot_t) = 'K*kg/m3/s'
215 
216  var_t_name(i_cp_qv_t) = 'QV_t_CP'
217  var_t_desc(i_cp_qv_t) = 'tendency rho*QV in CP'
218  var_t_unit(i_cp_qv_t) = 'kg/m3/s'
219  do iq = 1, n_hyd
220  var_t_name(3+iq) = trim(hyd_name(iq))//'_t_CP'
221  var_t_desc(3+iq) = 'tendency rho*'//trim(hyd_name(iq))//' in CP'
222  var_t_unit(3+iq) = 'kg/m3/s'
223  enddo
224 
225  !--- read namelist
226  rewind(io_fid_conf)
227  read(io_fid_conf,nml=param_atmos_phy_cp_vars,iostat=ierr)
228  if( ierr < 0 ) then !--- missing
229  log_info("ATMOS_PHY_CP_vars_setup",*) 'Not found namelist. Default used.'
230  elseif( ierr > 0 ) then !--- fatal error
231  log_error("ATMOS_PHY_CP_vars_setup",*) 'Not appropriate names in namelist PARAM_ATMOS_PHY_CP_VARS. Check!'
232  call prc_abort
233  endif
234  log_nml(param_atmos_phy_cp_vars)
235 
236  log_newline
237  log_info("ATMOS_PHY_CP_vars_setup",*) '[ATMOS_PHY_CP] prognostic/diagnostic variables'
238  log_info_cont('(1x,A,A24,A,A48,A,A12,A)') &
239  ' |', 'VARNAME ','|', &
240  'DESCRIPTION ', '[', 'UNIT ', ']'
241  do iv = 1, vmax
242  log_info_cont('(1x,A,I3,A,A24,A,A48,A,A12,A)') &
243  'NO.',iv,'|',var_name(iv),'|',var_desc(iv),'[',var_unit(iv),']'
244  enddo
245 
246  ! tendency
247  do iv = 1, vmax_t
248  log_info_cont('(1x,A,I3,A,A24,A,A48,A,A12,A)') &
249  'NO.',iv+vmax,'|',var_t_name(iv),'|',var_t_desc(iv),'[',var_t_unit(iv),']'
250  enddo
251 
252  log_newline
253  if ( atmos_phy_cp_restart_in_basename /= '' ) then
254  log_info("ATMOS_PHY_CP_vars_setup",*) 'Restart input? : YES, file = ', trim(atmos_phy_cp_restart_in_basename)
255  log_info("ATMOS_PHY_CP_vars_setup",*) 'Add timelabel? : ', atmos_phy_cp_restart_in_postfix_timelabel
256  else
257  log_info("ATMOS_PHY_CP_vars_setup",*) 'Restart input? : NO'
258  endif
260  .AND. atmos_phy_cp_restart_out_basename /= '' ) then
261  log_info("ATMOS_PHY_CP_vars_setup",*) 'Restart output? : YES, file = ', trim(atmos_phy_cp_restart_out_basename)
262  log_info("ATMOS_PHY_CP_vars_setup",*) 'Add timelabel? : ', atmos_phy_cp_restart_out_postfix_timelabel
263  else
264  log_info("ATMOS_PHY_CP_vars_setup",*) 'Restart output? : NO'
266  endif
267 
268  return
269  end subroutine atmos_phy_cp_vars_setup
270 
271  !-----------------------------------------------------------------------------
273  subroutine atmos_phy_cp_vars_fillhalo
274  use scale_comm_cartesc, only: &
275  comm_vars8, &
276  comm_wait
277  use scale_atmos_hydrometeor, only: &
278  n_hyd
279  implicit none
280 
281  integer :: i, j
282  integer :: iq
283  !---------------------------------------------------------------------------
284 
285  do j = js, je
286  do i = is, ie
299  enddo
300  enddo
301 
302  do iq = 1, n_hyd
303  do j = js, je
304  do i = is, ie
305  atmos_phy_cp_rhohyd_t( 1:ks-1,i,j,iq) = atmos_phy_cp_rhohyd_t(ks,i,j,iq)
306  atmos_phy_cp_rhohyd_t(ke+1:ka ,i,j,iq) = atmos_phy_cp_rhohyd_t(ke,i,j,iq)
307  enddo
308  enddo
309  end do
310 
311  call comm_vars8( atmos_phy_cp_mflx_cloudbase(:,:) , 1 )
312  call comm_vars8( atmos_phy_cp_sflx_rain(:,:) , 2 )
313  call comm_vars8( atmos_phy_cp_cloudtop(:,:) , 3 )
314  call comm_vars8( atmos_phy_cp_cloudbase(:,:) , 4 )
315  call comm_vars8( atmos_phy_cp_cldfrac_dp(:,:,:), 5 )
316  call comm_vars8( atmos_phy_cp_cldfrac_sh(:,:,:), 6 )
317  call comm_vars8( atmos_phy_cp_w0mean(:,:,:), 7 )
318  call comm_vars8( atmos_phy_cp_kf_nca(:,:) , 8 )
319 
320  ! tendency
321  call comm_vars8( atmos_phy_cp_dens_t(:,:,:), vmax+1 )
322  call comm_vars8( atmos_phy_cp_rhot_t(:,:,:), vmax+2 )
323  call comm_vars8( atmos_phy_cp_rhoqv_t(:,:,:), vmax+3 )
324  do iq = 1, n_hyd
325  call comm_vars8( atmos_phy_cp_rhohyd_t(:,:,:,iq), vmax+3+iq )
326  enddo
327 
328  call comm_wait ( atmos_phy_cp_mflx_cloudbase(:,:) , 1 )
329  call comm_wait ( atmos_phy_cp_sflx_rain(:,:) , 2 )
330  call comm_wait ( atmos_phy_cp_cloudtop(:,:) , 3 )
331  call comm_wait ( atmos_phy_cp_cloudbase(:,:) , 4 )
332  call comm_wait ( atmos_phy_cp_cldfrac_dp(:,:,:), 5 )
333  call comm_wait ( atmos_phy_cp_cldfrac_sh(:,:,:), 6 )
334  call comm_wait ( atmos_phy_cp_w0mean(:,:,:), 7 )
335  call comm_wait ( atmos_phy_cp_kf_nca(:,:) , 8 )
336 
337 
338  call comm_wait ( atmos_phy_cp_dens_t(:,:,:), vmax+1 )
339  call comm_wait ( atmos_phy_cp_rhot_t(:,:,:), vmax+2 )
340  call comm_wait ( atmos_phy_cp_rhoqv_t(:,:,:), vmax+3 )
341  do iq = 1, n_hyd
342  call comm_wait ( atmos_phy_cp_rhohyd_t(:,:,:,iq), vmax+3+iq )
343  enddo
344 
345  return
346  end subroutine atmos_phy_cp_vars_fillhalo
347 
348  !-----------------------------------------------------------------------------
351  use scale_time, only: &
353  use scale_file_cartesc, only: &
355  implicit none
356 
357  character(len=19) :: timelabel
358  character(len=H_LONG) :: basename
359  !---------------------------------------------------------------------------
360 
361  log_newline
362  log_info("ATMOS_PHY_CP_vars_restart_open",*) 'Open restart file (ATMOS_PHY_CP) '
363 
364  if ( atmos_phy_cp_restart_in_basename /= '' ) then
365 
367  call time_gettimelabel( timelabel )
368  basename = trim(atmos_phy_cp_restart_in_basename)//'_'//trim(timelabel)
369  else
370  basename = trim(atmos_phy_cp_restart_in_basename)
371  endif
372 
373  log_info("ATMOS_PHY_CP_vars_restart_open",*) 'basename: ', trim(basename)
374 
375  call file_cartesc_open( basename, restart_fid, aggregate=atmos_phy_cp_restart_in_aggregate )
376  else
377  log_info("ATMOS_PHY_CP_vars_restart_open",*) 'restart file for ATMOS_PHY_CP is not specified.'
378  endif
379 
380  return
381  end subroutine atmos_phy_cp_vars_restart_open
382 
383  !-----------------------------------------------------------------------------
386  use scale_file, only: &
388  use scale_file_cartesc, only: &
389  file_cartesc_read, &
391  use scale_atmos_hydrometeor, only: &
392  n_hyd
393  implicit none
394 
395  integer :: i, j, iq
396  !---------------------------------------------------------------------------
397 
398  if ( restart_fid /= -1 ) then
399  log_newline
400  log_info("ATMOS_PHY_CP_vars_restart_read",*) 'Read from restart file (ATMOS_PHY_CP) '
401 
402  call file_cartesc_read( restart_fid, var_name(1), 'XY', & ! [IN]
403  atmos_phy_cp_mflx_cloudbase(:,:) ) ! [OUT]
404  call file_cartesc_read( restart_fid, var_name(2), 'XY', & ! [IN]
405  atmos_phy_cp_sflx_rain(:,:) ) ! [OUT]
406  call file_cartesc_read( restart_fid, var_name(3), 'XY', & ! [IN]
407  atmos_phy_cp_cloudtop(:,:) ) ! [OUT]
408  call file_cartesc_read( restart_fid, var_name(4), 'XY', & ! [IN]
409  atmos_phy_cp_cloudbase(:,:) ) ! [OUT]
410  call file_cartesc_read( restart_fid, var_name(5), 'ZXY', & ! [IN]
411  atmos_phy_cp_cldfrac_dp(:,:,:) ) ! [OUT]
412  call file_cartesc_read( restart_fid, var_name(6), 'ZXY', & ! [IN]
413  atmos_phy_cp_cldfrac_sh(:,:,:) ) ! [OUT]
414  call file_cartesc_read( restart_fid, var_name(7), 'ZXY', & ! [IN]
415  atmos_phy_cp_w0mean(:,:,:) ) ! [OUT]
416  call file_cartesc_read( restart_fid, var_name(8), 'XY', & ! [IN]
417  atmos_phy_cp_kf_nca(:,:) ) ! [OUT]
418  ! tendency
419  call file_cartesc_read( restart_fid, var_t_name(1), 'ZXY', & ! [IN]
420  atmos_phy_cp_dens_t(:,:,:) ) ! [OUT]
421  call file_cartesc_read( restart_fid, var_t_name(2), 'ZXY', & ! [IN]
422  atmos_phy_cp_rhot_t(:,:,:) ) ! [OUT]
423  call file_cartesc_read( restart_fid, var_t_name(3), 'ZXY', & ! [IN]
424  atmos_phy_cp_rhoqv_t(:,:,:) ) ! [OUT]
425  do iq = 1, n_hyd
426  call file_cartesc_read( restart_fid, var_t_name(3+iq), 'ZXY', & ! [IN]
427  atmos_phy_cp_rhohyd_t(:,:,:,iq) ) ! [OUT]
428  enddo
429 
430  if ( file_get_aggregate(restart_fid) ) then
431  call file_cartesc_flush( restart_fid ) ! X/Y halos have been read from file
432 
433  ! fill K halos
434  do j = 1, ja
435  do i = 1, ia
448  enddo
449  enddo
450 
451  do iq = 1, n_hyd
452  do j = 1, ja
453  do i = 1, ia
454  atmos_phy_cp_rhohyd_t( 1:ks-1,i,j,iq) = atmos_phy_cp_rhohyd_t(ks,i,j,iq)
455  atmos_phy_cp_rhohyd_t(ke+1:ka, i,j,iq) = atmos_phy_cp_rhohyd_t(ke,i,j,iq)
456  enddo
457  enddo
458  enddo
459  else
461  end if
462 
464 
465  else
466  log_info("ATMOS_PHY_CP_vars_restart_read",*) 'invalid restart file ID for ATMOS_PHY_CP.'
467  endif
468 
469  return
470  end subroutine atmos_phy_cp_vars_restart_read
471 
472  !-----------------------------------------------------------------------------
475  use scale_time, only: &
477  use scale_file_cartesc, only: &
479  implicit none
480 
481  character(len=19) :: timelabel
482  character(len=H_LONG) :: basename
483  !---------------------------------------------------------------------------
484 
485  if ( atmos_phy_cp_restart_out_basename /= '' ) then
486 
487  log_newline
488  log_info("ATMOS_PHY_CP_vars_restart_create",*) 'Create restart file (ATMOS_PHY_AE) '
489 
491  call time_gettimelabel( timelabel )
492  basename = trim(atmos_phy_cp_restart_out_basename)//'_'//trim(timelabel)
493  else
494  basename = trim(atmos_phy_cp_restart_out_basename)
495  endif
496 
497  log_info("ATMOS_PHY_CP_vars_restart_create",*) 'basename: ', trim(basename)
498 
499  call file_cartesc_create( &
501  restart_fid, & ! [OUT]
502  aggregate=atmos_phy_cp_restart_out_aggregate ) ! [IN]
503 
504  endif
505 
506  return
507  end subroutine atmos_phy_cp_vars_restart_create
508 
509  !-----------------------------------------------------------------------------
512  use scale_file_cartesc, only: &
514  implicit none
515 
516  if ( restart_fid /= -1 ) then
517  call file_cartesc_enddef( restart_fid ) ! [IN]
518  endif
519 
520  return
521  end subroutine atmos_phy_cp_vars_restart_enddef
522 
523  !-----------------------------------------------------------------------------
526  use scale_file_cartesc, only: &
528  implicit none
529  !---------------------------------------------------------------------------
530 
531  if ( restart_fid /= -1 ) then
532  log_newline
533  log_info("ATMOS_PHY_CP_vars_restart_close",*) 'Close restart file (ATMOS_PHY_CP) '
534 
535  call file_cartesc_close( restart_fid ) ! [IN]
536 
537  restart_fid = -1
538  endif
539 
540  return
541  end subroutine atmos_phy_cp_vars_restart_close
542 
543  !-----------------------------------------------------------------------------
546  use scale_file_cartesc, only: &
548  use scale_atmos_hydrometeor, only: &
549  n_hyd
550  implicit none
551 
552  integer :: i, iq
553  !---------------------------------------------------------------------------
554 
555  if ( restart_fid /= -1 ) then
556 
557  do i = 1, 8
558  call file_cartesc_def_var( restart_fid, & ! [IN]
559  var_name(i), var_desc(i), var_unit(i), & ! [IN]
560  var_dim(i), atmos_phy_cp_restart_out_dtype, & ! [IN]
561  var_id(i) ) ! [OUT]
562  end do
563 
564  do i = 1, 3
565  call file_cartesc_def_var( restart_fid, & ! [IN]
566  var_t_name(i), var_t_desc(i), var_t_unit(i), & ! [IN]
567  'ZXY', atmos_phy_cp_restart_out_dtype, & ! [IN]
568  var_t_id(i) ) ! [OUT]
569  end do
570 
571  do iq = 1, n_hyd
572  call file_cartesc_def_var( restart_fid, & ! [IN]
573  var_t_name(3+iq), var_t_desc(3+iq), var_t_unit(3+iq), & ! [IN]
574  'ZXY', atmos_phy_cp_restart_out_dtype, & ! [IN]
575  var_t_id(3+iq) ) ! [OUT]
576  enddo
577 
578  endif
579 
580  return
581  end subroutine atmos_phy_cp_vars_restart_def_var
582 
583  !-----------------------------------------------------------------------------
586  use scale_file_cartesc, only: &
587  file_cartesc_write => file_cartesc_write_var
588  use scale_atmos_hydrometeor, only: &
589  n_hyd
590  implicit none
591 
592  integer :: iq
593  !---------------------------------------------------------------------------
594 
595  if ( restart_fid /= -1 ) then
596 
598 
600 
601  call file_cartesc_write( restart_fid, var_id(1), atmos_phy_cp_mflx_cloudbase(:,:), & ! [IN]
602  var_name(1), 'XY' ) ! [IN]
603  call file_cartesc_write( restart_fid, var_id(2), atmos_phy_cp_sflx_rain(:,:), & ! [IN]
604  var_name(2), 'XY' ) ! [IN]
605  call file_cartesc_write( restart_fid, var_id(3), atmos_phy_cp_cloudtop(:,:), & ! [IN]
606  var_name(3), 'XY' ) ! [IN]
607  call file_cartesc_write( restart_fid, var_id(4), atmos_phy_cp_cloudbase(:,:), & ! [IN]
608  var_name(4), 'XY' ) ! [IN]
609  call file_cartesc_write( restart_fid, var_id(5), atmos_phy_cp_cldfrac_dp(:,:,:), & ! [IN]
610  var_name(5), 'ZXY' ) ! [IN]
611  call file_cartesc_write( restart_fid, var_id(6), atmos_phy_cp_cldfrac_sh(:,:,:), & ! [IN]
612  var_name(6), 'ZXY' ) ! [IN]
613  call file_cartesc_write( restart_fid, var_id(7), atmos_phy_cp_w0mean(:,:,:), & ! [IN]
614  var_name(7), 'ZXY' ) ! [IN]
615  call file_cartesc_write( restart_fid, var_id(8), atmos_phy_cp_kf_nca(:,:), & ! [IN]
616  var_name(8), 'XY' ) ! [IN]
617 
618  ! tendency
619  call file_cartesc_write( restart_fid, var_t_id(1), atmos_phy_cp_dens_t(:,:,:), & ! [IN]
620  var_t_name(1), 'ZXY' ) ! [IN]
621  call file_cartesc_write( restart_fid, var_t_id(2), atmos_phy_cp_rhot_t(:,:,:), & ! [IN]
622  var_t_name(2), 'ZXY' ) ! [IN]
623  call file_cartesc_write( restart_fid, var_t_id(3), atmos_phy_cp_rhoqv_t(:,:,:), & ! [IN]
624  var_t_name(3), 'ZXY' ) ! [IN]
625  do iq = 1, n_hyd
626  call file_cartesc_write( restart_fid, var_t_id(3+iq), atmos_phy_cp_rhohyd_t(:,:,:,iq), & ! [IN]
627  var_t_name(3+iq), 'ZXY' ) ! [IN]
628  enddo
629 
630  endif
631 
632  return
633  end subroutine atmos_phy_cp_vars_restart_write
634 
636  use scale_statistics, only: &
638  statistics_total
639  use scale_atmos_grid_cartesc_real, only: &
644  use scale_atmos_hydrometeor, only: &
645  n_hyd
646 
647  integer :: iq
648 
649  !---------------------------------------------------------------------------
650 
651  if ( statistics_checktotal ) then
652  call statistics_total( ia, is, ie, ja, js, je, &
653  atmos_phy_cp_mflx_cloudbase(:,:) , var_name(1), & ! (in)
654  atmos_grid_cartesc_real_area(:,:), & ! (in)
656  call statistics_total( ia, is, ie, ja, js, je, &
657  atmos_phy_cp_sflx_rain(:,:) , var_name(2), & ! (in)
658  atmos_grid_cartesc_real_area(:,:), & ! (in)
660  call statistics_total( ia, is, ie, ja, js, je, &
661  atmos_phy_cp_cloudtop(:,:) , var_name(3), & ! (in)
662  atmos_grid_cartesc_real_area(:,:), & ! (in)
664  call statistics_total( ia, is, ie, ja, js, je, &
665  atmos_phy_cp_cloudbase(:,:) , var_name(4), & ! (in)
666  atmos_grid_cartesc_real_area(:,:), & ! (in)
668  call statistics_total( ka, ks, ke, ia, is, ie, ja, js, je, &
669  atmos_phy_cp_cldfrac_dp(:,:,:), var_name(5), &
670  atmos_grid_cartesc_real_vol(:,:,:), & ! (in)
672  call statistics_total( ka, ks, ke, ia, is, ie, ja, js, je, &
673  atmos_phy_cp_cldfrac_sh(:,:,:), var_name(6), & ! (in)
674  atmos_grid_cartesc_real_vol(:,:,:), & ! (in)
676  call statistics_total( ka, ks, ke, ia, is, ie, ja, js, je, &
677  atmos_phy_cp_w0mean(:,:,:), var_name(7), & ! (in)
678  atmos_grid_cartesc_real_vol(:,:,:), & ! (in)
680  call statistics_total( ia, is, ie, ja, js, je, &
681  atmos_phy_cp_kf_nca(:,:) , var_name(8), & ! (in)
682  atmos_grid_cartesc_real_area(:,:), & ! (in)
684  ! tendency
685  call statistics_total( ka, ks, ke, ia, is, ie, ja, js, je, &
686  atmos_phy_cp_dens_t(:,:,:), var_t_name(1), & ! (in)
687  atmos_grid_cartesc_real_vol(:,:,:), & ! (in)
689  call statistics_total( ka, ks, ke, ia, is, ie, ja, js, je, &
690  atmos_phy_cp_rhot_t(:,:,:), var_t_name(2), & ! (in)
691  atmos_grid_cartesc_real_vol(:,:,:), & ! (in)
693  call statistics_total( ka, ks, ke, ia, is, ie, ja, js, je, &
694  atmos_phy_cp_rhoqv_t(:,:,:), var_t_name(3), & ! (in)
695  atmos_grid_cartesc_real_vol(:,:,:), & ! (in)
697  do iq = 1, n_hyd
698  call statistics_total( ka, ks, ke, ia, is, ie, ja, js, je, &
699  atmos_phy_cp_rhohyd_t(:,:,:,iq), var_t_name(3+iq), & ! (in)
700  atmos_grid_cartesc_real_vol(:,:,:), & ! (in)
702  enddo
703  endif
704 
705  return
706  end subroutine atmos_phy_cp_vars_checktotal
707 
708 end module mod_atmos_phy_cp_vars
subroutine, public atmos_phy_cp_vars_restart_def_var
Write restart.
module Atmosphere / Physics Cumulus
character(len=h_short), dimension(n_hyd), parameter, public hyd_name
character(len=h_mid), public atmos_phy_cp_restart_out_title
title of the output file
real(rp), dimension(:,:,:), allocatable, public atmos_phy_cp_dens_t
character(len=h_long), public atmos_phy_cp_restart_in_basename
Basename of the input file.
subroutine, public atmos_phy_cp_vars_restart_enddef
Exit netCDF define mode.
real(rp), dimension(:,:,:), allocatable, public atmos_phy_cp_rhoqv_t
integer, public ia
of whole cells: x, local, with HALO
subroutine, public atmos_phy_cp_vars_restart_open
Open restart file for read.
subroutine, public atmos_phy_cp_vars_restart_write
Write restart.
logical, public atmos_phy_cp_restart_output
output restart file?
logical, public atmos_phy_cp_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
character(len=h_long), public atmos_phy_cp_restart_out_basename
Basename of the output file.
real(rp), dimension(:,:,:), allocatable, public atmos_grid_cartesc_real_vol
control volume (zxy) [m3]
real(rp), public atmos_grid_cartesc_real_totvol
total volume (zxy, local) [m3]
subroutine, public atmos_phy_cp_vars_restart_create
Create restart file.
integer, public ja
of whole cells: y, local, with HALO
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:55
logical, public atmos_phy_cp_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
logical, public statistics_checktotal
calc&report variable totals to logfile?
character(len=h_short), public atmos_phy_cp_restart_out_dtype
REAL4 or REAL8.
real(rp), public const_undef
Definition: scale_const.F90:41
subroutine, public atmos_phy_cp_vars_restart_close
Close restart file.
real(rp), dimension(:,:,:), allocatable, public atmos_phy_cp_cldfrac_dp
module COMMUNICATION
real(rp), dimension(:,:,:), allocatable, public atmos_phy_cp_w0mean
integer, public is
start point of inner domain: x, local
module file
Definition: scale_file.F90:15
integer, public ie
end point of inner domain: x, local
subroutine, public file_cartesc_create(basename, title, datatype, fid, date, subsec, haszcoord, append, aggregate, single)
Create/open a netCDF file.
subroutine, public atmos_phy_cp_vars_setup
Setup.
module TRACER
module atmosphere / hydrometeor
subroutine, public time_gettimelabel(timelabel)
generate time label
Definition: scale_time.F90:94
logical, public atmos_phy_cp_restart_in_aggregate
Switch to use aggregate file.
logical, public atmos_phy_cp_restart_out_aggregate
Switch to use aggregate file.
module atmosphere / grid / cartesC index
integer, public ke
end point of inner domain: z, local
real(rp), dimension(:,:,:), allocatable, public atmos_phy_cp_rhot_t
module PROCESS
Definition: scale_prc.F90:11
integer, public je
end point of inner domain: y, local
subroutine, public atmos_phy_cp_vars_fillhalo
HALO Communication.
subroutine, public file_cartesc_enddef(fid)
Exit netCDF file define mode.
module TIME
Definition: scale_time.F90:16
integer, public ks
start point of inner domain: z, local
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:338
module CONSTANT
Definition: scale_const.F90:11
integer, public js
start point of inner domain: y, local
subroutine, public file_cartesc_def_var(fid, varname, desc, unit, dim_type, datatype, vid, standard_name, timeintv, nsteps, cell_measures)
Define a variable to file.
real(rp), dimension(:,:), allocatable, public atmos_phy_cp_cloudtop
real(rp), dimension(:,:,:,:), allocatable, public atmos_phy_cp_rhohyd_t
logical function, public file_get_aggregate(fid)
module profiler
Definition: scale_prof.F90:11
module Atmosphere GRID CartesC Real(real space)
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_area
horizontal area ( xy, normal z) [m2]
module PRECISION
module file / cartesianC
integer, public ka
of whole cells: z, local, with HALO
subroutine, public atmos_phy_cp_vars_restart_read
Read restart.
module Statistics
real(rp), dimension(:,:), allocatable, public atmos_phy_cp_mflx_cloudbase
module STDIO
Definition: scale_io.F90:10
real(rp), dimension(:,:), allocatable, public atmos_phy_cp_cloudbase
subroutine, public file_cartesc_flush(fid)
Flush all pending requests to a netCDF file (PnetCDF only)
integer, parameter, public n_hyd
real(rp), dimension(:,:,:), allocatable, public atmos_phy_cp_cldfrac_sh
real(rp), dimension(:,:), allocatable, public atmos_phy_cp_sflx_rain
subroutine, public file_cartesc_open(basename, fid, aggregate)
open a netCDF file for read
subroutine, public file_cartesc_close(fid)
Close a netCDF file.
real(rp), dimension(:,:), allocatable, public atmos_phy_cp_kf_nca
real(rp), public atmos_grid_cartesc_real_totarea
total area (xy, local) [m2]
real(rp), dimension(:,:,:), allocatable, public atmos_phy_cp_momz_t