SCALE-RM
mod_urban_vars.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
10 !-------------------------------------------------------------------------------
12  !-----------------------------------------------------------------------------
13  !
14  !++ used modules
15  !
16  use scale_precision
17  use scale_stdio
18  use scale_prof
19  use scale_debug
22 
23  use scale_const, only: &
24  i_sw => const_i_sw, &
25  i_lw => const_i_lw
26  !-----------------------------------------------------------------------------
27  implicit none
28  private
29  !-----------------------------------------------------------------------------
30  !
31  !++ Public procedure
32  !
33  public :: urban_vars_setup
34  public :: urban_vars_restart_read
35  public :: urban_vars_restart_write
36  public :: urban_vars_history
37  public :: urban_vars_total
38  public :: urban_vars_external_in
39 
44  public :: urban_vars_restart_close
45 
46  !-----------------------------------------------------------------------------
47  !
48  !++ Public parameters & variables
49  !
50  logical, public :: urban_restart_output = .false.
51 
52  character(len=H_LONG), public :: urban_restart_in_basename = ''
53  character(len=H_LONG), public :: urban_restart_out_basename = ''
54  character(len=H_MID), public :: urban_restart_out_title = 'URBAN restart'
55  character(len=H_MID), public :: urban_restart_out_dtype = 'DEFAULT'
56 
57  ! prognostic variables
58  real(RP), public, allocatable :: urban_tr (:,:) ! urban surface temperature of roof [K]
59  real(RP), public, allocatable :: urban_tb (:,:) ! urban surface temperature of wall [K]
60  real(RP), public, allocatable :: urban_tg (:,:) ! urban surface temperature of road [K]
61  real(RP), public, allocatable :: urban_tc (:,:) ! urban canopy air temperature [K]
62  real(RP), public, allocatable :: urban_qc (:,:) ! urban canopy humidity [kg/kg]
63  real(RP), public, allocatable :: urban_uc (:,:) ! urban canopy wind [m/s]
64  real(RP), public, allocatable :: urban_trl (:,:,:) ! urban temperature in layer of roof [K]
65  real(RP), public, allocatable :: urban_tbl (:,:,:) ! urban temperature in layer of wall [K]
66  real(RP), public, allocatable :: urban_tgl (:,:,:) ! urban temperature in layer of road [K]
67  real(RP), public, allocatable :: urban_rainr(:,:) ! urban rain storage on roof [mm=kg/m2]
68  real(RP), public, allocatable :: urban_rainb(:,:) ! urban rain storage on wall [mm=kg/m2]
69  real(RP), public, allocatable :: urban_raing(:,:) ! urban rain storage on road [mm=kg/m2]
70  real(RP), public, allocatable :: urban_roff (:,:) ! urban runoff [mm=kg/m2]
71 
72  ! tendency variables
73  real(RP), public, allocatable :: urban_trl_t (:,:,:) ! tendency of URBAN_TRL
74  real(RP), public, allocatable :: urban_tbl_t (:,:,:) ! tendency of URBAN_TBL
75  real(RP), public, allocatable :: urban_tgl_t (:,:,:) ! tendency of URBAN_TGL
76  real(RP), public, allocatable :: urban_tc_t (:,:) ! tendency of URBAN_TC
77  real(RP), public, allocatable :: urban_uc_t (:,:) ! tendency of URBAN_UC
78  real(RP), public, allocatable :: urban_qc_t (:,:) ! tendency of URBAN_QC
79  real(RP), public, allocatable :: urban_tr_t (:,:) ! tendency of URBAN_TR
80  real(RP), public, allocatable :: urban_tb_t (:,:) ! tendency of URBAN_TB
81  real(RP), public, allocatable :: urban_tg_t (:,:) ! tendency of URBAN_TG
82  real(RP), public, allocatable :: urban_rainr_t(:,:) ! tendency of URBAN_RAINR
83  real(RP), public, allocatable :: urban_rainb_t(:,:) ! tendency of URBAN_RAINB
84  real(RP), public, allocatable :: urban_raing_t(:,:) ! tendency of URBAN_RAING
85  real(RP), public, allocatable :: urban_roff_t (:,:) ! tendency of URBAN_ROFF
86 
87  ! for restart
88  real(RP), public, allocatable :: urban_sfc_temp (:,:) ! urban grid average of surface temperature [K]
89  real(RP), public, allocatable :: urban_sfc_albedo(:,:,:) ! urban grid average of albedo [0-1]
90  real(RP), public, allocatable :: urban_sflx_mw (:,:) ! urban grid average of w-momentum flux [kg/m2/s]
91  real(RP), public, allocatable :: urban_sflx_mu (:,:) ! urban grid average of u-momentum flux [kg/m2/s]
92  real(RP), public, allocatable :: urban_sflx_mv (:,:) ! urban grid average of v-momentum flux [kg/m2/s]
93  real(RP), public, allocatable :: urban_sflx_sh (:,:) ! urban grid average of sensible heat flux [W/m2]
94  real(RP), public, allocatable :: urban_sflx_lh (:,:) ! urban grid average of latent heat flux [W/m2]
95  real(RP), public, allocatable :: urban_sflx_gh (:,:) ! urban grid average of ground heat flux [W/m2]
96  real(RP), public, allocatable :: urban_sflx_evap (:,:) ! urban grid average of water vapor flux [kg/m2/s]
97 
98  ! diagnostic variables
99  real(RP), public, allocatable :: urban_z0m(:,:) ! urban grid average of rougness length (momentum) [m]
100  real(RP), public, allocatable :: urban_z0h(:,:) ! urban grid average of rougness length (heat) [m]
101  real(RP), public, allocatable :: urban_z0e(:,:) ! urban grid average of rougness length (vapor) [m]
102  real(RP), public, allocatable :: urban_u10(:,:) ! urban grid average of velocity u at 10m [m/s]
103  real(RP), public, allocatable :: urban_v10(:,:) ! urban grid average of velocity v at 10m [m/s]
104  real(RP), public, allocatable :: urban_t2 (:,:) ! urban grid average of temperature at 2m [K]
105  real(RP), public, allocatable :: urban_q2 (:,:) ! urban grid average of water vapor at 2m [kg/kg]
106 
107  ! recieved atmospheric variables
108  real(RP), public, allocatable :: atmos_temp (:,:)
109  real(RP), public, allocatable :: atmos_pres (:,:)
110  real(RP), public, allocatable :: atmos_w (:,:)
111  real(RP), public, allocatable :: atmos_u (:,:)
112  real(RP), public, allocatable :: atmos_v (:,:)
113  real(RP), public, allocatable :: atmos_dens (:,:)
114  real(RP), public, allocatable :: atmos_qv (:,:)
115  real(RP), public, allocatable :: atmos_pbl (:,:)
116  real(RP), public, allocatable :: atmos_sfc_pres (:,:)
117  real(RP), public, allocatable :: atmos_sflx_lw (:,:,:)
118  real(RP), public, allocatable :: atmos_sflx_sw (:,:,:)
119  real(RP), public, allocatable :: atmos_cossza (:,:)
120  real(RP), public, allocatable :: atmos_sflx_prec(:,:)
121 
122  !-----------------------------------------------------------------------------
123  !
124  !++ Private procedure
125  !
126  !-----------------------------------------------------------------------------
127  !
128  !++ Private parameters & variables
129  !
130  logical, private :: urban_vars_checkrange = .false.
131 
132  integer, private, parameter :: vmax = 23
133  integer, private, parameter :: i_tr = 1
134  integer, private, parameter :: i_tb = 2
135  integer, private, parameter :: i_tg = 3
136  integer, private, parameter :: i_tc = 4
137  integer, private, parameter :: i_qc = 5
138  integer, private, parameter :: i_uc = 6
139  integer, private, parameter :: i_trl = 7
140  integer, private, parameter :: i_tbl = 8
141  integer, private, parameter :: i_tgl = 9
142  integer, private, parameter :: i_rainr = 10
143  integer, private, parameter :: i_rainb = 11
144  integer, private, parameter :: i_raing = 12
145  integer, private, parameter :: i_roff = 13
146  integer, private, parameter :: i_sfc_temp = 14
147  integer, private, parameter :: i_alb_lw = 15
148  integer, private, parameter :: i_alb_sw = 16
149  integer, private, parameter :: i_sflx_mw = 17
150  integer, private, parameter :: i_sflx_mu = 18
151  integer, private, parameter :: i_sflx_mv = 19
152  integer, private, parameter :: i_sflx_sh = 20
153  integer, private, parameter :: i_sflx_lh = 21
154  integer, private, parameter :: i_sflx_gh = 22
155  integer, private, parameter :: i_sflx_evap = 23
156 
157  character(len=H_SHORT), private :: var_name(vmax)
158  character(len=H_MID), private :: var_desc(vmax)
159  character(len=H_SHORT), private :: var_unit(vmax)
160  integer, private :: var_id(vmax)
161  integer, private :: restart_fid = -1 ! file ID
162 
163  data var_name / 'URBAN_TR' , &
164  'URBAN_TB' , &
165  'URBAN_TG' , &
166  'URBAN_TC' , &
167  'URBAN_QC' , &
168  'URBAN_UC' , &
169  'URBAN_TRL' , &
170  'URBAN_TBL' , &
171  'URBAN_TGL' , &
172  'URBAN_RAINR' , &
173  'URBAN_RAINB' , &
174  'URBAN_RAING' , &
175  'URBAN_ROFF', &
176  'URBAN_SFC_TEMP', &
177  'URBAN_ALB_LW', &
178  'URBAN_ALB_SW', &
179  'URBAN_SFLX_MW', &
180  'URBAN_SFLX_MU', &
181  'URBAN_SFLX_MV', &
182  'URBAN_SFLX_SH', &
183  'URBAN_SFLX_LH', &
184  'URBAN_SFLX_GH', &
185  'URBAN_SFLX_evap' /
186 
187  data var_desc / 'urban surface temperature of roof', &
188  'urban surface temperature of wall', &
189  'urban surface temperature of road', &
190  'urban canopy air temperature', &
191  'urban canopy humidity', &
192  'urban canopy wind', &
193  'urban temperature in layer of roof', &
194  'urban temperature in layer of wall', &
195  'urban temperature in layer of road', &
196  'urban rain strage on roof', &
197  'urban rain strage on wall', &
198  'urban rain strage on road', &
199  'urban runoff ', &
200  'urban grid average of temperature', &
201  'urban grid average of albedo LW', &
202  'urban grid average of albedo SW', &
203  'urban grid average of w-momentum flux', &
204  'urban grid average of u-momentum flux', &
205  'urban grid average of v-momentum flux', &
206  'urban grid average of sensible heat flux', &
207  'urban grid average of latent heat flux', &
208  'urban grid average of ground heat flux', &
209  'urban grid average of water vapor flux' /
210 
211  data var_unit / 'K', &
212  'K', &
213  'K', &
214  'K', &
215  'kg/kg', &
216  'm/s', &
217  'K', &
218  'K', &
219  'K', &
220  'kg/m2', &
221  'kg/m2', &
222  'kg/m2', &
223  'kg/m2', &
224  'K', &
225  '0-1', &
226  '0-1', &
227  'kg/m2/s', &
228  'kg/m2/s', &
229  'kg/m2/s', &
230  'W/m2', &
231  'W/m2', &
232  'W/m2', &
233  'kg/m2/s' /
234 
235  !-----------------------------------------------------------------------------
236 contains
237  !-----------------------------------------------------------------------------
239  subroutine urban_vars_setup
240  use scale_process, only: &
242  use scale_const, only: &
243  undef => const_undef
244  implicit none
245 
246  namelist / param_urban_vars / &
252  urban_vars_checkrange
253 
254  integer :: ierr
255  integer :: iv
256  !---------------------------------------------------------------------------
257 
258  if( io_l ) write(io_fid_log,*)
259  if( io_l ) write(io_fid_log,*) '++++++ Module[VARS] / Categ[URBAN] / Origin[SCALE-RM]'
260 
261  allocate( urban_tr(ia,ja) )
262  allocate( urban_tb(ia,ja) )
263  allocate( urban_tg(ia,ja) )
264  allocate( urban_tc(ia,ja) )
265  allocate( urban_qc(ia,ja) )
266  allocate( urban_uc(ia,ja) )
267  allocate( urban_trl(uks:uke,ia,ja) )
268  allocate( urban_tbl(uks:uke,ia,ja) )
269  allocate( urban_tgl(uks:uke,ia,ja) )
270  allocate( urban_rainr(ia,ja) )
271  allocate( urban_rainb(ia,ja) )
272  allocate( urban_raing(ia,ja) )
273  allocate( urban_roff(ia,ja) )
274  urban_tr(:,:) = undef
275  urban_tb(:,:) = undef
276  urban_tg(:,:) = undef
277  urban_tc(:,:) = undef
278  urban_qc(:,:) = undef
279  urban_uc(:,:) = undef
280  urban_trl(:,:,:) = undef
281  urban_tbl(:,:,:) = undef
282  urban_tgl(:,:,:) = undef
283  urban_rainr(:,:) = undef
284  urban_rainb(:,:) = undef
285  urban_raing(:,:) = undef
286  urban_roff(:,:) = undef
287 
288  allocate( urban_tr_t(ia,ja) )
289  allocate( urban_tb_t(ia,ja) )
290  allocate( urban_tg_t(ia,ja) )
291  allocate( urban_tc_t(ia,ja) )
292  allocate( urban_qc_t(ia,ja) )
293  allocate( urban_uc_t(ia,ja) )
294  allocate( urban_trl_t(uks:uke,ia,ja) )
295  allocate( urban_tbl_t(uks:uke,ia,ja) )
296  allocate( urban_tgl_t(uks:uke,ia,ja) )
297  allocate( urban_rainr_t(ia,ja) )
298  allocate( urban_rainb_t(ia,ja) )
299  allocate( urban_raing_t(ia,ja) )
300  allocate( urban_roff_t(ia,ja) )
301  urban_tr_t(:,:) = undef
302  urban_tb_t(:,:) = undef
303  urban_tg_t(:,:) = undef
304  urban_tc_t(:,:) = undef
305  urban_qc_t(:,:) = undef
306  urban_uc_t(:,:) = undef
307  urban_trl_t(:,:,:) = undef
308  urban_tbl_t(:,:,:) = undef
309  urban_tgl_t(:,:,:) = undef
310  urban_rainr_t(:,:) = undef
311  urban_rainb_t(:,:) = undef
312  urban_raing_t(:,:) = undef
313  urban_roff_t(:,:) = undef
314 
315  allocate( urban_sfc_temp(ia,ja) )
316  allocate( urban_sfc_albedo(ia,ja,2) )
317  allocate( urban_sflx_mw(ia,ja) )
318  allocate( urban_sflx_mu(ia,ja) )
319  allocate( urban_sflx_mv(ia,ja) )
320  allocate( urban_sflx_sh(ia,ja) )
321  allocate( urban_sflx_lh(ia,ja) )
322  allocate( urban_sflx_gh(ia,ja) )
323  allocate( urban_sflx_evap(ia,ja) )
324  urban_sfc_temp(:,:) = undef
325  urban_sfc_albedo(:,:,:) = undef
326  urban_sflx_mw(:,:) = undef
327  urban_sflx_mu(:,:) = undef
328  urban_sflx_mv(:,:) = undef
329  urban_sflx_sh(:,:) = undef
330  urban_sflx_lh(:,:) = undef
331  urban_sflx_gh(:,:) = undef
332  urban_sflx_evap(:,:) = undef
333 
334  allocate( urban_z0m(ia,ja) )
335  allocate( urban_z0h(ia,ja) )
336  allocate( urban_z0e(ia,ja) )
337  allocate( urban_u10(ia,ja) )
338  allocate( urban_v10(ia,ja) )
339  allocate( urban_t2(ia,ja) )
340  allocate( urban_q2(ia,ja) )
341  urban_z0m(:,:) = undef
342  urban_z0h(:,:) = undef
343  urban_z0e(:,:) = undef
344  urban_u10(:,:) = undef
345  urban_v10(:,:) = undef
346  urban_t2(:,:) = undef
347  urban_q2(:,:) = undef
348 
349  allocate( atmos_temp(ia,ja) )
350  allocate( atmos_pres(ia,ja) )
351  allocate( atmos_w(ia,ja) )
352  allocate( atmos_u(ia,ja) )
353  allocate( atmos_v(ia,ja) )
354  allocate( atmos_dens(ia,ja) )
355  allocate( atmos_qv(ia,ja) )
356  allocate( atmos_pbl(ia,ja) )
357  allocate( atmos_sfc_pres(ia,ja) )
358  allocate( atmos_sflx_lw(ia,ja,2) )
359  allocate( atmos_sflx_sw(ia,ja,2) )
360  allocate( atmos_cossza(ia,ja) )
361  allocate( atmos_sflx_prec(ia,ja) )
362  atmos_temp(:,:) = undef
363  atmos_pres(:,:) = undef
364  atmos_w(:,:) = undef
365  atmos_u(:,:) = undef
366  atmos_v(:,:) = undef
367  atmos_dens(:,:) = undef
368  atmos_qv(:,:) = undef
369  atmos_pbl(:,:) = undef
370  atmos_sfc_pres(:,:) = undef
371  atmos_sflx_lw(:,:,:) = undef
372  atmos_sflx_sw(:,:,:) = undef
373  atmos_cossza(:,:) = undef
374  atmos_sflx_prec(:,:) = undef
375 
376  !--- read namelist
377  rewind(io_fid_conf)
378  read(io_fid_conf,nml=param_urban_vars,iostat=ierr)
379  if( ierr < 0 ) then !--- missing
380  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
381  elseif( ierr > 0 ) then !--- fatal error
382  write(*,*) 'xxx Not appropriate names in namelist PARAM_URBAN_VARS. Check!'
383  call prc_mpistop
384  endif
385  if( io_lnml ) write(io_fid_log,nml=param_urban_vars)
386 
387  if( io_l ) write(io_fid_log,*)
388  if( io_l ) write(io_fid_log,*) '*** List of prognostic variables (URBAN) ***'
389  if( io_l ) write(io_fid_log,'(1x,A,A15,A,A32,3(A))') &
390  '*** |','VARNAME ','|', 'DESCRIPTION ','[', 'UNIT ',']'
391  do iv = 1, vmax
392  if( io_l ) write(io_fid_log,'(1x,A,i3,A,A15,A,A32,3(A))') &
393  '*** NO.',iv,'|',var_name(iv),'|',var_desc(iv),'[',var_unit(iv),']'
394  enddo
395 
396  if( io_l ) write(io_fid_log,*)
397  if ( urban_restart_in_basename /= '' ) then
398  if( io_l ) write(io_fid_log,*) '*** Restart input? : ', trim(urban_restart_in_basename)
399  else
400  if( io_l ) write(io_fid_log,*) '*** Restart input? : NO'
401  endif
402  if ( urban_restart_output &
403  .AND. urban_restart_out_basename /= '' ) then
404  if( io_l ) write(io_fid_log,*) '*** Restart output? : ', trim(urban_restart_out_basename)
405  else
406  if( io_l ) write(io_fid_log,*) '*** Restart output? : NO'
407  urban_restart_output = .false.
408  endif
409 
410  return
411  end subroutine urban_vars_setup
412 
413  !-----------------------------------------------------------------------------
415  subroutine urban_vars_restart_read
416  use scale_fileio, only: &
417  fileio_read
418  use mod_urban_admin, only: &
419  urban_sw
420  implicit none
421  !---------------------------------------------------------------------------
422 
423  if( io_l ) write(io_fid_log,*)
424  if( io_l ) write(io_fid_log,*) '*** Input restart file (URBAN) ***'
425 
426  if ( urban_sw .and. urban_restart_in_basename /= '' ) then
427  if( io_l ) write(io_fid_log,*) '*** basename: ', trim(urban_restart_in_basename)
428 
429  call fileio_read( urban_tr(:,:), & ! [OUT]
430  urban_restart_in_basename, var_name(i_tr), 'XY', step=1 ) ! [IN]
431  call fileio_read( urban_tb(:,:), & ! [OUT]
432  urban_restart_in_basename, var_name(i_tb), 'XY', step=1 ) ! [IN]
433  call fileio_read( urban_tg(:,:), & ! [OUT]
434  urban_restart_in_basename, var_name(i_tg), 'XY', step=1 ) ! [IN]
435  call fileio_read( urban_tc(:,:), & ! [OUT]
436  urban_restart_in_basename, var_name(i_tc), 'XY', step=1 ) ! [IN]
437  call fileio_read( urban_qc(:,:), & ! [OUT]
438  urban_restart_in_basename, var_name(i_qc), 'XY', step=1 ) ! [IN]
439  call fileio_read( urban_uc(:,:), & ! [OUT]
440  urban_restart_in_basename, var_name(i_uc), 'XY', step=1 ) ! [IN]
441 
442  call fileio_read( urban_trl(:,:,:), & ! [OUT]
443  urban_restart_in_basename, var_name(i_trl), 'Urban', step=1 ) ! [IN]
444  call fileio_read( urban_tbl(:,:,:), & ! [OUT]
445  urban_restart_in_basename, var_name(i_tbl), 'Urban', step=1 ) ! [IN]
446  call fileio_read( urban_tgl(:,:,:), & ! [OUT]
447  urban_restart_in_basename, var_name(i_tgl), 'Urban', step=1 ) ! [IN]
448 
449  call fileio_read( urban_rainr(:,:), & ! [OUT]
450  urban_restart_in_basename, var_name(i_rainr), 'XY', step=1 ) ! [IN]
451  call fileio_read( urban_rainb(:,:), & ! [OUT]
452  urban_restart_in_basename, var_name(i_rainb), 'XY', step=1 ) ! [IN]
453  call fileio_read( urban_raing(:,:), & ! [OUT]
454  urban_restart_in_basename, var_name(i_raing), 'XY', step=1 ) ! [IN]
455  call fileio_read( urban_roff(:,:), & ! [OUT]
456  urban_restart_in_basename, var_name(i_roff), 'XY', step=1 ) ! [IN]
457 
458  call fileio_read( urban_sfc_temp(:,:), & ! [OUT]
459  urban_restart_in_basename, var_name(i_sfc_temp), 'XY', step=1 ) ! [IN]
460  call fileio_read( urban_sfc_albedo(:,:,i_lw), & ! [OUT]
461  urban_restart_in_basename, var_name(i_alb_lw), 'XY', step=1 ) ! [IN]
462  call fileio_read( urban_sfc_albedo(:,:,i_sw), & ! [OUT]
463  urban_restart_in_basename, var_name(i_alb_sw), 'XY', step=1 ) ! [IN]
464 
465  call fileio_read( urban_sflx_mw(:,:), & ! [OUT]
466  urban_restart_in_basename, var_name(i_sflx_mw), 'XY', step=1 ) ! [IN]
467  call fileio_read( urban_sflx_mu(:,:), & ! [OUT]
468  urban_restart_in_basename, var_name(i_sflx_mu), 'XY', step=1 ) ! [IN]
469  call fileio_read( urban_sflx_mv(:,:), & ! [OUT]
470  urban_restart_in_basename, var_name(i_sflx_mv), 'XY', step=1 ) ! [IN]
471  call fileio_read( urban_sflx_sh(:,:), & ! [OUT]
472  urban_restart_in_basename, var_name(i_sflx_sh), 'XY', step=1 ) ! [IN]
473  call fileio_read( urban_sflx_lh(:,:), & ! [OUT]
474  urban_restart_in_basename, var_name(i_sflx_lh), 'XY', step=1 ) ! [IN]
475  call fileio_read( urban_sflx_gh(:,:), & ! [OUT]
476  urban_restart_in_basename, var_name(i_sflx_gh), 'XY', step=1 ) ! [IN]
477  call fileio_read( urban_sflx_evap(:,:), & ! [OUT]
478  urban_restart_in_basename, var_name(i_sflx_evap), 'XY', step=1 ) ! [IN]
479 
480  call urban_vars_total
481 
482  else
483  if( io_l ) write(io_fid_log,*) '*** restart file for urban is not specified.'
484  endif
485 
486  return
487  end subroutine urban_vars_restart_read
488 
489  !-----------------------------------------------------------------------------
491  subroutine urban_vars_restart_write
492  use scale_time, only: &
494  use scale_fileio, only: &
495  fileio_write
496  use mod_urban_admin, only: &
497  urban_sw
498  implicit none
499 
500  character(len=20) :: timelabel
501  character(len=H_LONG) :: basename
502  !---------------------------------------------------------------------------
503 
504  if ( urban_sw .and. urban_restart_out_basename /= '' ) then
505 
506  call time_gettimelabel( timelabel )
507  write(basename,'(A,A,A)') trim(urban_restart_out_basename), '_', trim(timelabel)
508 
509  if( io_l ) write(io_fid_log,*)
510  if( io_l ) write(io_fid_log,*) '*** Output restart file (URBAN) ***'
511  if( io_l ) write(io_fid_log,*) '*** filename: ', trim(basename)
512 
513  call urban_vars_total
514 
515  call fileio_write( urban_tr(:,:), basename, urban_restart_out_title, & ! [IN]
516  var_name(i_tr), var_desc(i_tr), var_unit(i_tr), & ! [IN]
517  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
518  call fileio_write( urban_tb(:,:), basename, urban_restart_out_title, & ! [IN]
519  var_name(i_tb), var_desc(i_tb), var_unit(i_tb), & ! [IN]
520  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
521  call fileio_write( urban_tg(:,:), basename, urban_restart_out_title, & ! [IN]
522  var_name(i_tg), var_desc(i_tg), var_unit(i_tg), & ! [IN]
523  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
524  call fileio_write( urban_tc(:,:), basename, urban_restart_out_title, & ! [IN]
525  var_name(i_tc), var_desc(i_tc), var_unit(i_tc), & ! [IN]
526  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
527  call fileio_write( urban_qc(:,:), basename, urban_restart_out_title, & ! [IN]
528  var_name(i_qc), var_desc(i_qc), var_unit(i_qc), & ! [IN]
529  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
530  call fileio_write( urban_uc(:,:), basename, urban_restart_out_title, & ! [IN]
531  var_name(i_uc), var_desc(i_uc), var_unit(i_uc), & ! [IN]
532  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
533 
534  call fileio_write( urban_trl(:,:,:), basename, urban_restart_out_title, & ! [IN]
535  var_name(i_trl), var_desc(i_trl), var_unit(i_trl), & ! [IN]
536  'Urban', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
537  call fileio_write( urban_tbl(:,:,:), basename, urban_restart_out_title, & ! [IN]
538  var_name(i_tbl), var_desc(i_tbl), var_unit(i_tbl), & ! [IN]
539  'Urban', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
540  call fileio_write( urban_tgl(:,:,:), basename, urban_restart_out_title, & ! [IN]
541  var_name(i_tgl), var_desc(i_tgl), var_unit(i_tgl), & ! [IN]
542  'Urban', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
543 
544  call fileio_write( urban_rainr(:,:), basename, urban_restart_out_title, & ! [IN]
545  var_name(i_rainr), var_desc(i_rainr), var_unit(i_rainr), & ! [IN]
546  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
547  call fileio_write( urban_rainb(:,:), basename, urban_restart_out_title, & ! [IN]
548  var_name(i_rainb), var_desc(i_rainb), var_unit(i_rainb), & ! [IN]
549  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
550  call fileio_write( urban_raing(:,:), basename, urban_restart_out_title, & ! [IN]
551  var_name(i_raing), var_desc(i_raing), var_unit(i_raing), & ! [IN]
552  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
553  call fileio_write( urban_roff(:,:), basename, urban_restart_out_title, & ! [IN]
554  var_name(i_roff), var_desc(i_roff), var_unit(i_roff), & ! [IN]
555  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
556 
557  call fileio_write( urban_sfc_temp(:,:), basename, urban_restart_out_title, & ! [IN]
558  var_name(i_sfc_temp), var_desc(i_sfc_temp), var_unit(i_sfc_temp), & ! [IN]
559  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
560  call fileio_write( urban_sfc_albedo(:,:,i_lw), basename, urban_restart_out_title, & ! [IN]
561  var_name(i_alb_lw), var_desc(i_alb_lw), var_unit(i_alb_lw), & ! [IN]
562  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
563  call fileio_write( urban_sfc_albedo(:,:,i_sw), basename, urban_restart_out_title, & ! [IN]
564  var_name(i_alb_sw), var_desc(i_alb_sw), var_unit(i_alb_sw), & ! [IN]
565  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
566 
567  call fileio_write( urban_sflx_mw(:,:), basename, urban_restart_out_title, & ! [IN]
568  var_name(i_sflx_mw), var_desc(i_sflx_mw), var_unit(i_sflx_mw), & ! [IN]
569  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
570  call fileio_write( urban_sflx_mu(:,:), basename, urban_restart_out_title, & ! [IN]
571  var_name(i_sflx_mu), var_desc(i_sflx_mu), var_unit(i_sflx_mu), & ! [IN]
572  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
573  call fileio_write( urban_sflx_mv(:,:), basename, urban_restart_out_title, & ! [IN]
574  var_name(i_sflx_mv), var_desc(i_sflx_mv), var_unit(i_sflx_mv), & ! [IN]
575  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
576  call fileio_write( urban_sflx_sh(:,:), basename, urban_restart_out_title, & ! [IN]
577  var_name(i_sflx_sh), var_desc(i_sflx_sh), var_unit(i_sflx_sh), & ! [IN]
578  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
579  call fileio_write( urban_sflx_lh(:,:), basename, urban_restart_out_title, & ! [IN]
580  var_name(i_sflx_lh), var_desc(i_sflx_lh), var_unit(i_sflx_lh), & ! [IN]
581  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
582  call fileio_write( urban_sflx_gh(:,:), basename, urban_restart_out_title, & ! [IN]
583  var_name(i_sflx_gh), var_desc(i_sflx_gh), var_unit(i_sflx_gh), & ! [IN]
584  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
585  call fileio_write( urban_sflx_evap(:,:), basename, urban_restart_out_title, & ! [IN]
586  var_name(i_sflx_evap), var_desc(i_sflx_evap), var_unit(i_sflx_evap), & ! [IN]
587  'XY', urban_restart_out_dtype, nohalo=.true. ) ! [IN]
588 
589  endif
590 
591  return
592  end subroutine urban_vars_restart_write
593 
594  !-----------------------------------------------------------------------------
596  subroutine urban_vars_history
597  use scale_history, only: &
598  hist_in
599  implicit none
600  !---------------------------------------------------------------------------
601 
602  if ( urban_vars_checkrange ) then
603  call valcheck( urban_tr(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_tr), &
604  __file__, __line__ )
605  call valcheck( urban_tb(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_tb), &
606  __file__, __line__ )
607  call valcheck( urban_tg(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_tg), &
608  __file__, __line__ )
609  call valcheck( urban_tc(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_tc), &
610  __file__, __line__ )
611  call valcheck( urban_qc(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_qc), &
612  __file__, __line__ )
613  call valcheck( urban_uc(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_uc), &
614  __file__, __line__ )
615  call valcheck( urban_trl(:,is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_trl), &
616  __file__, __line__ )
617  call valcheck( urban_tbl(:,is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_tbl), &
618  __file__, __line__ )
619  call valcheck( urban_tgl(:,is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_tgl), &
620  __file__, __line__ )
621  call valcheck( urban_rainr(is:ie,js:je), -1000.0_rp, 1000.0_rp, var_name(i_rainr), &
622  __file__, __line__ )
623  call valcheck( urban_rainb(is:ie,js:je), -1000.0_rp, 1000.0_rp, var_name(i_rainb), &
624  __file__, __line__ )
625  call valcheck( urban_raing(is:ie,js:je), -1000.0_rp, 1000.0_rp, var_name(i_raing), &
626  __file__, __line__ )
627  call valcheck( urban_roff(is:ie,js:je), -1000.0_rp, 1000.0_rp, var_name(i_roff), &
628  __file__, __line__ )
629  call valcheck( urban_sfc_temp(is:ie,js:je), 0.0_rp, 1000.0_rp, var_name(i_sfc_temp), &
630  __file__, __line__ )
631  call valcheck( urban_sfc_albedo(is:ie,js:je,i_lw), 0.0_rp, 2.0_rp, var_name(i_alb_lw), &
632  __file__, __line__ )
633  call valcheck( urban_sfc_albedo(is:ie,js:je,i_sw), 0.0_rp, 2.0_rp, var_name(i_alb_sw), &
634  __file__, __line__ )
635  endif
636 
637  call hist_in( urban_tr(:,:), var_name(i_tr), var_desc(i_tr), var_unit(i_tr) )
638  call hist_in( urban_tb(:,:), var_name(i_tb), var_desc(i_tb), var_unit(i_tb) )
639  call hist_in( urban_tg(:,:), var_name(i_tg), var_desc(i_tg), var_unit(i_tg) )
640  call hist_in( urban_tc(:,:), var_name(i_tc), var_desc(i_tc), var_unit(i_tc) )
641  call hist_in( urban_qc(:,:), var_name(i_qc), var_desc(i_qc), var_unit(i_qc) )
642  call hist_in( urban_uc(:,:), var_name(i_uc), var_desc(i_uc), var_unit(i_uc) )
643 
644  call hist_in( urban_trl(:,:,:), var_name(i_trl), var_desc(i_trl), var_unit(i_trl), zdim='urban' )
645  call hist_in( urban_tbl(:,:,:), var_name(i_tbl), var_desc(i_tbl), var_unit(i_tbl), zdim='urban' )
646  call hist_in( urban_tgl(:,:,:), var_name(i_tgl), var_desc(i_tgl), var_unit(i_tgl), zdim='urban' )
647 
648  call hist_in( urban_rainr(:,:), var_name(i_rainr), var_desc(i_rainr), var_unit(i_rainr) )
649  call hist_in( urban_rainb(:,:), var_name(i_rainb), var_desc(i_rainb), var_unit(i_rainb) )
650  call hist_in( urban_raing(:,:), var_name(i_raing), var_desc(i_raing), var_unit(i_raing) )
651  call hist_in( urban_roff(:,:), var_name(i_roff), var_desc(i_roff), var_unit(i_roff) )
652 
653  call hist_in( urban_sfc_temp(:,:), var_name(i_sfc_temp), var_desc(i_sfc_temp), var_unit(i_sfc_temp) )
654  call hist_in( urban_sfc_albedo(:,:,i_lw), var_name(i_alb_lw), var_desc(i_alb_lw), var_unit(i_alb_lw) )
655  call hist_in( urban_sfc_albedo(:,:,i_sw), var_name(i_alb_sw), var_desc(i_alb_sw), var_unit(i_alb_sw) )
656 
657  call hist_in( urban_sflx_mw(:,:), var_name(i_sflx_mw), var_desc(i_sflx_mw), var_unit(i_sflx_mw) )
658  call hist_in( urban_sflx_mu(:,:), var_name(i_sflx_mu), var_desc(i_sflx_mu), var_unit(i_sflx_mu) )
659  call hist_in( urban_sflx_mv(:,:), var_name(i_sflx_mv), var_desc(i_sflx_mv), var_unit(i_sflx_mv) )
660  call hist_in( urban_sflx_sh(:,:), var_name(i_sflx_sh), var_desc(i_sflx_sh), var_unit(i_sflx_sh) )
661  call hist_in( urban_sflx_lh(:,:), var_name(i_sflx_lh), var_desc(i_sflx_lh), var_unit(i_sflx_lh) )
662  call hist_in( urban_sflx_gh(:,:), var_name(i_sflx_gh), var_desc(i_sflx_gh), var_unit(i_sflx_gh) )
663  call hist_in( urban_sflx_evap(:,:), var_name(i_sflx_evap), var_desc(i_sflx_evap), var_unit(i_sflx_evap) )
664 
665  return
666  end subroutine urban_vars_history
667 
668  !-----------------------------------------------------------------------------
670  subroutine urban_vars_total
671  use scale_rm_statistics, only: &
673  stat_total
674  implicit none
675 
676  real(RP) :: total
677  integer :: k
678  !---------------------------------------------------------------------------
679 
680  if ( statistics_checktotal ) then
681  call stat_total( total, urban_tr(:,:), var_name(i_tr) )
682  call stat_total( total, urban_tb(:,:), var_name(i_tb) )
683  call stat_total( total, urban_tg(:,:), var_name(i_tg) )
684  call stat_total( total, urban_tc(:,:), var_name(i_tc) )
685  call stat_total( total, urban_qc(:,:), var_name(i_qc) )
686  call stat_total( total, urban_uc(:,:), var_name(i_uc) )
687 
688  do k = uks, uke
689  call stat_total( total, urban_trl(k,:,:), var_name(i_trl) )
690  call stat_total( total, urban_tbl(k,:,:), var_name(i_tbl) )
691  call stat_total( total, urban_tgl(k,:,:), var_name(i_tgl) )
692  enddo
693 
694  call stat_total( total, urban_rainr(:,:), var_name(i_rainr) )
695  call stat_total( total, urban_rainb(:,:), var_name(i_rainb) )
696  call stat_total( total, urban_raing(:,:), var_name(i_raing) )
697  call stat_total( total, urban_roff(:,:), var_name(i_roff) )
698 
699  call stat_total( total, urban_sfc_temp(:,:), var_name(i_sfc_temp) )
700  call stat_total( total, urban_sfc_albedo(:,:,i_lw), var_name(i_alb_lw) )
701  call stat_total( total, urban_sfc_albedo(:,:,i_sw), var_name(i_alb_sw) )
702 
703  call stat_total( total, urban_sflx_mw(:,:), var_name(i_sflx_mw) )
704  call stat_total( total, urban_sflx_mu(:,:), var_name(i_sflx_mu) )
705  call stat_total( total, urban_sflx_mv(:,:), var_name(i_sflx_mv) )
706  call stat_total( total, urban_sflx_sh(:,:), var_name(i_sflx_sh) )
707  call stat_total( total, urban_sflx_lh(:,:), var_name(i_sflx_lh) )
708  call stat_total( total, urban_sflx_gh(:,:), var_name(i_sflx_gh) )
709  call stat_total( total, urban_sflx_evap(:,:), var_name(i_sflx_evap) )
710 
711  endif
712 
713  return
714  end subroutine urban_vars_total
715 
716  !-----------------------------------------------------------------------------
718  subroutine urban_vars_external_in( &
719  URBAN_TC_in, &
720  URBAN_QC_in, &
721  URBAN_UC_in, &
722  URBAN_SFC_TEMP_in, &
723  URBAN_SFC_albedo_in )
724  implicit none
725 
726  real(RP), intent(in) :: URBAN_TC_in (ia,ja)
727  real(RP), intent(in) :: URBAN_QC_in (ia,ja)
728  real(RP), intent(in) :: URBAN_UC_in (ia,ja)
729  real(RP), intent(in) :: URBAN_SFC_TEMP_in (ia,ja)
730  real(RP), intent(in) :: URBAN_SFC_albedo_in(ia,ja,2)
731 
732  integer :: k
733  !---------------------------------------------------------------------------
734 
735  if( io_l ) write(io_fid_log,*)
736  if( io_l ) write(io_fid_log,*) '*** External Input (coupler) ***'
737 
738  urban_tr(:,:) = urban_sfc_temp_in(:,:)
739  urban_tb(:,:) = urban_sfc_temp_in(:,:)
740  urban_tg(:,:) = urban_sfc_temp_in(:,:)
741 
742  urban_tc(:,:) = urban_tc_in(:,:)
743  urban_qc(:,:) = urban_qc_in(:,:)
744  urban_uc(:,:) = urban_uc_in(:,:)
745 
746  do k = uks, uke
747  urban_trl(k,:,:) = urban_sfc_temp_in(:,:)
748  urban_tbl(k,:,:) = urban_sfc_temp_in(:,:)
749  urban_tgl(k,:,:) = urban_sfc_temp_in(:,:)
750  end do
751 
752  urban_rainr(:,:) = 0.0_rp
753  urban_rainb(:,:) = 0.0_rp
754  urban_raing(:,:) = 0.0_rp
755  urban_roff(:,:) = 0.0_rp
756 
757  urban_sfc_temp(:,:) = urban_sfc_temp_in(:,:)
758  urban_sfc_albedo(:,:,:) = urban_sfc_albedo_in(:,:,:)
759 
760  urban_z0m(:,:) = 2.0_rp ! tentative, will be replace in urban scheme
761  urban_z0h(:,:) = 0.2_rp ! tentative, will be replace in urban scheme
762  urban_z0e(:,:) = 0.2_rp ! tentative, will be replace in urban scheme
763  urban_sflx_mw(:,:) = 0.0_rp
764  urban_sflx_mu(:,:) = 0.0_rp
765  urban_sflx_mv(:,:) = 0.0_rp
766  urban_sflx_sh(:,:) = 0.0_rp
767  urban_sflx_lh(:,:) = 0.0_rp
768  urban_sflx_gh(:,:) = 0.0_rp
769  urban_sflx_evap(:,:) = 0.0_rp
770 
771  call urban_vars_total
772 
773  return
774  end subroutine urban_vars_external_in
775 
776  !-----------------------------------------------------------------------------
778  subroutine urban_vars_restart_create
779  use scale_time, only: &
781  use scale_fileio, only: &
783  use mod_urban_admin, only: &
784  urban_sw
785  implicit none
786 
787  character(len=20) :: timelabel
788  character(len=H_LONG) :: basename
789  !---------------------------------------------------------------------------
790 
791  if ( urban_sw .and. urban_restart_out_basename /= '' ) then
792 
793  call time_gettimelabel( timelabel )
794  write(basename,'(A,A,A)') trim(urban_restart_out_basename), '_', trim(timelabel)
795 
796  if( io_l ) write(io_fid_log,*)
797  if( io_l ) write(io_fid_log,*) '*** Output restart file (URBAN) ***'
798  if( io_l ) write(io_fid_log,*) '*** filename: ', trim(basename)
799 
800  call fileio_create( restart_fid, basename, urban_restart_out_title, urban_restart_out_dtype )
801  endif
802 
803  return
804  end subroutine urban_vars_restart_create
805 
806  !-----------------------------------------------------------------------------
808  subroutine urban_vars_restart_enddef
809  use scale_fileio, only: &
811  implicit none
812 
813  if ( restart_fid .NE. -1 ) then
814  call fileio_enddef( restart_fid ) ! [IN]
815  endif
816 
817  return
818  end subroutine urban_vars_restart_enddef
819 
820  !-----------------------------------------------------------------------------
822  subroutine urban_vars_restart_close
823  use scale_fileio, only: &
825  implicit none
826 
827  if ( restart_fid .NE. -1 ) then
828  call fileio_close( restart_fid ) ! [IN]
829  restart_fid = -1
830  endif
831 
832  return
833  end subroutine urban_vars_restart_close
834 
835  !-----------------------------------------------------------------------------
837  subroutine urban_vars_restart_def_var
838  use scale_fileio, only: &
840  implicit none
841 
842  !---------------------------------------------------------------------------
843 
844  if ( restart_fid .NE. -1 ) then
845 
846  call fileio_def_var( restart_fid, var_id(i_tr), var_name(i_tr), var_desc(i_tr), &
847  var_unit(i_tr), 'XY', urban_restart_out_dtype )
848  call fileio_def_var( restart_fid, var_id(i_tb), var_name(i_tb), var_desc(i_tb), &
849  var_unit(i_tb), 'XY', urban_restart_out_dtype )
850  call fileio_def_var( restart_fid, var_id(i_tg), var_name(i_tg), var_desc(i_tg), &
851  var_unit(i_tg), 'XY', urban_restart_out_dtype )
852  call fileio_def_var( restart_fid, var_id(i_tc), var_name(i_tc), var_desc(i_tc), &
853  var_unit(i_tc), 'XY', urban_restart_out_dtype )
854  call fileio_def_var( restart_fid, var_id(i_qc), var_name(i_qc), var_desc(i_qc), &
855  var_unit(i_qc), 'XY', urban_restart_out_dtype )
856  call fileio_def_var( restart_fid, var_id(i_uc), var_name(i_uc), var_desc(i_uc), &
857  var_unit(i_uc), 'XY', urban_restart_out_dtype )
858 
859  call fileio_def_var( restart_fid, var_id(i_trl), var_name(i_trl), var_desc(i_trl), &
860  var_unit(i_trl), 'Urban', urban_restart_out_dtype )
861  call fileio_def_var( restart_fid, var_id(i_tbl), var_name(i_tbl), var_desc(i_tbl), &
862  var_unit(i_tbl), 'Urban', urban_restart_out_dtype )
863  call fileio_def_var( restart_fid, var_id(i_tgl), var_name(i_tgl), var_desc(i_tgl), &
864  var_unit(i_tgl), 'Urban', urban_restart_out_dtype )
865 
866  call fileio_def_var( restart_fid, var_id(i_rainr), var_name(i_rainr), var_desc(i_rainr), &
867  var_unit(i_rainr), 'XY', urban_restart_out_dtype )
868  call fileio_def_var( restart_fid, var_id(i_rainb), var_name(i_rainb), var_desc(i_rainb), &
869  var_unit(i_rainb), 'XY', urban_restart_out_dtype )
870  call fileio_def_var( restart_fid, var_id(i_raing), var_name(i_raing), var_desc(i_raing), &
871  var_unit(i_raing), 'XY', urban_restart_out_dtype )
872  call fileio_def_var( restart_fid, var_id(i_roff), var_name(i_roff), var_desc(i_roff), &
873  var_unit(i_roff), 'XY', urban_restart_out_dtype )
874 
875  call fileio_def_var( restart_fid, var_id(i_sfc_temp), var_name(i_sfc_temp), var_desc(i_sfc_temp), &
876  var_unit(i_sfc_temp), 'XY', urban_restart_out_dtype )
877  call fileio_def_var( restart_fid, var_id(i_alb_lw), var_name(i_alb_lw), var_desc(i_alb_lw), &
878  var_unit(i_alb_lw), 'XY', urban_restart_out_dtype )
879  call fileio_def_var( restart_fid, var_id(i_alb_sw), var_name(i_alb_sw), var_desc(i_alb_sw), &
880  var_unit(i_alb_sw), 'XY', urban_restart_out_dtype )
881 
882  call fileio_def_var( restart_fid, var_id(i_sflx_mw), var_name(i_sflx_mw), var_desc(i_sflx_mw), &
883  var_unit(i_sflx_mw), 'XY', urban_restart_out_dtype )
884  call fileio_def_var( restart_fid, var_id(i_sflx_mu), var_name(i_sflx_mu), var_desc(i_sflx_mu), &
885  var_unit(i_sflx_mu), 'XY', urban_restart_out_dtype )
886  call fileio_def_var( restart_fid, var_id(i_sflx_mv), var_name(i_sflx_mv), var_desc(i_sflx_mv), &
887  var_unit(i_sflx_mv), 'XY', urban_restart_out_dtype )
888  call fileio_def_var( restart_fid, var_id(i_sflx_sh), var_name(i_sflx_sh), var_desc(i_sflx_sh), &
889  var_unit(i_sflx_sh), 'XY', urban_restart_out_dtype )
890  call fileio_def_var( restart_fid, var_id(i_sflx_lh), var_name(i_sflx_lh), var_desc(i_sflx_lh), &
891  var_unit(i_sflx_lh), 'XY', urban_restart_out_dtype )
892  call fileio_def_var( restart_fid, var_id(i_sflx_gh), var_name(i_sflx_gh), var_desc(i_sflx_gh), &
893  var_unit(i_sflx_gh), 'XY', urban_restart_out_dtype )
894  call fileio_def_var( restart_fid, var_id(i_sflx_evap), var_name(i_sflx_evap), var_desc(i_sflx_evap), &
895  var_unit(i_sflx_evap), 'XY', urban_restart_out_dtype )
896 
897  endif
898 
899  return
900  end subroutine urban_vars_restart_def_var
901 
902  !-----------------------------------------------------------------------------
905  use scale_fileio, only: &
906  fileio_write_var
907  implicit none
908 
909  !---------------------------------------------------------------------------
910 
911  if ( restart_fid .NE. -1 ) then
912 
913  call urban_vars_total
914 
915  call fileio_write_var( restart_fid, var_id(i_tr), urban_tr(:,:), & ! [IN]
916  var_name(i_tr), 'XY', nohalo=.true. ) ! [IN]
917  call fileio_write_var( restart_fid, var_id(i_tb), urban_tb(:,:), & ! [IN]
918  var_name(i_tb), 'XY', nohalo=.true. ) ! [IN]
919  call fileio_write_var( restart_fid, var_id(i_tg), urban_tg(:,:), & ! [IN]
920  var_name(i_tg), 'XY', nohalo=.true. ) ! [IN]
921  call fileio_write_var( restart_fid, var_id(i_tc), urban_tc(:,:), & ! [IN]
922  var_name(i_tc), 'XY', nohalo=.true. ) ! [IN]
923  call fileio_write_var( restart_fid, var_id(i_qc), urban_qc(:,:), & ! [IN]
924  var_name(i_qc), 'XY', nohalo=.true. ) ! [IN]
925  call fileio_write_var( restart_fid, var_id(i_uc), urban_uc(:,:), & ! [IN]
926  var_name(i_uc), 'XY', nohalo=.true. ) ! [IN]
927 
928  call fileio_write_var( restart_fid, var_id(i_trl), urban_trl(:,:,:), & ! [IN]
929  var_name(i_trl), 'Urban', nohalo=.true. ) ! [IN]
930  call fileio_write_var( restart_fid, var_id(i_tbl), urban_tbl(:,:,:), & ! [IN]
931  var_name(i_tbl), 'Urban', nohalo=.true. ) ! [IN]
932  call fileio_write_var( restart_fid, var_id(i_tgl), urban_tgl(:,:,:), & ! [IN]
933  var_name(i_tgl), 'Urban', nohalo=.true. ) ! [IN]
934 
935  call fileio_write_var( restart_fid, var_id(i_rainr), urban_rainr(:,:), & ! [IN]
936  var_name(i_rainr), 'XY', nohalo=.true. ) ! [IN]
937  call fileio_write_var( restart_fid, var_id(i_rainb), urban_rainb(:,:), & ! [IN]
938  var_name(i_rainb), 'XY', nohalo=.true. ) ! [IN]
939  call fileio_write_var( restart_fid, var_id(i_raing), urban_raing(:,:), & ! [IN]
940  var_name(i_raing), 'XY', nohalo=.true. ) ! [IN]
941  call fileio_write_var( restart_fid, var_id(i_roff), urban_roff(:,:), & ! [IN]
942  var_name(i_roff), 'XY', nohalo=.true. ) ! [IN]
943 
944  call fileio_write_var( restart_fid, var_id(i_sfc_temp), urban_sfc_temp(:,:), & ! [IN]
945  var_name(i_sfc_temp), 'XY', nohalo=.true. ) ! [IN]
946  call fileio_write_var( restart_fid, var_id(i_alb_lw), urban_sfc_albedo(:,:,i_lw), & ! [IN]
947  var_name(i_alb_lw), 'XY', nohalo=.true. ) ! [IN]
948  call fileio_write_var( restart_fid, var_id(i_alb_sw), urban_sfc_albedo(:,:,i_sw), & ! [IN]
949  var_name(i_alb_sw), 'XY', nohalo=.true. ) ! [IN]
950 
951  call fileio_write_var( restart_fid, var_id(i_sflx_mw), urban_sflx_mw(:,:), & ! [IN]
952  var_name(i_sflx_mw), 'XY', nohalo=.true. ) ! [IN]
953  call fileio_write_var( restart_fid, var_id(i_sflx_mu), urban_sflx_mu(:,:), & ! [IN]
954  var_name(i_sflx_mu), 'XY', nohalo=.true. ) ! [IN]
955  call fileio_write_var( restart_fid, var_id(i_sflx_mv), urban_sflx_mv(:,:), & ! [IN]
956  var_name(i_sflx_mv), 'XY', nohalo=.true. ) ! [IN]
957  call fileio_write_var( restart_fid, var_id(i_sflx_sh), urban_sflx_sh(:,:), & ! [IN]
958  var_name(i_sflx_sh), 'XY', nohalo=.true. ) ! [IN]
959  call fileio_write_var( restart_fid, var_id(i_sflx_lh), urban_sflx_lh(:,:), & ! [IN]
960  var_name(i_sflx_lh), 'XY', nohalo=.true. ) ! [IN]
961  call fileio_write_var( restart_fid, var_id(i_sflx_gh), urban_sflx_gh(:,:), & ! [IN]
962  var_name(i_sflx_gh), 'XY', nohalo=.true. ) ! [IN]
963  call fileio_write_var( restart_fid, var_id(i_sflx_evap), urban_sflx_evap(:,:), & ! [IN]
964  var_name(i_sflx_evap), 'XY', nohalo=.true. ) ! [IN]
965 
966  endif
967 
968  return
969  end subroutine urban_vars_restart_write_var
970 
971 end module mod_urban_vars
real(rp), dimension(:,:), allocatable, public urban_qc_t
integer, public is
start point of inner domain: x, local
module DEBUG
Definition: scale_debug.F90:13
logical, public statistics_checktotal
calc&report variable totals to logfile?
logical, public urban_sw
integer, public je
end point of inner domain: y, local
integer, public const_i_lw
long-wave radiation index
Definition: scale_const.F90:98
subroutine, public prc_mpistop
Abort MPI.
real(rp), dimension(:,:), allocatable, public urban_qc
real(rp), dimension(:,:), allocatable, public urban_rainr_t
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.
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:59
real(rp), dimension(:,:), allocatable, public urban_v10
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_sflx_evap
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.
module STDIO
Definition: scale_stdio.F90:12
real(rp), dimension(:,:), allocatable, public urban_tb_t
real(rp), dimension(:,:), allocatable, public urban_t2
subroutine, public urban_vars_history
History output set for urban variables.
real(rp), dimension(:,:), allocatable, public urban_tb
subroutine, public urban_vars_external_in(URBAN_TC_in, URBAN_QC_in, URBAN_UC_in, URBAN_SFC_TEMP_in, URBAN_SFC_albedo_in)
Input from External I/O.
module URBAN Variables
real(rp), dimension(:,:), allocatable, public urban_raing
module FILE I/O (netcdf)
real(rp), dimension(:,:), allocatable, public urban_uc
real(rp), dimension(:,:), allocatable, public atmos_sflx_prec
subroutine, public urban_vars_restart_write_var
Write urban restart.
real(rp), public const_undef
Definition: scale_const.F90:43
module Statistics
subroutine, public urban_vars_restart_write
Write urban restart.
module grid index
subroutine, public urban_vars_restart_close
Close restart file.
real(rp), dimension(:,:), allocatable, public atmos_pbl
real(rp), dimension(:,:), allocatable, public urban_sflx_sh
character(len=h_long), public urban_restart_out_basename
basename of the output file
subroutine, public fileio_def_var(fid, vid, varname, desc, unit, axistype, datatype, timeintv)
Define a variable to file.
real(rp), dimension(:,:), allocatable, public urban_tr
integer, public ia
of x whole cells (local, with HALO)
real(rp), dimension(:,:,:), allocatable, public urban_tgl
subroutine, public time_gettimelabel(timelabel)
generate time label
Definition: scale_time.F90:90
real(rp), dimension(:,:), allocatable, public atmos_qv
real(rp), dimension(:,:), allocatable, public atmos_sfc_pres
real(rp), dimension(:,:), allocatable, public atmos_cossza
real(rp), dimension(:,:), allocatable, public urban_uc_t
real(rp), dimension(:,:), allocatable, public urban_z0h
subroutine, public fileio_create(fid, basename, title, datatype, date, subsec, append, nozcoord)
Create/open a netCDF file.
real(rp), dimension(:,:,:), allocatable, public atmos_sflx_sw
real(rp), dimension(:,:), allocatable, public atmos_v
integer, public js
start point of inner domain: y, local
module TIME
Definition: scale_time.F90:15
real(rp), dimension(:,:), allocatable, public urban_roff
module PROCESS
real(rp), dimension(:,:), allocatable, public atmos_dens
subroutine, public urban_vars_setup
Setup.
module CONSTANT
Definition: scale_const.F90:14
real(rp), dimension(:,:,:), allocatable, public urban_sfc_albedo
real(rp), dimension(:,:), allocatable, public urban_sflx_lh
character(len=h_mid), public urban_restart_out_dtype
REAL4 or REAL8.
real(rp), dimension(:,:), allocatable, public urban_tc
real(rp), dimension(:,:), allocatable, public atmos_pres
logical, public urban_restart_output
output restart file?
subroutine, public fileio_enddef(fid)
Exit netCDF file define mode.
real(rp), dimension(:,:), allocatable, public urban_rainr
module profiler
Definition: scale_prof.F90:10
integer, public ie
end point of inner domain: x, local
logical, public io_lnml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:60
real(rp), dimension(:,:), allocatable, public atmos_temp
integer, public const_i_sw
short-wave radiation index
Definition: scale_const.F90:99
module PRECISION
module HISTORY
real(rp), dimension(:,:), allocatable, public urban_q2
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
subroutine, public fileio_close(fid)
Close a netCDF file.
real(rp), dimension(:,:,:), allocatable, public urban_trl
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
real(rp), dimension(:,:), allocatable, public urban_rainb_t
real(rp), dimension(:,:,:), allocatable, public atmos_sflx_lw
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
module Urban admin
real(rp), dimension(:,:,:), allocatable, public urban_tbl
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
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 restart file
real(rp), dimension(:,:), allocatable, public urban_roff_t
real(rp), dimension(:,:,:), allocatable, public urban_tbl_t
real(rp), dimension(:,:), allocatable, public urban_sflx_mw
character(len=h_mid), public urban_restart_out_title
title of the output file
module urban grid index
integer, public ja
of y whole cells (local, with HALO)