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
74 integer,
parameter :: i_intrp_off = 0
75 integer,
parameter :: i_intrp_mask = 1
76 integer,
parameter :: i_intrp_fill = 2
78 integer,
parameter :: cosin = 1
79 integer,
parameter :: sine = 2
81 real(RP),
allocatable :: lon_org (:,:)
82 real(RP),
allocatable :: lat_org (:,:)
83 real(RP),
allocatable :: cz_org(:,:,:)
85 real(RP),
allocatable :: dens_org(:,:,:)
86 real(RP),
allocatable :: qtrc_org(:,:,:,:)
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(:,:,:)
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(:,:,:)
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(:,:)
109 integer,
private :: itp_nh = 4
110 integer,
private :: itp_nv = 2
112 integer,
private :: io_fid_grads_nml = -1
113 integer,
private :: io_fid_grads_data = -1
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.
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
135 real(RP),
private,
parameter :: maskval_tg = 298.0_rp
136 real(RP),
private,
parameter :: maskval_strg = 0.02_rp
142 integer :: number_of_files = 1
143 integer :: number_of_tsteps = 1
144 integer :: number_of_skip_tsteps = 0
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
153 integer :: parent_mp_type = 6
155 logical :: serial_proc_read = .true.
157 logical :: use_file_density = .false.
173 logical,
intent(in) :: flg_intrp
176 namelist / param_mkinit_real_atmos / &
179 number_of_skip_tsteps, &
185 boundary_update_dt, &
190 character(len=H_LONG) :: BASENAME_ATMOS =
'' 191 character(len=H_LONG) :: BASENAME_WITHNUM =
'' 192 character(len=5) :: NUM =
'' 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(:,:,:,:,:)
205 integer :: totaltimesteps = 1
207 integer :: skip_steps
211 integer :: k, i, j, iq, n, ns, ne
215 if(
io_l )
write(
io_fid_log,*)
'+++ Module[RealCaseAtmos]/Categ[MKINIT]' 219 read(
io_fid_conf,nml=param_mkinit_real_atmos,iostat=ierr)
221 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 222 elseif( ierr > 0 )
then 223 write(*,*)
'xxx Not appropriate names in namelist PARAM_MKINIT_REAL_ATMOS. Check!' 234 if ( filetype_org ==
"GrADS" )
then 235 basename_withnum = basename_org
238 if ( number_of_files > 1 .or. basename_add_num )
then 239 basename_withnum = trim(basename_org)//
"_00000" 241 basename_withnum = trim(basename_org)
243 basename_atmos = basename_org
252 if ( boundary_update_dt <= 0.0_rp )
then 253 write(*,*)
'xxx BOUNDARY_UPDATE_DT is necessary in real case preprocess' 257 if ( timelen > 0 )
then 258 number_of_tsteps = timelen
261 totaltimesteps = number_of_files * number_of_tsteps
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) )
271 do n = 1, number_of_files
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
277 basename_withnum = trim(basename_atmos)
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
284 ns = number_of_tsteps * (n - 1) + 1
285 ne = ns + (number_of_tsteps - 1)
287 if ( ne <= number_of_skip_tsteps )
then 292 skip_steps = max(number_of_skip_tsteps - ns + 1, 0)
293 ns = max(ns, number_of_skip_tsteps+1)
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), &
305 flg_bin, flg_intrp, &
312 ns = number_of_skip_tsteps + 1
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)
323 qtrc(k,i,j,iq) = qtrc_org(k,i,j,iq,ns)
330 totaltimesteps = totaltimesteps - number_of_skip_tsteps
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), &
338 boundary_update_dt, &
342 deallocate( dens_org )
343 deallocate( momz_org )
344 deallocate( momx_org )
345 deallocate( momy_org )
346 deallocate( rhot_org )
347 deallocate( qtrc_org )
404 logical :: USE_FILE_LANDWATER = .true.
405 real(RP) :: INIT_LANDWATER_RATIO = 0.5_rp
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
414 logical :: elevation_collection = .true.
416 namelist / param_mkinit_real_land / &
419 number_of_skip_tsteps, &
423 use_file_landwater, &
424 init_landwater_ratio, &
427 intrp_land_sfc_temp, &
430 elevation_collection, &
433 namelist / param_mkinit_real_ocean / &
436 number_of_skip_tsteps, &
442 boundary_update_dt, &
444 intrp_ocean_sfc_temp, &
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
460 real(RP) :: LAND_SFC_TEMP_ORG(
ia,
ja)
461 real(RP) :: LAND_SFC_albedo_ORG(
ia,
ja,2)
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)
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(:,:,:)
476 integer :: mdlid_land, mdlid_ocean
477 integer :: ldims(3), odims(2)
479 integer :: totaltimesteps = 1
481 integer :: skip_steps
486 integer :: k, i, j, n, ns, ne
490 if(
io_l )
write(
io_fid_log,*)
'+++ Module[RealCaseSurface]/Categ[MKINIT]' 497 read(
io_fid_conf,nml=param_mkinit_real_land,iostat=ierr)
499 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 500 elseif( ierr > 0 )
then 501 write(*,*)
'xxx Not appropriate names in namelist PARAM_MKINIT_REAL_LAND. Check!' 506 filetype_land = filetype_org
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
513 basename_land = trim(basename_org)
516 serial_land = serial_proc_read
518 lit = mod(number_of_skip_tsteps,number_of_tsteps)+1
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
532 read(
io_fid_conf,nml=param_mkinit_real_ocean,iostat=ierr)
534 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 535 elseif( ierr > 0 )
then 536 write(*,*)
'xxx Not appropriate names in namelist PARAM_MKINIT_REAL_OCEAN. Check!' 541 filetype_ocean = filetype_org
543 if ( filetype_ocean .ne.
"GrADS" .and. ( number_of_files > 1 .or. basename_add_num ) )
then 544 basename_ocean = trim(basename_org)//
"_00000" 546 basename_ocean = trim(basename_org)
549 select case ( soilwater_ds2vc )
551 soilwater_ds2vc_flag = .true.
553 soilwater_ds2vc_flag = .false.
555 write(*,*)
' xxx Unsupported SOILWATER_DS2CV TYPE:', trim(soilwater_ds2vc)
559 serial_ocean = serial_proc_read
562 call parentsurfacesetup( ldims, odims, &
570 use_file_landwater, &
573 intrp_land_sfc_temp, &
575 intrp_ocean_sfc_temp )
577 if ( timelen > 0 )
then 578 number_of_tsteps = timelen
581 totaltimesteps = number_of_files * number_of_tsteps
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 ) )
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
593 if ( mdlid_ocean ==
igrads )
then 598 do n = 1, number_of_files
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
604 basename_ocean = trim(basename_org)
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
611 ns = number_of_tsteps * (n - 1) + 1
612 ne = ns + (number_of_tsteps - 1)
614 if ( ne <= number_of_skip_tsteps )
then 619 skip_steps = max(number_of_skip_tsteps - ns + 1, 0)
620 ns = max(ns, number_of_skip_tsteps+1)
623 call parentsurfaceinput( land_temp_org, &
626 land_sfc_albedo_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), &
644 mdlid_land, mdlid_ocean, &
646 use_file_landwater, &
647 init_landwater_ratio, &
649 soilwater_ds2vc_flag, &
650 elevation_collection, &
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)
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)
690 ns = number_of_skip_tsteps + 1
722 totaltimesteps = totaltimesteps - number_of_skip_tsteps
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' 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), &
734 boundary_update_dt, &
740 deallocate( ocean_temp_org )
741 deallocate( ocean_sfc_temp_org )
742 deallocate( ocean_sfc_albedo_org )
743 deallocate( ocean_sfc_z0_org )
757 use_file_density_in, &
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
780 logical,
intent(in) :: use_file_density_in
785 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputAtmos]/Categ[Setup]' 790 do_read_atom = .true.
792 do_read_atom = .false.
795 do_read_atom = .true.
798 select case(trim(filetype))
802 do_read_atom = .true.
805 update_coord = .false.
806 use_file_density = use_file_density_in
816 update_coord = .true.
817 use_file_density = .false.
826 update_coord = .false.
827 use_file_density = .false.
836 update_coord = .true.
837 use_file_density = .false.
844 write(*,*)
' xxx Unsupported FILE TYPE:', trim(filetype)
850 call comm_bcast( dims(:), 6 )
851 call comm_bcast( timelen )
854 if(
io_l )
write(
io_fid_log,*)
'+++ Horizontal Interpolation Level:', &
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 ) )
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) ) )
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) ) )
884 subroutine parentatominput( &
905 thermodyn_pott => atmos_thermodyn_pott
907 hydrostatic_buildrho_real => atmos_hydrostatic_buildrho_real
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
935 logical,
intent(in) :: flg_bin
936 logical,
intent(in) :: flg_intrp
937 integer,
intent(in) :: mptype_parent
938 integer,
intent(in) :: timelen
939 integer,
intent(in) :: skiplen
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)
953 integer :: k, i, j, iq
955 character(len=H_SHORT) :: mptype_run
959 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputAtmos]/Categ[Input]' 965 mptype_run =
'single' 967 mptype_run =
'single' 969 mptype_run =
'double' 971 mptype_run =
'single-bin' 973 write(*,*)
'xxx Unsupported TRACER_TYPE (', trim(
tracer_type),
'). Check!' 978 if ( do_read_atom )
then 980 select case ( mdlid )
1007 do n = skiplen+1, timelen
1010 if ( do_read_atom )
then 1012 select case ( mdlid )
1016 pres_org, dens_org, pott_org, &
1018 flg_bin, flg_intrp, &
1019 basename_org, mptype_parent, &
1025 pres_org, temp_org, qtrc_org, &
1026 lon_org, lat_org, cz_org, &
1027 basename_org, mptype_parent, &
1033 pres_org, temp_org, qtrc_org, &
1034 basename_org, dims, n )
1039 pres_org, temp_org, qtrc_org, &
1040 lon_org, lat_org, cz_org, &
1041 basename_org, dims, n )
1045 if ( use_temp )
then 1049 call thermodyn_pott( pott_org(k,i,j), &
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) )
1069 call comm_bcast( pres_org, dims(1)+2, dims(2), dims(3) )
1072 if ( first .or. update_coord )
then 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) )
1082 if ( first .or. update_coord )
then 1085 lon(:,:), lat(:,:), cz(
ks:
ke,:,:) )
1093 cz_org, lat_org, lon_org, &
1094 dims(1)+2, dims(2), dims(3) )
1130 work(k,i,j) = llvelx(k,i,j) * rotc(i,j,cosin) + llvely(k,i,j) * rotc(i,j,sine )
1139 velx(k,i,j) = ( work(k,i+1,j) + work(k,i,j) ) * 0.5_rp
1145 velx(k,
ia,j) = work(k,
ia,j)
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. )
1157 work(k,i,j) = - llvelx(k,i,j) * rotc(i,j,sine ) + llvely(k,i,j) * rotc(i,j,cosin)
1165 vely(k,i,j) = ( work(k,i,j+1) + work(k,i,j) ) * 0.5_rp
1171 vely(k,i,
ja) = work(k,i,
ja)
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. )
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(:,:,:,:) )
1193 qtrc_org(k,i,j,iq) = max( qtrc_org(k,i,j,iq), 0.0_rp )
1210 qtrc_org(:,:,:,iq), &
1219 if( use_file_density )
then 1222 dens_org =
log( dens_org )
1234 pres_org =
log( pres_org )
1249 if (
i_qc > 0 )
then 1251 qc(:,:,:) = qc(:,:,:) + qtrc(:,:,:,iq,nn)
1256 call hydrostatic_buildrho_real( dens(:,:,:,nn), &
1260 qtrc(:,:,:,
i_qv,nn), &
1263 call comm_vars8( dens(:,:,:,nn), 1 )
1264 call comm_wait ( dens(:,:,:,nn), 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
1278 momz(
ke,i,j,nn) = 0.0_rp
1284 rhot(k,i,j,nn) = pott(k,i,j) * dens(k,i,j,nn)
1291 momx(k,i,j,nn) = velx(k,i,j) * ( dens(k,i+1,j,nn) + dens(k,i,j,nn) ) * 0.5_rp
1297 momx(k,
ia,j,nn) = velx(k,
ia,j) * dens(k,
ia,j,nn)
1300 call comm_vars8( momx(:,:,:,nn), 1 )
1305 momy(k,i,j,nn) = vely(k,i,j) * ( dens(k,i,j+1,nn) + dens(k,i,j,nn) ) * 0.5_rp
1311 momy(k,i,
ja,nn) = vely(k,i,
ja) * dens(k,i,
ja,nn)
1314 call comm_vars8( momy(:,:,:,nn), 2 )
1316 call comm_wait ( momx(:,:,:,nn), 1, .false. )
1317 call comm_wait ( momy(:,:,:,nn), 2, .false. )
1324 end subroutine parentatominput
1328 subroutine parentatomboundary( &
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
1359 character(len=H_MID) :: atmos_boundary_out_dtype =
'DEFAULT' 1360 real(RP),
allocatable :: buffer(:,:,:,:)
1361 integer :: nowdate(6)
1363 integer :: k, i, j, n, iq
1371 nowdate(1) = nowdate(1)
1373 allocate( buffer(
ka,
ia,
ja,te-ts+1) )
1376 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputAtmos]/Categ[Boundary]' 1378 call fileio_write( dens(:,:,:,ts:te), basename, title, &
1379 'DENS',
'Reference Density',
'kg/m3',
'ZXYT', &
1380 atmos_boundary_out_dtype, update_dt, nowdate )
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) )
1391 call fileio_write( buffer, basename, title, &
1392 'VELZ',
'Reference VELZ',
'm/s',
'ZXYT', &
1393 atmos_boundary_out_dtype, update_dt, nowdate )
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) )
1405 buffer(:,
ia,:,n-ts+1) = buffer(:,
ia-1,:,n-ts+1)
1407 call fileio_write( buffer, basename, title, &
1408 'VELX',
'Reference VELX',
'm/s',
'ZXYT', &
1409 atmos_boundary_out_dtype, update_dt, nowdate )
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) )
1421 buffer(:,:,
ja,n-ts+1) = buffer(:,:,
ja-1,n-ts+1)
1423 call fileio_write( buffer, basename, title, &
1424 'VELY',
'Reference VELY',
'm/s',
'ZXYT', &
1425 atmos_boundary_out_dtype, update_dt, nowdate )
1431 buffer(k,i,j,n-ts+1) = rhot(k,i,j,n) / dens(k,i,j,n)
1436 call fileio_write( buffer, basename, title, &
1437 'POTT',
'Reference PT',
'K',
'ZXYT', &
1438 atmos_boundary_out_dtype, update_dt, nowdate )
1445 buffer(k,i,j,n-ts+1) = qtrc(k,i,j,iq,n)
1450 call fileio_write( buffer, basename, title, &
1452 atmos_boundary_out_dtype, update_dt, nowdate )
1455 deallocate( buffer )
1458 end subroutine parentatomboundary
1462 subroutine parentsurfacesetup( &
1470 use_file_landwater, &
1473 intrp_land_sfc_temp, &
1475 intrp_ocean_sfc_temp )
1495 integer,
intent(out) :: ldims(3)
1496 integer,
intent(out) :: odims(2)
1497 integer,
intent(out) :: lmdlid
1498 integer,
intent(out) :: omdlid
1499 integer,
intent(out) :: timelen
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
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
1513 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputSurface]/Categ[Setup]' 1518 write(*,*)
'xxx LKMAX less than 4: ',
lkmax 1519 write(*,*)
'xxx in Real Case, LKMAX should be set more than 4' 1523 if( serial_land )
then 1525 do_read_land = .true.
1527 do_read_land = .false.
1530 do_read_land = .true.
1533 select case(trim(filetype_land))
1537 serial_land = .false.
1538 do_read_land = .true.
1540 use_waterratio = .false.
1547 use_waterratio = .true.
1549 case(
'NICAM-NETCDF')
1554 use_waterratio = .false.
1561 use_file_landwater, &
1566 write(*,*)
' xxx Unsupported FILE TYPE:', trim(filetype_land)
1571 if( serial_land )
then 1572 call comm_bcast( ldims(:), 3 )
1573 call comm_bcast( use_waterratio )
1577 select case ( intrp_land_temp )
1579 i_intrp_land_temp = i_intrp_off
1581 i_intrp_land_temp = i_intrp_mask
1583 i_intrp_land_temp = i_intrp_fill
1585 write(*,*)
'xxx INTRP_LAND_TEMP is invalid. ', intrp_land_temp
1588 select case ( intrp_land_sfc_temp )
1590 i_intrp_land_sfc_temp = i_intrp_off
1592 i_intrp_land_sfc_temp = i_intrp_mask
1594 i_intrp_land_sfc_temp = i_intrp_fill
1596 write(*,*)
'xxx INTRP_LAND_SFC_TEMP is invalid. ', intrp_land_sfc_temp
1599 select case ( intrp_land_water )
1601 i_intrp_land_water = i_intrp_off
1603 i_intrp_land_water = i_intrp_mask
1605 i_intrp_land_water = i_intrp_fill
1607 write(*,*)
'xxx INTRP_LAND_WATER is invalid. ', intrp_land_water
1611 select case ( lmdlid )
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
1621 if( serial_ocean )
then 1623 do_read_ocean = .true.
1625 do_read_ocean = .false.
1628 do_read_ocean = .true.
1631 select case(trim(filetype_ocean))
1636 serial_ocean = .false.
1637 do_read_ocean = .true.
1639 update_coord = .false.
1646 update_coord = .true.
1648 case(
'NICAM-NETCDF')
1653 update_coord = .false.
1660 update_coord = .false.
1664 write(*,*)
' xxx Unsupported FILE TYPE:', trim(filetype_ocean)
1669 if( serial_ocean )
then 1670 call comm_bcast( odims(:), 2 )
1671 call comm_bcast( timelen )
1675 select case ( intrp_ocean_temp )
1677 i_intrp_ocean_temp = i_intrp_off
1679 i_intrp_ocean_temp = i_intrp_mask
1681 i_intrp_ocean_temp = i_intrp_fill
1683 write(*,*)
'xxx INTRP_OCEAN_TEMP is invalid. ', intrp_ocean_temp
1686 select case ( intrp_ocean_sfc_temp )
1688 i_intrp_ocean_sfc_temp = i_intrp_off
1690 i_intrp_ocean_sfc_temp = i_intrp_mask
1692 i_intrp_ocean_sfc_temp = i_intrp_fill
1694 write(*,*)
'xxx INTRP_OCEAN_SFC_TEMP is invalid. ', intrp_ocean_sfc_temp
1698 select case ( omdlid )
1700 i_intrp_ocean_temp = i_intrp_mask
1701 i_intrp_ocean_sfc_temp = i_intrp_mask
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) ) )
1715 end subroutine parentsurfacesetup
1719 subroutine parentsurfaceinput( &
1745 use_file_landwater, &
1746 init_landwater_ratio, &
1748 soilwater_ds2vc_flag, &
1749 elevation_collection, &
1768 thermodyn_temp_pres => atmos_thermodyn_temp_pres
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
1815 real(RP),
intent(in) :: init_landwater_ratio
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
1821 integer,
intent(in) :: skiplen
1822 integer,
intent(in) :: lit
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))
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))
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))
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)
1861 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputOcean]/Categ[Input]' 1865 if ( do_read_land )
then 1867 select case ( mdlid_land )
1872 lst_org, ust_org, albg_org, &
1873 topo_org, lmask_org, &
1874 llon_org, llat_org, lz_org, &
1875 basename_land, ldims, &
1876 use_file_landwater, lit )
1882 lst_org, ust_org, albg_org, &
1883 topo_org, lmask_org, &
1884 llon_org, llat_org, lz_org, &
1885 basename_land, ldims, &
1886 use_file_landwater, lit )
1893 llon_org, llat_org, lz_org, &
1894 topo_org, lmask_org, &
1895 basename_land, ldims, &
1896 use_file_landwater, lit )
1903 tg_org, strg_org, smds_org, &
1905 llon_org, llat_org, lz_org, &
1906 topo_org, lmask_org, &
1907 basename_land, ldims, &
1908 use_file_landwater, lit )
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) )
1921 call comm_bcast( strg_org, ldims(1), ldims(2), ldims(3) )
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) )
1938 call thermodyn_temp_pres( temp, &
1946 qc_urb(i,j) = 0.0_rp
1948 qc_urb(i,j) = qtrc(
ks,i,j,
i_qv)
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 ), &
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 ), &
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)
1970 + ( momy(
ks,
ia,
ja) / dens(
ks,
ia,
ja) )**2.0_rp ), 0.01_rp)
1972 call comm_vars8( uc_urb, 1 )
1973 call comm_wait ( uc_urb, 1, .false. )
1979 if ( do_read_ocean )
then 1981 select case ( mdlid_ocean )
2009 do n = skiplen+1, timelen
2012 if ( do_read_ocean )
then 2014 select case ( mdlid_ocean )
2019 albw_org, z0w_org, &
2021 basename_ocean, odims, &
2028 albw_org, z0w_org, &
2030 olon_org, olat_org, &
2031 basename_ocean, odims, &
2038 basename_ocean, odims, &
2049 olon_org, olat_org, &
2050 basename_ocean, odims, &
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) )
2073 if ( first .or. update_coord )
then 2077 igrd_o(:,:,:), jgrd_o(:,:,:), &
2078 olat_org(:,:), olon_org(:,:), &
2079 odims(1), odims(2), &
2080 llat_org(:,:), llon_org(:,:), &
2081 ldims(2), ldims(3) )
2084 igrd_o(:,:,:), jgrd_o(:,:,:), &
2085 olat_org(:,:), olon_org(:,:), &
2086 odims(1), odims(2), &
2087 llat_org(:,:), llon_org(:,:), &
2088 ldims(2), ldims(3) )
2093 if ( i_intrp_ocean_temp .ne. i_intrp_off )
then 2094 select case ( i_intrp_ocean_temp )
2095 case ( i_intrp_mask )
2097 case ( i_intrp_fill )
2098 call make_mask( omask, tw_org, odims(1), odims(2), landdata=.false.)
2100 call interp_oceanland_data(tw_org, omask, odims(1), odims(2), .false., intrp_iter_max)
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 )
2108 case ( i_intrp_fill )
2109 call make_mask( omask, sst_org, odims(1), odims(2), landdata=.false.)
2111 call interp_oceanland_data(sst_org, omask, odims(1), odims(2), .false., intrp_iter_max)
2120 tg_org, strg_org, smds_org, &
2121 lst_org, albg_org, &
2127 lz_org, llon_org, llat_org, &
2130 maskval_tg, maskval_strg, &
2131 init_landwater_ratio, &
2132 use_file_landwater, &
2134 soilwater_ds2vc_flag, &
2135 elevation_collection, &
2140 if ( first .or. update_coord )
then 2143 igrd_o(:,:,:), jgrd_o(:,:,:), odims(1), odims(2) )
2151 if ( albw_org(i,j,i_lw) == undef ) albw_org(i,j,i_lw) = 0.04_rp
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
2158 if ( first .or. update_coord )
then 2161 igrd(:,:,:), jgrd(:,:,:), &
2162 lat(:,:), lon(:,:), &
2164 olat_org(:,:), olon_org(:,:), &
2165 odims(1), odims(2) )
2169 igrd(:,:,:), jgrd(:,:,:),
ia,
ja )
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 )
2177 igrd(:,:,:), jgrd(:,:,:),
ia,
ja )
2184 if( abs(lsmask_nest(i,j)-0.0_rp) < eps )
then 2185 lst(i,j) = sst(i,j,nn)
2186 ust(i,j) = sst(i,j,nn)
2199 end subroutine parentsurfaceinput
2202 subroutine parentoceanboundary( &
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
2229 character(len=H_MID) :: ocean_boundary_out_dtype =
'DEFAULT' 2230 integer :: nowdate(6)
2238 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputOcean]/Categ[Boundary]' 2241 nowdate(1) = nowdate(1)
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 )
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 )
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 )
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 )
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 )
2264 end subroutine parentoceanboundary
2295 init_landwater_ratio, &
2296 use_file_landwater, &
2298 soilwater_ds2vc_flag, &
2299 elevation_collection, &
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
2351 real(RP) :: lmask(ldims(2), ldims(3))
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)
2361 real(RP) :: sst_land(ldims(2), ldims(3))
2362 real(RP) :: work(ldims(2), ldims(3))
2364 real(RP) :: lz3d_org(ldims(1),ldims(2),ldims(3))
2368 real(RP) :: topo(
ia,
ja)
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 )
2379 case ( i_intrp_fill )
2380 call make_mask( lmask, lst_org, ldims(2), ldims(3), landdata=.true.)
2382 write(*,*)
'xxx INTRP_LAND_SFC_TEMP is invalid.' 2385 call interp_oceanland_data(lst_org, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2404 igrd_l(:,:,:), jgrd_l(:,:,:), &
2405 llat_org(:,:), llon_org(:,:), &
2406 ldims(2), ldims(3), &
2407 olat_org(:,:), olon_org(:,:), &
2408 odims(1), odims(2) )
2413 igrd_l(:,:,:), jgrd_l(:,:,:), ldims(2), ldims(3) )
2419 if ( ust_org(i,j) == undef ) ust_org(i,j) = lst_org(i,j)
2423 if ( albg_org(i,j,i_lw) == undef ) albg_org(i,j,i_lw) = 0.03_rp
2424 if ( albg_org(i,j,i_sw) == undef ) albg_org(i,j,i_sw) = 0.22_rp
2429 if ( i_intrp_land_temp .ne. i_intrp_off )
then 2431 work(:,:) = tg_org(k,:,:)
2432 select case ( i_intrp_land_temp )
2433 case ( i_intrp_mask )
2435 case ( i_intrp_fill )
2436 call make_mask( lmask, work, ldims(2), ldims(3), landdata=.true.)
2438 call interp_oceanland_data( work, lmask, ldims(2), ldims(3), .true., intrp_iter_max )
2441 tg_org(k,:,:) = work(:,:)
2449 lz3d_org(:,i,j) = lz_org(:)
2455 lcz_3d(:,i,j) = lcz(:)
2460 vfactl(:,:,:,:,:), &
2462 igrd(:,:,:), jgrd(:,:,:), &
2465 lat(:,:), lon(:,:), &
2468 llat_org(:,:), llon_org(:,:), &
2469 ldims(1), ldims(2), ldims(3), &
2473 igrd(:,:,:), jgrd(:,:,:),
ia,
ja )
2475 igrd(:,:,:), jgrd(:,:,:),
ia,
ja )
2483 igrd(:,:,:), jgrd(:,:,:),
ia,
ja )
2485 igrd(:,:,:), jgrd(:,:,:),
ia,
ja )
2490 vfactl(:,:,:,:,:), &
2509 if ( elevation_collection )
then 2511 igrd(:,:,:), jgrd(:,:,:),
ia,
ja )
2515 if ( topo(i,j) > 0.0_rp )
then 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
2520 tg(k,i,j) = tg(k,i,j) - tdiff
2530 if( use_file_landwater )
then 2532 if ( use_waterratio )
then 2534 if ( i_intrp_land_water .ne. i_intrp_off )
then 2536 work(:,:) = smds_org(k,:,:)
2537 select case ( i_intrp_land_water )
2538 case ( i_intrp_mask )
2540 case ( i_intrp_fill )
2541 call make_mask( lmask, work, ldims(2), ldims(3), landdata=.true.)
2543 call interp_oceanland_data(work, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2544 lmask(:,:) = init_landwater_ratio
2547 smds_org(k,:,:) = work(:,:)
2554 vfactl(:,:,:,:,:), &
2560 strg(k,:,:) =
convert_ws2vwc( smds(k,:,:), critical=soilwater_ds2vc_flag )
2565 if ( i_intrp_land_water .ne. i_intrp_off )
then 2567 work(:,:) = strg_org(k,:,:)
2568 select case ( i_intrp_land_water )
2569 case ( i_intrp_mask )
2571 case ( i_intrp_fill )
2572 call make_mask( lmask, work, ldims(2), ldims(3), landdata=.true.)
2574 call interp_oceanland_data(work, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2575 lmask(:,:) = maskval_strg
2578 strg_org(k,:,:) = work(:,:)
2585 vfactl(:,:,:,:,:), &
2606 smds(:,:,:) = init_landwater_ratio
2618 albu(i,j,:) = albg(i,j,:)
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
2656 if( abs(
data(i,j) - undef) < sqrt(eps) )
then 2665 subroutine interp_oceanland_data( &
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
2682 integer,
intent(in) :: iter_max
2683 real(RP),
intent(out),
optional :: maskval
2685 integer :: untarget_mask
2686 integer,
allocatable :: imask(:,:),imaskr(:,:)
2687 real(RP),
allocatable :: newdata(:,:)
2691 integer :: i, j, ii, jj, kk
2694 allocate( imask(nx,ny) )
2695 allocate( imaskr(nx,ny) )
2696 allocate( newdata(nx,ny) )
2698 if(
present(maskval) ) maskval = 999.99_rp
2703 if( abs(lsmask(i,j)-1.0_rp) < eps )
then 2710 if ( landdata )
then 2722 if ( imask(i,j) == untarget_mask )
then 2723 newdata(i,j) =
data(i,j)
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)
2739 if ( jj < 1 .or. jj > ny ) cycle
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)
2749 if( count >= 3 )
then 2750 newdata(i,j) = nd / count
2751 imaskr(i,j) = untarget_mask
2753 newdata(i,j) =
data(i,j)
2761 imask(:,:) = imaskr(:,:)
2762 data(:,:) = newdata(:,:)
2766 deallocate( imaskr )
2767 deallocate( newdata )
2770 end subroutine interp_oceanland_data
2777 real(RP),
intent(inout) :: data(:,:)
2778 real(RP),
intent(in) :: maskval
2779 real(RP),
intent(in) :: frac_land(:,:)
2784 if( abs(frac_land(i,j)-0.0_rp) < eps )
then 2798 real(RP),
intent(inout) :: data(:,:)
2799 real(RP),
intent(in) :: maskval(:,:)
2800 integer,
intent(in) :: nx, ny
2801 character(*),
intent(in) :: elem
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
2811 data(i,j) = maskval(i,j)
2820 subroutine diagnose_number_concentration( &
2826 real(RP),
intent(inout) :: qvars(:,:,:,:)
2828 real(RP),
parameter :: Dc = 20.d-6
2829 real(RP),
parameter :: Dr = 200.d-6
2830 real(RP),
parameter :: Di = 80.d-6
2831 real(RP),
parameter :: Ds = 80.d-6
2832 real(RP),
parameter :: Dg = 200.d-6
2833 real(RP),
parameter :: RHOw = 1000.d0
2834 real(RP),
parameter :: RHOf = 100.d0
2835 real(RP),
parameter :: RHOg = 400.d0
2836 real(RP),
parameter :: b = 3.d0
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 )
2852 end subroutine diagnose_number_concentration
real(rp), dimension(:,:,:), allocatable, target, public momz
subroutine, public intrpnest_domain_compatibility(lon_org, lat_org, lev_org, lon_loc, lat_loc, lev_loc, skip_x, skip_y, skip_z)
logical, public prc_ismaster
master process in local communicator?
real(rp), dimension(:,:), allocatable, public atmos_phy_sf_sfc_z0e
real(rp), dimension(:,:,:), allocatable, public ocean_sfc_albedo
ocean surface albedo [0-1]
integer, public const_i_lw
long-wave radiation index
subroutine, public prc_mpistop
Abort MPI.
real(rp), dimension(:,:), allocatable, public urban_qc
real(rp), dimension(:,:), allocatable, public landuse_fact_urban
urban factor
module GRID (nesting system)
real(rp), dimension(:,:,:), allocatable, target, public rhot
integer, parameter, public inicam
logical, public io_l
output log or not? (this process)
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0e
ocean surface roughness length for vapor [m]
real(rp), dimension(:,:), allocatable, public ocean_temp
temperature at uppermost ocean layer [K]
module ATMOSPHERIC Variables
real(rp), dimension(:,:,:), allocatable, target, public momx
integer, public ke
end point of inner domain: z, local
real(rp), dimension(:,:,:), allocatable, public real_fz
geopotential height [m] (cell face )
real(rp), dimension(:,:), allocatable, public atmos_phy_sf_sfc_temp
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
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]
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)
real(rp), dimension(:,:), allocatable, public urban_raing
character(len=h_short), public tracer_type
real(rp), dimension(:,:), allocatable, public urban_uc
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
real(rp), dimension(:,:), allocatable, public land_sfc_temp
land surface skin temperature [K]
module ATMOSPHERIC Surface Variables
real(rp), dimension(:,:), allocatable, public urban_tr
integer, public ia
of x whole cells (local, with HALO)
real(rp), dimension(:,:,:), allocatable, public urban_tgl
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]
integer, public ka
of z whole cells (local, with HALO)
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]
module ATMOSPHERE / Hydrostatic barance
real(rp), dimension(:,:), allocatable, public landuse_fact_ocean
ocean factor
real(rp), dimension(:,:), allocatable, public urban_roff
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)
procedure(intrpnest_intfc_interp_3d), pointer, public intrpnest_interp_3d
real(rp), dimension(:,:,:), allocatable, public urban_sfc_albedo
character(len=h_short), dimension(:), allocatable, public aq_unit
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:,:), allocatable, public urban_tc
real(rp), dimension(:,:,:), allocatable, target, public momy
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]
real(rp), public const_eps
small number
module ATMOSPHERE / Thermodynamics
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)
real(rp), dimension(:,:), allocatable, public real_lon
longitude [rad,0-2pi]
integer, public const_i_sw
short-wave radiation index
real(rp), dimension(:,:), allocatable, public topo_zsfc
absolute ground height [m]
real(rp), dimension(:), allocatable, public grid_lcz
center coordinate [m]: z, local=global
real(rp), public const_pi
pi
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]
real(rp), dimension(:,:,:), allocatable, public urban_trl
integer, public io_fid_conf
Config file ID.
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.
real(rp), dimension(:,:,:), allocatable, public urban_tbl
real(rp), dimension(:,:), allocatable, public real_lonx
longitude at staggered point (uy) [rad,0-2pi]
real(rp), dimension(:,:), allocatable, public landuse_frac_land
land fraction
real(rp), dimension(:,:), allocatable, public ocean_sfc_z0h
ocean surface roughness length for heat [m]
real(rp), dimension(:,:), allocatable, public urban_rainb
real(rp), dimension(:,:,:,:), allocatable, target, public qtrc
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)