SCALE-RM
mod_realinput.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
14  !-----------------------------------------------------------------------------
15  !
16  !++ used modules
17  !
18  use scale_precision
19  use scale_stdio
23  use scale_grid_real, only: &
24  lon => real_lon, &
25  lat => real_lat, &
26  lonx => real_lonx, &
27  laty => real_laty, &
28  cz => real_cz, &
29  fz => real_fz
30  use scale_grid_nest, only: &
32  use scale_index
33  use scale_tracer
34  use scale_process, only: &
35  prc_ismaster, &
37  use scale_external_io, only: &
38  iscale, &
39  iwrfarw, &
40  inicam, &
41  igrads
42  use scale_comm, only: &
43  comm_bcast
44  !-----------------------------------------------------------------------------
45  implicit none
46  private
47  !-----------------------------------------------------------------------------
48  !
49  !++ Public procedure
50  !
51  public :: realinput_atmos
52  public :: realinput_surface
53 
54  !-----------------------------------------------------------------------------
55  !
56  !++ Public parameters & variables
57  !
58  !-----------------------------------------------------------------------------
59  !
60  !++ Private procedure
61  !
62  private :: parentatominput
63  private :: parentatomboundary
64  private :: parentsurfacesetup
65  private :: parentsurfaceinput
66  private :: parentoceanboundary
67  private :: interp_oceanland_data
68  private :: diagnose_number_concentration
69 
70  !-----------------------------------------------------------------------------
71  !
72  !++ Private parameters & variables
73  !
74  integer, parameter :: i_intrp_off = 0
75  integer, parameter :: i_intrp_mask = 1
76  integer, parameter :: i_intrp_fill = 2
77 
78  integer, parameter :: cosin = 1
79  integer, parameter :: sine = 2
80 
81  real(RP), allocatable :: lon_org (:,:)
82  real(RP), allocatable :: lat_org (:,:)
83  real(RP), allocatable :: cz_org(:,:,:)
84 
85  real(RP), allocatable :: dens_org(:,:,:)
86  real(RP), allocatable :: qtrc_org(:,:,:,:)
87 
88  real(RP), allocatable :: velz_org(:,:,:)
89  real(RP), allocatable :: velx_org(:,:,:)
90  real(RP), allocatable :: vely_org(:,:,:)
91  real(RP), allocatable :: pott_org(:,:,:)
92  real(RP), allocatable :: temp_org(:,:,:)
93  real(RP), allocatable :: pres_org(:,:,:)
94 
95  real(RP), allocatable :: hfact(:,:,:)
96  real(RP), allocatable :: vfact(:,:,:,:,:)
97  integer, allocatable :: igrd (:,:,:)
98  integer, allocatable :: jgrd (:,:,:)
99  integer, allocatable :: kgrd (:,:,:,:,:)
100  integer, allocatable :: ncopy(:,:,:)
101 
102  real(RP), allocatable :: tw_org(:,:)
103  real(RP), allocatable :: sst_org(:,:)
104  real(RP), allocatable :: albw_org(:,:,:)
105  real(RP), allocatable :: olon_org(:,:)
106  real(RP), allocatable :: olat_org(:,:)
107  real(RP), allocatable :: omask_org(:,:)
108 
109  integer, private :: itp_nh = 4
110  integer, private :: itp_nv = 2
111 
112  integer, private :: io_fid_grads_nml = -1
113  integer, private :: io_fid_grads_data = -1
114 
115  logical, private :: do_read_atom
116  logical, private :: do_read_land
117  logical, private :: do_read_ocean
118  logical, private :: rotate
119  logical, private :: use_waterratio
120  logical, private :: update_coord
121  logical, private :: use_temp
122  logical, private :: serial
123  logical, private :: serial_land
124  logical, private :: serial_ocean
125  logical, private :: first = .true.
126 
127  integer, private :: i_intrp_land_temp
128  integer, private :: i_intrp_land_water
129  integer, private :: i_intrp_land_sfc_temp
130  integer, private :: i_intrp_ocean_temp
131  integer, private :: i_intrp_ocean_sfc_temp
132 
133 
134  ! replace missing value
135  real(RP), private, parameter :: maskval_tg = 298.0_rp
136  real(RP), private, parameter :: maskval_strg = 0.02_rp
137  ! default value 0.02: set as value of forest at 40% of evapolation rate.
138  ! forest is considered as a typical landuse over Japan area.
139 
140 
141  ! for namelist
142  integer :: number_of_files = 1
143  integer :: number_of_tsteps = 1 ! num of time steps in one file
144  integer :: number_of_skip_tsteps = 0 ! num of skipped first several data
145 
146  character(len=H_LONG) :: filetype_org = ''
147  character(len=H_LONG) :: basename_org = ''
148  logical :: basename_add_num = .false.
149  character(len=H_LONG) :: basename_boundary = 'boundary_atmos'
150  character(len=H_LONG) :: boundary_title = 'SCALE-RM BOUNDARY CONDITION for REAL CASE'
151  real(RP) :: boundary_update_dt = 0.0_rp ! inteval time of boudary data update [s]
152 
153  integer :: parent_mp_type = 6 ! microphysics type of the parent model (number of classes)
154  ! 0: dry, 3:3-class, 5:5-class, 6:6-class, >6:double moment
155  logical :: serial_proc_read = .true. ! read by one MPI process and broadcast
156  ! only for SCALE boundary
157  logical :: use_file_density = .false. ! use density data from files
158 
159  !-----------------------------------------------------------------------------
160 contains
161  !-----------------------------------------------------------------------------
162  subroutine realinput_atmos( &
163  flg_intrp )
164  use mod_atmos_vars, only: &
165  dens, &
166  momz, &
167  momx, &
168  momy, &
169  rhot, &
170  qtrc
171  implicit none
172 
173  logical, intent(in) :: flg_intrp ! flag for interpolation of SBM(S10) from outer bulk-MP model
174 
175 
176  namelist / param_mkinit_real_atmos / &
177  number_of_files, &
178  number_of_tsteps, &
179  number_of_skip_tsteps, &
180  filetype_org, &
181  basename_org, &
182  basename_add_num, &
183  basename_boundary, &
184  boundary_title, &
185  boundary_update_dt, &
186  parent_mp_type, &
187  serial_proc_read, &
188  use_file_density
189 
190  character(len=H_LONG) :: BASENAME_ATMOS = ''
191  character(len=H_LONG) :: BASENAME_WITHNUM = ''
192  character(len=5) :: NUM = ''
193 
194  ! atmos
195  real(RP), allocatable :: DENS_ORG(:,:,:,:)
196  real(RP), allocatable :: MOMZ_ORG(:,:,:,:)
197  real(RP), allocatable :: MOMX_ORG(:,:,:,:)
198  real(RP), allocatable :: MOMY_ORG(:,:,:,:)
199  real(RP), allocatable :: RHOT_ORG(:,:,:,:)
200  real(RP), allocatable :: QTRC_ORG(:,:,:,:,:)
201 
202  integer :: mdlid
203  integer :: dims(6) ! dims 1-3: normal, 4-6: staggerd
204 
205  integer :: totaltimesteps = 1
206  integer :: timelen
207  integer :: skip_steps
208  integer :: ierr
209  logical :: flg_bin ! flag for SBM(S10) is used or not 0-> not used, 1-> used
210 
211  integer :: k, i, j, iq, n, ns, ne
212  !---------------------------------------------------------------------------
213 
214  if( io_l ) write(io_fid_log,*)
215  if( io_l ) write(io_fid_log,*) '+++ Module[RealCaseAtmos]/Categ[MKINIT]'
216 
217  !--- read namelist
218  rewind(io_fid_conf)
219  read(io_fid_conf,nml=param_mkinit_real_atmos,iostat=ierr)
220  if( ierr < 0 ) then !--- missing
221  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
222  elseif( ierr > 0 ) then !--- fatal error
223  write(*,*) 'xxx Not appropriate names in namelist PARAM_MKINIT_REAL_ATMOS. Check!'
224  call prc_mpistop
225  endif
226  if( io_lnml ) write(io_fid_log,nml=param_mkinit_real_atmos)
227 
228  if( tracer_type == 'SUZUKI10' ) then
229  flg_bin = .true.
230  else
231  flg_bin = .false.
232  endif
233 
234  if ( filetype_org == "GrADS" ) then
235  basename_withnum = basename_org ! namelist file name
236  basename_atmos = ""
237  else
238  if ( number_of_files > 1 .or. basename_add_num ) then
239  basename_withnum = trim(basename_org)//"_00000"
240  else
241  basename_withnum = trim(basename_org)
242  end if
243  basename_atmos = basename_org
244  end if
245 
246  call parentatomsetup( dims(:), timelen, mdlid, & ![OUT]
247  basename_withnum, & ![IN]
248  filetype_org, & ![IN]
249  use_file_density, & ![IN]
250  serial_proc_read ) ![IN]
251 
252  if ( boundary_update_dt <= 0.0_rp ) then
253  write(*,*) 'xxx BOUNDARY_UPDATE_DT is necessary in real case preprocess'
254  call prc_mpistop
255  endif
256 
257  if ( timelen > 0 ) then
258  number_of_tsteps = timelen ! read from file
259  endif
260 
261  totaltimesteps = number_of_files * number_of_tsteps
262 
263  allocate( dens_org(ka,ia,ja,1+number_of_skip_tsteps:totaltimesteps ) )
264  allocate( momz_org(ka,ia,ja,1+number_of_skip_tsteps:totaltimesteps ) )
265  allocate( momx_org(ka,ia,ja,1+number_of_skip_tsteps:totaltimesteps ) )
266  allocate( momy_org(ka,ia,ja,1+number_of_skip_tsteps:totaltimesteps ) )
267  allocate( rhot_org(ka,ia,ja,1+number_of_skip_tsteps:totaltimesteps ) )
268  allocate( qtrc_org(ka,ia,ja,qa,1+number_of_skip_tsteps:totaltimesteps) )
269 
270  !--- read external file
271  do n = 1, number_of_files
272 
273  if ( number_of_files > 1 .or. basename_add_num ) then
274  write(num,'(I5.5)') n-1
275  basename_withnum = trim(basename_atmos)//"_"//num
276  else
277  basename_withnum = trim(basename_atmos)
278  end if
279 
280  if( io_l ) write(io_fid_log,*) ' '
281  if( io_l ) write(io_fid_log,*) '+++ Target File Name: ',trim(basename_withnum)
282  if( io_l ) write(io_fid_log,*) ' Time Steps in One File: ', number_of_tsteps
283 
284  ns = number_of_tsteps * (n - 1) + 1
285  ne = ns + (number_of_tsteps - 1)
286 
287  if ( ne <= number_of_skip_tsteps ) then
288  if( io_l ) write(io_fid_log,*) ' SKIP'
289  cycle
290  end if
291 
292  skip_steps = max(number_of_skip_tsteps - ns + 1, 0)
293  ns = max(ns, number_of_skip_tsteps+1)
294 
295  ! read all prepared data
296  call parentatominput( dens_org(:,:,:,ns:ne), &
297  momz_org(:,:,:,ns:ne), &
298  momx_org(:,:,:,ns:ne), &
299  momy_org(:,:,:,ns:ne), &
300  rhot_org(:,:,:,ns:ne), &
301  qtrc_org(:,:,:,:,ns:ne), &
302  basename_withnum, &
303  dims(:), &
304  mdlid, &
305  flg_bin, flg_intrp, &
306  parent_mp_type, &
307  number_of_tsteps, &
308  skip_steps )
309  enddo
310 
311  !--- input initial data
312  ns = number_of_skip_tsteps + 1 ! skip first several data
313  do j = 1, ja
314  do i = 1, ia
315  do k = ks, ke
316  dens(k,i,j) = dens_org(k,i,j,ns)
317  momz(k,i,j) = momz_org(k,i,j,ns)
318  momx(k,i,j) = momx_org(k,i,j,ns)
319  momy(k,i,j) = momy_org(k,i,j,ns)
320  rhot(k,i,j) = rhot_org(k,i,j,ns)
321 
322  do iq = 1, qa
323  qtrc(k,i,j,iq) = qtrc_org(k,i,j,iq,ns)
324  enddo
325  enddo
326  enddo
327  enddo
328 
329  !--- output boundary data
330  totaltimesteps = totaltimesteps - number_of_skip_tsteps ! skip first several data
331  call parentatomboundary( dens_org(:,:,:,ns:ne), &
332  momz_org(:,:,:,ns:ne), &
333  momx_org(:,:,:,ns:ne), &
334  momy_org(:,:,:,ns:ne), &
335  rhot_org(:,:,:,ns:ne), &
336  qtrc_org(:,:,:,:,ns:ne), &
337  totaltimesteps, &
338  boundary_update_dt, &
339  basename_boundary, &
340  boundary_title )
341 
342  deallocate( dens_org )
343  deallocate( momz_org )
344  deallocate( momx_org )
345  deallocate( momy_org )
346  deallocate( rhot_org )
347  deallocate( qtrc_org )
348 
349  return
350  end subroutine realinput_atmos
351 
352  !-----------------------------------------------------------------------------
353  subroutine realinput_surface
354  use scale_const, only: &
355  i_sw => const_i_sw, &
356  i_lw => const_i_lw
357  use mod_atmos_vars, only: &
358  dens, &
359  momz, &
360  momx, &
361  momy, &
362  rhot, &
363  qtrc
364  use mod_land_vars, only: &
365  land_temp, &
366  land_water, &
367  land_sfc_temp, &
369  use mod_urban_vars, only: &
370  urban_sfc_temp, &
372  urban_tc, &
373  urban_qc, &
374  urban_uc, &
375  urban_tr, &
376  urban_tb, &
377  urban_tg, &
378  urban_trl, &
379  urban_tbl, &
380  urban_tgl, &
381  urban_rainr, &
382  urban_rainb, &
383  urban_raing, &
384  urban_roff
385  use mod_ocean_vars, only: &
386  ocean_temp, &
387  ocean_sfc_temp, &
389  ocean_sfc_z0m, &
390  ocean_sfc_z0h, &
392  use mod_atmos_phy_sf_vars, only: &
398  use scale_landuse, only: &
399  fact_ocean => landuse_fact_ocean, &
400  fact_land => landuse_fact_land, &
401  fact_urban => landuse_fact_urban
402  implicit none
403 
404  logical :: USE_FILE_LANDWATER = .true. ! use land water data from files
405  real(RP) :: INIT_LANDWATER_RATIO = 0.5_rp ! Ratio of land water to storage is constant, if USE_FILE_LANDWATER is ".false."
406  character(len=H_SHORT) :: INTRP_LAND_TEMP = 'off'
407  character(len=H_SHORT) :: INTRP_LAND_WATER = 'off'
408  character(len=H_SHORT) :: INTRP_LAND_SFC_TEMP = 'off'
409  character(len=H_SHORT) :: INTRP_OCEAN_TEMP = 'off'
410  character(len=H_SHORT) :: INTRP_OCEAN_SFC_TEMP = 'off'
411  integer :: INTRP_ITER_MAX = 20
412  character(len=H_SHORT) :: SOILWATER_DS2VC = 'limit'
413  logical :: soilwater_DS2VC_flag ! true: 'critical', false: 'limit'
414  logical :: elevation_collection = .true.
415 
416  namelist / param_mkinit_real_land / &
417  number_of_files, &
418  number_of_tsteps, &
419  number_of_skip_tsteps, &
420  filetype_org, &
421  basename_org, &
422  basename_add_num, &
423  use_file_landwater, &
424  init_landwater_ratio, &
425  intrp_land_temp, &
426  intrp_land_water, &
427  intrp_land_sfc_temp, &
428  intrp_iter_max, &
429  soilwater_ds2vc, &
430  elevation_collection, &
431  serial_proc_read
432 
433  namelist / param_mkinit_real_ocean / &
434  number_of_files, &
435  number_of_tsteps, &
436  number_of_skip_tsteps, &
437  filetype_org, &
438  basename_org, &
439  basename_add_num, &
440  basename_boundary, &
441  boundary_title, &
442  boundary_update_dt, &
443  intrp_ocean_temp, &
444  intrp_ocean_sfc_temp, &
445  intrp_iter_max, &
446  serial_proc_read
447 
448  character(len=H_LONG) :: FILETYPE_LAND
449  character(len=H_LONG) :: FILETYPE_OCEAN
450  character(len=H_LONG) :: BASENAME_LAND
451  character(len=H_LONG) :: BASENAME_OCEAN
452  character(len=H_LONG) :: BASENAME_WITHNUM = ''
453  character(len=5) :: NUM = ''
454  logical :: SERIAL_PROC_READ_land
455  logical :: SERIAL_PROC_READ_ocean
456 
457  ! land
458  real(RP) :: LAND_TEMP_ORG(lkmax,ia,ja)
459  real(RP) :: LAND_WATER_ORG(lkmax,ia,ja)
460  real(RP) :: LAND_SFC_TEMP_ORG(ia,ja)
461  real(RP) :: LAND_SFC_albedo_ORG(ia,ja,2)
462 
463  ! urban
464  real(RP) :: URBAN_TC_ORG(ia,ja)
465  real(RP) :: URBAN_QC_ORG(ia,ja)
466  real(RP) :: URBAN_UC_ORG(ia,ja)
467  real(RP) :: URBAN_SFC_TEMP_ORG(ia,ja)
468  real(RP) :: URBAN_SFC_albedo_ORG(ia,ja,2)
469 
470  ! ocean
471  real(RP), allocatable :: OCEAN_TEMP_ORG(:,:,:)
472  real(RP), allocatable :: OCEAN_SFC_TEMP_ORG(:,:,:)
473  real(RP), allocatable :: OCEAN_SFC_albedo_ORG(:,:,:,:)
474  real(RP), allocatable :: OCEAN_SFC_Z0_ORG(:,:,:)
475 
476  integer :: mdlid_land, mdlid_ocean
477  integer :: ldims(3), odims(2)
478 
479  integer :: totaltimesteps = 1
480  integer :: timelen
481  integer :: skip_steps
482  integer :: lit
483  integer :: lfn
484  integer :: ierr
485 
486  integer :: k, i, j, n, ns, ne
487  !---------------------------------------------------------------------------
488 
489  if( io_l ) write(io_fid_log,*)
490  if( io_l ) write(io_fid_log,*) '+++ Module[RealCaseSurface]/Categ[MKINIT]'
491 
492 
493  ! LAND/URBAN
494 
495  !--- read namelist
496  rewind(io_fid_conf)
497  read(io_fid_conf,nml=param_mkinit_real_land,iostat=ierr)
498  if( ierr < 0 ) then !--- missing
499  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
500  elseif( ierr > 0 ) then !--- fatal error
501  write(*,*) 'xxx Not appropriate names in namelist PARAM_MKINIT_REAL_LAND. Check!'
502  call prc_mpistop
503  endif
504  if( io_lnml ) write(io_fid_log,nml=param_mkinit_real_land)
505 
506  filetype_land = filetype_org
507 
508  lfn = number_of_skip_tsteps / number_of_tsteps
509  if ( filetype_land .ne. "GrADS" .and. ( number_of_files > 1 .or. basename_add_num ) ) then
510  write(num,'(I5.5)') lfn
511  basename_land = trim(basename_org)//"_"//num
512  else
513  basename_land = trim(basename_org)
514  end if
515 
516  serial_land = serial_proc_read
517 
518  lit = mod(number_of_skip_tsteps,number_of_tsteps)+1
519 
520  !--- read external file
521  if( io_l ) write(io_fid_log,*) ' '
522  if( io_l ) write(io_fid_log,*) '+++ Target File Name (Land): ',trim(basename_land)
523  if( io_l ) write(io_fid_log,*) ' Time Steps in One File: ', number_of_tsteps
524  if( io_l ) write(io_fid_log,*) ' Time Step to read: ', lit
525 
526 
527 
528  ! OCEAN
529 
530  !--- read namelist
531  rewind(io_fid_conf)
532  read(io_fid_conf,nml=param_mkinit_real_ocean,iostat=ierr)
533  if( ierr < 0 ) then !--- missing
534  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
535  elseif( ierr > 0 ) then !--- fatal error
536  write(*,*) 'xxx Not appropriate names in namelist PARAM_MKINIT_REAL_OCEAN. Check!'
537  call prc_mpistop
538  endif
539  if( io_lnml ) write(io_fid_log,nml=param_mkinit_real_ocean)
540 
541  filetype_ocean = filetype_org
542 
543  if ( filetype_ocean .ne. "GrADS" .and. ( number_of_files > 1 .or. basename_add_num ) ) then
544  basename_ocean = trim(basename_org)//"_00000"
545  else
546  basename_ocean = trim(basename_org)
547  end if
548 
549  select case ( soilwater_ds2vc )
550  case ( 'critical' )
551  soilwater_ds2vc_flag = .true.
552  case ('limit' )
553  soilwater_ds2vc_flag = .false.
554  case default
555  write(*,*) ' xxx Unsupported SOILWATER_DS2CV TYPE:', trim(soilwater_ds2vc)
556  call prc_mpistop
557  end select
558 
559  serial_ocean = serial_proc_read
560 
561 
562  call parentsurfacesetup( ldims, odims, & ![OUT]
563  mdlid_land, & ![OUT]
564  mdlid_ocean, & ![OUT]
565  timelen, & ![OUT]
566  basename_land, & ![IN]
567  basename_ocean, & ![IN]
568  filetype_land, & ![IN]
569  filetype_ocean, & ![IN]
570  use_file_landwater, & ![IN]
571  intrp_land_temp, & ![IN]
572  intrp_land_water, & ![IN]
573  intrp_land_sfc_temp, & ![IN]
574  intrp_ocean_temp, & ![IN]
575  intrp_ocean_sfc_temp ) ![IN]
576 
577  if ( timelen > 0 ) then
578  number_of_tsteps = timelen ! read from file
579  endif
580 
581  totaltimesteps = number_of_files * number_of_tsteps
582 
583  allocate( ocean_temp_org(ia,ja,1+number_of_skip_tsteps:totaltimesteps ) )
584  allocate( ocean_sfc_temp_org(ia,ja,1+number_of_skip_tsteps:totaltimesteps ) )
585  allocate( ocean_sfc_albedo_org(ia,ja,2,1+number_of_skip_tsteps:totaltimesteps ) )
586  allocate( ocean_sfc_z0_org(ia,ja,1+number_of_skip_tsteps:totaltimesteps ) )
587 
588  if ( mdlid_land == igrads .and. ( number_of_files > 1 .or. basename_add_num ) ) then
589  write(num,'(I5.5)') lfn
590  basename_land = "_"//num
591  end if
592 
593  if ( mdlid_ocean == igrads ) then
594  basename_org = ""
595  end if
596 
597  !--- read external file
598  do n = 1, number_of_files
599 
600  if ( number_of_files > 1 .or. basename_add_num ) then
601  write(num,'(I5.5)') n-1
602  basename_ocean = trim(basename_org)//"_"//num
603  else
604  basename_ocean = trim(basename_org)
605  end if
606 
607  if( io_l ) write(io_fid_log,*) ' '
608  if( io_l ) write(io_fid_log,*) '+++ Target File Name (Ocean): ', trim(basename_ocean)
609  if( io_l ) write(io_fid_log,*) ' Time Steps in One File: ', number_of_tsteps
610 
611  ns = number_of_tsteps * (n - 1) + 1
612  ne = ns + (number_of_tsteps - 1)
613 
614  if ( ne <= number_of_skip_tsteps ) then
615  if( io_l ) write(io_fid_log,*) ' SKIP'
616  cycle
617  end if
618 
619  skip_steps = max(number_of_skip_tsteps - ns + 1, 0)
620  ns = max(ns, number_of_skip_tsteps+1)
621 
622  ! read all prepared data
623  call parentsurfaceinput( land_temp_org, &
624  land_water_org, &
625  land_sfc_temp_org, &
626  land_sfc_albedo_org, &
627  urban_tc_org, &
628  urban_qc_org, &
629  urban_uc_org, &
630  urban_sfc_temp_org, &
631  urban_sfc_albedo_org, &
632  ocean_temp_org(:,:,ns:ne), &
633  ocean_sfc_temp_org(:,:,ns:ne), &
634  ocean_sfc_albedo_org(:,:,:,ns:ne), &
635  ocean_sfc_z0_org(:,:,ns:ne), &
636  dens, &
637  momz, &
638  momx, &
639  momy, &
640  rhot, &
641  qtrc, &
642  basename_land, &
643  basename_ocean, &
644  mdlid_land, mdlid_ocean, &
645  ldims, odims, &
646  use_file_landwater, &
647  init_landwater_ratio, &
648  intrp_iter_max, &
649  soilwater_ds2vc_flag, &
650  elevation_collection, &
651  number_of_tsteps, &
652  skip_steps, lit )
653 
654  enddo
655 
656 
657  !--- input initial data
658  do j = 1, ja
659  do i = 1, ia
660  land_sfc_temp(i,j) = land_sfc_temp_org(i,j)
661  land_sfc_albedo(i,j,i_lw) = land_sfc_albedo_org(i,j,i_lw)
662  land_sfc_albedo(i,j,i_sw) = land_sfc_albedo_org(i,j,i_sw)
663  do k = 1, lkmax
664  land_temp(k,i,j) = land_temp_org(k,i,j)
665  land_water(k,i,j) = land_water_org(k,i,j)
666  end do
667 
668  urban_sfc_temp(i,j) = urban_sfc_temp_org(i,j)
669  urban_sfc_albedo(i,j,i_lw) = urban_sfc_albedo_org(i,j,i_lw)
670  urban_sfc_albedo(i,j,i_sw) = urban_sfc_albedo_org(i,j,i_sw)
671  do k = uks, uke
672  urban_trl(k,i,j) = urban_sfc_temp_org(i,j)
673  urban_tbl(k,i,j) = urban_sfc_temp_org(i,j)
674  urban_tgl(k,i,j) = urban_sfc_temp_org(i,j)
675  end do
676  urban_tc(i,j) = urban_tc_org(i,j)
677  urban_qc(i,j) = urban_qc_org(i,j)
678  urban_uc(i,j) = urban_uc_org(i,j)
679  urban_tr(i,j) = urban_sfc_temp_org(i,j)
680  urban_tb(i,j) = urban_sfc_temp_org(i,j)
681  urban_tg(i,j) = urban_sfc_temp_org(i,j)
682  urban_rainr(i,j) = 0.0_rp
683  urban_rainb(i,j) = 0.0_rp
684  urban_raing(i,j) = 0.0_rp
685  urban_roff(i,j) = 0.0_rp
686  enddo
687  enddo
688 
689 
690  ns = number_of_skip_tsteps + 1 ! skip first several data
691  do j = 1, ja
692  do i = 1, ia
693  ocean_temp(i,j) = ocean_temp_org(i,j,ns)
694  ocean_sfc_temp(i,j) = ocean_sfc_temp_org(i,j,ns)
695  ocean_sfc_albedo(i,j,i_lw) = ocean_sfc_albedo_org(i,j,i_lw,ns)
696  ocean_sfc_albedo(i,j,i_sw) = ocean_sfc_albedo_org(i,j,i_sw,ns)
697  ocean_sfc_z0m(i,j) = ocean_sfc_z0_org(i,j,ns)
698  ocean_sfc_z0h(i,j) = ocean_sfc_z0_org(i,j,ns)
699  ocean_sfc_z0e(i,j) = ocean_sfc_z0_org(i,j,ns)
700  enddo
701  enddo
702 
703  do j = 1, ja
704  do i = 1, ia
705  atmos_phy_sf_sfc_temp(i,j) = fact_ocean(i,j) * ocean_sfc_temp(i,j) &
706  + fact_land(i,j) * land_sfc_temp(i,j) &
707  + fact_urban(i,j) * urban_sfc_temp(i,j)
708  atmos_phy_sf_sfc_albedo(i,j,i_lw) = fact_ocean(i,j) * ocean_sfc_albedo(i,j,i_lw) &
709  + fact_land(i,j) * land_sfc_albedo(i,j,i_lw) &
710  + fact_urban(i,j) * urban_sfc_albedo(i,j,i_lw)
711  atmos_phy_sf_sfc_albedo(i,j,i_sw) = fact_ocean(i,j) * ocean_sfc_albedo(i,j,i_sw) &
712  + fact_land(i,j) * land_sfc_albedo(i,j,i_sw) &
713  + fact_urban(i,j) * urban_sfc_albedo(i,j,i_sw)
717  end do
718  end do
719 
720 
721  !--- output boundary data
722  totaltimesteps = totaltimesteps - number_of_skip_tsteps ! skip first several data
723  if ( totaltimesteps > 1 ) then
724  if ( boundary_update_dt <= 0.0_rp ) then
725  write(*,*) 'xxx BOUNDARY_UPDATE_DT is necessary in real case preprocess'
726  call prc_mpistop
727  endif
728 
729  call parentoceanboundary( ocean_temp_org(:,:,ns:ne), &
730  ocean_sfc_temp_org(:,:,ns:ne), &
731  ocean_sfc_albedo_org(:,:,:,ns:ne), &
732  ocean_sfc_z0_org(:,:,ns:ne), &
733  totaltimesteps, &
734  boundary_update_dt, &
735  basename_boundary, &
736  boundary_title )
737 
738  end if
739 
740  deallocate( ocean_temp_org )
741  deallocate( ocean_sfc_temp_org )
742  deallocate( ocean_sfc_albedo_org )
743  deallocate( ocean_sfc_z0_org )
744 
745  return
746  end subroutine realinput_surface
747 
748 
749  !-----------------------------------------------------------------------------
751  subroutine parentatomsetup( &
752  dims, &
753  timelen, &
754  mdlid, &
755  basename_org, &
756  filetype, &
757  use_file_density_in, &
758  serial_in )
759  use scale_external_io, only: &
760  iscale, &
761  iwrfarw, &
762  inicam, &
763  igrads
764  use mod_realinput_scale, only: &
766  use mod_realinput_wrfarw, only: &
768  use mod_realinput_nicam, only: &
770  use mod_realinput_grads, only: &
772  implicit none
773 
774  integer, intent(out) :: dims(6)
775  integer, intent(out) :: timelen
776  integer, intent(out) :: mdlid
777  character(len=*), intent(in) :: basename_org
778  character(len=*), intent(in) :: filetype
779  logical, intent(in) :: serial_in ! read by a serial process
780  logical, intent(in) :: use_file_density_in ! use density data from files
781 
782  !---------------------------------------------------------------------------
783 
784  if( io_l ) write(io_fid_log,*)
785  if( io_l ) write(io_fid_log,*) '+++ ScaleLib/IO[RealinputAtmos]/Categ[Setup]'
786 
787  serial = serial_in
788  if( serial ) then
789  if( prc_ismaster ) then
790  do_read_atom = .true.
791  else
792  do_read_atom = .false.
793  endif
794  else
795  do_read_atom = .true.
796  endif
797 
798  select case(trim(filetype))
799  case('SCALE-RM')
800 
801  mdlid = iscale
802  do_read_atom = .true.
803  serial = .false.
804  call parentatomsetupscale( dims ) ! (out)
805  update_coord = .false.
806  use_file_density = use_file_density_in
807  use_temp = .false.
808  rotate = .false.
809  timelen = -1
810 
811  case('WRF-ARW')
812 
813  mdlid = iwrfarw
814  if ( do_read_atom ) call parentatomsetupwrfarw( dims, timelen, & ! (out)
815  basename_org ) ! (in)
816  update_coord = .true.
817  use_file_density = .false.
818  use_temp = .true.
819  rotate = .true.
820 
821  case('NICAM-NETCDF')
822 
823  mdlid = inicam
824  if ( do_read_atom ) call parentatomsetupnicam( dims, timelen, & ! (out)
825  basename_org ) ! (in)
826  update_coord = .false.
827  use_file_density = .false.
828  use_temp = .true.
829  rotate = .true.
830 
831  case('GrADS')
832 
833  mdlid = igrads
834  if ( do_read_atom ) call parentatomsetupgrads( dims, & ! (out)
835  basename_org ) ! (in)
836  update_coord = .true.
837  use_file_density = .false.
838  use_temp = .true.
839  rotate = .true.
840  timelen = -1
841 
842  case default
843 
844  write(*,*) ' xxx Unsupported FILE TYPE:', trim(filetype)
845  call prc_mpistop
846 
847  endselect
848 
849  if( serial ) then
850  call comm_bcast( dims(:), 6 )
851  call comm_bcast( timelen )
852  endif
853 
854  if( io_l ) write(io_fid_log,*) '+++ Horizontal Interpolation Level:', &
856  itp_nh = int( nest_interp_level )
857  itp_nv = 2
858 
859  allocate( hfact( ia, ja, itp_nh ) )
860  allocate( vfact( ka, ia, ja, itp_nh, itp_nv ) )
861  allocate( igrd( ia, ja, itp_nh ) )
862  allocate( jgrd( ia, ja, itp_nh ) )
863  allocate( kgrd( ka, ia, ja, itp_nh, itp_nv ) )
864  allocate( ncopy( ia, ja, itp_nh ) )
865 
866  allocate( lon_org( dims(2), dims(3) ) )
867  allocate( lat_org( dims(2), dims(3) ) )
868  allocate( cz_org( dims(1)+2, dims(2), dims(3) ) )
869 
870  allocate( velz_org( dims(1)+2, dims(2), dims(3) ) )
871  allocate( velx_org( dims(1)+2, dims(2), dims(3) ) )
872  allocate( vely_org( dims(1)+2, dims(2), dims(3) ) )
873  allocate( pott_org( dims(1)+2, dims(2), dims(3) ) )
874  allocate( temp_org( dims(1)+2, dims(2), dims(3) ) )
875  allocate( pres_org( dims(1)+2, dims(2), dims(3) ) )
876  allocate( qtrc_org( dims(1)+2, dims(2), dims(3), qa ) )
877  allocate( dens_org( dims(1)+2, dims(2), dims(3) ) )
878 
879  return
880  end subroutine parentatomsetup
881 
882  !-----------------------------------------------------------------------------
884  subroutine parentatominput( &
885  dens, &
886  momz, &
887  momx, &
888  momy, &
889  rhot, &
890  qtrc, &
891  basename_org, &
892  dims, &
893  mdlid, &
894  flg_bin, &
895  flg_intrp, &
896  mptype_parent, &
897  timelen, &
898  skiplen )
899  use scale_comm, only: &
900  comm_vars8, &
901  comm_wait
902  use scale_gridtrans, only: &
903  rotc => gtrans_rotc
904  use scale_atmos_thermodyn, only: &
905  thermodyn_pott => atmos_thermodyn_pott
906  use scale_atmos_hydrostatic, only: &
907  hydrostatic_buildrho_real => atmos_hydrostatic_buildrho_real
908  use scale_interpolation_nest, only: &
912  use mod_realinput_scale, only: &
915  use mod_realinput_wrfarw, only: &
918  use mod_realinput_nicam, only: &
921  use mod_realinput_grads, only: &
924  implicit none
925 
926  real(RP), intent(out) :: dens(:,:,:,:)
927  real(RP), intent(out) :: momz(:,:,:,:)
928  real(RP), intent(out) :: momx(:,:,:,:)
929  real(RP), intent(out) :: momy(:,:,:,:)
930  real(RP), intent(out) :: rhot(:,:,:,:)
931  real(RP), intent(out) :: qtrc(:,:,:,:,:)
932  character(len=*), intent(in) :: basename_org
933  integer, intent(in) :: dims(6)
934  integer, intent(in) :: mdlid ! model type id
935  logical, intent(in) :: flg_bin ! flag for SBM(S10) is used or not 0-> not used, 1-> used
936  logical, intent(in) :: flg_intrp ! flag for interpolation of SBM(S10) from outer bulk-MP model
937  integer, intent(in) :: mptype_parent ! microphysics type of the parent model (number of classes)
938  integer, intent(in) :: timelen ! time steps in one file
939  integer, intent(in) :: skiplen ! skip steps
940 
941  real(RP) :: velz (ka,ia,ja)
942  real(RP) :: velx (ka,ia,ja)
943  real(RP) :: vely (ka,ia,ja)
944  real(RP) :: llvelx(ka,ia,ja)
945  real(RP) :: llvely(ka,ia,ja)
946  real(RP) :: work (ka,ia,ja)
947  real(RP) :: pott (ka,ia,ja)
948  real(RP) :: temp (ka,ia,ja)
949  real(RP) :: pres (ka,ia,ja)
950 
951  real(RP) :: qc(ka,ia,ja)
952 
953  integer :: k, i, j, iq
954  integer :: n, nn
955  character(len=H_SHORT) :: mptype_run
956  !---------------------------------------------------------------------------
957 
958  if( io_l ) write(io_fid_log,*)
959  if( io_l ) write(io_fid_log,*) '+++ ScaleLib/IO[RealinputAtmos]/Categ[Input]'
960 
961  select case (tracer_type)
962  case ("DRY")
963  mptype_run = 'dry'
964  case ("KESSLER")
965  mptype_run = 'single'
966  case ("TOMITA08")
967  mptype_run = 'single'
968  case ("SN14")
969  mptype_run = 'double'
970  case ("SUZUKI10")
971  mptype_run = 'single-bin'
972  case default
973  write(*,*) 'xxx Unsupported TRACER_TYPE (', trim(tracer_type), '). Check!'
974  call prc_mpistop
975  end select
976 
977 
978  if ( do_read_atom ) then
979 
980  select case ( mdlid )
981  case ( iscale ) ! TYPE: SCALE-RM
982 
983  call parentatomopenscale( lon_org, lat_org, & ! (out)
984  cz_org, & ! (out)
985  basename_org, & ! (in)
986  dims ) ! (in)
987 
988  case ( iwrfarw ) ! TYPE: WRF-ARW
989 
991 
992  case ( inicam ) ! TYPE: NICAM-NETCDF
993 
994  call parentatomopennicam( lon_org, lat_org, & ! (out)
995  cz_org, & ! (out)
996  basename_org, & ! (in)
997  dims ) ! (in)
998 
999  case ( igrads ) ! TYPE: GrADS format
1000 
1001  call parentatomopengrads
1002 
1003  end select
1004 
1005  end if
1006 
1007  do n = skiplen+1, timelen
1008  nn = n - skiplen
1009 
1010  if ( do_read_atom ) then
1011 
1012  select case ( mdlid )
1013  case ( iscale ) ! TYPE: SCALE-RM
1014 
1015  call parentatominputscale( velz_org, velx_org, vely_org, & ! (out)
1016  pres_org, dens_org, pott_org, & ! (out)
1017  qtrc_org, & ! (out)
1018  flg_bin, flg_intrp, & ! (in)
1019  basename_org, mptype_parent, & ! (in)
1020  dims, n ) ! (in)
1021 
1022  case ( iwrfarw ) ! TYPE: WRF-ARW
1023 
1024  call parentatominputwrfarw( velz_org, velx_org, vely_org, & ! (out)
1025  pres_org, temp_org, qtrc_org, & ! (out)
1026  lon_org, lat_org, cz_org, & ! (out)
1027  basename_org, mptype_parent, & ! (in)
1028  dims, n ) ! (in)
1029 
1030  case ( inicam ) ! TYPE: NICAM-NETCDF
1031 
1032  call parentatominputnicam( velz_org, velx_org, vely_org, & ! (out)
1033  pres_org, temp_org, qtrc_org, & ! (out)
1034  basename_org, dims, n ) ! (in)
1035 
1036  case ( igrads ) ! TYPE: GrADS format
1037 
1038  call parentatominputgrads( velz_org, velx_org, vely_org, & ! (out)
1039  pres_org, temp_org, qtrc_org, & ! (out)
1040  lon_org, lat_org, cz_org, & ! (out)
1041  basename_org, dims, n ) ! (in)
1042 
1043  end select
1044 
1045  if ( use_temp ) then
1046  do j = 1, dims(3)
1047  do i = 1, dims(2)
1048  do k = 1, dims(1)+2
1049  call thermodyn_pott( pott_org(k,i,j), & ! [OUT]
1050  temp_org(k,i,j), & ! [IN]
1051  pres_org(k,i,j), & ! [IN]
1052  qtrc_org(k,i,j,:) ) ! [IN]
1053  end do
1054  end do
1055  end do
1056  end if
1057 
1058  end if
1059 
1060  if ( serial ) then
1061  call comm_bcast( velz_org, dims(1)+2, dims(2), dims(3) )
1062  call comm_bcast( velx_org, dims(1)+2, dims(2), dims(3) )
1063  call comm_bcast( vely_org, dims(1)+2, dims(2), dims(3) )
1064  call comm_bcast( pott_org, dims(1)+2, dims(2), dims(3) )
1065  call comm_bcast( qtrc_org, dims(1)+2, dims(2), dims(3), qa )
1066  if ( use_file_density ) then
1067  call comm_bcast( dens_org, dims(1)+2, dims(2), dims(3) )
1068  else
1069  call comm_bcast( pres_org, dims(1)+2, dims(2), dims(3) )
1070  end if
1071 
1072  if ( first .or. update_coord ) then
1073 
1074  call comm_bcast( lon_org, dims(2), dims(3) )
1075  call comm_bcast( lat_org, dims(2), dims(3) )
1076  call comm_bcast( cz_org, dims(1)+2, dims(2), dims(3) )
1077 
1078  end if
1079 
1080  end if
1081 
1082  if ( first .or. update_coord ) then
1083 
1084  call intrpnest_domain_compatibility( lon_org(:,:), lat_org(:,:), cz_org(:,:,:), &
1085  lon(:,:), lat(:,:), cz(ks:ke,:,:) )
1086 
1087  ! full level
1088  call intrpnest_interp_fact_llz( hfact, vfact, & ! [OUT]
1089  kgrd, igrd, jgrd, & ! [OUT]
1090  ncopy, & ! [OUT]
1091  cz, lat, lon, & ! [IN]
1092  ks, ke, ia, ja, & ! [IN]
1093  cz_org, lat_org, lon_org, & ! [IN]
1094  dims(1)+2, dims(2), dims(3) ) ! [IN]
1095 
1096  end if
1097 
1098  call intrpnest_interp_3d( velz(:,:,:), &
1099  velz_org(:,:,:), &
1100  hfact(:,:,:), &
1101  vfact(:,:,:,:,:), &
1102  kgrd(:,:,:,:,:), &
1103  igrd(:,:,:), &
1104  jgrd(:,:,:), &
1105  ia, ja, ks, ke-1 )
1106 
1107  call intrpnest_interp_3d( llvelx(:,:,:), &
1108  velx_org(:,:,:), &
1109  hfact(:,:,:), &
1110  vfact(:,:,:,:,:), &
1111  kgrd(:,:,:,:,:), &
1112  igrd(:,:,:), &
1113  jgrd(:,:,:), &
1114  ia, ja, ks, ke )
1115 
1116  call intrpnest_interp_3d( llvely(:,:,:), &
1117  vely_org(:,:,:), &
1118  hfact(:,:,:), &
1119  vfact(:,:,:,:,:), &
1120  kgrd(:,:,:,:,:), &
1121  igrd(:,:,:), &
1122  jgrd(:,:,:), &
1123  ia, ja, ks, ke )
1124 
1125  if ( rotate ) then
1126  ! convert from latlon coordinate to local mapping (x)
1127  do j = 1, ja
1128  do i = 1, ia
1129  do k = ks, ke
1130  work(k,i,j) = llvelx(k,i,j) * rotc(i,j,cosin) + llvely(k,i,j) * rotc(i,j,sine )
1131  end do
1132  end do
1133  end do
1134 
1135  ! from scalar point to staggered point
1136  do j = 1, ja
1137  do i = 1, ia-1
1138  do k = ks, ke
1139  velx(k,i,j) = ( work(k,i+1,j) + work(k,i,j) ) * 0.5_rp
1140  end do
1141  end do
1142  end do
1143  do j = 1, ja
1144  do k = ks, ke
1145  velx(k,ia,j) = work(k,ia,j)
1146  end do
1147  end do
1148  velx(ks-1,:,:) = 0.0_rp
1149  velx(ks-2,:,:) = 0.0_rp
1150  call comm_vars8( velx(:,:,:), 1 )
1151  call comm_wait ( velx(:,:,:), 1, .false. )
1152 
1153  ! convert from latlon coordinate to local mapping (y)
1154  do j = 1, ja
1155  do i = 1, ia
1156  do k = ks, ke
1157  work(k,i,j) = - llvelx(k,i,j) * rotc(i,j,sine ) + llvely(k,i,j) * rotc(i,j,cosin)
1158  end do
1159  end do
1160  end do
1161 
1162  do j = 1, ja-1
1163  do i = 1, ia
1164  do k = ks, ke
1165  vely(k,i,j) = ( work(k,i,j+1) + work(k,i,j) ) * 0.5_rp
1166  end do
1167  end do
1168  end do
1169  do i = 1, ia
1170  do k = ks, ke
1171  vely(k,i,ja) = work(k,i,ja)
1172  end do
1173  end do
1174  vely(ks-1,:,:) = 0.0_rp
1175  vely(ks-2,:,:) = 0.0_rp
1176  call comm_vars8( vely(:,:,:), 1 )
1177  call comm_wait ( vely(:,:,:), 1, .false. )
1178 
1179  else
1180  velx = llvelx
1181  vely = llvely
1182  end if
1183 
1184  if( trim(mptype_run)=='double' .and. mptype_parent <= 6 )then
1185  if( io_l ) write(io_fid_log,*) '--- Diagnose Number Concentration from Mixing Ratio'
1186  call diagnose_number_concentration( qtrc_org(:,:,:,:) ) ! [inout]
1187  endif
1188 
1189  do j = 1, dims(3)
1190  do i = 1, dims(2)
1191  do k = 1, dims(1)+2
1192  do iq = 1, qa
1193  qtrc_org(k,i,j,iq) = max( qtrc_org(k,i,j,iq), 0.0_rp )
1194  end do
1195  end do
1196  end do
1197  end do
1198 
1199  call intrpnest_interp_3d( pott(:,:,:), &
1200  pott_org(:,:,:), &
1201  hfact(:,:,:), &
1202  vfact(:,:,:,:,:), &
1203  kgrd(:,:,:,:,:), &
1204  igrd(:,:,:), &
1205  jgrd(:,:,:), &
1206  ia, ja, ks, ke )
1207 
1208  do iq = 1, qa
1209  call intrpnest_interp_3d( qtrc(:,:,:,iq,nn), &
1210  qtrc_org(:,:,:,iq), &
1211  hfact(:,:,:), &
1212  vfact(:,:,:,:,:), &
1213  kgrd(:,:,:,:,:), &
1214  igrd(:,:,:), &
1215  jgrd(:,:,:), &
1216  ia, ja, ks, ke )
1217  end do
1218 
1219  if( use_file_density ) then
1220  ! use logarithmic density to interpolate more accurately
1221 
1222  dens_org = log( dens_org )
1223  call intrpnest_interp_3d( dens(:,:,:,nn), &
1224  dens_org(:,:,:), &
1225  hfact(:,:,:), &
1226  vfact(:,:,:,:,:), &
1227  kgrd(:,:,:,:,:), &
1228  igrd(:,:,:), &
1229  jgrd(:,:,:), &
1230  ia, ja, ks, ke, &
1231  logwegt=.true. )
1232  else
1233 
1234  pres_org = log( pres_org )
1235  call intrpnest_interp_3d( pres(:,:,:), &
1236  pres_org(:,:,:), &
1237  hfact(:,:,:), &
1238  vfact(:,:,:,:,:), &
1239  kgrd(:,:,:,:,:), &
1240  igrd(:,:,:), &
1241  jgrd(:,:,:), &
1242  ia, ja, ks, ke, &
1243  logwegt=.true. )
1244 
1245 #ifdef DRY
1246  qc = 0.0_rp
1247 #else
1248  qc = 0.0_rp
1249  if ( i_qc > 0 ) then
1250  do iq = qws, qwe
1251  qc(:,:,:) = qc(:,:,:) + qtrc(:,:,:,iq,nn)
1252  enddo
1253  end if
1254 #endif
1255  ! make density & pressure profile in moist condition
1256  call hydrostatic_buildrho_real( dens(:,:,:,nn), & ! [OUT]
1257  temp(:,:,:), & ! [OUT]
1258  pres(:,:,:), & ! [INOUT]
1259  pott(:,:,:), & ! [IN]
1260  qtrc(:,:,:,i_qv,nn), & ! [IN]
1261  qc(:,:,:) ) ! [IN]
1262 
1263  call comm_vars8( dens(:,:,:,nn), 1 )
1264  call comm_wait ( dens(:,:,:,nn), 1 )
1265 
1266  end if
1267 
1268 
1269  do j = 1, ja
1270  do i = 1, ia
1271  do k = ks, ke-1
1272  momz(k,i,j,nn) = velz(k,i,j) * ( dens(k+1,i,j,nn) + dens(k,i,j,nn) ) * 0.5_rp
1273  end do
1274  end do
1275  end do
1276  do j = 1, ja
1277  do i = 1, ia
1278  momz(ke,i,j,nn) = 0.0_rp
1279  end do
1280  end do
1281  do j = 1, ja
1282  do i = 1, ia
1283  do k = ks, ke
1284  rhot(k,i,j,nn) = pott(k,i,j) * dens(k,i,j,nn)
1285  end do
1286  end do
1287  end do
1288  do j = 1, ja
1289  do i = 1, ia-1
1290  do k = ks, ke
1291  momx(k,i,j,nn) = velx(k,i,j) * ( dens(k,i+1,j,nn) + dens(k,i,j,nn) ) * 0.5_rp
1292  end do
1293  end do
1294  end do
1295  do j = 1, ja
1296  do k = ks, ke
1297  momx(k,ia,j,nn) = velx(k,ia,j) * dens(k,ia,j,nn)
1298  end do
1299  end do
1300  call comm_vars8( momx(:,:,:,nn), 1 )
1301 
1302  do j = 1, ja-1
1303  do i = 1, ia
1304  do k = ks, ke
1305  momy(k,i,j,nn) = vely(k,i,j) * ( dens(k,i,j+1,nn) + dens(k,i,j,nn) ) * 0.5_rp
1306  end do
1307  end do
1308  end do
1309  do i = 1, ia
1310  do k = ks, ke
1311  momy(k,i,ja,nn) = vely(k,i,ja) * dens(k,i,ja,nn)
1312  end do
1313  end do
1314  call comm_vars8( momy(:,:,:,nn), 2 )
1315 
1316  call comm_wait ( momx(:,:,:,nn), 1, .false. )
1317  call comm_wait ( momy(:,:,:,nn), 2, .false. )
1318 
1319  end do
1320 
1321  first = .false.
1322 
1323  return
1324  end subroutine parentatominput
1325 
1326  !-----------------------------------------------------------------------------
1328  subroutine parentatomboundary( &
1329  dens, &
1330  momz, &
1331  momx, &
1332  momy, &
1333  rhot, &
1334  qtrc, &
1335  numsteps, &
1336  update_dt, &
1337  basename, &
1338  title )
1339  use scale_comm, only: &
1340  comm_vars, &
1341  comm_wait
1342  use scale_fileio, only: &
1343  fileio_write
1344  use scale_time, only: &
1345  time_nowdate
1346  implicit none
1347 
1348  real(RP), intent(in) :: dens(:,:,:,:)
1349  real(RP), intent(in) :: momz(:,:,:,:)
1350  real(RP), intent(in) :: momx(:,:,:,:)
1351  real(RP), intent(in) :: momy(:,:,:,:)
1352  real(RP), intent(in) :: rhot(:,:,:,:)
1353  real(RP), intent(in) :: qtrc(:,:,:,:,:)
1354  real(RP), intent(in) :: update_dt
1355  character(len=*), intent(in) :: basename
1356  character(len=*), intent(in) :: title
1357  integer, intent(in) :: numsteps ! total time steps
1358 
1359  character(len=H_MID) :: atmos_boundary_out_dtype = 'DEFAULT'
1360  real(RP), allocatable :: buffer(:,:,:,:)
1361  integer :: nowdate(6)
1362 
1363  integer :: k, i, j, n, iq
1364  integer :: ts, te
1365  !---------------------------------------------------------------------------
1366 
1367  ts = 1
1368  te = numsteps
1369 
1370  nowdate = time_nowdate
1371  nowdate(1) = nowdate(1)
1372 
1373  allocate( buffer(ka,ia,ja,te-ts+1) )
1374 
1375  if( io_l ) write(io_fid_log,*)
1376  if( io_l ) write(io_fid_log,*) '+++ ScaleLib/IO[RealinputAtmos]/Categ[Boundary]'
1377 
1378  call fileio_write( dens(:,:,:,ts:te), basename, title, &
1379  'DENS', 'Reference Density', 'kg/m3', 'ZXYT', &
1380  atmos_boundary_out_dtype, update_dt, nowdate )
1381 
1382  do n = ts, te
1383  do j = 1, ja
1384  do i = 1, ia
1385  do k = ks, ke
1386  buffer(k,i,j,n-ts+1) = 2.0_rp * momz(k,i,j,n) / ( dens(k+1,i,j,n) + dens(k,i,j,n) )
1387  end do
1388  end do
1389  end do
1390  end do
1391  call fileio_write( buffer, basename, title, &
1392  'VELZ', 'Reference VELZ', 'm/s', 'ZXYT', &
1393  atmos_boundary_out_dtype, update_dt, nowdate )
1394 
1395  do n = ts, te
1396  do j = 1, ja
1397  do i = 1, ia-1
1398  do k = ks, ke
1399  buffer(k,i,j,n-ts+1) = 2.0_rp * momx(k,i,j,n) / ( dens(k,i+1,j,n) + dens(k,i,j,n) )
1400  end do
1401  end do
1402  end do
1403  end do
1404  do n = ts, te
1405  buffer(:,ia,:,n-ts+1) = buffer(:,ia-1,:,n-ts+1)
1406  end do
1407  call fileio_write( buffer, basename, title, &
1408  'VELX', 'Reference VELX', 'm/s', 'ZXYT', &
1409  atmos_boundary_out_dtype, update_dt, nowdate )
1410 
1411  do n = ts, te
1412  do j = 1, ja-1
1413  do i = 1, ia
1414  do k = ks, ke
1415  buffer(k,i,j,n-ts+1) = 2.0_rp * momy(k,i,j,n) / ( dens(k,i,j+1,n) + dens(k,i,j,n) )
1416  end do
1417  end do
1418  end do
1419  end do
1420  do n = ts, te
1421  buffer(:,:,ja,n-ts+1) = buffer(:,:,ja-1,n-ts+1)
1422  end do
1423  call fileio_write( buffer, basename, title, &
1424  'VELY', 'Reference VELY', 'm/s', 'ZXYT', &
1425  atmos_boundary_out_dtype, update_dt, nowdate )
1426 
1427  do n = ts, te
1428  do j = 1, ja
1429  do i = 1, ia
1430  do k = ks, ke
1431  buffer(k,i,j,n-ts+1) = rhot(k,i,j,n) / dens(k,i,j,n)
1432  end do
1433  end do
1434  end do
1435  end do
1436  call fileio_write( buffer, basename, title, &
1437  'POTT', 'Reference PT', 'K', 'ZXYT', &
1438  atmos_boundary_out_dtype, update_dt, nowdate )
1439 
1440  do iq = 1, qa
1441  do n = ts, te
1442  do j = 1, ja
1443  do i = 1, ia
1444  do k = ks, ke
1445  buffer(k,i,j,n-ts+1) = qtrc(k,i,j,iq,n)
1446  end do
1447  end do
1448  end do
1449  end do
1450  call fileio_write( buffer, basename, title, &
1451  aq_name(iq), 'Reference '//trim(aq_name(iq)), aq_unit(iq), 'ZXYT', &
1452  atmos_boundary_out_dtype, update_dt, nowdate )
1453  end do
1454 
1455  deallocate( buffer )
1456 
1457  return
1458  end subroutine parentatomboundary
1459 
1460  !-----------------------------------------------------------------------------
1462  subroutine parentsurfacesetup( &
1463  ldims, odims, &
1464  lmdlid, omdlid, &
1465  timelen, &
1466  basename_land, &
1467  basename_ocean, &
1468  filetype_land, &
1469  filetype_ocean, &
1470  use_file_landwater, &
1471  intrp_land_temp, &
1472  intrp_land_water, &
1473  intrp_land_sfc_temp, &
1474  intrp_ocean_temp, &
1475  intrp_ocean_sfc_temp )
1476  use scale_external_io, only: &
1477  iscale, &
1478  iwrfarw, &
1479  inicam, &
1480  igrads
1481  use mod_realinput_scale, only: &
1484  use mod_realinput_wrfarw, only: &
1487  use mod_realinput_nicam, only: &
1490  use mod_realinput_grads, only: &
1493  implicit none
1494 
1495  integer, intent(out) :: ldims(3) ! dims for land
1496  integer, intent(out) :: odims(2) ! dims for ocean
1497  integer, intent(out) :: lmdlid ! model id for land
1498  integer, intent(out) :: omdlid ! model id for ocean
1499  integer, intent(out) :: timelen ! number of time steps in ocean file
1500  character(len=*), intent(in) :: basename_land
1501  character(len=*), intent(in) :: basename_ocean
1502  character(len=*), intent(in) :: filetype_land
1503  character(len=*), intent(in) :: filetype_ocean
1504  logical, intent(in) :: use_file_landwater ! use land water data from files
1505  character(len=*), intent(in) :: intrp_land_temp
1506  character(len=*), intent(in) :: intrp_land_water
1507  character(len=*), intent(in) :: intrp_land_sfc_temp
1508  character(len=*), intent(in) :: intrp_ocean_temp
1509  character(len=*), intent(in) :: intrp_ocean_sfc_temp
1510  !---------------------------------------------------------------------------
1511 
1512  if( io_l ) write(io_fid_log,*)
1513  if( io_l ) write(io_fid_log,*) '+++ ScaleLib/IO[RealinputSurface]/Categ[Setup]'
1514 
1515  ! Land
1516 
1517  if( lkmax < 4 )then
1518  write(*,*) 'xxx LKMAX less than 4: ', lkmax
1519  write(*,*) 'xxx in Real Case, LKMAX should be set more than 4'
1520  call prc_mpistop
1521  endif
1522 
1523  if( serial_land ) then
1524  if( prc_ismaster ) then
1525  do_read_land = .true.
1526  else
1527  do_read_land = .false.
1528  endif
1529  else
1530  do_read_land = .true.
1531  endif
1532 
1533  select case(trim(filetype_land))
1534  case('SCALE-RM')
1535 
1536  lmdlid = iscale
1537  serial_land = .false.
1538  do_read_land = .true.
1539  call parentlandsetupscale( ldims ) ! (out)
1540  use_waterratio = .false.
1541 
1542  case('WRF-ARW')
1543 
1544  lmdlid = iwrfarw
1545  if ( do_read_land ) call parentlandsetupwrfarw( ldims, & ! (out)
1546  basename_land ) ! (in)
1547  use_waterratio = .true.
1548 
1549  case('NICAM-NETCDF')
1550 
1551  lmdlid = inicam
1552  if ( do_read_land ) call parentlandsetupnicam( ldims, & ! (out)
1553  basename_land ) ! (in)
1554  use_waterratio = .false.
1555 
1556  case('GrADS')
1557 
1558  lmdlid = igrads
1559  if ( do_read_land ) call parentlandsetupgrads( ldims, & ! (out)
1560  use_waterratio, & ! (out)
1561  use_file_landwater, & ! (in)
1562  basename_land ) ! (in)
1563 
1564  case default
1565 
1566  write(*,*) ' xxx Unsupported FILE TYPE:', trim(filetype_land)
1567  call prc_mpistop
1568 
1569  endselect
1570 
1571  if( serial_land ) then
1572  call comm_bcast( ldims(:), 3 )
1573  call comm_bcast( use_waterratio )
1574  endif
1575 
1576 
1577  select case ( intrp_land_temp )
1578  case ( 'off' )
1579  i_intrp_land_temp = i_intrp_off
1580  case ( 'mask' )
1581  i_intrp_land_temp = i_intrp_mask
1582  case ( 'fill' )
1583  i_intrp_land_temp = i_intrp_fill
1584  case default
1585  write(*,*) 'xxx INTRP_LAND_TEMP is invalid. ', intrp_land_temp
1586  call prc_mpistop
1587  end select
1588  select case ( intrp_land_sfc_temp )
1589  case ( 'off' )
1590  i_intrp_land_sfc_temp = i_intrp_off
1591  case ( 'mask' )
1592  i_intrp_land_sfc_temp = i_intrp_mask
1593  case ( 'fill' )
1594  i_intrp_land_sfc_temp = i_intrp_fill
1595  case default
1596  write(*,*) 'xxx INTRP_LAND_SFC_TEMP is invalid. ', intrp_land_sfc_temp
1597  call prc_mpistop
1598  end select
1599  select case ( intrp_land_water )
1600  case ( 'off' )
1601  i_intrp_land_water = i_intrp_off
1602  case ( 'mask' )
1603  i_intrp_land_water = i_intrp_mask
1604  case ( 'fill' )
1605  i_intrp_land_water = i_intrp_fill
1606  case default
1607  write(*,*) 'xxx INTRP_LAND_WATER is invalid. ', intrp_land_water
1608  call prc_mpistop
1609  end select
1610 
1611  select case ( lmdlid )
1612  case ( iscale, iwrfarw, inicam )
1613  i_intrp_land_temp = i_intrp_mask
1614  i_intrp_land_sfc_temp = i_intrp_mask
1615  i_intrp_land_water = i_intrp_mask
1616  end select
1617 
1618 
1619  ! Ocean
1620 
1621  if( serial_ocean ) then
1622  if( prc_ismaster ) then
1623  do_read_ocean = .true.
1624  else
1625  do_read_ocean = .false.
1626  endif
1627  else
1628  do_read_ocean = .true.
1629  endif
1630 
1631  select case(trim(filetype_ocean))
1632  case('SCALE-RM')
1633 
1634  timelen = -1
1635  omdlid = iscale
1636  serial_ocean = .false.
1637  do_read_ocean = .true.
1638  call parentoceansetupscale( odims )
1639  update_coord = .false.
1640 
1641  case('WRF-ARW')
1642 
1643  omdlid = iwrfarw
1644  if ( do_read_ocean ) call parentoceansetupwrfarw( odims, timelen, & ! (out)
1645  basename_ocean ) ! (in)
1646  update_coord = .true.
1647 
1648  case('NICAM-NETCDF')
1649 
1650  omdlid = inicam
1651  if ( do_read_ocean ) call parentoceansetupnicam( odims, timelen, & ! (out)
1652  basename_ocean ) ! (in)
1653  update_coord = .false.
1654 
1655  case('GrADS')
1656 
1657  omdlid = igrads
1658  if ( do_read_ocean ) call parentoceansetupgrads( odims, timelen, & ! (out)
1659  basename_ocean ) ! (out)
1660  update_coord = .false.
1661 
1662  case default
1663 
1664  write(*,*) ' xxx Unsupported FILE TYPE:', trim(filetype_ocean)
1665  call prc_mpistop
1666 
1667  endselect
1668 
1669  if( serial_ocean ) then
1670  call comm_bcast( odims(:), 2 )
1671  call comm_bcast( timelen )
1672  endif
1673 
1674 
1675  select case ( intrp_ocean_temp )
1676  case ( 'off' )
1677  i_intrp_ocean_temp = i_intrp_off
1678  case ( 'mask' )
1679  i_intrp_ocean_temp = i_intrp_mask
1680  case ( 'fill' )
1681  i_intrp_ocean_temp = i_intrp_fill
1682  case default
1683  write(*,*) 'xxx INTRP_OCEAN_TEMP is invalid. ', intrp_ocean_temp
1684  call prc_mpistop
1685  end select
1686  select case ( intrp_ocean_sfc_temp )
1687  case ( 'off' )
1688  i_intrp_ocean_sfc_temp = i_intrp_off
1689  case ( 'mask' )
1690  i_intrp_ocean_sfc_temp = i_intrp_mask
1691  case ( 'fill' )
1692  i_intrp_ocean_sfc_temp = i_intrp_fill
1693  case default
1694  write(*,*) 'xxx INTRP_OCEAN_SFC_TEMP is invalid. ', intrp_ocean_sfc_temp
1695  call prc_mpistop
1696  end select
1697 
1698  select case ( omdlid )
1699  case ( iscale, iwrfarw, inicam )
1700  i_intrp_ocean_temp = i_intrp_mask
1701  i_intrp_ocean_sfc_temp = i_intrp_mask
1702  end select
1703 
1704 
1705  allocate( tw_org( odims(1), odims(2) ) )
1706  allocate( sst_org( odims(1), odims(2) ) )
1707  allocate( albw_org( odims(1), odims(2), 2 ) )
1708  allocate( olon_org( odims(1), odims(2) ) )
1709  allocate( olat_org( odims(1), odims(2) ) )
1710  allocate( omask_org( odims(1), odims(2) ) )
1711 
1712  first = .true.
1713 
1714  return
1715  end subroutine parentsurfacesetup
1716 
1717  !-----------------------------------------------------------------------------
1719  subroutine parentsurfaceinput( &
1720  tg, &
1721  strg, &
1722  lst, &
1723  albg, &
1724  tc_urb, &
1725  qc_urb, &
1726  uc_urb, &
1727  ust, &
1728  albu, &
1729  tw, &
1730  sst, &
1731  albw, &
1732  z0w, &
1733  DENS, &
1734  MOMZ, &
1735  MOMX, &
1736  MOMY, &
1737  RHOT, &
1738  QTRC, &
1739  basename_land, &
1740  basename_ocean, &
1741  mdlid_land, &
1742  mdlid_ocean, &
1743  ldims, &
1744  odims, &
1745  use_file_landwater, &
1746  init_landwater_ratio, &
1747  intrp_iter_max, &
1748  soilwater_ds2vc_flag, &
1749  elevation_collection, &
1750  timelen, &
1751  skiplen, &
1752  lit )
1753  use scale_comm, only: &
1754  comm_bcast, &
1755  comm_vars8, &
1756  comm_wait
1757  use scale_const, only: &
1758  eps => const_eps, &
1759  undef => const_undef, &
1760  i_sw => const_i_sw, &
1761  i_lw => const_i_lw
1762  use scale_interpolation_nest, only: &
1765  use scale_land_grid, only: &
1766  lcz => grid_lcz
1767  use scale_atmos_thermodyn, only: &
1768  thermodyn_temp_pres => atmos_thermodyn_temp_pres
1769  use scale_landuse, only: &
1770  lsmask_nest => landuse_frac_land
1771  use mod_realinput_scale, only: &
1775  use mod_realinput_wrfarw, only: &
1779  use mod_realinput_nicam, only: &
1783  use mod_realinput_grads, only: &
1787  implicit none
1788 
1789  real(RP), intent(inout) :: tg(lkmax,ia,ja)
1790  real(RP), intent(inout) :: strg(lkmax,ia,ja)
1791  real(RP), intent(inout) :: lst(ia,ja)
1792  real(RP), intent(inout) :: albg(ia,ja,2)
1793  real(RP), intent(inout) :: tc_urb(ia,ja)
1794  real(RP), intent(inout) :: qc_urb(ia,ja)
1795  real(RP), intent(inout) :: uc_urb(ia,ja)
1796  real(RP), intent(inout) :: ust(ia,ja)
1797  real(RP), intent(inout) :: albu(ia,ja,2)
1798  real(RP), intent(out) :: tw(:,:,:)
1799  real(RP), intent(out) :: sst(:,:,:)
1800  real(RP), intent(out) :: albw(:,:,:,:)
1801  real(RP), intent(out) :: z0w(:,:,:)
1802  real(RP), intent(in) :: DENS(ka,ia,ja)
1803  real(RP), intent(in) :: MOMZ(ka,ia,ja)
1804  real(RP), intent(in) :: MOMX(ka,ia,ja)
1805  real(RP), intent(in) :: MOMY(ka,ia,ja)
1806  real(RP), intent(in) :: RHOT(ka,ia,ja)
1807  real(RP), intent(in) :: QTRC(ka,ia,ja,qa)
1808  character(len=*), intent(in) :: basename_land
1809  character(len=*), intent(in) :: basename_ocean
1810  integer, intent(in) :: mdlid_land
1811  integer, intent(in) :: mdlid_ocean
1812  integer, intent(in) :: ldims(3)
1813  integer, intent(in) :: odims(2)
1814  logical, intent(in) :: use_file_landwater ! use land water data from files
1815  real(RP), intent(in) :: init_landwater_ratio ! Ratio of land water to storage is constant,
1816  ! if use_file_landwater is ".false."
1817  integer, intent(in) :: intrp_iter_max
1818  logical, intent(in) :: soilwater_ds2vc_flag
1819  logical, intent(in) :: elevation_collection
1820  integer, intent(in) :: timelen ! time steps in one file
1821  integer, intent(in) :: skiplen ! skip steps
1822  integer, intent(in) :: lit
1823 
1824  ! land
1825  real(RP) :: tg_org (ldims(1),ldims(2),ldims(3))
1826  real(RP) :: strg_org (ldims(1),ldims(2),ldims(3))
1827  real(RP) :: smds_org (ldims(1),ldims(2),ldims(3))
1828 ! real(RP) :: skint_org( ldims(2),ldims(3))
1829  real(RP) :: lst_org ( ldims(2),ldims(3))
1830  real(RP) :: ust_org ( ldims(2),ldims(3))
1831  real(RP) :: albg_org ( ldims(2),ldims(3),2)
1832  real(RP) :: topo_org ( ldims(2),ldims(3))
1833  real(RP) :: lmask_org( ldims(2),ldims(3))
1834  real(RP) :: lz_org (ldims(1) )
1835  real(RP) :: llon_org ( ldims(2),ldims(3))
1836  real(RP) :: llat_org ( ldims(2),ldims(3))
1837 
1838  ! ocean
1839  real(RP) :: tw_org ( odims(1),odims(2))
1840  real(RP) :: sst_org ( odims(1),odims(2))
1841  real(RP) :: albw_org ( odims(1),odims(2),2)
1842  real(RP) :: z0w_org ( odims(1),odims(2))
1843  real(RP) :: olon_org ( odims(1),odims(2))
1844  real(RP) :: olat_org ( odims(1),odims(2))
1845  real(RP) :: omask_org( odims(1),odims(2))
1846  real(RP) :: omask ( odims(1),odims(2))
1847  real(RP) :: lst_ocean( odims(1),odims(2))
1848 
1849  real(RP) :: hfact_o(odims(1),odims(2),itp_nh)
1850  integer :: igrd_o (odims(1),odims(2),itp_nh)
1851  integer :: jgrd_o (odims(1),odims(2),itp_nh)
1852 
1853  real(RP) :: temp
1854  real(RP) :: pres
1855 
1856  integer :: i, j
1857  integer :: n, nn
1858  !---------------------------------------------------------------------------
1859 
1860  if( io_l ) write(io_fid_log,*)
1861  if( io_l ) write(io_fid_log,*) '+++ ScaleLib/IO[RealinputOcean]/Categ[Input]'
1862 
1863  if ( first ) then ! read land data only once
1864 
1865  if ( do_read_land ) then
1866 
1867  select case ( mdlid_land )
1868  case ( iscale ) ! TYPE: SCALE-RM
1869 
1870  call parentlandinputscale( &
1871  tg_org, strg_org, & ! (out)
1872  lst_org, ust_org, albg_org, & ! (out)
1873  topo_org, lmask_org, & ! (out)
1874  llon_org, llat_org, lz_org, & ! (out)
1875  basename_land, ldims, & ! (in)
1876  use_file_landwater, lit ) ! (in)
1877 
1878  case ( iwrfarw ) ! TYPE: WRF-ARW
1879 
1880  call parentlandinputwrfarw( &
1881  tg_org, smds_org, & ! (out)
1882  lst_org, ust_org, albg_org, & ! (out)
1883  topo_org, lmask_org, & ! (out)
1884  llon_org, llat_org, lz_org, & ! (out)
1885  basename_land, ldims, & ! (in)
1886  use_file_landwater, lit ) ! (in)
1887 
1888  case ( inicam ) ! TYPE: NICAM-NETCDF
1889 
1890  call parentlandinputnicam( &
1891  tg_org, strg_org, & ! (out)
1892  lst_org, & ! (out)
1893  llon_org, llat_org, lz_org, & ! (out)
1894  topo_org, lmask_org, & ! (out)
1895  basename_land, ldims, & ! (in)
1896  use_file_landwater, lit ) ! (in)
1897  ust_org = undef
1898  albg_org = undef
1899 
1900  case ( igrads ) ! TYPE: GrADS format
1901 
1902  call parentlandinputgrads( &
1903  tg_org, strg_org, smds_org, & ! (out)
1904  lst_org, & ! (out)
1905  llon_org, llat_org, lz_org, & ! (out)
1906  topo_org, lmask_org, & ! (out)
1907  basename_land, ldims, & ! (in)
1908  use_file_landwater, lit ) ! (in)
1909  ust_org = undef
1910  albg_org = undef
1911 
1912  end select
1913 
1914  end if
1915 
1916  if ( serial_land ) then
1917  call comm_bcast( tg_org, ldims(1), ldims(2), ldims(3) )
1918  if ( use_waterratio ) then
1919  call comm_bcast( smds_org, ldims(1), ldims(2), ldims(3) )
1920  else
1921  call comm_bcast( strg_org, ldims(1), ldims(2), ldims(3) )
1922  end if
1923  call comm_bcast( lst_org, ldims(2), ldims(3) )
1924  call comm_bcast( ust_org, ldims(2), ldims(3) )
1925  call comm_bcast( albg_org(:,:,i_lw), ldims(2), ldims(3) )
1926  call comm_bcast( albg_org(:,:,i_sw), ldims(2), ldims(3) )
1927  call comm_bcast( topo_org, ldims(2), ldims(3) )
1928  call comm_bcast( lmask_org, ldims(2), ldims(3) )
1929  call comm_bcast( llon_org, ldims(2), ldims(3) )
1930  call comm_bcast( llat_org, ldims(2), ldims(3) )
1931  end if
1932 
1933 
1934  ! urban data
1935 
1936  do j = 1, ja
1937  do i = 1, ia
1938  call thermodyn_temp_pres( temp, & ! [OUT]
1939  pres, & ! [OUT] not used
1940  dens(ks,i,j), & ! [IN]
1941  rhot(ks,i,j), & ! [IN]
1942  qtrc(ks,i,j,:) ) ! [IN]
1943 
1944  tc_urb(i,j) = temp
1945 #ifdef DRY
1946  qc_urb(i,j) = 0.0_rp
1947 #else
1948  qc_urb(i,j) = qtrc(ks,i,j,i_qv)
1949 #endif
1950  enddo
1951  enddo
1952 
1953  do j = 1, ja-1
1954  do i = 1, ia-1
1955  uc_urb(i,j) = max(sqrt( ( momx(ks,i,j) / (dens(ks,i+1, j)+dens(ks,i,j)) * 2.0_rp )**2.0_rp &
1956  + ( momy(ks,i,j) / (dens(ks, i,j+1)+dens(ks,i,j)) * 2.0_rp )**2.0_rp ), &
1957  0.01_rp)
1958  enddo
1959  enddo
1960  do j = 1, ja-1
1961  uc_urb(ia,j) = max(sqrt( ( momx(ks,ia,j) / dens(ks,ia,j ) )**2.0_rp &
1962  + ( momy(ks,ia,j) / (dens(ks,ia,j+1)+dens(ks,ia,j)) * 2.0_rp )**2.0_rp ), &
1963  0.01_rp)
1964  enddo
1965  do i = 1, ia-1
1966  uc_urb(i,ja) = max(sqrt( ( momx(ks,i,ja) / (dens(ks,i+1,ja)+dens(ks,i,ja)) * 2.0_rp )**2.0_rp &
1967  + ( momy(ks,i,ja) / dens(ks,i ,ja) )**2.0_rp ), 0.01_rp)
1968  enddo
1969  uc_urb(ia,ja) = max(sqrt( ( momx(ks,ia,ja) / dens(ks,ia,ja) )**2.0_rp &
1970  + ( momy(ks,ia,ja) / dens(ks,ia,ja) )**2.0_rp ), 0.01_rp)
1971 
1972  call comm_vars8( uc_urb, 1 )
1973  call comm_wait ( uc_urb, 1, .false. )
1974 
1975 
1976  end if ! first
1977 
1978 
1979  if ( do_read_ocean ) then
1980 
1981  select case ( mdlid_ocean )
1982  case ( iscale ) ! TYPE: SCALE-RM
1983 
1984  call parentoceanopenscale( olon_org, olat_org, & ! (out)
1985  omask_org, & ! (out)
1986  basename_ocean, & ! (in)
1987  odims ) ! (in)
1988 
1989  case ( iwrfarw ) ! TYPE: WRF-ARW
1990 
1992 
1993  case ( inicam ) ! TYPE: NICAM-NETCDF
1994 
1995  call parentoceanopennicam( olon_org, olat_org, & ! (out)
1996  omask_org, & ! (out)
1997  basename_ocean, & ! (in)
1998  odims ) ! (in)
1999 
2000  case ( igrads ) ! TYPE: GrADS format
2001 
2003 
2004  end select
2005 
2006  end if
2007 
2008 
2009  do n = skiplen+1, timelen
2010  nn = n - skiplen
2011 
2012  if ( do_read_ocean ) then
2013 
2014  select case ( mdlid_ocean )
2015  case ( iscale ) ! TYPE: SCALE-RM
2016 
2017  call parentoceaninputscale( &
2018  tw_org, sst_org, & ! (out)
2019  albw_org, z0w_org, & ! (out)
2020  omask_org, & ! (out)
2021  basename_ocean, odims, & ! (in)
2022  n ) ! (in)
2023 
2024  case ( iwrfarw ) ! TYPE: WRF-ARW
2025 
2026  call parentoceaninputwrfarw( &
2027  tw_org, sst_org, & ! (out)
2028  albw_org, z0w_org, & ! (out)
2029  omask_org, & ! (out)
2030  olon_org, olat_org, & ! (out)
2031  basename_ocean, odims, & ! (in)
2032  n ) ! (in)
2033 
2034  case ( inicam ) ! TYPE: NICAM-NETCDF
2035 
2036  call parentoceaninputnicam( &
2037  tw_org, sst_org, & ! (out)
2038  basename_ocean, odims, & ! (in)
2039  omask_org, & ! (in)
2040  n ) ! (in)
2041  albw_org = undef
2042  z0w_org = undef
2043 
2044  case ( igrads ) ! TYPE: GrADS format
2045 
2046  call parentoceaninputgrads( &
2047  tw_org, sst_org, & ! (out)
2048  omask_org, & ! (out)
2049  olon_org, olat_org, & ! (out)
2050  basename_ocean, odims, & ! (in)
2051  n ) ! (in)
2052  albw_org = undef
2053  z0w_org = undef
2054 
2055  end select
2056 
2057  end if
2058 
2059  if ( serial_ocean ) then
2060  call comm_bcast( tw_org, odims(1), odims(2) )
2061  call comm_bcast( sst_org, odims(1), odims(2) )
2062  call comm_bcast( albw_org(:,:,i_lw), odims(1), odims(2) )
2063  call comm_bcast( albw_org(:,:,i_sw), odims(1), odims(2) )
2064  call comm_bcast( z0w_org, odims(1), odims(2) )
2065  call comm_bcast( omask_org, odims(1), odims(2) )
2066  if ( first .or. update_coord ) then
2067  call comm_bcast( olon_org, odims(1), odims(2) )
2068  call comm_bcast( olat_org, odims(1), odims(2) )
2069  end if
2070  end if
2071 
2072 
2073  if ( first .or. update_coord ) then
2074 
2075  ! interpolation facter between outer ocean grid
2076  call intrpnest_interp_fact_latlon( hfact_o(:,:,:), & ! [OUT]
2077  igrd_o(:,:,:), jgrd_o(:,:,:), & ! [OUT]
2078  olat_org(:,:), olon_org(:,:), & ! [IN]
2079  odims(1), odims(2), & ! [IN]
2080  llat_org(:,:), llon_org(:,:), & ! [IN]
2081  ldims(2), ldims(3) ) ! [IN]
2082 
2083  call intrpnest_interp_fact_latlon( hfact_o(:,:,:), & ! [OUT]
2084  igrd_o(:,:,:), jgrd_o(:,:,:), & ! [OUT]
2085  olat_org(:,:), olon_org(:,:), & ! [IN]
2086  odims(1), odims(2), & ! [IN]
2087  llat_org(:,:), llon_org(:,:), & ! [IN]
2088  ldims(2), ldims(3) ) ! [IN]
2089 
2090  end if
2091 
2092  ! Ocean temp: interpolate over the land
2093  if ( i_intrp_ocean_temp .ne. i_intrp_off ) then
2094  select case ( i_intrp_ocean_temp )
2095  case ( i_intrp_mask )
2096  omask = omask_org
2097  case ( i_intrp_fill )
2098  call make_mask( omask, tw_org, odims(1), odims(2), landdata=.false.)
2099  end select
2100  call interp_oceanland_data(tw_org, omask, odims(1), odims(2), .false., intrp_iter_max)
2101  end if
2102 
2103  ! SST: interpolate over the land
2104  if ( i_intrp_ocean_sfc_temp .ne. i_intrp_off ) then
2105  select case ( i_intrp_ocean_sfc_temp )
2106  case ( i_intrp_mask )
2107  omask = omask_org
2108  case ( i_intrp_fill )
2109  call make_mask( omask, sst_org, odims(1), odims(2), landdata=.false.)
2110  end select
2111  call interp_oceanland_data(sst_org, omask, odims(1), odims(2), .false., intrp_iter_max)
2112  end if
2113 
2114  if ( first ) then ! interporate land data only once
2115 
2116  call land_interporation( &
2117  tg, strg, & ! (out)
2118  lst, albg, & ! (out)
2119  ust, albu, & ! (out)
2120  tg_org, strg_org, smds_org, & ! (inout)
2121  lst_org, albg_org, & ! (inout)
2122  ust_org, & ! (inout)
2123  sst_org, & ! (in)
2124  lmask_org, & ! (in)
2125  lsmask_nest, & ! (in)
2126  topo_org, & ! (in)
2127  lz_org, llon_org, llat_org, & ! (in)
2128  lcz, lon, lat, & ! (in)
2129  ldims, odims, & ! (in)
2130  maskval_tg, maskval_strg, & ! (in)
2131  init_landwater_ratio, & ! (in)
2132  use_file_landwater, & ! (in)
2133  use_waterratio, & ! (in)
2134  soilwater_ds2vc_flag, & ! (in)
2135  elevation_collection, & ! (in)
2136  intrp_iter_max ) ! (in)
2137 
2138  end if ! first
2139 
2140  if ( first .or. update_coord ) then
2141  ! land surface temperature at ocean grid
2142  call intrpnest_interp_2d( lst_ocean(:,:), lst_org(:,:), hfact_o(:,:,:), &
2143  igrd_o(:,:,:), jgrd_o(:,:,:), odims(1), odims(2) )
2144  end if
2145 
2146  call replace_misval_map( sst_org, lst_ocean, odims(1), odims(2), "SST")
2147  call replace_misval_map( tw_org, lst_ocean, odims(1), odims(2), "OCEAN_TEMP")
2148 
2149  do j = 1, odims(2)
2150  do i = 1, odims(1)
2151  if ( albw_org(i,j,i_lw) == undef ) albw_org(i,j,i_lw) = 0.04_rp ! emissivity of water surface : 0.96
2152  if ( albw_org(i,j,i_sw) == undef ) albw_org(i,j,i_sw) = 0.10_rp
2153  if ( z0w_org(i,j) == undef ) z0w_org(i,j) = 0.001_rp
2154  end do
2155  end do
2156 
2157 
2158  if ( first .or. update_coord ) then
2159  ! interporation for ocean variables
2160  call intrpnest_interp_fact_latlon( hfact(:,:,:), & ! [OUT]
2161  igrd(:,:,:), jgrd(:,:,:), & ! [OUT]
2162  lat(:,:), lon(:,:), & ! [IN]
2163  ia, ja, & ! [IN]
2164  olat_org(:,:), olon_org(:,:), & ! [IN]
2165  odims(1), odims(2) ) ! [IN]
2166  end if
2167 
2168  call intrpnest_interp_2d( tw(:,:,nn), tw_org(:,:), hfact(:,:,:), &
2169  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2170  call intrpnest_interp_2d( sst(:,:,nn), sst_org(:,:), hfact(:,:,:), &
2171  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2172  call intrpnest_interp_2d( albw(:,:,i_lw,nn), albw_org(:,:,i_lw), hfact(:,:,:), &
2173  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2174  call intrpnest_interp_2d( albw(:,:,i_sw,nn), albw_org(:,:,i_sw), hfact(:,:,:), &
2175  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2176  call intrpnest_interp_2d( z0w(:,:,nn), z0w_org(:,:), hfact(:,:,:), &
2177  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2178 
2179  if ( first ) then
2180 
2181  ! replace values over the ocean ####
2182  do j = 1, ja
2183  do i = 1, ia
2184  if( abs(lsmask_nest(i,j)-0.0_rp) < eps ) then ! ocean grid
2185  lst(i,j) = sst(i,j,nn)
2186  ust(i,j) = sst(i,j,nn)
2187  endif
2188  enddo
2189  enddo
2190 
2191  end if
2192 
2193 
2194  first = .false.
2195 
2196  end do ! time loop
2197 
2198  return
2199  end subroutine parentsurfaceinput
2200 
2202  subroutine parentoceanboundary( &
2203  tw, &
2204  sst, &
2205  albw, &
2206  z0, &
2207  numsteps, &
2208  update_dt, &
2209  basename, &
2210  title )
2211  use scale_const, only: &
2212  i_sw => const_i_sw, &
2213  i_lw => const_i_lw
2214  use scale_fileio, only: &
2215  fileio_write
2216  use scale_time, only: &
2217  time_nowdate
2218  implicit none
2219 
2220  real(RP), intent(in) :: tw(:,:,:)
2221  real(RP), intent(in) :: sst(:,:,:)
2222  real(RP), intent(in) :: albw(:,:,:,:)
2223  real(RP), intent(in) :: z0(:,:,:)
2224  real(RP), intent(in) :: update_dt
2225  character(len=*), intent(in) :: basename
2226  character(len=*), intent(in) :: title
2227  integer, intent(in) :: numsteps ! total time steps
2228 
2229  character(len=H_MID) :: ocean_boundary_out_dtype = 'DEFAULT'
2230  integer :: nowdate(6)
2231  integer :: ts, te
2232  !---------------------------------------------------------------------------
2233 
2234  ts = 1
2235  te = numsteps
2236 
2237  if( io_l ) write(io_fid_log,*)
2238  if( io_l ) write(io_fid_log,*) '+++ ScaleLib/IO[RealinputOcean]/Categ[Boundary]'
2239 
2240  nowdate = time_nowdate
2241  nowdate(1) = nowdate(1)
2242 
2243  call fileio_write( tw(:,:,ts:te), basename, title, &
2244  'OCEAN_TEMP', 'Reference Ocean Temperature', 'K', 'XYT', &
2245  ocean_boundary_out_dtype, update_dt, nowdate )
2246 
2247  call fileio_write( sst(:,:,ts:te), basename, title, &
2248  'OCEAN_SFC_TEMP', 'Reference Ocean Surface Temperature', 'K', 'XYT', &
2249  ocean_boundary_out_dtype, update_dt, nowdate )
2250 
2251  call fileio_write( albw(:,:,i_lw,ts:te), basename, title, &
2252  'OCEAN_ALB_LW', 'Reference Ocean Surface Albedo Long-wave', '1', 'XYT', &
2253  ocean_boundary_out_dtype, update_dt, nowdate )
2254 
2255  call fileio_write( albw(:,:,i_sw,ts:te), basename, title, &
2256  'OCEAN_ALB_SW', 'Reference Ocean Surface Albedo Short-wave', '1', 'XYT', &
2257  ocean_boundary_out_dtype, update_dt, nowdate )
2258 
2259  call fileio_write( z0(:,:,ts:te), basename, title, &
2260  'OCEAN_SFC_Z0', 'Reference Ocean Surface Z0', 'm', 'XYT', &
2261  ocean_boundary_out_dtype, update_dt, nowdate )
2262 
2263  return
2264  end subroutine parentoceanboundary
2265 
2266 
2267  !-------------------------------
2268  subroutine land_interporation( &
2269  tg, &
2270  strg, &
2271  lst, &
2272  albg, &
2273  ust, &
2274  albu, &
2275  tg_org, &
2276  strg_org, &
2277  smds_org, &
2278  lst_org, &
2279  albg_org, &
2280  ust_org, &
2281  sst_org, &
2282  lmask_org, &
2283  lsmask_nest, &
2284  topo_org, &
2285  lz_org, &
2286  llon_org, &
2287  llat_org, &
2288  LCZ, &
2289  LON, &
2290  LAT, &
2291  ldims, &
2292  odims, &
2293  maskval_tg, &
2294  maskval_strg, &
2295  init_landwater_ratio, &
2296  use_file_landwater, &
2297  use_waterratio, &
2298  soilwater_ds2vc_flag, &
2299  elevation_collection, &
2300  intrp_iter_max )
2301  use scale_process, only: &
2302  prc_mpistop
2303  use scale_const, only: &
2304  undef => const_undef, &
2305  i_sw => const_i_sw, &
2306  i_lw => const_i_lw, &
2307  laps => const_laps
2308  use scale_interpolation_nest, only: &
2313  use scale_topography, only: &
2314  topo_zsfc
2315  use mod_land_vars, only: &
2317  implicit none
2318  real(RP), intent(out) :: tg(lkmax,ia,ja)
2319  real(RP), intent(out) :: strg(lkmax,ia,ja)
2320  real(RP), intent(out) :: lst(ia,ja)
2321  real(RP), intent(out) :: albg(ia,ja,2)
2322  real(RP), intent(out) :: ust(ia,ja)
2323  real(RP), intent(out) :: albu(ia,ja,2)
2324  real(RP), intent(inout) :: tg_org(:,:,:)
2325  real(RP), intent(inout) :: strg_org(:,:,:)
2326  real(RP), intent(inout) :: smds_org(:,:,:)
2327  real(RP), intent(inout) :: lst_org(:,:)
2328  real(RP), intent(inout) :: albg_org(:,:,:)
2329  real(RP), intent(inout) :: ust_org(:,:)
2330  real(RP), intent(inout) :: sst_org(:,:)
2331  real(RP), intent(in) :: lmask_org(:,:)
2332  real(RP), intent(in) :: lsmask_nest(:,:)
2333  real(RP), intent(in) :: topo_org(:,:)
2334  real(RP), intent(in) :: lz_org(:)
2335  real(RP), intent(in) :: llon_org(:,:)
2336  real(RP), intent(in) :: llat_org(:,:)
2337  real(RP), intent(in) :: LCZ(lkmax)
2338  real(RP), intent(in) :: LON(ia,ja)
2339  real(RP), intent(in) :: LAT(ia,ja)
2340  integer, intent(in) :: ldims(3)
2341  integer, intent(in) :: odims(2)
2342  real(RP), intent(in) :: maskval_tg
2343  real(RP), intent(in) :: maskval_strg
2344  real(RP), intent(in) :: init_landwater_ratio
2345  logical, intent(in) :: use_file_landwater
2346  logical, intent(in) :: use_waterratio
2347  logical, intent(in) :: soilwater_ds2vc_flag
2348  logical, intent(in) :: elevation_collection
2349  integer, intent(in) :: intrp_iter_max
2350 
2351  real(RP) :: lmask(ldims(2), ldims(3))
2352  real(RP) :: smds(lkmax,ia,ja)
2353 
2354  ! data for interporation
2355  real(RP) :: hfact_l(ldims(2), ldims(3), itp_nh)
2356  integer :: igrd_l (ldims(2), ldims(3), itp_nh)
2357  integer :: jgrd_l (ldims(2), ldims(3), itp_nh)
2358  real(RP) :: vfactl(lkmax,ia,ja,itp_nh,itp_nv)
2359  integer :: kgrdl (lkmax,ia,ja,itp_nh,itp_nv)
2360 
2361  real(RP) :: sst_land(ldims(2), ldims(3))
2362  real(RP) :: work(ldims(2), ldims(3))
2363 
2364  real(RP) :: lz3d_org(ldims(1),ldims(2),ldims(3))
2365  real(RP) :: lcz_3D(lkmax,ia,ja)
2366 
2367  ! elevation collection
2368  real(RP) :: topo(ia,ja)
2369  real(RP) :: tdiff
2370 
2371  integer :: k, i, j
2372 
2373 
2374  ! Surface skin temp: interpolate over the ocean
2375  if ( i_intrp_land_sfc_temp .ne. i_intrp_off ) then
2376  select case ( i_intrp_land_sfc_temp )
2377  case ( i_intrp_mask )
2378  lmask = lmask_org
2379  case ( i_intrp_fill )
2380  call make_mask( lmask, lst_org, ldims(2), ldims(3), landdata=.true.)
2381  case default
2382  write(*,*) 'xxx INTRP_LAND_SFC_TEMP is invalid.'
2383  call prc_mpistop
2384  end select
2385  call interp_oceanland_data(lst_org, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2386  end if
2387 
2388  ! Urban surface temp: interpolate over the ocean
2389  ! if ( i_INTRP_URB_SFC_TEMP .ne. i_intrp_off ) then
2390  ! select case ( i_INTRP_URB_SFC_TEMP )
2391  ! case ( i_intrp_mask )
2392  ! lmask = lmask_org
2393  ! case ( i_intrp_fill )
2394  ! call make_mask( lmask, ust_org, ldims(2), ldims(3), landdata=.true.)
2395  ! case default
2396  ! write(*,*) 'xxx INTRP_URB_SFC_TEMP is invalid.'
2397  ! call PRC_MPIstop
2398  ! end select
2399  ! call interp_OceanLand_data(ust_org, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2400  !end if
2401 
2402  ! interpolation facter between outer land grid and ocean grid
2403  call intrpnest_interp_fact_latlon( hfact_l(:,:,:), & ! [OUT]
2404  igrd_l(:,:,:), jgrd_l(:,:,:), & ! [OUT]
2405  llat_org(:,:), llon_org(:,:), & ! [IN]
2406  ldims(2), ldims(3), & ! [IN]
2407  olat_org(:,:), olon_org(:,:), & ! [IN]
2408  odims(1), odims(2) ) ! [IN]
2409 
2410 
2411  ! sst on land grid
2412  call intrpnest_interp_2d( sst_land(:,:), sst_org(:,:), hfact_l(:,:,:), &
2413  igrd_l(:,:,:), jgrd_l(:,:,:), ldims(2), ldims(3) )
2414  call replace_misval_map( lst_org, sst_land, ldims(2), ldims(3), "SKINT")
2415 
2416  ! replace missing value
2417  do j = 1, ldims(3)
2418  do i = 1, ldims(2)
2419  if ( ust_org(i,j) == undef ) ust_org(i,j) = lst_org(i,j)
2420 ! if ( skinw_org(i,j) == UNDEF ) skinw_org(i,j) = 0.0_RP
2421 ! if ( snowq_org(i,j) == UNDEF ) snowq_org(i,j) = 0.0_RP
2422 ! if ( snowt_org(i,j) == UNDEF ) snowt_org(i,j) = TEM00
2423  if ( albg_org(i,j,i_lw) == undef ) albg_org(i,j,i_lw) = 0.03_rp ! emissivity of general ground surface : 0.95-0.98
2424  if ( albg_org(i,j,i_sw) == undef ) albg_org(i,j,i_sw) = 0.22_rp
2425  end do
2426  end do
2427 
2428  ! Land temp: interpolate over the ocean
2429  if ( i_intrp_land_temp .ne. i_intrp_off ) then
2430  do k = 1, ldims(1)
2431  work(:,:) = tg_org(k,:,:)
2432  select case ( i_intrp_land_temp )
2433  case ( i_intrp_mask )
2434  lmask = lmask_org
2435  case ( i_intrp_fill )
2436  call make_mask( lmask, work, ldims(2), ldims(3), landdata=.true.)
2437  end select
2438  call interp_oceanland_data( work, lmask, ldims(2), ldims(3), .true., intrp_iter_max )
2439  !replace land temp using skin temp
2440  call replace_misval_map( work, lst_org, ldims(2), ldims(3), "STEMP")
2441  tg_org(k,:,:) = work(:,:)
2442  end do
2443  end if
2444 
2445 
2446  ! fill grid data
2447  do j = 1, ldims(3)
2448  do i = 1, ldims(2)
2449  lz3d_org(:,i,j) = lz_org(:)
2450  end do
2451  end do
2452 
2453  do j = 1, ja
2454  do i = 1, ia
2455  lcz_3d(:,i,j) = lcz(:)
2456  enddo
2457  enddo
2458 
2459  call intrpnest_interp_fact_llz( hfact(:,:,:), & ! [OUT]
2460  vfactl(:,:,:,:,:), & ! [OUT]
2461  kgrdl(:,:,:,:,:), & ! [OUT]
2462  igrd(:,:,:), jgrd(:,:,:), & ! [OUT]
2463  ncopy(:,:,:), & ! [OUT]
2464  lcz_3d(:,:,:), & ! [IN]
2465  lat(:,:), lon(:,:), & ! [IN]
2466  1, lkmax, ia, ja, & ! [IN]
2467  lz3d_org(:,:,:), & ! [IN]
2468  llat_org(:,:), llon_org(:,:), & ! [IN]
2469  ldims(1), ldims(2), ldims(3), & ! [IN]
2470  landgrid=.true. ) ! [IN]
2471 
2472  call intrpnest_interp_2d( lst(:,:), lst_org(:,:), hfact(:,:,:), &
2473  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2474  call intrpnest_interp_2d( ust(:,:), ust_org(:,:), hfact(:,:,:), &
2475  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2476 ! call INTRPNEST_interp_2d( skinw(:,:), skinw_org(:,:), hfact(:,:,:), &
2477 ! igrd(:,:,:), jgrd(:,:,:), IA, JA )
2478 ! call INTRPNEST_interp_2d( snowq(:,:), snowq_org(:,:), hfact(:,:,:), &
2479 ! igrd(:,:,:), jgrd(:,:,:), IA, JA )
2480 ! call INTRPNEST_interp_2d( snowt(:,:), snowt_org(:,:), hfact(:,:,:), &
2481 ! igrd(:,:,:), jgrd(:,:,:), IA, JA )
2482  call intrpnest_interp_2d( albg(:,:,i_lw), albg_org(:,:,i_lw), hfact(:,:,:), &
2483  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2484  call intrpnest_interp_2d( albg(:,:,i_sw), albg_org(:,:,i_sw), hfact(:,:,:), &
2485  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2486 
2487  call intrpnest_interp_3d( tg(:,:,:), &
2488  tg_org(:,:,:), &
2489  hfact(:,:,:), &
2490  vfactl(:,:,:,:,:), &
2491  kgrdl(:,:,:,:,:), &
2492  igrd(:,:,:), &
2493  jgrd(:,:,:), &
2494  ia, ja, 1, lkmax-1 )
2495 
2496  do j = 1, ja
2497  do i = 1, ia
2498  tg(lkmax,i,j) = tg(lkmax-1,i,j)
2499  enddo ! i
2500  enddo ! j
2501 
2502  ! replace values over the ocean
2503  do k = 1, lkmax
2504  call replace_misval_const( tg(k,:,:), maskval_tg, lsmask_nest )
2505  enddo
2506 
2507 
2508  ! elevation collection
2509  if ( elevation_collection ) then
2510  call intrpnest_interp_2d( topo(:,:), topo_org(:,:), hfact(:,:,:), &
2511  igrd(:,:,:), jgrd(:,:,:), ia, ja )
2512 
2513  do j = 1, ja
2514  do i = 1, ia
2515  if ( topo(i,j) > 0.0_rp ) then ! ignore UNDEF value
2516  tdiff = ( topo_zsfc(i,j) - topo(i,j) ) * laps
2517  lst(i,j) = lst(i,j) - tdiff
2518  ust(i,j) = ust(i,j) - tdiff
2519  do k = 1, lkmax
2520  tg(k,i,j) = tg(k,i,j) - tdiff
2521  end do
2522  end if
2523  end do
2524  end do
2525  end if
2526 
2527 
2528 
2529  ! Land water: interpolate over the ocean
2530  if( use_file_landwater )then
2531 
2532  if ( use_waterratio ) then
2533 
2534  if ( i_intrp_land_water .ne. i_intrp_off ) then
2535  do k = 1, ldims(1)
2536  work(:,:) = smds_org(k,:,:)
2537  select case ( i_intrp_land_water )
2538  case ( i_intrp_mask )
2539  lmask = lmask_org
2540  case ( i_intrp_fill )
2541  call make_mask( lmask, work, ldims(2), ldims(3), landdata=.true.)
2542  end select
2543  call interp_oceanland_data(work, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2544  lmask(:,:) = init_landwater_ratio
2545  !replace missing value to init_landwater_ratio
2546  call replace_misval_map( work, lmask, ldims(2), ldims(3), "SMOISDS")
2547  smds_org(k,:,:) = work(:,:)
2548  enddo
2549  end if
2550 
2551  call intrpnest_interp_3d( smds(:,:,:), &
2552  smds_org(:,:,:), &
2553  hfact(:,:,:), &
2554  vfactl(:,:,:,:,:), &
2555  kgrdl(:,:,:,:,:), &
2556  igrd(:,:,:), &
2557  jgrd(:,:,:), &
2558  ia, ja, 1, lkmax-1 )
2559  do k = 1, lkmax
2560  strg(k,:,:) = convert_ws2vwc( smds(k,:,:), critical=soilwater_ds2vc_flag )
2561  end do
2562 
2563  else
2564 
2565  if ( i_intrp_land_water .ne. i_intrp_off ) then
2566  do k = 1, ldims(1)
2567  work(:,:) = strg_org(k,:,:)
2568  select case ( i_intrp_land_water )
2569  case ( i_intrp_mask )
2570  lmask = lmask_org
2571  case ( i_intrp_fill )
2572  call make_mask( lmask, work, ldims(2), ldims(3), landdata=.true.)
2573  end select
2574  call interp_oceanland_data(work, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2575  lmask(:,:) = maskval_strg
2576  !replace missing value to init_landwater_ratio
2577  call replace_misval_map( work, lmask, ldims(2), ldims(3), "SMOIS")
2578  strg_org(k,:,:) = work(:,:)
2579  enddo
2580  end if
2581 
2582  call intrpnest_interp_3d( strg(:,:,:), &
2583  strg_org(:,:,:), &
2584  hfact(:,:,:), &
2585  vfactl(:,:,:,:,:), &
2586  kgrdl(:,:,:,:,:), &
2587  igrd(:,:,:), &
2588  jgrd(:,:,:), &
2589  ia, ja, 1, lkmax-1 )
2590  ! interpolation
2591  do j = 1, ja
2592  do i = 1, ia
2593  strg(lkmax,i,j) = strg(lkmax-1,i,j)
2594  enddo
2595  enddo
2596 
2597  end if
2598 
2599  ! replace values over the ocean
2600  do k = 1, lkmax
2601  call replace_misval_const( strg(k,:,:), maskval_strg, lsmask_nest )
2602  enddo
2603 
2604  else ! not read from boundary file
2605 
2606  smds(:,:,:) = init_landwater_ratio
2607  ! conversion from water saturation [fraction] to volumetric water content [m3/m3]
2608  do k = 1, lkmax
2609  strg(k,:,:) = convert_ws2vwc( smds(k,:,:), critical=.true. )
2610  end do
2611 
2612  endif ! use_file_waterratio
2613 
2614 
2615  ! copy albedo of land to urban
2616  do j = 1, ja
2617  do i = 1, ia
2618  albu(i,j,:) = albg(i,j,:)
2619  enddo
2620  enddo
2621 
2622 
2623  return
2624  end subroutine land_interporation
2625 
2626  !-------------------------------
2627  subroutine make_mask( &
2628  gmask, & ! (out)
2629  data, & ! (in)
2630  nx, & ! (in)
2631  ny, & ! (in)
2632  landdata ) ! (in)
2633  use scale_const, only: &
2634  eps => const_eps, &
2635  undef => const_undef
2636  implicit none
2637  real(RP), intent(out) :: gmask(:,:)
2638  real(RP), intent(in) :: data(:,:)
2639  integer, intent(in) :: nx
2640  integer, intent(in) :: ny
2641  logical, intent(in) :: landdata ! .true. => land data , .false. => ocean data
2642 
2643  real(RP) :: dd
2644  integer :: i,j
2645 
2646  if( landdata )then
2647  gmask(:,:) = 1.0_rp ! gmask=1 will be skip in "interp_OceanLand_data"
2648  dd = 0.0_rp
2649  else
2650  gmask(:,:) = 0.0_rp ! gmask=0 will be skip in "interp_OceanLand_data"
2651  dd = 1.0_rp
2652  endif
2653 
2654  do j = 1, ny
2655  do i = 1, nx
2656  if( abs(data(i,j) - undef) < sqrt(eps) )then
2657  gmask(i,j) = dd
2658  endif
2659  enddo
2660  enddo
2661 
2662  return
2663  end subroutine make_mask
2664  !-----------------------------------------------------------------------------
2665  subroutine interp_oceanland_data( &
2666  data, & ! (inout)
2667  lsmask, & ! (in)
2668  nx, & ! (in)
2669  ny, & ! (in)
2670  landdata, & ! (in)
2671  iter_max, & ! (in)
2672  maskval & ! (out)
2673  )
2674  use scale_const, only: &
2675  eps => const_eps
2676  implicit none
2677  real(RP), intent(inout) :: data(:,:)
2678  real(RP), intent(in) :: lsmask(:,:)
2679  integer, intent(in) :: nx
2680  integer, intent(in) :: ny
2681  logical, intent(in) :: landdata ! .true. => land data , .false. => ocean data
2682  integer, intent(in) :: iter_max
2683  real(RP), intent(out), optional :: maskval
2684 
2685  integer :: untarget_mask
2686  integer, allocatable :: imask(:,:),imaskr(:,:)
2687  real(RP),allocatable :: newdata(:,:)
2688  real(RP) :: nd
2689  integer :: count
2690 
2691  integer :: i, j, ii, jj, kk
2692 
2693  !---------------------------------------------------------------------------
2694  allocate( imask(nx,ny) )
2695  allocate( imaskr(nx,ny) )
2696  allocate( newdata(nx,ny) )
2697  newdata = 0.0_rp
2698  if( present(maskval) ) maskval = 999.99_rp
2699 
2700  ! search target cell for interpolation
2701  do j = 1, ny
2702  do i = 1, nx
2703  if( abs(lsmask(i,j)-1.0_rp) < eps )then
2704  imask(i,j) = 1 ! land grid
2705  else
2706  imask(i,j) = 0 ! ocean grid
2707  endif
2708  enddo
2709  enddo
2710  if ( landdata ) then ! interpolation for land data
2711  untarget_mask = 1
2712  else ! interpolation for ocean data
2713  untarget_mask = 0
2714  endif
2715 
2716  ! start interpolation
2717 
2718  imaskr = imask
2719  do kk = 1, iter_max
2720  do j = 1, ny
2721  do i = 1, nx
2722  if ( imask(i,j) == untarget_mask ) then ! not missing value
2723  newdata(i,j) = data(i,j)
2724  cycle
2725  else
2726 
2727  if ( present(maskval) ) then
2728  if ( abs(maskval-999.99_rp)<eps ) then
2729  if (abs(lsmask(i,j)-0.0_rp) < eps) maskval = data(i,j)
2730  endif
2731  endif
2732 
2733  !--------------------------------------
2734  ! check data of neighbor grid
2735  !---------------------------------------
2736  count = 0
2737  nd = 0.0_rp
2738  do jj = j-1, j+1
2739  if ( jj < 1 .or. jj > ny ) cycle
2740  do ii = i-1, i+1
2741  if ( ii < 1 .or. ii > nx .or. (jj == j .and. ii == i) ) cycle
2742  if ( imask(ii,jj) == untarget_mask ) then
2743  nd = nd + data(ii,jj)
2744  count = count + 1
2745  end if
2746  end do
2747  end do
2748 
2749  if( count >= 3 )then ! coast grid : interpolate
2750  newdata(i,j) = nd / count
2751  imaskr(i,j) = untarget_mask
2752  else
2753  newdata(i,j) = data(i,j)
2754  endif
2755 
2756  endif ! sea/land
2757 
2758  enddo
2759  enddo
2760 
2761  imask(:,:) = imaskr(:,:)
2762  data(:,:) = newdata(:,:)
2763  enddo ! kk
2764 
2765  deallocate( imask )
2766  deallocate( imaskr )
2767  deallocate( newdata )
2768 
2769  return
2770  end subroutine interp_oceanland_data
2771 
2772  !-----------------------------------------------------------------------------
2773  subroutine replace_misval_const( data, maskval, frac_land )
2774  use scale_const, only: &
2775  eps => const_eps
2776  implicit none
2777  real(RP), intent(inout) :: data(:,:)
2778  real(RP), intent(in) :: maskval
2779  real(RP), intent(in) :: frac_land(:,:)
2780  integer :: i, j
2781 
2782  do j = 1, ja
2783  do i = 1, ia
2784  if( abs(frac_land(i,j)-0.0_rp) < eps )then ! ocean grid
2785  data(i,j) = maskval
2786  endif
2787  enddo
2788  enddo
2789 
2790  end subroutine replace_misval_const
2791 
2792  !-----------------------------------------------------------------------------
2793  subroutine replace_misval_map( data, maskval, nx, ny, elem)
2794  use scale_const, only: &
2795  eps => const_eps, &
2796  undef => const_undef
2797  implicit none
2798  real(RP), intent(inout) :: data(:,:)
2799  real(RP), intent(in) :: maskval(:,:)
2800  integer, intent(in) :: nx, ny
2801  character(*), intent(in) :: elem
2802  integer :: i, j
2803 
2804  do j = 1, ny
2805  do i = 1, nx
2806  if( abs(data(i,j) - undef) < sqrt(eps) )then
2807  if( abs(maskval(i,j) - undef) < sqrt(eps) )then
2808  write(*,*) "Data for mask has missing value. ",trim(elem),i,j
2809  call prc_mpistop
2810  else
2811  data(i,j) = maskval(i,j)
2812  endif
2813  endif
2814  enddo
2815  enddo
2816 
2817  end subroutine replace_misval_map
2818 
2819  !-----------------------------------------------------------------------------
2820  subroutine diagnose_number_concentration( &
2821  qvars & ! (inout)
2822  )
2823  use scale_const, only: &
2824  pi => const_pi
2825  implicit none
2826  real(RP), intent(inout) :: qvars(:,:,:,:)
2827 
2828  real(RP), parameter :: Dc = 20.d-6 ! typical particle diameter for cloud [m]
2829  real(RP), parameter :: Dr = 200.d-6 ! typical particle diameter for rain [m]
2830  real(RP), parameter :: Di = 80.d-6 ! typical particle diameter for ice [m]
2831  real(RP), parameter :: Ds = 80.d-6 ! typical particle diameter for snow [m]
2832  real(RP), parameter :: Dg = 200.d-6 ! typical particle diameter for grapel [m]
2833  real(RP), parameter :: RHOw = 1000.d0 ! typical density for warm particles [kg/m3]
2834  real(RP), parameter :: RHOf = 100.d0 ! typical density for frozen particles [kg/m3]
2835  real(RP), parameter :: RHOg = 400.d0 ! typical density for grapel particles [kg/m3]
2836  real(RP), parameter :: b = 3.d0 ! assume spherical form
2837 
2838  real(RP) :: piov6
2839  !---------------------------------------------------------------------------
2840 
2841 #ifndef DRY
2842  piov6 = pi / 6.0_rp
2843 
2844  qvars(:,:,:,i_nc) = qvars(:,:,:,i_qc) / ( (piov6*rhow) * dc**b )
2845  qvars(:,:,:,i_nr) = qvars(:,:,:,i_qr) / ( (piov6*rhow) * dr**b )
2846  qvars(:,:,:,i_ni) = qvars(:,:,:,i_qi) / ( (piov6*rhof) * di**b )
2847  qvars(:,:,:,i_ns) = qvars(:,:,:,i_qs) / ( (piov6*rhof) * ds**b )
2848  qvars(:,:,:,i_ng) = qvars(:,:,:,i_qg) / ( (piov6*rhog) * dg**b )
2849 #endif
2850 
2851  return
2852  end subroutine diagnose_number_concentration
2853 
2854 end module mod_realinput
subroutine, public parentatomsetupgrads(dims, basename)
Atmos Setup.
subroutine replace_misval_map(data, maskval, nx, ny, elem)
real(rp), dimension(:,:,:), allocatable, target, public momz
subroutine make_mask(gmask, data, nx, ny, landdata)
subroutine, public intrpnest_domain_compatibility(lon_org, lat_org, lev_org, lon_loc, lat_loc, lev_loc, skip_x, skip_y, skip_z)
subroutine, public parentoceaninputgrads(tw_org, sst_org, omask_org, olon_org, olat_org, basename_num, odims, nt)
logical, public prc_ismaster
master process in local communicator?
real(rp), dimension(:,:), allocatable, public atmos_phy_sf_sfc_z0e
subroutine, public parentatomopenwrfarw
subroutine, public parentoceanopengrads
real(rp), dimension(:,:,:), allocatable, public ocean_sfc_albedo
ocean surface albedo [0-1]
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 landuse_fact_urban
urban factor
subroutine, public parentlandinputwrfarw(tg_org, sh2o_org, lst_org, ust_org, albg_org, topo_org, lmask_org, llon_org, llat_org, lz_org, basename, ldims, use_file_landwater, it)
module REAL input WRF-ARW
subroutine, public parentoceanopennicam(olon_org, olat_org, omask_org, basename_num, odims)
module GRID (nesting system)
subroutine, public parentatomopennicam(lon_org, lat_org, cz_org, basename_num, dims)
real(rp), dimension(:,:,:), allocatable, target, public rhot
subroutine, public parentatominputnicam(velz_org, velx_org, vely_org, pres_org, temp_org, qtrc_org, basename_num, dims, it)
integer, parameter, public inicam
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:59
subroutine, public parentlandsetupwrfarw(ldims, basename_land)
Land Setup.
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0e
ocean surface roughness length for vapor [m]
subroutine, public parentoceanopenscale(olon_org, olat_org, omask_org, basename_ocean, odims)
real(rp), dimension(:,:), allocatable, public ocean_temp
temperature at uppermost ocean layer [K]
integer, public i_ng
subroutine land_interporation(tg, strg, lst, albg, ust, albu, tg_org, strg_org, smds_org, lst_org, albg_org, ust_org, sst_org, lmask_org, lsmask_nest, topo_org, lz_org, llon_org, llat_org, LCZ, LON, LAT, ldims, odims, maskval_tg, maskval_strg, init_landwater_ratio, use_file_landwater, use_waterratio, soilwater_ds2vc_flag, elevation_collection, intrp_iter_max)
integer, public qwe
module ATMOSPHERIC Variables
subroutine parentatomsetup(dims, timelen, mdlid, basename_org, filetype, use_file_density_in, serial_in)
Atmos Setup.
real(rp), dimension(:,:,:), allocatable, target, public momx
module STDIO
Definition: scale_stdio.F90:12
integer, public ke
end point of inner domain: z, local
integer, public qa
real(rp), dimension(:,:,:), allocatable, public real_fz
geopotential height [m] (cell face )
real(rp), dimension(:,:), allocatable, public atmos_phy_sf_sfc_temp
integer, public qws
real(rp), dimension(:,:,:), allocatable, public real_cz
geopotential height [m] (cell center)
integer, parameter, public igrads
procedure(intrpnest_intfc_interp_2d), pointer, public intrpnest_interp_2d
subroutine, public parentlandsetupscale(ldims)
Land Setup.
real(rp), dimension(:,:), allocatable, public urban_tb
integer, public nest_interp_level
horizontal interpolation level
real(rp), dimension(:,:,:), allocatable, target, public dens
real(rp), public const_laps
lapse rate of ISA [K/m]
Definition: scale_const.F90:60
subroutine, public parentoceaninputwrfarw(tw_org, sst_org, albw_org, z0w_org, omask_org, olon_org, olat_org, basename, odims, it)
module GRID (cartesian) for land
integer, parameter, public iwrfarw
integer, parameter, public iscale
subroutine, public intrpnest_interp_fact_latlon(hfact, igrd, jgrd, mylat, mylon, myIA, myJA, inlat, inlon, inIA, inJA)
module URBAN Variables
real(rp), dimension(:,:), allocatable, public urban_raing
subroutine, public parentlandsetupgrads(ldims, use_waterratio, use_file_landwater, basename)
Land Setup.
character(len=h_short), public tracer_type
module FILE I/O (netcdf)
real(rp), dimension(:,:), allocatable, public urban_uc
module FILE I/O (netcdf)
subroutine, public intrpnest_interp_fact_llz(hfact, vfact, kgrd, igrd, jgrd, ncopy, myhgt, mylat, mylon, myKS, myKE, myIA, myJA, inhgt, inlat, inlon, inKA, inIA, inJA, landgrid)
real(rp), public const_undef
Definition: scale_const.F90:43
module grid index
real(rp), dimension(:,:), allocatable, public land_sfc_temp
land surface skin temperature [K]
subroutine, public parentatomopenscale(lon_org, lat_org, cz_org, basename_org, dims)
module ATMOSPHERIC Surface Variables
subroutine, public parentoceansetupnicam(odims, timelen, basename_org)
Ocean Setup.
subroutine, public parentoceansetupwrfarw(odims, timelen, basename_org)
Ocean Setup.
module TRACER
module Index
Definition: scale_index.F90:14
real(rp), dimension(:,:), allocatable, public urban_tr
module REAL input NICAM
module REAL input
integer, public ia
of x whole cells (local, with HALO)
real(rp), dimension(:,:,:), allocatable, public urban_tgl
module GRIDTRANS
subroutine, public parentoceaninputscale(tw_org, sst_org, albw_org, z0w_org, omask_org, basename_ocean, odims, it)
module GRID (real space)
module LANDUSE
real(rp), dimension(:,:), allocatable, public atmos_phy_sf_sfc_z0h
real(rp) function, dimension(ia, ja), public convert_ws2vwc(WS, critical)
conversion from water saturation [fraction] to volumetric water content [m3/m3]
subroutine, public parentlandinputnicam(tg_org, strg_org, lst_org, llon_org, llat_org, lz_org, topo_org, lmask_org, basename_num, ldims, use_file_landwater, it)
integer, public ka
of z whole cells (local, with HALO)
integer, public i_ni
integer, public i_qv
subroutine, public parentatomsetupscale(dims)
Atmos Setup.
subroutine, public parentatomsetupnicam(dims, timelen, basename_org)
Atmos Setup.
module REAL input SCALE
subroutine, public parentlandsetupnicam(ldims, basename_org)
Land Setup.
real(rp), dimension(:,:,:), allocatable, public atmos_phy_sf_sfc_albedo
character(len=h_short), dimension(:), allocatable, public aq_name
real(rp), dimension(:,:,:), allocatable, public land_temp
temperature of each soil layer [K]
subroutine, public parentlandinputscale(tg_org, strg_org, lst_org, ust_org, albg_org, topo_org, lmask_org, llon_org, llat_org, lz_org, basename_land, ldims, use_file_landwater, it)
module COMMUNICATION
Definition: scale_comm.F90:23
module ATMOSPHERE / Hydrostatic barance
real(rp), dimension(:,:), allocatable, public landuse_fact_ocean
ocean factor
module TIME
Definition: scale_time.F90:15
integer, public i_nc
real(rp), dimension(:,:), allocatable, public urban_roff
module PROCESS
subroutine, public realinput_atmos(flg_intrp)
subroutine, public parentlandinputgrads(tg_org, strg_org, smds_org, lst_org, llon_org, llat_org, lz_org, topo_org, lmask_org, basename_num, ldims, use_file_landwater, nt)
real(rp), dimension(:,:,:), allocatable, public gtrans_rotc
rotation coefficient
real(rp), dimension(:,:,:), allocatable, public land_sfc_albedo
land surface albedo [0-1]
subroutine, public log(type, message)
Definition: dc_log.f90:133
procedure(intrpnest_intfc_interp_3d), pointer, public intrpnest_interp_3d
module LAND Variables
subroutine, public parentoceansetupgrads(odims, timelen, basename)
Ocean Setup.
subroutine, public parentatominputwrfarw(velz_org, llvelx_org, llvely_org, pres_org, temp_org, qtrc_org, lon_org, lat_org, cz_org, basename, mptype_parent, dims, it)
subroutine, public parentatomsetupwrfarw(dims, timelen, basename_org)
Atmos Setup.
module CONSTANT
Definition: scale_const.F90:14
real(rp), dimension(:,:,:), allocatable, public urban_sfc_albedo
character(len=h_short), dimension(:), allocatable, public aq_unit
integer, public i_nr
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:,:), allocatable, public urban_tc
real(rp), dimension(:,:,:), allocatable, target, public momy
integer, public i_qs
real(rp), dimension(:,:), allocatable, public urban_rainr
module INTERPOLATION (nesting system)
real(rp), dimension(:,:,:), allocatable, public land_water
moisture of each soil layer [m3/m3]
integer, public i_qi
real(rp), public const_eps
small number
Definition: scale_const.F90:36
module ATMOSPHERE / Thermodynamics
integer, public i_ns
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0m
ocean surface roughness length for momentum [m]
logical, public io_lnml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:60
real(rp), dimension(:,:), allocatable, public real_lon
longitude [rad,0-2pi]
integer, public i_qg
integer, public const_i_sw
short-wave radiation index
Definition: scale_const.F90:99
subroutine, public parentoceansetupscale(odims)
Ocean Setup.
module PRECISION
real(rp), dimension(:,:), allocatable, public topo_zsfc
absolute ground height [m]
real(rp), dimension(:), allocatable, public grid_lcz
center coordinate [m]: z, local=global
module REAL input GrADS
module TOPOGRAPHY
real(rp), public const_pi
pi
Definition: scale_const.F90:34
real(rp), dimension(:,:), allocatable, public urban_tg
real(rp), dimension(:,:), allocatable, public ocean_sfc_temp
ocean surface skin temperature [K]
real(rp), dimension(:,:), allocatable, public atmos_phy_sf_sfc_z0m
real(rp), dimension(:,:), allocatable, public urban_sfc_temp
integer, dimension(6), public time_nowdate
current time [YYYY MM DD HH MM SS]
Definition: scale_time.F90:65
module land grid index
real(rp), dimension(:,:,:), allocatable, public urban_trl
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
subroutine, public parentoceanopenwrfarw
real(rp), dimension(:,:), allocatable, public real_lat
latitude [rad,-pi,pi]
real(rp), dimension(:,:), allocatable, public landuse_fact_land
land factor
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
subroutine, public parentatominputscale(velz_org, velx_org, vely_org, pres_org, dens_org, pott_org, qtrc_org, flg_bin, flg_intrp, basename_org, mptype_parent, dims, it)
subroutine, public realinput_surface
real(rp), dimension(:,:,:), allocatable, public urban_tbl
real(rp), dimension(:,:), allocatable, public real_lonx
longitude at staggered point (uy) [rad,0-2pi]
subroutine, public parentatominputgrads(velz_org, velx_org, vely_org, pres_org, temp_org, qtrc_org, lon_org, lat_org, cz_org, basename_num, dims, nt)
real(rp), dimension(:,:), allocatable, public landuse_frac_land
land fraction
integer, public i_qr
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0h
ocean surface roughness length for heat [m]
module OCEAN Variables
real(rp), dimension(:,:), allocatable, public urban_rainb
subroutine, public parentatomopengrads
subroutine replace_misval_const(data, maskval, frac_land)
integer, public i_qc
real(rp), dimension(:,:,:,:), allocatable, target, public qtrc
subroutine, public parentoceaninputnicam(tw_org, sst_org, basename_num, odims, omask_org, it)
module urban grid index
real(rp), dimension(:,:), allocatable, public real_laty
latitude at staggered point (xv) [rad,-pi,pi]
integer, public ja
of y whole cells (local, with HALO)