SCALE-RM
mod_urban_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
20  use scale_debug
22  use scale_tracer
24  !-----------------------------------------------------------------------------
25  implicit none
26  private
27  !-----------------------------------------------------------------------------
28  !
29  !++ Public procedure
30  !
31  public :: urban_vars_setup
32  public :: urban_vars_restart_read
33  public :: urban_vars_restart_write
34  public :: urban_vars_history
35  public :: urban_vars_total
36 
38  public :: urban_vars_restart_open
41  public :: urban_vars_restart_close
42 
43  !-----------------------------------------------------------------------------
44  !
45  !++ Public parameters & variables
46  !
47  logical, public :: urban_restart_output = .false.
48 
49  character(len=H_LONG), public :: urban_restart_in_basename = ''
50  logical, public :: urban_restart_in_aggregate
51  logical, public :: urban_restart_in_postfix_timelabel = .false.
52  character(len=H_LONG), public :: urban_restart_out_basename = ''
53  logical, public :: urban_restart_out_aggregate
54  logical, public :: urban_restart_out_postfix_timelabel = .true.
55  character(len=H_MID), public :: urban_restart_out_title = 'URBAN restart'
56  character(len=H_SHORT), public :: urban_restart_out_dtype = 'DEFAULT'
57 
58  ! prognostic variables
59  real(RP), public, allocatable :: urban_tr (:,:) ! urban surface temperature of roof [K]
60  real(RP), public, allocatable :: urban_tb (:,:) ! urban surface temperature of wall [K]
61  real(RP), public, allocatable :: urban_tg (:,:) ! urban surface temperature of road [K]
62  real(RP), public, allocatable :: urban_tc (:,:) ! urban canopy air temperature [K]
63  real(RP), public, allocatable :: urban_qc (:,:) ! urban canopy humidity [kg/kg]
64  real(RP), public, allocatable :: urban_uc (:,:) ! urban canopy wind [m/s]
65  real(RP), public, allocatable :: urban_trl (:,:,:) ! urban temperature in layer of roof [K]
66  real(RP), public, allocatable :: urban_tbl (:,:,:) ! urban temperature in layer of wall [K]
67  real(RP), public, allocatable :: urban_tgl (:,:,:) ! urban temperature in layer of road [K]
68  real(RP), public, allocatable :: urban_rainr(:,:) ! urban rain storage on roof [mm=kg/m2]
69  real(RP), public, allocatable :: urban_rainb(:,:) ! urban rain storage on wall [mm=kg/m2]
70  real(RP), public, allocatable :: urban_raing(:,:) ! urban rain storage on road [mm=kg/m2]
71  real(RP), public, allocatable :: urban_roff (:,:) ! urban runoff [mm=kg/m2]
72 
73  ! tendency variables
74  real(RP), public, allocatable :: urban_trl_t (:,:,:) ! tendency of URBAN_TRL
75  real(RP), public, allocatable :: urban_tbl_t (:,:,:) ! tendency of URBAN_TBL
76  real(RP), public, allocatable :: urban_tgl_t (:,:,:) ! tendency of URBAN_TGL
77  real(RP), public, allocatable :: urban_tc_t (:,:) ! tendency of URBAN_TC
78  real(RP), public, allocatable :: urban_uc_t (:,:) ! tendency of URBAN_UC
79  real(RP), public, allocatable :: urban_qc_t (:,:) ! tendency of URBAN_QC
80  real(RP), public, allocatable :: urban_tr_t (:,:) ! tendency of URBAN_TR
81  real(RP), public, allocatable :: urban_tb_t (:,:) ! tendency of URBAN_TB
82  real(RP), public, allocatable :: urban_tg_t (:,:) ! tendency of URBAN_TG
83  real(RP), public, allocatable :: urban_rainr_t(:,:) ! tendency of URBAN_RAINR
84  real(RP), public, allocatable :: urban_rainb_t(:,:) ! tendency of URBAN_RAINB
85  real(RP), public, allocatable :: urban_raing_t(:,:) ! tendency of URBAN_RAING
86  real(RP), public, allocatable :: urban_roff_t (:,:) ! tendency of URBAN_ROFF
87 
88  ! for restart
89  real(RP), public, allocatable :: urban_sfc_temp (:,:) ! urban grid average of surface temperature [K]
90  real(RP), public, allocatable :: urban_sfc_albedo(:,:,:,:) ! urban grid average of albedo (direct/diffuse,IR/near-IR/VIS) (0-1)
91  real(RP), public, allocatable :: urban_sflx_mw (:,:) ! urban grid average of w-momentum flux [kg/m2/s]
92  real(RP), public, allocatable :: urban_sflx_mu (:,:) ! urban grid average of u-momentum flux [kg/m2/s]
93  real(RP), public, allocatable :: urban_sflx_mv (:,:) ! urban grid average of v-momentum flux [kg/m2/s]
94  real(RP), public, allocatable :: urban_sflx_sh (:,:) ! urban grid average of sensible heat flux [W/m2]
95  real(RP), public, allocatable :: urban_sflx_lh (:,:) ! urban grid average of latent heat flux [W/m2]
96  real(RP), public, allocatable :: urban_sflx_gh (:,:) ! urban grid average of ground heat flux [W/m2]
97  real(RP), public, allocatable :: urban_sflx_qtrc (:,:,:) ! urban grid average of water vapor flux [kg/m2/s]
98 
99  ! diagnostic variables
100  real(RP), public, allocatable :: urban_z0m(:,:) ! urban grid average of rougness length (momentum) [m]
101  real(RP), public, allocatable :: urban_z0h(:,:) ! urban grid average of rougness length (heat) [m]
102  real(RP), public, allocatable :: urban_z0e(:,:) ! urban grid average of rougness length (vapor) [m]
103  real(RP), public, allocatable :: urban_u10(:,:) ! urban grid average of velocity u at 10m [m/s]
104  real(RP), public, allocatable :: urban_v10(:,:) ! urban grid average of velocity v at 10m [m/s]
105  real(RP), public, allocatable :: urban_t2 (:,:) ! urban grid average of temperature at 2m [K]
106  real(RP), public, allocatable :: urban_q2 (:,:) ! urban grid average of water vapor at 2m [kg/kg]
107 
108  ! recieved atmospheric variables
109  real(RP), public, allocatable :: atmos_temp (:,:)
110  real(RP), public, allocatable :: atmos_pres (:,:)
111  real(RP), public, allocatable :: atmos_w (:,:)
112  real(RP), public, allocatable :: atmos_u (:,:)
113  real(RP), public, allocatable :: atmos_v (:,:)
114  real(RP), public, allocatable :: atmos_dens (:,:)
115  real(RP), public, allocatable :: atmos_qv (:,:)
116  real(RP), public, allocatable :: atmos_pbl (:,:)
117  real(RP), public, allocatable :: atmos_sfc_dens (:,:)
118  real(RP), public, allocatable :: atmos_sfc_pres (:,:)
119  real(RP), public, allocatable :: atmos_sflx_lw (:,:,:)
120  real(RP), public, allocatable :: atmos_sflx_sw (:,:,:)
121  real(RP), public, allocatable :: atmos_cossza (:,:)
122  real(RP), public, allocatable :: atmos_sflx_rain(:,:)
123  real(RP), public, allocatable :: atmos_sflx_snow(:,:)
124 
125  !-----------------------------------------------------------------------------
126  !
127  !++ Private procedure
128  !
129  !-----------------------------------------------------------------------------
130  !
131  !++ Private parameters & variables
132  !
133  logical, private :: urban_vars_checkrange = .false.
134 
135  integer, private, parameter :: vmax = 27
136  integer, private, parameter :: i_tr = 1
137  integer, private, parameter :: i_tb = 2
138  integer, private, parameter :: i_tg = 3
139  integer, private, parameter :: i_tc = 4
140  integer, private, parameter :: i_qc = 5
141  integer, private, parameter :: i_uc = 6
142  integer, private, parameter :: i_trl = 7
143  integer, private, parameter :: i_tbl = 8
144  integer, private, parameter :: i_tgl = 9
145  integer, private, parameter :: i_rainr = 10
146  integer, private, parameter :: i_rainb = 11
147  integer, private, parameter :: i_raing = 12
148  integer, private, parameter :: i_roff = 13
149  integer, private, parameter :: i_sfc_temp = 14
150  integer, private, parameter :: i_sfc_alb_ir_dir = 15
151  integer, private, parameter :: i_sfc_alb_ir_dif = 16
152  integer, private, parameter :: i_sfc_alb_nir_dir = 17
153  integer, private, parameter :: i_sfc_alb_nir_dif = 18
154  integer, private, parameter :: i_sfc_alb_vis_dir = 19
155  integer, private, parameter :: i_sfc_alb_vis_dif = 20
156  integer, private, parameter :: i_sflx_mw = 21
157  integer, private, parameter :: i_sflx_mu = 22
158  integer, private, parameter :: i_sflx_mv = 23
159  integer, private, parameter :: i_sflx_sh = 24
160  integer, private, parameter :: i_sflx_lh = 25
161  integer, private, parameter :: i_sflx_gh = 26
162  integer, private, parameter :: i_sflx_evap = 27
163 
164  character(len=H_SHORT), private :: var_name(vmax)
165  character(len=H_MID), private :: var_desc(vmax)
166  character(len=H_MID), private :: var_stdn(vmax)
167  character(len=H_SHORT), private :: var_unit(vmax)
168  integer, private :: var_id(vmax)
169  integer, private :: restart_fid = -1 ! file ID
170 
171  data var_name / 'URBAN_TR', &
172  'URBAN_TB', &
173  'URBAN_TG', &
174  'URBAN_TC', &
175  'URBAN_QC', &
176  'URBAN_UC', &
177  'URBAN_TRL', &
178  'URBAN_TBL', &
179  'URBAN_TGL', &
180  'URBAN_RAINR', &
181  'URBAN_RAINB', &
182  'URBAN_RAING', &
183  'URBAN_ROFF', &
184  'URBAN_SFC_TEMP', &
185  'URBAN_SFC_ALB_IR_dir', &
186  'URBAN_SFC_ALB_IR_dif', &
187  'URBAN_SFC_ALB_NIR_dir', &
188  'URBAN_SFC_ALB_NIR_dif', &
189  'URBAN_SFC_ALB_VIS_dir', &
190  'URBAN_SFC_ALB_VIS_dif', &
191  'URBAN_SFLX_MW', &
192  'URBAN_SFLX_MU', &
193  'URBAN_SFLX_MV', &
194  'URBAN_SFLX_SH', &
195  'URBAN_SFLX_LH', &
196  'URBAN_SFLX_GH', &
197  'URBAN_SFLX_evap' /
198 
199  data var_desc / 'urban surface temperature of roof', &
200  'urban surface temperature of wall', &
201  'urban surface temperature of road', &
202  'urban canopy air temperature', &
203  'urban canopy humidity', &
204  'urban canopy wind', &
205  'urban temperature in layer of roof', &
206  'urban temperature in layer of wall', &
207  'urban temperature in layer of road', &
208  'urban rain strage on roof', &
209  'urban rain strage on wall', &
210  'urban rain strage on road', &
211  'urban runoff ', &
212  'urban grid average of temperature', &
213  'urban grid average of albedo for IR (direct)', &
214  'urban grid average of albedo for IR (diffuse)', &
215  'urban grid average of albedo for NIR (direct)', &
216  'urban grid average of albedo for NIR (diffuse)', &
217  'urban grid average of albedo for VIS (direct)', &
218  'urban grid average of albedo for VIS (diffuse)', &
219  'urban grid average of w-momentum flux', &
220  'urban grid average of u-momentum flux', &
221  'urban grid average of v-momentum flux', &
222  'urban grid average of sensible heat flux (upward)', &
223  'urban grid average of latent heat flux (upward)', &
224  'urban grid average of subsurface heat flux (downward)', &
225  'urban grid average of water vapor flux (upward)' /
226 
227  data var_stdn / '', &
228  '', &
229  '', &
230  '', &
231  '', &
232  '', &
233  '', &
234  '', &
235  '', &
236  '', &
237  '', &
238  '', &
239  '', &
240  '', &
241  '', &
242  '', &
243  '', &
244  '', &
245  '', &
246  '', &
247  '', &
248  '', &
249  '', &
250  '', &
251  '', &
252  '', &
253  '' /
254 
255  data var_unit / 'K', &
256  'K', &
257  'K', &
258  'K', &
259  'kg/kg', &
260  'm/s', &
261  'K', &
262  'K', &
263  'K', &
264  'kg/m2', &
265  'kg/m2', &
266  'kg/m2', &
267  'kg/m2', &
268  'K', &
269  '1', &
270  '1', &
271  '1', &
272  '1', &
273  '1', &
274  '1', &
275  'kg/m2/s', &
276  'kg/m2/s', &
277  'kg/m2/s', &
278  'W/m2', &
279  'W/m2', &
280  'W/m2', &
281  'kg/m2/s' /
282 
283 
284  logical, private :: urban_restart_in_check_coordinates = .true.
285 
286  !-----------------------------------------------------------------------------
287 contains
288  !-----------------------------------------------------------------------------
290  subroutine urban_vars_setup
291  use scale_prc, only: &
292  prc_abort
293  use scale_const, only: &
294  undef => const_undef
295  implicit none
296 
297  namelist / param_urban_vars / &
301  urban_restart_in_check_coordinates, &
308  urban_vars_checkrange
309 
310  integer :: ierr
311  integer :: iv
312  !---------------------------------------------------------------------------
313 
314  log_newline
315  log_info("URBAN_vars_setup",*) 'Setup'
316 
317  allocate( urban_tr(uia,uja) )
318  allocate( urban_tb(uia,uja) )
319  allocate( urban_tg(uia,uja) )
320  allocate( urban_tc(uia,uja) )
321  allocate( urban_qc(uia,uja) )
322  allocate( urban_uc(uia,uja) )
323  allocate( urban_trl(uks:uke,uia,uja) )
324  allocate( urban_tbl(uks:uke,uia,uja) )
325  allocate( urban_tgl(uks:uke,uia,uja) )
326  allocate( urban_rainr(uia,uja) )
327  allocate( urban_rainb(uia,uja) )
328  allocate( urban_raing(uia,uja) )
329  allocate( urban_roff(uia,uja) )
330  urban_tr(:,:) = undef
331  urban_tb(:,:) = undef
332  urban_tg(:,:) = undef
333  urban_tc(:,:) = undef
334  urban_qc(:,:) = undef
335  urban_uc(:,:) = undef
336  urban_trl(:,:,:) = undef
337  urban_tbl(:,:,:) = undef
338  urban_tgl(:,:,:) = undef
339  urban_rainr(:,:) = undef
340  urban_rainb(:,:) = undef
341  urban_raing(:,:) = undef
342  urban_roff(:,:) = undef
343 
344  allocate( urban_tr_t(uia,uja) )
345  allocate( urban_tb_t(uia,uja) )
346  allocate( urban_tg_t(uia,uja) )
347  allocate( urban_tc_t(uia,uja) )
348  allocate( urban_qc_t(uia,uja) )
349  allocate( urban_uc_t(uia,uja) )
350  allocate( urban_trl_t(uks:uke,uia,uja) )
351  allocate( urban_tbl_t(uks:uke,uia,uja) )
352  allocate( urban_tgl_t(uks:uke,uia,uja) )
353  allocate( urban_rainr_t(uia,uja) )
354  allocate( urban_rainb_t(uia,uja) )
355  allocate( urban_raing_t(uia,uja) )
356  allocate( urban_roff_t(uia,uja) )
357  urban_tr_t(:,:) = undef
358  urban_tb_t(:,:) = undef
359  urban_tg_t(:,:) = undef
360  urban_tc_t(:,:) = undef
361  urban_qc_t(:,:) = undef
362  urban_uc_t(:,:) = undef
363  urban_trl_t(:,:,:) = undef
364  urban_tbl_t(:,:,:) = undef
365  urban_tgl_t(:,:,:) = undef
366  urban_rainr_t(:,:) = undef
367  urban_rainb_t(:,:) = undef
368  urban_raing_t(:,:) = undef
369  urban_roff_t(:,:) = undef
370 
371  allocate( urban_sfc_temp(uia,uja) )
373  allocate( urban_sflx_mw(uia,uja) )
374  allocate( urban_sflx_mu(uia,uja) )
375  allocate( urban_sflx_mv(uia,uja) )
376  allocate( urban_sflx_sh(uia,uja) )
377  allocate( urban_sflx_lh(uia,uja) )
378  allocate( urban_sflx_gh(uia,uja) )
379  allocate( urban_sflx_qtrc(uia,uja,qa) )
380  urban_sfc_temp(:,:) = undef
381  urban_sfc_albedo(:,:,:,:) = undef
382  urban_sflx_mw(:,:) = undef
383  urban_sflx_mu(:,:) = undef
384  urban_sflx_mv(:,:) = undef
385  urban_sflx_sh(:,:) = undef
386  urban_sflx_lh(:,:) = undef
387  urban_sflx_gh(:,:) = undef
388  urban_sflx_qtrc(:,:,:) = undef
389 
390  allocate( urban_z0m(uia,uja) )
391  allocate( urban_z0h(uia,uja) )
392  allocate( urban_z0e(uia,uja) )
393  allocate( urban_u10(uia,uja) )
394  allocate( urban_v10(uia,uja) )
395  allocate( urban_t2(uia,uja) )
396  allocate( urban_q2(uia,uja) )
397  urban_z0m(:,:) = undef
398  urban_z0h(:,:) = undef
399  urban_z0e(:,:) = undef
400  urban_u10(:,:) = undef
401  urban_v10(:,:) = undef
402  urban_t2(:,:) = undef
403  urban_q2(:,:) = undef
404 
405  allocate( atmos_temp(uia,uja) )
406  allocate( atmos_pres(uia,uja) )
407  allocate( atmos_w(uia,uja) )
408  allocate( atmos_u(uia,uja) )
409  allocate( atmos_v(uia,uja) )
410  allocate( atmos_dens(uia,uja) )
411  allocate( atmos_qv(uia,uja) )
412  allocate( atmos_pbl(uia,uja) )
413  allocate( atmos_sfc_dens(uia,uja) )
414  allocate( atmos_sfc_pres(uia,uja) )
415  allocate( atmos_sflx_lw(uia,uja,2) )
416  allocate( atmos_sflx_sw(uia,uja,2) )
417  allocate( atmos_cossza(uia,uja) )
418  allocate( atmos_sflx_rain(uia,uja) )
419  allocate( atmos_sflx_snow(uia,uja) )
420  atmos_temp(:,:) = undef
421  atmos_pres(:,:) = undef
422  atmos_w(:,:) = undef
423  atmos_u(:,:) = undef
424  atmos_v(:,:) = undef
425  atmos_dens(:,:) = undef
426  atmos_qv(:,:) = undef
427  atmos_pbl(:,:) = undef
428  atmos_sfc_dens(:,:) = undef
429  atmos_sfc_pres(:,:) = undef
430  atmos_sflx_lw(:,:,:) = undef
431  atmos_sflx_sw(:,:,:) = undef
432  atmos_cossza(:,:) = undef
433  atmos_sflx_rain(:,:) = undef
434  atmos_sflx_snow(:,:) = undef
435 
436  !--- read namelist
437  rewind(io_fid_conf)
438  read(io_fid_conf,nml=param_urban_vars,iostat=ierr)
439  if( ierr < 0 ) then !--- missing
440  log_info("URBAN_vars_setup",*) 'Not found namelist. Default used.'
441  elseif( ierr > 0 ) then !--- fatal error
442  log_error("URBAN_vars_setup",*) 'Not appropriate names in namelist PARAM_URBAN_VARS. Check!'
443  call prc_abort
444  endif
445  log_nml(param_urban_vars)
446 
447  log_newline
448  log_info("URBAN_vars_setup",*) 'List of prognostic variables (URBAN) '
449  log_info_cont('(1x,A,A24,A,A48,A,A12,A)') &
450  ' |', 'VARNAME ','|', &
451  'DESCRIPTION ', '[', 'UNIT ', ']'
452  do iv = 1, vmax
453  log_info_cont('(1x,A,I3,A,A24,A,A48,A,A12,A)') &
454  'NO.',iv,'|',var_name(iv),'|',var_desc(iv),'[',var_unit(iv),']'
455  enddo
456 
457  log_newline
458  if ( urban_restart_in_basename /= '' ) then
459  log_info("URBAN_vars_setup",*) 'Restart input? : YES, file = ', trim(urban_restart_in_basename)
460  log_info("URBAN_vars_setup",*) 'Add timelabel? : ', urban_restart_in_postfix_timelabel
461  else
462  log_info("URBAN_vars_setup",*) 'Restart input? : NO'
463  endif
464  if ( urban_restart_output &
465  .AND. urban_restart_out_basename /= '' ) then
466  log_info("URBAN_vars_setup",*) 'Restart output? : YES, file = ', trim(urban_restart_out_basename)
467  log_info("URBAN_vars_setup",*) 'Add timelabel? : ', urban_restart_out_postfix_timelabel
468  else
469  log_info("URBAN_vars_setup",*) 'Restart output? : NO'
470  urban_restart_output = .false.
471  endif
472 
473  return
474  end subroutine urban_vars_setup
475 
476  !-----------------------------------------------------------------------------
478  subroutine urban_vars_restart_open
479  use scale_time, only: &
481  use scale_file_cartesc, only: &
483  file_cartesc_check_coordinates
484  use mod_urban_admin, only: &
485  urban_do
486  implicit none
487 
488  character(len=19) :: timelabel
489  character(len=H_LONG) :: basename
490  !---------------------------------------------------------------------------
491 
492  log_newline
493  log_info("URBAN_vars_restart_open",*) 'Open restart file (URBAN) '
494 
495  if ( urban_do .and. urban_restart_in_basename /= '' ) then
496 
498  call time_gettimelabel( timelabel )
499  basename = trim(urban_restart_in_basename)//'_'//trim(timelabel)
500  else
501  basename = trim(urban_restart_in_basename)
502  endif
503 
504  log_info("URBAN_vars_restart_open",*) 'basename: ', trim(basename)
505 
506  call file_cartesc_open( basename, restart_fid, aggregate=urban_restart_in_aggregate )
507 
508  if ( urban_restart_in_check_coordinates ) then
509  call file_cartesc_check_coordinates( restart_fid, urban=.true. )
510  end if
511 
512  else
513  log_info("URBAN_vars_restart_open",*) 'restart file for urban is not specified.'
514  endif
515 
516  return
517  end subroutine urban_vars_restart_open
518 
519  !-----------------------------------------------------------------------------
521  subroutine urban_vars_restart_read
522  use scale_prc, only: &
523  prc_abort
524  use scale_file, only: &
526  use scale_file_cartesc, only: &
527  file_cartesc_read, &
529  implicit none
530  !---------------------------------------------------------------------------
531 
532  if ( restart_fid /= -1 ) then
533  log_newline
534  log_info("URBAN_vars_restart_read",*) 'Read from restart file (URBAN) '
535 
536  call file_cartesc_read( restart_fid, var_name(i_tr), 'XY', & ! [IN]
537  urban_tr(:,:) ) ! [OUT]
538  call file_cartesc_read( restart_fid, var_name(i_tb), 'XY', & ! [IN]
539  urban_tb(:,:) ) ! [OUT]
540  call file_cartesc_read( restart_fid, var_name(i_tg), 'XY', & ! [IN]
541  urban_tg(:,:) ) ! [OUT]
542  call file_cartesc_read( restart_fid, var_name(i_tc), 'XY', & ! [IN]
543  urban_tc(:,:) ) ! [OUT]
544  call file_cartesc_read( restart_fid, var_name(i_qc), 'XY', & ! [IN]
545  urban_qc(:,:) ) ! [OUT]
546  call file_cartesc_read( restart_fid, var_name(i_uc), 'XY', & ! [IN]
547  urban_uc(:,:) ) ! [OUT]
548 
549  call file_cartesc_read( restart_fid, var_name(i_trl), 'UXY', & ! [IN]
550  urban_trl(:,:,:) ) ! [OUT]
551  call file_cartesc_read( restart_fid, var_name(i_tbl), 'UXY', & ! [IN]
552  urban_tbl(:,:,:) ) ! [OUT]
553  call file_cartesc_read( restart_fid, var_name(i_tgl), 'UXY', & ! [IN]
554  urban_tgl(:,:,:) ) ! [OUT]
555 
556  call file_cartesc_read( restart_fid, var_name(i_rainr), 'XY', & ! [IN]
557  urban_rainr(:,:) ) ! [OUT]
558  call file_cartesc_read( restart_fid, var_name(i_rainb), 'XY', & ! [IN]
559  urban_rainb(:,:) ) ! [OUT]
560  call file_cartesc_read( restart_fid, var_name(i_raing), 'XY', & ! [IN]
561  urban_raing(:,:) ) ! [OUT]
562  call file_cartesc_read( restart_fid, var_name(i_roff), 'XY', & ! [IN]
563  urban_roff(:,:) ) ! [OUT]
564 
565  call file_cartesc_read( restart_fid, var_name(i_sfc_temp), 'XY', & ! [IN]
566  urban_sfc_temp(:,:) ) ! [OUT]
567  call file_cartesc_read( restart_fid, var_name(i_sfc_alb_ir_dir), 'XY', & ! [IN]
568  urban_sfc_albedo(:,:,i_r_direct ,i_r_ir ) ) ! [OUT]
569  call file_cartesc_read( restart_fid, var_name(i_sfc_alb_ir_dif), 'XY', & ! [IN]
570  urban_sfc_albedo(:,:,i_r_diffuse,i_r_ir ) ) ! [OUT]
571  call file_cartesc_read( restart_fid, var_name(i_sfc_alb_nir_dir), 'XY', & ! [IN]
572  urban_sfc_albedo(:,:,i_r_direct ,i_r_nir) ) ! [OUT]
573  call file_cartesc_read( restart_fid, var_name(i_sfc_alb_nir_dif), 'XY', & ! [IN]
574  urban_sfc_albedo(:,:,i_r_diffuse,i_r_nir) ) ! [OUT]
575  call file_cartesc_read( restart_fid, var_name(i_sfc_alb_vis_dir), 'XY', & ! [IN]
576  urban_sfc_albedo(:,:,i_r_direct ,i_r_vis) ) ! [OUT]
577  call file_cartesc_read( restart_fid, var_name(i_sfc_alb_vis_dif), 'XY', & ! [IN]
578  urban_sfc_albedo(:,:,i_r_diffuse,i_r_vis) ) ! [OUT]
579 
580  if( file_get_aggregate(restart_fid) ) call file_cartesc_flush( restart_fid ) ! commit all pending read requests
581 
582  call urban_vars_total
583  else
584  log_error("URBAN_vars_restart_read",*) 'invalid restart file ID for urban.'
585  call prc_abort
586  endif
587 
588  return
589  end subroutine urban_vars_restart_read
590 
591  !-----------------------------------------------------------------------------
593  subroutine urban_vars_history
594  use scale_file_history, only: &
595  file_history_in
596  use scale_atmos_hydrometeor, only: &
597  i_qv
598  implicit none
599  !---------------------------------------------------------------------------
600 
601  call prof_rapstart('URB_History', 1)
602 
603  if ( urban_vars_checkrange ) then
604  call valcheck( urban_tr(uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, var_name(i_tr), &
605  __file__, __line__ )
606  call valcheck( urban_tb(uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, var_name(i_tb), &
607  __file__, __line__ )
608  call valcheck( urban_tg(uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, var_name(i_tg), &
609  __file__, __line__ )
610  call valcheck( urban_tc(uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, var_name(i_tc), &
611  __file__, __line__ )
612  call valcheck( urban_qc(uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, var_name(i_qc), &
613  __file__, __line__ )
614  call valcheck( urban_uc(uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, var_name(i_uc), &
615  __file__, __line__ )
616  call valcheck( urban_trl(:,uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, var_name(i_trl), &
617  __file__, __line__ )
618  call valcheck( urban_tbl(:,uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, var_name(i_tbl), &
619  __file__, __line__ )
620  call valcheck( urban_tgl(:,uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, var_name(i_tgl), &
621  __file__, __line__ )
622  call valcheck( urban_rainr(uis:uie,ujs:uje), -1000.0_rp, 1000.0_rp, var_name(i_rainr), &
623  __file__, __line__ )
624  call valcheck( urban_rainb(uis:uie,ujs:uje), -1000.0_rp, 1000.0_rp, var_name(i_rainb), &
625  __file__, __line__ )
626  call valcheck( urban_raing(uis:uie,ujs:uje), -1000.0_rp, 1000.0_rp, var_name(i_raing), &
627  __file__, __line__ )
628  call valcheck( urban_roff(uis:uie,ujs:uje), -1000.0_rp, 1000.0_rp, var_name(i_roff), &
629  __file__, __line__ )
630  call valcheck( urban_sfc_temp(uis:uie,ujs:uje), 0.0_rp, 1000.0_rp, &
631  var_name(i_sfc_temp), __file__, __line__ )
632  call valcheck( urban_sfc_albedo(uis:uie,ujs:uje,i_r_direct ,i_r_ir ), 0.0_rp, 2.0_rp, &
633  var_name(i_sfc_alb_ir_dir ), __file__, __line__ )
634  call valcheck( urban_sfc_albedo(uis:uie,ujs:uje,i_r_diffuse,i_r_ir ), 0.0_rp, 2.0_rp, &
635  var_name(i_sfc_alb_ir_dif ), __file__, __line__ )
636  call valcheck( urban_sfc_albedo(uis:uie,ujs:uje,i_r_direct ,i_r_nir), 0.0_rp, 2.0_rp, &
637  var_name(i_sfc_alb_nir_dir), __file__, __line__ )
638  call valcheck( urban_sfc_albedo(uis:uie,ujs:uje,i_r_diffuse,i_r_nir), 0.0_rp, 2.0_rp, &
639  var_name(i_sfc_alb_nir_dif), __file__, __line__ )
640  call valcheck( urban_sfc_albedo(uis:uie,ujs:uje,i_r_direct ,i_r_vis), 0.0_rp, 2.0_rp, &
641  var_name(i_sfc_alb_vis_dir), __file__, __line__ )
642  call valcheck( urban_sfc_albedo(uis:uie,ujs:uje,i_r_diffuse,i_r_vis), 0.0_rp, 2.0_rp, &
643  var_name(i_sfc_alb_vis_dif), __file__, __line__ )
644  endif
645 
646  call file_history_in( urban_tr(:,:), var_name(i_tr), var_desc(i_tr), var_unit(i_tr) )
647  call file_history_in( urban_tb(:,:), var_name(i_tb), var_desc(i_tb), var_unit(i_tb) )
648  call file_history_in( urban_tg(:,:), var_name(i_tg), var_desc(i_tg), var_unit(i_tg) )
649  call file_history_in( urban_tc(:,:), var_name(i_tc), var_desc(i_tc), var_unit(i_tc) )
650  call file_history_in( urban_qc(:,:), var_name(i_qc), var_desc(i_qc), var_unit(i_qc) )
651  call file_history_in( urban_uc(:,:), var_name(i_uc), var_desc(i_uc), var_unit(i_uc) )
652 
653  call file_history_in( urban_trl(:,:,:), var_name(i_trl), var_desc(i_trl), var_unit(i_trl), dim_type='UXY' )
654  call file_history_in( urban_tbl(:,:,:), var_name(i_tbl), var_desc(i_tbl), var_unit(i_tbl), dim_type='UXY' )
655  call file_history_in( urban_tgl(:,:,:), var_name(i_tgl), var_desc(i_tgl), var_unit(i_tgl), dim_type='UXY' )
656 
657  call file_history_in( urban_rainr(:,:), var_name(i_rainr), var_desc(i_rainr), var_unit(i_rainr) )
658  call file_history_in( urban_rainb(:,:), var_name(i_rainb), var_desc(i_rainb), var_unit(i_rainb) )
659  call file_history_in( urban_raing(:,:), var_name(i_raing), var_desc(i_raing), var_unit(i_raing) )
660  call file_history_in( urban_roff(:,:), var_name(i_roff), var_desc(i_roff), var_unit(i_roff) )
661 
662  call file_history_in( urban_sfc_temp(:,:), var_name(i_sfc_temp), &
663  var_desc(i_sfc_temp), var_unit(i_sfc_temp), standard_name=var_stdn(i_sfc_temp) )
664  call file_history_in( urban_sfc_albedo(:,:,i_r_direct ,i_r_ir ), var_name(i_sfc_alb_ir_dir), &
665  var_desc(i_sfc_alb_ir_dir), var_unit(i_sfc_alb_ir_dir), standard_name=var_stdn(i_sfc_alb_ir_dir) )
666  call file_history_in( urban_sfc_albedo(:,:,i_r_diffuse,i_r_ir ), var_name(i_sfc_alb_ir_dif), &
667  var_desc(i_sfc_alb_ir_dif), var_unit(i_sfc_alb_ir_dif), standard_name=var_stdn(i_sfc_alb_ir_dif) )
668  call file_history_in( urban_sfc_albedo(:,:,i_r_direct ,i_r_nir), var_name(i_sfc_alb_nir_dir), &
669  var_desc(i_sfc_alb_nir_dir), var_unit(i_sfc_alb_nir_dir), standard_name=var_stdn(i_sfc_alb_nir_dir) )
670  call file_history_in( urban_sfc_albedo(:,:,i_r_diffuse,i_r_nir), var_name(i_sfc_alb_nir_dif), &
671  var_desc(i_sfc_alb_nir_dif), var_unit(i_sfc_alb_nir_dif), standard_name=var_stdn(i_sfc_alb_nir_dif) )
672  call file_history_in( urban_sfc_albedo(:,:,i_r_direct ,i_r_vis), var_name(i_sfc_alb_vis_dir), &
673  var_desc(i_sfc_alb_vis_dir), var_unit(i_sfc_alb_vis_dir), standard_name=var_stdn(i_sfc_alb_vis_dir) )
674  call file_history_in( urban_sfc_albedo(:,:,i_r_diffuse,i_r_vis), var_name(i_sfc_alb_vis_dif), &
675  var_desc(i_sfc_alb_vis_dif), var_unit(i_sfc_alb_vis_dif), standard_name=var_stdn(i_sfc_alb_vis_dif) )
676 
677  call file_history_in( urban_sflx_mw(:,:), var_name(i_sflx_mw), var_desc(i_sflx_mw), var_unit(i_sflx_mw) )
678  call file_history_in( urban_sflx_mu(:,:), var_name(i_sflx_mu), var_desc(i_sflx_mu), var_unit(i_sflx_mu) )
679  call file_history_in( urban_sflx_mv(:,:), var_name(i_sflx_mv), var_desc(i_sflx_mv), var_unit(i_sflx_mv) )
680  call file_history_in( urban_sflx_sh(:,:), var_name(i_sflx_sh), var_desc(i_sflx_sh), var_unit(i_sflx_sh) )
681  call file_history_in( urban_sflx_lh(:,:), var_name(i_sflx_lh), var_desc(i_sflx_lh), var_unit(i_sflx_lh) )
682  call file_history_in( urban_sflx_gh(:,:), var_name(i_sflx_gh), var_desc(i_sflx_gh), var_unit(i_sflx_gh) )
683  if ( i_qv > 0 ) then
684  call file_history_in( urban_sflx_qtrc(:,:,i_qv), var_name(i_sflx_evap), var_desc(i_sflx_evap), var_unit(i_sflx_evap) )
685  endif
686 
687  call prof_rapend ('URB_History', 1)
688 
689  return
690  end subroutine urban_vars_history
691 
692  !-----------------------------------------------------------------------------
694  subroutine urban_vars_total
695  use scale_statistics, only: &
697  statistics_total
698  use scale_atmos_hydrometeor, only: &
699  i_qv
700  use scale_urban_grid_cartesc_real, only: &
705  implicit none
706 
707  !---------------------------------------------------------------------------
708 
709  if ( statistics_checktotal ) then
710 
711  ! 3D
712  call statistics_total( uka, uks, uke, uia, uis, uie, uja, ujs, uje, &
713  urban_trl(:,:,:), var_name(i_trl), & ! (in)
714  urban_grid_cartesc_real_vol(:,:,:), & ! (in)
716  call statistics_total( uka, uks, uke, uia, uis, uie, uja, ujs, uje, &
717  urban_tbl(:,:,:), var_name(i_tbl), & ! (in)
718  urban_grid_cartesc_real_vol(:,:,:), & ! (in)
720  call statistics_total( uka, uks, uke, uia, uis, uie, uja, ujs, uje, &
721  urban_tgl(:,:,:), var_name(i_tgl), & ! (in)
722  urban_grid_cartesc_real_vol(:,:,:), & ! (in)
724 
725  ! 2D
726  call statistics_total( uia, uis, uie, uja, ujs, uje, &
727  urban_tr(:,:), var_name(i_tr), & ! (in)
728  urban_grid_cartesc_real_area(:,:), & ! (in)
730  call statistics_total( uia, uis, uie, uja, ujs, uje, &
731  urban_tb(:,:), var_name(i_tb), & ! (in)
732  urban_grid_cartesc_real_area(:,:), & ! (in)
734  call statistics_total( uia, uis, uie, uja, ujs, uje, &
735  urban_tg(:,:), var_name(i_tg), & ! (in)
736  urban_grid_cartesc_real_area(:,:), & ! (in)
738  call statistics_total( uia, uis, uie, uja, ujs, uje, &
739  urban_tc(:,:), var_name(i_tc), & ! (in)
740  urban_grid_cartesc_real_area(:,:), & ! (in)
742  call statistics_total( uia, uis, uie, uja, ujs, uje, &
743  urban_qc(:,:), var_name(i_qc), & ! (in)
744  urban_grid_cartesc_real_area(:,:), & ! (in)
746  call statistics_total( uia, uis, uie, uja, ujs, uje, &
747  urban_uc(:,:), var_name(i_uc), & ! (in)
748  urban_grid_cartesc_real_area(:,:), & ! (in)
750 
751  call statistics_total( uia, uis, uie, uja, ujs, uje, &
752  urban_rainr(:,:), var_name(i_rainr), & ! (in)
753  urban_grid_cartesc_real_area(:,:), & ! (in)
755  call statistics_total( uia, uis, uie, uja, ujs, uje, &
756  urban_rainb(:,:), var_name(i_rainb), & ! (in)
757  urban_grid_cartesc_real_area(:,:), & ! (in)
759  call statistics_total( uia, uis, uie, uja, ujs, uje, &
760  urban_raing(:,:), var_name(i_raing), & ! (in)
761  urban_grid_cartesc_real_area(:,:), & ! (in)
763  call statistics_total( uia, uis, uie, uja, ujs, uje, &
764  urban_roff(:,:), var_name(i_roff), & ! (in)
765  urban_grid_cartesc_real_area(:,:), & ! (in)
767 
768  call statistics_total( uia, uis, uie, uja, ujs, uje, & ! [IN]
769  urban_sfc_temp(:,:), var_name(i_sfc_temp), & ! [IN]
770  urban_grid_cartesc_real_area(:,:), & ! [IN]
772  call statistics_total( uia, uis, uie, uja, ujs, uje, & ! [IN]
773  urban_sfc_albedo(:,:,i_r_direct ,i_r_ir ), var_name(i_sfc_alb_ir_dir), & ! [IN]
774  urban_grid_cartesc_real_area(:,:), & ! [IN]
776  call statistics_total( uia, uis, uie, uja, ujs, uje, & ! [IN]
777  urban_sfc_albedo(:,:,i_r_diffuse,i_r_ir ), var_name(i_sfc_alb_ir_dif), & ! [IN]
778  urban_grid_cartesc_real_area(:,:), & ! [IN]
780  call statistics_total( uia, uis, uie, uja, ujs, uje, & ! [IN]
781  urban_sfc_albedo(:,:,i_r_direct ,i_r_nir), var_name(i_sfc_alb_nir_dir), & ! [IN]
782  urban_grid_cartesc_real_area(:,:), & ! [IN]
784  call statistics_total( uia, uis, uie, uja, ujs, uje, & ! [IN]
785  urban_sfc_albedo(:,:,i_r_diffuse,i_r_nir), var_name(i_sfc_alb_nir_dif), & ! [IN]
786  urban_grid_cartesc_real_area(:,:), & ! [IN]
788  call statistics_total( uia, uis, uie, uja, ujs, uje, & ! [IN]
789  urban_sfc_albedo(:,:,i_r_direct ,i_r_vis), var_name(i_sfc_alb_vis_dir), & ! [IN]
790  urban_grid_cartesc_real_area(:,:), & ! [IN]
792  call statistics_total( uia, uis, uie, uja, ujs, uje, & ! [IN]
793  urban_sfc_albedo(:,:,i_r_diffuse,i_r_vis), var_name(i_sfc_alb_vis_dif), & ! [IN]
794  urban_grid_cartesc_real_area(:,:), & ! [IN]
796 
797  call statistics_total( uia, uis, uie, uja, ujs, uje, &
798  urban_sflx_mw(:,:), var_name(i_sflx_mw), & ! (in)
799  urban_grid_cartesc_real_area(:,:), & ! (in)
801  call statistics_total( uia, uis, uie, uja, ujs, uje, &
802  urban_sflx_mu(:,:), var_name(i_sflx_mu), & ! (in)
803  urban_grid_cartesc_real_area(:,:), & ! (in)
805  call statistics_total( uia, uis, uie, uja, ujs, uje, &
806  urban_sflx_mv(:,:), var_name(i_sflx_mv), & ! (in)
807  urban_grid_cartesc_real_area(:,:), & ! (in)
809  call statistics_total( uia, uis, uie, uja, ujs, uje, &
810  urban_sflx_sh(:,:), var_name(i_sflx_sh), & ! (in)
811  urban_grid_cartesc_real_area(:,:), & ! (in)
813  call statistics_total( uia, uis, uie, uja, ujs, uje, &
814  urban_sflx_lh(:,:), var_name(i_sflx_lh), & ! (in)
815  urban_grid_cartesc_real_area(:,:), & ! (in)
817  call statistics_total( uia, uis, uie, uja, ujs, uje, &
818  urban_sflx_gh(:,:), var_name(i_sflx_gh), & ! (in)
819  urban_grid_cartesc_real_area(:,:), & ! (in)
821  if ( i_qv > 0 ) then
822  call statistics_total( uia, uis, uie, uja, ujs, uje, &
823  urban_sflx_qtrc(:,:,i_qv), var_name(i_sflx_evap), & ! (in)
824  urban_grid_cartesc_real_area(:,:), & ! (in)
826  endif
827  endif
828 
829  return
830  end subroutine urban_vars_total
831 
832  !-----------------------------------------------------------------------------
834  subroutine urban_vars_restart_create
835  use scale_time, only: &
837  use scale_file_cartesc, only: &
839  use mod_urban_admin, only: &
840  urban_do
841  implicit none
842 
843  character(len=19) :: timelabel
844  character(len=H_LONG) :: basename
845  !---------------------------------------------------------------------------
846 
847  if ( urban_do .and. urban_restart_out_basename /= '' ) then
848 
849  log_newline
850  log_info("URBAN_vars_restart_create",*) 'Create restart file (URBAN) '
851 
853  call time_gettimelabel( timelabel )
854  basename = trim(urban_restart_out_basename)//'_'//trim(timelabel)
855  else
856  basename = trim(urban_restart_out_basename)
857  endif
858 
859  log_info("URBAN_vars_restart_create",*) 'basename: ', trim(basename)
860 
861  call file_cartesc_create( &
863  restart_fid, & ! [OUT]
864  aggregate=urban_restart_out_aggregate ) ! [IN]
865 
866  endif
867 
868  return
869  end subroutine urban_vars_restart_create
870 
871  !-----------------------------------------------------------------------------
873  subroutine urban_vars_restart_enddef
874  use scale_file_cartesc, only: &
876  implicit none
877 
878  if ( restart_fid /= -1 ) then
879  call file_cartesc_enddef( restart_fid ) ! [IN]
880  endif
881 
882  return
883  end subroutine urban_vars_restart_enddef
884 
885  !-----------------------------------------------------------------------------
887  subroutine urban_vars_restart_close
888  use scale_file_cartesc, only: &
890  implicit none
891  !---------------------------------------------------------------------------
892 
893  if ( restart_fid /= -1 ) then
894  log_newline
895  log_info("URBAN_vars_restart_close",*) 'Close restart file (URBAN) '
896 
897  call file_cartesc_close( restart_fid ) ! [IN]
898 
899  restart_fid = -1
900  endif
901 
902  return
903  end subroutine urban_vars_restart_close
904 
905  !-----------------------------------------------------------------------------
907  subroutine urban_vars_restart_def_var
908  use scale_file_cartesc, only: &
910  implicit none
911 
912  integer :: i
913  !---------------------------------------------------------------------------
914 
915  if ( restart_fid /= -1 ) then
916 
917  do i = i_tr, i_sfc_alb_vis_dif
918  if ( i==i_trl .or. i==i_tbl .or. i==i_tgl ) then ! 3D
919  call file_cartesc_def_var( restart_fid, & ! [IN]
920  var_name(i), var_desc(i), var_unit(i), & ! [IN]
921  'UXY', urban_restart_out_dtype, & ! [IN]
922  var_id(i) ) ! [OUT]
923  else
924  call file_cartesc_def_var( restart_fid, & ! [IN]
925  var_name(i), var_desc(i), var_unit(i), & ! [IN]
926  'XY', urban_restart_out_dtype, & ! [IN]
927  var_id(i) ) ! [OUT]
928  end if
929  end do
930 
931  endif
932 
933  return
934  end subroutine urban_vars_restart_def_var
935 
936  !-----------------------------------------------------------------------------
938  subroutine urban_vars_restart_write
939  use scale_file_cartesc, only: &
940  file_cartesc_write_var
941  implicit none
942  !---------------------------------------------------------------------------
943 
944  if ( restart_fid /= -1 ) then
945 
946  call urban_vars_total
947 
948  call file_cartesc_write_var( restart_fid, var_id(i_tr), urban_tr(:,:), & ! [IN]
949  var_name(i_tr), 'XY', fill_halo=.true. ) ! [IN]
950  call file_cartesc_write_var( restart_fid, var_id(i_tb), urban_tb(:,:), & ! [IN]
951  var_name(i_tb), 'XY', fill_halo=.true. ) ! [IN]
952  call file_cartesc_write_var( restart_fid, var_id(i_tg), urban_tg(:,:), & ! [IN]
953  var_name(i_tg), 'XY', fill_halo=.true. ) ! [IN]
954  call file_cartesc_write_var( restart_fid, var_id(i_tc), urban_tc(:,:), & ! [IN]
955  var_name(i_tc), 'XY', fill_halo=.true. ) ! [IN]
956  call file_cartesc_write_var( restart_fid, var_id(i_qc), urban_qc(:,:), & ! [IN]
957  var_name(i_qc), 'XY', fill_halo=.true. ) ! [IN]
958  call file_cartesc_write_var( restart_fid, var_id(i_uc), urban_uc(:,:), & ! [IN]
959  var_name(i_uc), 'XY', fill_halo=.true. ) ! [IN]
960 
961  call file_cartesc_write_var( restart_fid, var_id(i_trl), urban_trl(:,:,:), & ! [IN]
962  var_name(i_trl), 'UXY', fill_halo=.true. ) ! [IN]
963  call file_cartesc_write_var( restart_fid, var_id(i_tbl), urban_tbl(:,:,:), & ! [IN]
964  var_name(i_tbl), 'UXY', fill_halo=.true. ) ! [IN]
965  call file_cartesc_write_var( restart_fid, var_id(i_tgl), urban_tgl(:,:,:), & ! [IN]
966  var_name(i_tgl), 'UXY', fill_halo=.true. ) ! [IN]
967 
968  call file_cartesc_write_var( restart_fid, var_id(i_rainr), urban_rainr(:,:), & ! [IN]
969  var_name(i_rainr), 'XY', fill_halo=.true. ) ! [IN]
970  call file_cartesc_write_var( restart_fid, var_id(i_rainb), urban_rainb(:,:), & ! [IN]
971  var_name(i_rainb), 'XY', fill_halo=.true. ) ! [IN]
972  call file_cartesc_write_var( restart_fid, var_id(i_raing), urban_raing(:,:), & ! [IN]
973  var_name(i_raing), 'XY', fill_halo=.true. ) ! [IN]
974  call file_cartesc_write_var( restart_fid, var_id(i_roff), urban_roff(:,:), & ! [IN]
975  var_name(i_roff), 'XY', fill_halo=.true. ) ! [IN]
976 
977  call file_cartesc_write_var( restart_fid, var_id(i_sfc_temp), & ! [IN]
978  urban_sfc_temp(:,:), & ! [IN]
979  var_name(i_sfc_temp), 'XY', fill_halo=.true. ) ! [IN]
980  call file_cartesc_write_var( restart_fid, var_id(i_sfc_alb_ir_dir), & ! [IN]
981  urban_sfc_albedo(:,:,i_r_direct ,i_r_ir ), & ! [IN]
982  var_name(i_sfc_alb_ir_dir), 'XY', fill_halo=.true. ) ! [IN]
983  call file_cartesc_write_var( restart_fid, var_id(i_sfc_alb_ir_dif), & ! [IN]
984  urban_sfc_albedo(:,:,i_r_diffuse,i_r_ir ), & ! [IN]
985  var_name(i_sfc_alb_ir_dif), 'XY', fill_halo=.true. ) ! [IN]
986  call file_cartesc_write_var( restart_fid, var_id(i_sfc_alb_nir_dir), & ! [IN]
987  urban_sfc_albedo(:,:,i_r_direct ,i_r_nir), & ! [IN]
988  var_name(i_sfc_alb_nir_dir), 'XY', fill_halo=.true. ) ! [IN]
989  call file_cartesc_write_var( restart_fid, var_id(i_sfc_alb_nir_dif), & ! [IN]
990  urban_sfc_albedo(:,:,i_r_diffuse,i_r_nir), & ! [IN]
991  var_name(i_sfc_alb_nir_dif), 'XY', fill_halo=.true. ) ! [IN]
992  call file_cartesc_write_var( restart_fid, var_id(i_sfc_alb_vis_dir), & ! [IN]
993  urban_sfc_albedo(:,:,i_r_direct ,i_r_vis), & ! [IN]
994  var_name(i_sfc_alb_vis_dir), 'XY', fill_halo=.true. ) ! [IN]
995  call file_cartesc_write_var( restart_fid, var_id(i_sfc_alb_vis_dif), & ! [IN]
996  urban_sfc_albedo(:,:,i_r_diffuse,i_r_vis), & ! [IN]
997  var_name(i_sfc_alb_vis_dif), 'XY', fill_halo=.true. ) ! [IN]
998 
999  endif
1000 
1001  return
1002  end subroutine urban_vars_restart_write
1003 
1004 end module mod_urban_vars
real(rp), dimension(:,:), allocatable, public urban_qc_t
module DEBUG
Definition: scale_debug.F90:11
real(rp), dimension(:,:,:), allocatable, public urban_sflx_qtrc
real(rp), dimension(:,:), allocatable, public urban_qc
real(rp), dimension(:,:), allocatable, public urban_rainr_t
module coupler / surface-atmospehre
real(rp), dimension(:,:,:), allocatable, public urban_trl_t
real(rp), dimension(:,:), allocatable, public urban_tg_t
real(rp), dimension(:,:), allocatable, public urban_u10
subroutine, public urban_vars_restart_create
Create urban restart file.
real(rp), dimension(:,:), allocatable, public urban_v10
integer, parameter, public i_r_vis
real(rp), public urban_grid_cartesc_real_totarea
total area
real(rp), dimension(:,:), allocatable, public urban_raing_t
real(rp), dimension(:,:), allocatable, public urban_z0e
real(rp), dimension(:,:), allocatable, public urban_sflx_mu
subroutine, public urban_vars_restart_enddef
Exit netCDF define mode.
real(rp), dimension(:,:), allocatable, public urban_z0m
subroutine, public urban_vars_total
Budget monitor for urban.
subroutine, public urban_vars_restart_read
Read urban restart.
real(rp), dimension(:,:), allocatable, public urban_tb_t
integer, public qa
real(rp), dimension(:,:), allocatable, public urban_t2
subroutine, public urban_vars_history
History output set for urban variables.
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:55
real(rp), dimension(:,:), allocatable, public urban_tb
logical, public urban_restart_out_postfix_timelabel
Add timelabel to the basename of output file?
integer, parameter, public n_rad_dir
integer, parameter, public n_rad_rgn
module URBAN Variables
real(rp), dimension(:,:), allocatable, public urban_raing
logical, public statistics_checktotal
calc&report variable totals to logfile?
module urban / grid / icosahedralA / index
real(rp), dimension(:,:), allocatable, public urban_uc
real(rp), public const_undef
Definition: scale_const.F90:41
real(rp), dimension(:,:,:,:), allocatable, public urban_sfc_albedo
character(len=h_short), public urban_restart_out_dtype
REAL4 or REAL8.
subroutine, public urban_vars_restart_write
Write urban restart.
real(rp), dimension(:,:,:), allocatable, public urban_grid_cartesc_real_vol
volume of grid cell
module file
Definition: scale_file.F90:15
subroutine, public urban_vars_restart_close
Close restart file.
real(rp), dimension(:,:), allocatable, public atmos_pbl
subroutine, public file_cartesc_create(basename, title, datatype, fid, date, subsec, haszcoord, append, aggregate, single)
Create/open a netCDF file.
real(rp), dimension(:,:), allocatable, public urban_sflx_sh
module TRACER
character(len=h_long), public urban_restart_out_basename
Basename of the output file.
real(rp), dimension(:,:), allocatable, public urban_tr
real(rp), dimension(:,:,:), allocatable, public urban_tgl
real(rp), public urban_grid_cartesc_real_totvol
total volume
module atmosphere / hydrometeor
subroutine, public time_gettimelabel(timelabel)
generate time label
Definition: scale_time.F90:94
real(rp), dimension(:,:), allocatable, public atmos_qv
real(rp), dimension(:,:), allocatable, public atmos_sfc_pres
real(rp), dimension(:,:), allocatable, public atmos_cossza
module PROCESS
Definition: scale_prc.F90:11
real(rp), dimension(:,:), allocatable, public urban_uc_t
real(rp), dimension(:,:), allocatable, public urban_z0h
real(rp), dimension(:,:,:), allocatable, public atmos_sflx_sw
real(rp), dimension(:,:), allocatable, public atmos_v
subroutine, public file_cartesc_enddef(fid)
Exit netCDF file define mode.
module TIME
Definition: scale_time.F90:16
real(rp), dimension(:,:), allocatable, public urban_roff
logical, public urban_restart_out_aggregate
Switch to use aggregate file.
real(rp), dimension(:,:), allocatable, public atmos_dens
real(rp), dimension(:,:), allocatable, public urban_grid_cartesc_real_area
area of grid cell
real(rp), dimension(:,:), allocatable, public atmos_sflx_rain
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:338
subroutine, public urban_vars_setup
Setup.
module CONSTANT
Definition: scale_const.F90:11
integer, parameter, public i_r_direct
real(rp), dimension(:,:), allocatable, public urban_sflx_lh
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 urban_tc
real(rp), dimension(:,:), allocatable, public atmos_pres
logical, public urban_restart_output
Output restart file?
logical function, public file_get_aggregate(fid)
real(rp), dimension(:,:), allocatable, public urban_rainr
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
Definition: scale_prof.F90:157
module profiler
Definition: scale_prof.F90:11
subroutine, public urban_vars_restart_open
Open urban restart file for read.
integer, parameter, public i_r_nir
logical, public urban_restart_in_postfix_timelabel
Add timelabel to the basename of input file?
logical, public urban_restart_in_aggregate
Switch to use aggregate file.
real(rp), dimension(:,:), allocatable, public atmos_temp
module PRECISION
module file / cartesianC
real(rp), dimension(:,:), allocatable, public urban_q2
module urban / grid / cartesianC / real
real(rp), dimension(:,:), allocatable, public urban_tg
real(rp), dimension(:,:), allocatable, public atmos_u
subroutine, public urban_vars_restart_def_var
Define urban variables in restart file.
real(rp), dimension(:,:), allocatable, public urban_sfc_temp
module Statistics
real(rp), dimension(:,:,:), allocatable, public urban_trl
integer, parameter, public i_r_ir
real(rp), dimension(:,:), allocatable, public urban_rainb_t
module STDIO
Definition: scale_io.F90:10
integer, parameter, public i_r_diffuse
subroutine, public file_cartesc_flush(fid)
Flush all pending requests to a netCDF file (PnetCDF only)
real(rp), dimension(:,:,:), allocatable, public atmos_sflx_lw
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
Definition: scale_prof.F90:210
real(rp), dimension(:,:), allocatable, public atmos_sflx_snow
module Urban admin
real(rp), dimension(:,:,:), allocatable, public urban_tbl
logical, public urban_do
subroutine, public file_cartesc_open(basename, fid, aggregate)
open a netCDF file for read
real(rp), dimension(:,:), allocatable, public urban_tr_t
real(rp), dimension(:,:,:), allocatable, public urban_tgl_t
real(rp), dimension(:,:), allocatable, public urban_sflx_gh
real(rp), dimension(:,:), allocatable, public urban_sflx_mv
real(rp), dimension(:,:), allocatable, public atmos_w
subroutine, public file_cartesc_close(fid)
Close a netCDF file.
real(rp), dimension(:,:), allocatable, public urban_rainb
real(rp), dimension(:,:), allocatable, public urban_tc_t
character(len=h_long), public urban_restart_in_basename
Basename of the input file.
real(rp), dimension(:,:), allocatable, public urban_roff_t
real(rp), dimension(:,:,:), allocatable, public urban_tbl_t
module file_history
real(rp), dimension(:,:), allocatable, public urban_sflx_mw
real(rp), dimension(:,:), allocatable, public atmos_sfc_dens
character(len=h_mid), public urban_restart_out_title
Title of the output file.