62 private :: parentatominput
63 private :: parentatomboundary
64 private :: parentsurfacesetup
65 private :: parentsurfaceinput
66 private :: parentoceanboundary
67 private :: interp_oceanland_data
73 integer,
parameter :: I_intrp_off = 0
74 integer,
parameter :: I_intrp_mask = 1
75 integer,
parameter :: I_intrp_fill = 2
77 integer,
parameter :: cosin = 1
78 integer,
parameter :: sine = 2
80 real(RP),
allocatable :: lon_org (:,:)
81 real(RP),
allocatable :: lat_org (:,:)
82 real(RP),
allocatable :: cz_org(:,:,:)
84 real(RP),
allocatable :: dens_org(:,:,:)
85 real(RP),
allocatable :: qtrc_org(:,:,:,:)
87 real(RP),
allocatable :: velz_org(:,:,:)
88 real(RP),
allocatable :: velx_org(:,:,:)
89 real(RP),
allocatable :: vely_org(:,:,:)
90 real(RP),
allocatable :: pott_org(:,:,:)
91 real(RP),
allocatable :: temp_org(:,:,:)
92 real(RP),
allocatable :: pres_org(:,:,:)
94 real(RP),
allocatable :: hfact(:,:,:)
95 real(RP),
allocatable :: vfact(:,:,:,:,:)
96 integer,
allocatable :: igrd (:,:,:)
97 integer,
allocatable :: jgrd (:,:,:)
98 integer,
allocatable :: kgrd (:,:,:,:,:)
99 integer,
allocatable :: ncopy(:,:,:)
101 real(RP),
allocatable :: tw_org(:,:)
102 real(RP),
allocatable :: sst_org(:,:)
103 real(RP),
allocatable :: albw_org(:,:,:)
104 real(RP),
allocatable :: olon_org(:,:)
105 real(RP),
allocatable :: olat_org(:,:)
106 real(RP),
allocatable :: omask_org(:,:)
108 integer,
private :: itp_nh = 4
109 integer,
private :: itp_nv = 2
111 integer,
private :: io_fid_grads_nml = -1
112 integer,
private :: io_fid_grads_data = -1
114 logical,
private :: do_read_atom
115 logical,
private :: do_read_land
116 logical,
private :: do_read_ocean
117 logical,
private :: rotate
118 logical,
private :: use_waterratio
119 logical,
private :: update_coord
120 logical,
private :: use_temp
121 logical,
private :: serial
122 logical,
private :: serial_land
123 logical,
private :: serial_ocean
124 logical,
private :: first = .true.
126 integer,
private :: i_intrp_land_temp
127 integer,
private :: i_intrp_land_water
128 integer,
private :: i_intrp_land_sfc_temp
129 integer,
private :: i_intrp_ocean_temp
130 integer,
private :: i_intrp_ocean_sfc_temp
134 real(RP),
private,
parameter :: maskval_tg = 298.0_rp
135 real(RP),
private,
parameter :: maskval_strg = 0.02_rp
141 integer :: NUMBER_OF_FILES = 1
142 integer :: NUMBER_OF_TSTEPS = 1
143 integer :: NUMBER_OF_SKIP_TSTEPS = 0
145 character(len=H_LONG) :: FILETYPE_ORG =
'' 146 character(len=H_LONG) :: BASENAME_ORG =
'' 147 logical :: BASENAME_ADD_NUM = .false.
148 character(len=H_LONG) :: BASENAME_BOUNDARY =
'boundary_atmos' 149 character(len=H_LONG) :: BOUNDARY_TITLE =
'SCALE-RM BOUNDARY CONDITION for REAL CASE' 150 real(RP) :: BOUNDARY_UPDATE_DT = 0.0_rp
152 integer :: PARENT_MP_TYPE = 6
154 logical :: SERIAL_PROC_READ = .true.
156 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 real(RP) :: init_ocean_alb_lw = 0.04_rp
407 real(RP) :: init_ocean_alb_sw = 0.10_rp
408 real(RP) :: init_ocean_z0w = 1.0e-3_rp
409 character(len=H_SHORT) :: intrp_land_temp =
'off' 410 character(len=H_SHORT) :: intrp_land_water =
'off' 411 character(len=H_SHORT) :: intrp_land_sfc_temp =
'off' 412 character(len=H_SHORT) :: intrp_ocean_temp =
'off' 413 character(len=H_SHORT) :: intrp_ocean_sfc_temp =
'off' 414 integer :: intrp_iter_max = 100
415 character(len=H_SHORT) :: soilwater_ds2vc =
'limit' 416 logical :: soilwater_ds2vc_flag
417 logical :: elevation_collection = .true.
419 namelist / param_mkinit_real_land / &
422 number_of_skip_tsteps, &
426 use_file_landwater, &
427 init_landwater_ratio, &
430 intrp_land_sfc_temp, &
433 elevation_collection, &
436 namelist / param_mkinit_real_ocean / &
439 number_of_skip_tsteps, &
445 boundary_update_dt, &
450 intrp_ocean_sfc_temp, &
454 character(len=H_LONG) :: filetype_land
455 character(len=H_LONG) :: filetype_ocean
456 character(len=H_LONG) :: basename_land
457 character(len=H_LONG) :: basename_ocean
458 character(len=H_LONG) :: basename_withnum =
'' 459 character(len=5) :: num =
'' 460 logical :: serial_proc_read_land
461 logical :: serial_proc_read_ocean
466 real(RP) :: land_sfc_temp_org(
ia,
ja)
467 real(RP) :: land_sfc_albedo_org(
ia,
ja,2)
470 real(RP) :: urban_tc_org(
ia,
ja)
471 real(RP) :: urban_qc_org(
ia,
ja)
472 real(RP) :: urban_uc_org(
ia,
ja)
473 real(RP) :: urban_sfc_temp_org(
ia,
ja)
474 real(RP) :: urban_sfc_albedo_org(
ia,
ja,2)
477 real(RP),
allocatable :: ocean_temp_org(:,:,:)
478 real(RP),
allocatable :: ocean_sfc_temp_org(:,:,:)
479 real(RP),
allocatable :: ocean_sfc_albedo_org(:,:,:,:)
480 real(RP),
allocatable :: ocean_sfc_z0_org(:,:,:)
482 integer :: mdlid_land, mdlid_ocean
483 integer :: ldims(3), odims(2)
485 integer :: totaltimesteps = 1
487 integer :: skip_steps
492 integer :: k, i, j, n, ns, ne
496 if(
io_l )
write(
io_fid_log,*)
'+++ Module[RealCaseSurface]/Categ[MKINIT]' 503 read(
io_fid_conf,nml=param_mkinit_real_land,iostat=ierr)
505 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 506 elseif( ierr > 0 )
then 507 write(*,*)
'xxx Not appropriate names in namelist PARAM_MKINIT_REAL_LAND. Check!' 512 filetype_land = filetype_org
514 lfn = number_of_skip_tsteps / number_of_tsteps
515 if ( filetype_land .ne.
"GrADS" .and. ( number_of_files > 1 .or. basename_add_num ) )
then 516 write(num,
'(I5.5)') lfn
517 basename_land = trim(basename_org)//
"_"//num
519 basename_land = trim(basename_org)
522 serial_land = serial_proc_read
524 lit = mod(number_of_skip_tsteps,number_of_tsteps)+1
528 if(
io_l )
write(
io_fid_log,*)
'+++ Target File Name (Land): ',trim(basename_land)
529 if(
io_l )
write(
io_fid_log,*)
' Time Steps in One File: ', number_of_tsteps
538 read(
io_fid_conf,nml=param_mkinit_real_ocean,iostat=ierr)
540 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 541 elseif( ierr > 0 )
then 542 write(*,*)
'xxx Not appropriate names in namelist PARAM_MKINIT_REAL_OCEAN. Check!' 547 filetype_ocean = filetype_org
549 if ( filetype_ocean .ne.
"GrADS" .and. ( number_of_files > 1 .or. basename_add_num ) )
then 550 basename_ocean = trim(basename_org)//
"_00000" 552 basename_ocean = trim(basename_org)
555 select case( soilwater_ds2vc )
557 soilwater_ds2vc_flag = .true.
559 soilwater_ds2vc_flag = .false.
561 write(*,*)
'xxx Unsupported SOILWATER_DS2CV TYPE:', trim(soilwater_ds2vc)
565 serial_ocean = serial_proc_read
568 call parentsurfacesetup( ldims, odims, &
576 use_file_landwater, &
579 intrp_land_sfc_temp, &
581 intrp_ocean_sfc_temp )
583 if ( timelen > 0 )
then 584 number_of_tsteps = timelen
587 totaltimesteps = number_of_files * number_of_tsteps
589 allocate( ocean_temp_org(
ia,
ja,1+number_of_skip_tsteps:totaltimesteps ) )
590 allocate( ocean_sfc_temp_org(
ia,
ja,1+number_of_skip_tsteps:totaltimesteps ) )
591 allocate( ocean_sfc_albedo_org(
ia,
ja,2,1+number_of_skip_tsteps:totaltimesteps ) )
592 allocate( ocean_sfc_z0_org(
ia,
ja,1+number_of_skip_tsteps:totaltimesteps ) )
594 if ( mdlid_land ==
igrads )
then 595 if ( number_of_files > 1 .or. basename_add_num )
then 596 write(num,
'(I5.5)') lfn
597 basename_land =
"_"//num
603 if ( mdlid_ocean ==
igrads )
then 608 do n = 1, number_of_files
610 if ( number_of_files > 1 .or. basename_add_num )
then 611 write(num,
'(I5.5)') n-1
612 basename_ocean = trim(basename_org)//
"_"//num
614 basename_ocean = trim(basename_org)
618 if(
io_l )
write(
io_fid_log,*)
'+++ Target File Name (Ocean): ', trim(basename_ocean)
619 if(
io_l )
write(
io_fid_log,*)
' Time Steps in One File: ', number_of_tsteps
621 ns = number_of_tsteps * (n - 1) + 1
622 ne = ns + (number_of_tsteps - 1)
624 if ( ne <= number_of_skip_tsteps )
then 629 skip_steps = max(number_of_skip_tsteps - ns + 1, 0)
630 ns = max(ns, number_of_skip_tsteps+1)
633 call parentsurfaceinput( land_temp_org, &
636 land_sfc_albedo_org, &
640 urban_sfc_temp_org, &
641 urban_sfc_albedo_org, &
642 ocean_temp_org(:,:,ns:ne), &
643 ocean_sfc_temp_org(:,:,ns:ne), &
644 ocean_sfc_albedo_org(:,:,:,ns:ne), &
645 ocean_sfc_z0_org(:,:,ns:ne), &
654 mdlid_land, mdlid_ocean, &
656 use_file_landwater, &
657 init_landwater_ratio, &
662 soilwater_ds2vc_flag, &
663 elevation_collection, &
685 urban_trl(k,i,j) = urban_sfc_temp_org(i,j)
686 urban_tbl(k,i,j) = urban_sfc_temp_org(i,j)
687 urban_tgl(k,i,j) = urban_sfc_temp_org(i,j)
692 urban_tr(i,j) = urban_sfc_temp_org(i,j)
693 urban_tb(i,j) = urban_sfc_temp_org(i,j)
694 urban_tg(i,j) = urban_sfc_temp_org(i,j)
703 ns = number_of_skip_tsteps + 1
735 totaltimesteps = totaltimesteps - number_of_skip_tsteps
736 if ( totaltimesteps > 1 )
then 737 if ( boundary_update_dt <= 0.0_rp )
then 738 write(*,*)
'xxx BOUNDARY_UPDATE_DT is necessary in real case preprocess' 742 call parentoceanboundary( ocean_temp_org(:,:,ns:ne), &
743 ocean_sfc_temp_org(:,:,ns:ne), &
744 ocean_sfc_albedo_org(:,:,:,ns:ne), &
745 ocean_sfc_z0_org(:,:,ns:ne), &
747 boundary_update_dt, &
753 deallocate( ocean_temp_org )
754 deallocate( ocean_sfc_temp_org )
755 deallocate( ocean_sfc_albedo_org )
756 deallocate( ocean_sfc_z0_org )
770 use_file_density_in, &
787 integer,
intent(out) :: dims(6)
788 integer,
intent(out) :: timelen
789 integer,
intent(out) :: mdlid
790 character(len=*),
intent(in) :: basename_org
791 character(len=*),
intent(in) :: filetype
792 logical,
intent(in) :: serial_in
793 logical,
intent(in) :: use_file_density_in
798 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputAtmos]/Categ[Setup]' 803 do_read_atom = .true.
805 do_read_atom = .false.
808 do_read_atom = .true.
811 select case(trim(filetype))
815 do_read_atom = .true.
818 update_coord = .false.
819 use_file_density = use_file_density_in
829 update_coord = .true.
830 use_file_density = .false.
839 update_coord = .false.
840 use_file_density = .false.
849 update_coord = .true.
850 use_file_density = use_file_density_in
857 write(*,*)
'xxx Unsupported FILE TYPE:', trim(filetype)
863 call comm_bcast( dims(:), 6 )
864 call comm_bcast( timelen )
867 if(
io_l )
write(
io_fid_log,*)
'+++ Horizontal Interpolation Level:', &
872 allocate( hfact(
ia,
ja, itp_nh ) )
873 allocate( vfact(
ka,
ia,
ja, itp_nh, itp_nv ) )
874 allocate( igrd(
ia,
ja, itp_nh ) )
875 allocate( jgrd(
ia,
ja, itp_nh ) )
876 allocate( kgrd(
ka,
ia,
ja, itp_nh, itp_nv ) )
877 allocate( ncopy(
ia,
ja, itp_nh ) )
879 allocate( lon_org( dims(2), dims(3) ) )
880 allocate( lat_org( dims(2), dims(3) ) )
881 allocate( cz_org( dims(1)+2, dims(2), dims(3) ) )
883 allocate( velz_org( dims(1)+2, dims(2), dims(3) ) )
884 allocate( velx_org( dims(1)+2, dims(2), dims(3) ) )
885 allocate( vely_org( dims(1)+2, dims(2), dims(3) ) )
886 allocate( pott_org( dims(1)+2, dims(2), dims(3) ) )
887 allocate( temp_org( dims(1)+2, dims(2), dims(3) ) )
888 allocate( pres_org( dims(1)+2, dims(2), dims(3) ) )
889 allocate( qtrc_org( dims(1)+2, dims(2), dims(3),
qa ) )
890 allocate( dens_org( dims(1)+2, dims(2), dims(3) ) )
897 subroutine parentatominput( &
918 thermodyn_pott => atmos_thermodyn_pott
926 hydrostatic_buildrho_real => atmos_hydrostatic_buildrho_real
947 real(RP),
intent(out) :: dens(:,:,:,:)
948 real(RP),
intent(out) :: momz(:,:,:,:)
949 real(RP),
intent(out) :: momx(:,:,:,:)
950 real(RP),
intent(out) :: momy(:,:,:,:)
951 real(RP),
intent(out) :: rhot(:,:,:,:)
952 real(RP),
intent(out) :: qtrc(:,:,:,:,:)
953 character(len=*),
intent(in) :: basename_org
954 integer,
intent(in) :: dims(6)
955 integer,
intent(in) :: mdlid
956 logical,
intent(in) :: flg_bin
957 logical,
intent(in) :: flg_intrp
958 integer,
intent(in) :: mptype_parent
959 integer,
intent(in) :: timelen
960 integer,
intent(in) :: skiplen
962 real(RP) :: velz (KA,IA,JA)
963 real(RP) :: velx (KA,IA,JA)
964 real(RP) :: vely (KA,IA,JA)
965 real(RP) :: llvelx(KA,IA,JA)
966 real(RP) :: llvely(KA,IA,JA)
967 real(RP) :: work (KA,IA,JA)
968 real(RP) :: pott (KA,IA,JA)
969 real(RP) :: temp (KA,IA,JA)
970 real(RP) :: pres (KA,IA,JA)
972 real(RP) :: qc(KA,IA,JA)
974 integer :: k, i, j, iq
976 character(len=H_SHORT) :: mptype_run
980 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputAtmos]/Categ[Input]' 986 mptype_run =
'single' 988 mptype_run =
'single' 990 mptype_run =
'double' 992 mptype_run =
'single-bin' 994 write(*,*)
'xxx Unsupported ATMOS_PHY_MP_TYPE (', trim(
atmos_phy_mp_type),
'). Check!' 999 if ( do_read_atom )
then 1001 select case( mdlid )
1028 do n = skiplen+1, timelen
1031 if ( do_read_atom )
then 1033 select case( mdlid )
1037 pres_org, dens_org, pott_org, &
1040 flg_bin, flg_intrp, &
1041 basename_org, mptype_parent, &
1047 pres_org, temp_org, qtrc_org, &
1048 lon_org, lat_org, cz_org, &
1049 basename_org, mptype_parent, &
1055 pres_org, temp_org, qtrc_org, &
1056 basename_org, dims, n )
1061 pres_org, dens_org, temp_org, &
1063 lon_org, lat_org, cz_org, &
1064 basename_org, dims, n )
1068 if ( use_temp )
then 1072 call thermodyn_pott( pott_org(k,i,j), &
1075 qtrc_org(k,i,j,:), &
1087 call comm_bcast( velz_org, dims(1)+2, dims(2), dims(3) )
1088 call comm_bcast( velx_org, dims(1)+2, dims(2), dims(3) )
1089 call comm_bcast( vely_org, dims(1)+2, dims(2), dims(3) )
1090 call comm_bcast( pott_org, dims(1)+2, dims(2), dims(3) )
1091 call comm_bcast( qtrc_org, dims(1)+2, dims(2), dims(3),
qa )
1092 if ( use_file_density )
then 1093 call comm_bcast( dens_org, dims(1)+2, dims(2), dims(3) )
1095 call comm_bcast( pres_org, dims(1)+2, dims(2), dims(3) )
1098 if ( first .or. update_coord )
then 1100 call comm_bcast( lon_org, dims(2), dims(3) )
1101 call comm_bcast( lat_org, dims(2), dims(3) )
1102 call comm_bcast( cz_org, dims(1)+2, dims(2), dims(3) )
1108 if ( first .or. update_coord )
then 1111 lon(:,:), lat(:,:), cz(
ks:
ke,:,:) )
1119 cz_org, lat_org, lon_org, &
1120 dims(1)+2, dims(2), dims(3) )
1156 work(k,i,j) = llvelx(k,i,j) * rotc(i,j,cosin) + llvely(k,i,j) * rotc(i,j,sine )
1165 velx(k,i,j) = ( work(k,i+1,j) + work(k,i,j) ) * 0.5_rp
1171 velx(k,ia,j) = work(k,ia,j)
1174 velx(
ks-1,:,:) = 0.0_rp
1175 velx(
ks-2,:,:) = 0.0_rp
1176 call comm_vars8( velx(:,:,:), 1 )
1177 call comm_wait ( velx(:,:,:), 1, .false. )
1183 work(k,i,j) = - llvelx(k,i,j) * rotc(i,j,sine ) + llvely(k,i,j) * rotc(i,j,cosin)
1191 vely(k,i,j) = ( work(k,i,j+1) + work(k,i,j) ) * 0.5_rp
1197 vely(k,i,ja) = work(k,i,ja)
1200 vely(
ks-1,:,:) = 0.0_rp
1201 vely(
ks-2,:,:) = 0.0_rp
1202 call comm_vars8( vely(:,:,:), 1 )
1203 call comm_wait ( vely(:,:,:), 1, .false. )
1210 if( trim(mptype_run)==
'double' .and. mptype_parent <= 6 )
then 1211 if(
io_l )
write(
io_fid_log,*)
'--- Diagnose Number Concentration from Mixing Ratio' 1212 call hydrometeor_diagnose_number_concentration( qtrc_org(:,:,:,:) )
1219 qtrc_org(k,i,j,iq) = max( qtrc_org(k,i,j,iq), 0.0_rp )
1236 qtrc_org(:,:,:,iq), &
1245 if( use_file_density )
then 1248 dens_org = log( dens_org )
1260 pres_org = log( pres_org )
1273 if (
i_qc > 0 )
then 1275 qc(:,:,:) = qc(:,:,:) + qtrc(:,:,:,iq,nn)
1280 call hydrostatic_buildrho_real( dens(:,:,:,nn), &
1284 qtrc(:,:,:,
i_qv,nn), &
1287 call comm_vars8( dens(:,:,:,nn), 1 )
1288 call comm_wait ( dens(:,:,:,nn), 1 )
1296 momz(k,i,j,nn) = velz(k,i,j) * ( dens(k+1,i,j,nn) + dens(k,i,j,nn) ) * 0.5_rp
1302 momz(
ke,i,j,nn) = 0.0_rp
1308 rhot(k,i,j,nn) = pott(k,i,j) * dens(k,i,j,nn)
1315 momx(k,i,j,nn) = velx(k,i,j) * ( dens(k,i+1,j,nn) + dens(k,i,j,nn) ) * 0.5_rp
1321 momx(k,ia,j,nn) = velx(k,ia,j) * dens(k,ia,j,nn)
1324 call comm_vars8( momx(:,:,:,nn), 1 )
1329 momy(k,i,j,nn) = vely(k,i,j) * ( dens(k,i,j+1,nn) + dens(k,i,j,nn) ) * 0.5_rp
1335 momy(k,i,ja,nn) = vely(k,i,ja) * dens(k,i,ja,nn)
1338 call comm_vars8( momy(:,:,:,nn), 2 )
1340 call comm_wait ( momx(:,:,:,nn), 1, .false. )
1341 call comm_wait ( momy(:,:,:,nn), 2, .false. )
1348 end subroutine parentatominput
1352 subroutine parentatomboundary( &
1379 real(RP),
intent(in) :: dens(:,:,:,:)
1380 real(RP),
intent(in) :: momz(:,:,:,:)
1381 real(RP),
intent(in) :: momx(:,:,:,:)
1382 real(RP),
intent(in) :: momy(:,:,:,:)
1383 real(RP),
intent(in) :: rhot(:,:,:,:)
1384 real(RP),
intent(in) :: qtrc(:,:,:,:,:)
1385 real(RP),
intent(in) :: update_dt
1386 character(len=*),
intent(in) :: basename
1387 character(len=*),
intent(in) :: title
1388 integer,
intent(in) :: numsteps
1390 character(len=H_SHORT) :: atmos_boundary_out_dtype =
'DEFAULT' 1391 real(RP),
allocatable :: buffer(:,:,:,:)
1392 integer :: nowdate(6)
1394 integer :: fid, vid(5+QA_MP)
1395 integer :: k, i, j, n, iq
1403 nowdate(1) = nowdate(1)
1405 allocate( buffer(
ka,
ia,
ja,te-ts+1) )
1408 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputAtmos]/Categ[Boundary]' 1410 call fileio_create( fid, basename, title, atmos_boundary_out_dtype, nowdate )
1412 call fileio_def_var( fid, vid(1),
'DENS',
'Reference Density',
'kg/m3',
'ZXYT', &
1413 atmos_boundary_out_dtype, update_dt, numsteps )
1414 call fileio_def_var( fid, vid(2),
'VELZ',
'Reference VELZ',
'm/s',
'ZXYT', &
1415 atmos_boundary_out_dtype, update_dt, numsteps )
1416 call fileio_def_var( fid, vid(3),
'VELX',
'Reference VELX',
'm/s',
'ZXYT', &
1417 atmos_boundary_out_dtype, update_dt, numsteps )
1418 call fileio_def_var( fid, vid(4),
'VELY',
'Reference VELY',
'm/s',
'ZXYT', &
1419 atmos_boundary_out_dtype, update_dt, numsteps )
1420 call fileio_def_var( fid, vid(5),
'POTT',
'Reference PT',
'K',
'ZXYT', &
1421 atmos_boundary_out_dtype, update_dt, numsteps )
1424 atmos_boundary_out_dtype, update_dt, numsteps )
1429 call fileio_write_var( fid, vid(1), dens(:,:,:,ts:te),
'DENS',
'ZXYT', update_dt )
1434 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) )
1439 call fileio_write_var( fid, vid(2), buffer,
'VELZ',
'ZXYT', update_dt )
1444 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) )
1450 buffer(:,
ia,:,n-ts+1) = buffer(:,
ia-1,:,n-ts+1)
1452 call fileio_write_var( fid, vid(3), buffer,
'VELX',
'ZXYT', update_dt )
1457 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) )
1463 buffer(:,:,
ja,n-ts+1) = buffer(:,:,
ja-1,n-ts+1)
1465 call fileio_write_var( fid, vid(4), buffer,
'VELY',
'ZXYT', update_dt )
1470 buffer(k,i,j,n-ts+1) = rhot(k,i,j,n) / dens(k,i,j,n)
1475 call fileio_write_var( fid, vid(5), buffer,
'POTT',
'ZXYT', update_dt )
1482 buffer(k,i,j,n-ts+1) = qtrc(k,i,j,iq,n)
1487 call fileio_write_var( fid, vid(6+iq-
qs_mp), buffer,
tracer_name(iq),
'ZXYT', update_dt )
1490 deallocate( buffer )
1493 end subroutine parentatomboundary
1497 subroutine parentsurfacesetup( &
1505 use_file_landwater, &
1508 intrp_land_sfc_temp, &
1510 intrp_ocean_sfc_temp )
1530 integer,
intent(out) :: ldims(3)
1531 integer,
intent(out) :: odims(2)
1532 integer,
intent(out) :: lmdlid
1533 integer,
intent(out) :: omdlid
1534 integer,
intent(out) :: timelen
1535 character(len=*),
intent(in) :: basename_land
1536 character(len=*),
intent(in) :: basename_ocean
1537 character(len=*),
intent(in) :: filetype_land
1538 character(len=*),
intent(in) :: filetype_ocean
1539 logical,
intent(in) :: use_file_landwater
1540 character(len=*),
intent(in) :: intrp_land_temp
1541 character(len=*),
intent(in) :: intrp_land_water
1542 character(len=*),
intent(in) :: intrp_land_sfc_temp
1543 character(len=*),
intent(in) :: intrp_ocean_temp
1544 character(len=*),
intent(in) :: intrp_ocean_sfc_temp
1548 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputSurface]/Categ[Setup]' 1553 write(*,*)
'xxx LKMAX less than 4: ',
lkmax 1554 write(*,*)
'xxx in Real Case, LKMAX should be set more than 4' 1558 if( serial_land )
then 1560 do_read_land = .true.
1562 do_read_land = .false.
1565 do_read_land = .true.
1568 select case(trim(filetype_land))
1572 serial_land = .false.
1573 do_read_land = .true.
1575 use_waterratio = .false.
1582 use_waterratio = .false.
1584 case(
'NICAM-NETCDF')
1589 use_waterratio = .false.
1596 use_file_landwater, &
1601 write(*,*)
'xxx Unsupported FILE TYPE:', trim(filetype_land)
1606 if( serial_land )
then 1607 call comm_bcast( ldims(:), 3 )
1608 call comm_bcast( use_waterratio )
1612 select case( intrp_land_temp )
1614 i_intrp_land_temp = i_intrp_off
1616 i_intrp_land_temp = i_intrp_mask
1618 i_intrp_land_temp = i_intrp_fill
1620 write(*,*)
'xxx INTRP_LAND_TEMP is invalid. ', intrp_land_temp
1623 select case( intrp_land_sfc_temp )
1625 i_intrp_land_sfc_temp = i_intrp_off
1627 i_intrp_land_sfc_temp = i_intrp_mask
1629 i_intrp_land_sfc_temp = i_intrp_fill
1631 write(*,*)
'xxx INTRP_LAND_SFC_TEMP is invalid. ', intrp_land_sfc_temp
1634 select case( intrp_land_water )
1636 i_intrp_land_water = i_intrp_off
1638 i_intrp_land_water = i_intrp_mask
1640 i_intrp_land_water = i_intrp_fill
1642 write(*,*)
'xxx INTRP_LAND_WATER is invalid. ', intrp_land_water
1646 select case( lmdlid )
1648 i_intrp_land_temp = i_intrp_mask
1649 i_intrp_land_sfc_temp = i_intrp_mask
1650 i_intrp_land_water = i_intrp_mask
1656 if( serial_ocean )
then 1658 do_read_ocean = .true.
1660 do_read_ocean = .false.
1663 do_read_ocean = .true.
1666 select case(trim(filetype_ocean))
1671 serial_ocean = .false.
1672 do_read_ocean = .true.
1674 update_coord = .false.
1681 update_coord = .true.
1683 case(
'NICAM-NETCDF')
1688 update_coord = .false.
1695 update_coord = .false.
1699 write(*,*)
'xxx Unsupported FILE TYPE:', trim(filetype_ocean)
1704 if( serial_ocean )
then 1705 call comm_bcast( odims(:), 2 )
1706 call comm_bcast( timelen )
1710 select case( intrp_ocean_temp )
1712 i_intrp_ocean_temp = i_intrp_off
1714 i_intrp_ocean_temp = i_intrp_mask
1716 i_intrp_ocean_temp = i_intrp_fill
1718 write(*,*)
'xxx INTRP_OCEAN_TEMP is invalid. ', intrp_ocean_temp
1721 select case( intrp_ocean_sfc_temp )
1723 i_intrp_ocean_sfc_temp = i_intrp_off
1725 i_intrp_ocean_sfc_temp = i_intrp_mask
1727 i_intrp_ocean_sfc_temp = i_intrp_fill
1729 write(*,*)
'xxx INTRP_OCEAN_SFC_TEMP is invalid. ', intrp_ocean_sfc_temp
1733 select case( omdlid )
1735 i_intrp_ocean_temp = i_intrp_mask
1736 i_intrp_ocean_sfc_temp = i_intrp_mask
1740 allocate( tw_org( odims(1), odims(2) ) )
1741 allocate( sst_org( odims(1), odims(2) ) )
1742 allocate( albw_org( odims(1), odims(2), 2 ) )
1743 allocate( olon_org( odims(1), odims(2) ) )
1744 allocate( olat_org( odims(1), odims(2) ) )
1745 allocate( omask_org( odims(1), odims(2) ) )
1750 end subroutine parentsurfacesetup
1754 subroutine parentsurfaceinput( &
1780 use_file_landwater, &
1781 init_landwater_ratio, &
1782 init_ocean_alb_lw, &
1783 init_ocean_alb_sw, &
1786 soilwater_ds2vc_flag, &
1787 elevation_collection, &
1806 thermodyn_temp_pres => atmos_thermodyn_temp_pres
1829 real(RP),
intent(inout) :: tg(LKMAX,IA,JA)
1830 real(RP),
intent(inout) :: strg(LKMAX,IA,JA)
1831 real(RP),
intent(inout) :: lst(IA,JA)
1832 real(RP),
intent(inout) :: albg(IA,JA,2)
1833 real(RP),
intent(inout) :: tc_urb(IA,JA)
1834 real(RP),
intent(inout) :: qc_urb(IA,JA)
1835 real(RP),
intent(inout) :: uc_urb(IA,JA)
1836 real(RP),
intent(inout) :: ust(IA,JA)
1837 real(RP),
intent(inout) :: albu(IA,JA,2)
1838 real(RP),
intent(out) :: tw(:,:,:)
1839 real(RP),
intent(out) :: sst(:,:,:)
1840 real(RP),
intent(out) :: albw(:,:,:,:)
1841 real(RP),
intent(out) :: z0w(:,:,:)
1842 real(RP),
intent(in) :: DENS(KA,IA,JA)
1843 real(RP),
intent(in) :: MOMZ(KA,IA,JA)
1844 real(RP),
intent(in) :: MOMX(KA,IA,JA)
1845 real(RP),
intent(in) :: MOMY(KA,IA,JA)
1846 real(RP),
intent(in) :: RHOT(KA,IA,JA)
1847 real(RP),
intent(in) :: QTRC(KA,IA,JA,QA)
1848 character(len=*),
intent(in) :: basename_land
1849 character(len=*),
intent(in) :: basename_ocean
1850 integer,
intent(in) :: mdlid_land
1851 integer,
intent(in) :: mdlid_ocean
1852 integer,
intent(in) :: ldims(3)
1853 integer,
intent(in) :: odims(2)
1854 logical,
intent(in) :: use_file_landwater
1855 real(RP),
intent(in) :: init_landwater_ratio
1857 real(RP),
intent(in) :: init_ocean_alb_lw
1858 real(RP),
intent(in) :: init_ocean_alb_sw
1859 real(RP),
intent(in) :: init_ocean_z0w
1860 integer,
intent(in) :: intrp_iter_max
1861 logical,
intent(in) :: soilwater_ds2vc_flag
1862 logical,
intent(in) :: elevation_collection
1863 integer,
intent(in) :: timelen
1864 integer,
intent(in) :: skiplen
1865 integer,
intent(in) :: lit
1868 real(RP) :: tg_org (ldims(1),ldims(2),ldims(3))
1869 real(RP) :: strg_org (ldims(1),ldims(2),ldims(3))
1870 real(RP) :: smds_org (ldims(1),ldims(2),ldims(3))
1872 real(RP) :: lst_org ( ldims(2),ldims(3))
1873 real(RP) :: ust_org ( ldims(2),ldims(3))
1874 real(RP) :: albg_org ( ldims(2),ldims(3),2)
1875 real(RP) :: topo_org ( ldims(2),ldims(3))
1876 real(RP) :: lmask_org( ldims(2),ldims(3))
1877 real(RP) :: lz_org (ldims(1) )
1878 real(RP) :: llon_org ( ldims(2),ldims(3))
1879 real(RP) :: llat_org ( ldims(2),ldims(3))
1882 real(RP) :: tw_org ( odims(1),odims(2))
1883 real(RP) :: sst_org ( odims(1),odims(2))
1884 real(RP) :: albw_org ( odims(1),odims(2),2)
1885 real(RP) :: z0w_org ( odims(1),odims(2))
1886 real(RP) :: olon_org ( odims(1),odims(2))
1887 real(RP) :: olat_org ( odims(1),odims(2))
1888 real(RP) :: omask_org( odims(1),odims(2))
1889 real(RP) :: omask ( odims(1),odims(2))
1890 real(RP) :: lst_ocean( odims(1),odims(2))
1892 real(RP) :: hfact_o(odims(1),odims(2),itp_nh)
1893 integer :: igrd_o (odims(1),odims(2),itp_nh)
1894 integer :: jgrd_o (odims(1),odims(2),itp_nh)
1904 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputSurface]/Categ[Input]' 1910 if ( do_read_land )
then 1912 select case( mdlid_land )
1917 lst_org, ust_org, albg_org, &
1918 topo_org, lmask_org, &
1919 llon_org, llat_org, lz_org, &
1920 basename_land, ldims, &
1921 use_file_landwater, lit )
1927 lst_org, ust_org, albg_org, &
1928 topo_org, lmask_org, &
1929 llon_org, llat_org, lz_org, &
1930 basename_land, ldims, &
1931 use_file_landwater, lit )
1938 llon_org, llat_org, lz_org, &
1939 topo_org, lmask_org, &
1940 basename_land, ldims, &
1941 use_file_landwater, lit )
1948 tg_org, strg_org, smds_org, &
1950 llon_org, llat_org, lz_org, &
1951 topo_org, lmask_org, &
1952 basename_land, ldims, &
1953 use_file_landwater, lit )
1961 if ( serial_land )
then 1962 call comm_bcast( tg_org, ldims(1), ldims(2), ldims(3) )
1963 if ( use_waterratio )
then 1964 call comm_bcast( smds_org, ldims(1), ldims(2), ldims(3) )
1966 call comm_bcast( strg_org, ldims(1), ldims(2), ldims(3) )
1968 call comm_bcast( lst_org, ldims(2), ldims(3) )
1969 call comm_bcast( ust_org, ldims(2), ldims(3) )
1970 call comm_bcast( albg_org(:,:,i_lw), ldims(2), ldims(3) )
1971 call comm_bcast( albg_org(:,:,i_sw), ldims(2), ldims(3) )
1972 call comm_bcast( topo_org, ldims(2), ldims(3) )
1973 call comm_bcast( lmask_org, ldims(2), ldims(3) )
1974 call comm_bcast( llon_org, ldims(2), ldims(3) )
1975 call comm_bcast( llat_org, ldims(2), ldims(3) )
1976 call comm_bcast( lz_org, ldims(1) )
1984 call thermodyn_temp_pres( temp, &
1995 qc_urb(i,j) = 0.0_rp
1997 qc_urb(i,j) = qtrc(
ks,i,j,
i_qv)
2004 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 &
2005 + ( momy(
ks,i,j) / (dens(
ks, i,j+1)+dens(
ks,i,j)) * 2.0_rp )**2.0_rp ), &
2010 uc_urb(ia,j) = max(sqrt( ( momx(
ks,ia,j) / dens(
ks,ia,j ) )**2.0_rp &
2011 + ( momy(
ks,ia,j) / (dens(
ks,ia,j+1)+dens(
ks,ia,j)) * 2.0_rp )**2.0_rp ), &
2015 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 &
2016 + ( momy(
ks,i,ja) / dens(
ks,i ,ja) )**2.0_rp ), 0.01_rp)
2018 uc_urb(ia,ja) = max(sqrt( ( momx(
ks,ia,ja) / dens(
ks,ia,ja) )**2.0_rp &
2019 + ( momy(
ks,ia,ja) / dens(
ks,ia,ja) )**2.0_rp ), 0.01_rp)
2021 call comm_vars8( uc_urb, 1 )
2022 call comm_wait ( uc_urb, 1, .false. )
2028 if ( do_read_ocean )
then 2030 select case( mdlid_ocean )
2058 do n = skiplen+1, timelen
2061 if ( do_read_ocean )
then 2063 select case( mdlid_ocean )
2068 albw_org, z0w_org, &
2070 basename_ocean, odims, &
2077 albw_org, z0w_org, &
2079 olon_org, olat_org, &
2080 basename_ocean, odims, &
2087 basename_ocean, odims, &
2098 olon_org, olat_org, &
2099 basename_ocean, odims, &
2108 if ( serial_ocean )
then 2109 call comm_bcast( tw_org, odims(1), odims(2) )
2110 call comm_bcast( sst_org, odims(1), odims(2) )
2111 call comm_bcast( albw_org(:,:,i_lw), odims(1), odims(2) )
2112 call comm_bcast( albw_org(:,:,i_sw), odims(1), odims(2) )
2113 call comm_bcast( z0w_org, odims(1), odims(2) )
2114 call comm_bcast( omask_org, odims(1), odims(2) )
2115 if ( first .or. update_coord )
then 2116 call comm_bcast( olon_org, odims(1), odims(2) )
2117 call comm_bcast( olat_org, odims(1), odims(2) )
2122 if ( first .or. update_coord )
then 2126 igrd_o(:,:,:), jgrd_o(:,:,:), &
2127 olat_org(:,:), olon_org(:,:), &
2128 odims(1), odims(2), &
2129 llat_org(:,:), llon_org(:,:), &
2130 ldims(2), ldims(3) )
2135 if ( i_intrp_ocean_temp .ne. i_intrp_off )
then 2136 select case( i_intrp_ocean_temp )
2137 case( i_intrp_mask )
2139 case( i_intrp_fill )
2140 call make_mask( omask, tw_org, odims(1), odims(2), landdata=.false.)
2142 call interp_oceanland_data(tw_org, omask, odims(1), odims(2), .false., intrp_iter_max)
2146 if ( i_intrp_ocean_sfc_temp .ne. i_intrp_off )
then 2147 select case( i_intrp_ocean_sfc_temp )
2148 case( i_intrp_mask )
2150 case( i_intrp_fill )
2151 call make_mask( omask, sst_org, odims(1), odims(2), landdata=.false.)
2153 call interp_oceanland_data(sst_org, omask, odims(1), odims(2), .false., intrp_iter_max)
2162 tg_org, strg_org, smds_org, &
2163 lst_org, albg_org, &
2169 lz_org, llon_org, llat_org, &
2172 maskval_tg, maskval_strg, &
2173 init_landwater_ratio, &
2174 use_file_landwater, &
2176 soilwater_ds2vc_flag, &
2177 elevation_collection, &
2182 if ( first .or. update_coord )
then 2185 igrd_o(:,:,:), jgrd_o(:,:,:), odims(1), odims(2) )
2193 if ( albw_org(i,j,i_lw) == undef ) albw_org(i,j,i_lw) = init_ocean_alb_lw
2194 if ( albw_org(i,j,i_sw) == undef ) albw_org(i,j,i_sw) = init_ocean_alb_sw
2195 if ( z0w_org(i,j) == undef ) z0w_org(i,j) = init_ocean_z0w
2200 if ( first .or. update_coord )
then 2203 igrd(:,:,:), jgrd(:,:,:), &
2204 lat(:,:), lon(:,:), &
2206 olat_org(:,:), olon_org(:,:), &
2207 odims(1), odims(2) )
2211 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2213 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2214 call intrpnest_interp_2d( albw(:,:,i_lw,nn), albw_org(:,:,i_lw), hfact(:,:,:), &
2215 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2216 call intrpnest_interp_2d( albw(:,:,i_sw,nn), albw_org(:,:,i_sw), hfact(:,:,:), &
2217 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2219 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2226 if( abs(lsmask_nest(i,j)-0.0_rp) < eps )
then 2227 lst(i,j) = sst(i,j,nn)
2228 ust(i,j) = sst(i,j,nn)
2241 end subroutine parentsurfaceinput
2244 subroutine parentoceanboundary( &
2265 real(RP),
intent(in) :: tw(:,:,:)
2266 real(RP),
intent(in) :: sst(:,:,:)
2267 real(RP),
intent(in) :: albw(:,:,:,:)
2268 real(RP),
intent(in) :: z0(:,:,:)
2269 real(RP),
intent(in) :: update_dt
2270 character(len=*),
intent(in) :: basename
2271 character(len=*),
intent(in) :: title
2272 integer,
intent(in) :: numsteps
2274 character(len=H_SHORT) :: ocean_boundary_out_dtype =
'DEFAULT' 2275 integer :: nowdate(6)
2276 integer :: fid, vid(5)
2284 if(
io_l )
write(
io_fid_log,*)
'+++ ScaleLib/IO[RealinputSurface]/Categ[Boundary]' 2287 nowdate(1) = nowdate(1)
2289 call fileio_create( fid, basename, title, ocean_boundary_out_dtype, nowdate )
2292 'OCEAN_TEMP',
'Reference Ocean Temperature',
'K',
'XYT', &
2293 ocean_boundary_out_dtype, update_dt, numsteps )
2295 'OCEAN_SFC_TEMP',
'Reference Ocean Surface Temperature',
'K',
'XYT', &
2296 ocean_boundary_out_dtype, update_dt, numsteps )
2298 'OCEAN_ALB_LW',
'Reference Ocean Surface Albedo Long-wave',
'1',
'XYT', &
2299 ocean_boundary_out_dtype, update_dt, numsteps )
2301 'OCEAN_ALB_SW',
'Reference Ocean Surface Albedo Short-wave',
'1',
'XYT', &
2302 ocean_boundary_out_dtype, update_dt, numsteps )
2304 'OCEAN_SFC_Z0',
'Reference Ocean Surface Z0',
'm',
'XYT', &
2305 ocean_boundary_out_dtype, update_dt, numsteps )
2309 call fileio_write_var( fid, vid(1), tw(:,:,ts:te),
'OCEAN_TEMP',
'XYT', update_dt )
2310 call fileio_write_var( fid, vid(2), sst(:,:,ts:te),
'OCEAN_SFC_TEMP',
'XYT', update_dt )
2311 call fileio_write_var( fid, vid(3), albw(:,:,i_lw,ts:te),
'OCEAN_ALB_LW',
'XYT', update_dt )
2312 call fileio_write_var( fid, vid(4), albw(:,:,i_sw,ts:te),
'OCEAN_ALB_SW',
'XYT', update_dt )
2313 call fileio_write_var( fid, vid(5), z0(:,:,ts:te),
'OCEAN_SFC_Z0',
'XYT', update_dt )
2316 end subroutine parentoceanboundary
2347 init_landwater_ratio, &
2348 use_file_landwater, &
2350 soilwater_ds2vc_flag, &
2351 elevation_collection, &
2370 real(RP),
intent(out) :: tg(LKMAX,IA,JA)
2371 real(RP),
intent(out) :: strg(LKMAX,IA,JA)
2372 real(RP),
intent(out) :: lst(IA,JA)
2373 real(RP),
intent(out) :: albg(IA,JA,2)
2374 real(RP),
intent(out) :: ust(IA,JA)
2375 real(RP),
intent(out) :: albu(IA,JA,2)
2376 real(RP),
intent(inout) :: tg_org(:,:,:)
2377 real(RP),
intent(inout) :: strg_org(:,:,:)
2378 real(RP),
intent(inout) :: smds_org(:,:,:)
2379 real(RP),
intent(inout) :: lst_org(:,:)
2380 real(RP),
intent(inout) :: albg_org(:,:,:)
2381 real(RP),
intent(inout) :: ust_org(:,:)
2382 real(RP),
intent(inout) :: sst_org(:,:)
2383 real(RP),
intent(in) :: lmask_org(:,:)
2384 real(RP),
intent(in) :: lsmask_nest(:,:)
2385 real(RP),
intent(in) :: topo_org(:,:)
2386 real(RP),
intent(in) :: lz_org(:)
2387 real(RP),
intent(in) :: llon_org(:,:)
2388 real(RP),
intent(in) :: llat_org(:,:)
2389 real(RP),
intent(in) :: LCZ(LKMAX)
2390 real(RP),
intent(in) :: LON(IA,JA)
2391 real(RP),
intent(in) :: LAT(IA,JA)
2392 integer,
intent(in) :: ldims(3)
2393 integer,
intent(in) :: odims(2)
2394 real(RP),
intent(in) :: maskval_tg
2395 real(RP),
intent(in) :: maskval_strg
2396 real(RP),
intent(in) :: init_landwater_ratio
2397 logical,
intent(in) :: use_file_landwater
2398 logical,
intent(in) :: use_waterratio
2399 logical,
intent(in) :: soilwater_ds2vc_flag
2400 logical,
intent(in) :: elevation_collection
2401 integer,
intent(in) :: intrp_iter_max
2403 real(RP) :: lmask(ldims(2), ldims(3))
2404 real(RP) :: smds(LKMAX,IA,JA)
2407 real(RP) :: hfact_l(ldims(2), ldims(3), itp_nh)
2408 integer :: igrd_l (ldims(2), ldims(3), itp_nh)
2409 integer :: jgrd_l (ldims(2), ldims(3), itp_nh)
2410 real(RP) :: vfactl(LKMAX,IA,JA,itp_nh,itp_nv)
2411 integer :: kgrdl (LKMAX,IA,JA,itp_nh,itp_nv)
2413 real(RP) :: sst_land(ldims(2), ldims(3))
2414 real(RP) :: work(ldims(2), ldims(3))
2416 real(RP) :: lz3d_org(ldims(1),ldims(2),ldims(3))
2417 real(RP) :: lcz_3D(LKMAX,IA,JA)
2420 real(RP) :: topo(IA,JA)
2427 if ( i_intrp_land_sfc_temp .ne. i_intrp_off )
then 2428 select case( i_intrp_land_sfc_temp )
2429 case( i_intrp_mask )
2431 case( i_intrp_fill )
2432 call make_mask( lmask, lst_org, ldims(2), ldims(3), landdata=.true.)
2434 write(*,*)
'xxx INTRP_LAND_SFC_TEMP is invalid.' 2437 call interp_oceanland_data(lst_org, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2456 igrd_l(:,:,:), jgrd_l(:,:,:), &
2457 llat_org(:,:), llon_org(:,:), &
2458 ldims(2), ldims(3), &
2459 olat_org(:,:), olon_org(:,:), &
2460 odims(1), odims(2) )
2465 igrd_l(:,:,:), jgrd_l(:,:,:), ldims(2), ldims(3) )
2471 if ( ust_org(i,j) == undef ) ust_org(i,j) = lst_org(i,j)
2475 if ( albg_org(i,j,i_lw) == undef ) albg_org(i,j,i_lw) = 0.03_rp
2476 if ( albg_org(i,j,i_sw) == undef ) albg_org(i,j,i_sw) = 0.22_rp
2481 if ( i_intrp_land_temp .ne. i_intrp_off )
then 2483 work(:,:) = tg_org(k,:,:)
2484 select case( i_intrp_land_temp )
2485 case( i_intrp_mask )
2487 case( i_intrp_fill )
2488 call make_mask( lmask, work, ldims(2), ldims(3), landdata=.true.)
2490 call interp_oceanland_data( work, lmask, ldims(2), ldims(3), .true., intrp_iter_max )
2493 tg_org(k,:,:) = work(:,:)
2501 lz3d_org(:,i,j) = lz_org(:)
2507 lcz_3d(:,i,j) = lcz(:)
2512 vfactl(:,:,:,:,:), &
2514 igrd(:,:,:), jgrd(:,:,:), &
2517 lat(:,:), lon(:,:), &
2520 llat_org(:,:), llon_org(:,:), &
2521 ldims(1), ldims(2), ldims(3), &
2525 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2527 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2535 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2537 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2542 vfactl(:,:,:,:,:), &
2546 ia, ja, 1, lkmax-1 )
2550 tg(lkmax,i,j) = tg(lkmax-1,i,j)
2561 if ( elevation_collection )
then 2563 igrd(:,:,:), jgrd(:,:,:), ia, ja )
2567 if ( topo(i,j) > 0.0_rp )
then 2568 tdiff = (
topo_zsfc(i,j) - topo(i,j) ) * laps
2569 lst(i,j) = lst(i,j) - tdiff
2570 ust(i,j) = ust(i,j) - tdiff
2572 tg(k,i,j) = tg(k,i,j) - tdiff
2582 if( use_file_landwater )
then 2584 if ( use_waterratio )
then 2586 if ( i_intrp_land_water .ne. i_intrp_off )
then 2588 work(:,:) = smds_org(k,:,:)
2589 select case( i_intrp_land_water )
2590 case( i_intrp_mask )
2592 case( i_intrp_fill )
2593 call make_mask( lmask, work, ldims(2), ldims(3), landdata=.true.)
2595 call interp_oceanland_data(work, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2596 lmask(:,:) = init_landwater_ratio
2599 smds_org(k,:,:) = work(:,:)
2606 vfactl(:,:,:,:,:), &
2610 ia, ja, 1, lkmax-1 )
2612 strg(k,:,:) =
convert_ws2vwc( smds(k,:,:), critical=soilwater_ds2vc_flag )
2617 if ( i_intrp_land_water .ne. i_intrp_off )
then 2619 work(:,:) = strg_org(k,:,:)
2620 select case( i_intrp_land_water )
2621 case( i_intrp_mask )
2623 case( i_intrp_fill )
2624 call make_mask( lmask, work, ldims(2), ldims(3), landdata=.true.)
2626 call interp_oceanland_data(work, lmask, ldims(2), ldims(3), .true., intrp_iter_max)
2627 lmask(:,:) = maskval_strg
2630 strg_org(k,:,:) = work(:,:)
2637 vfactl(:,:,:,:,:), &
2641 ia, ja, 1, lkmax-1 )
2651 strg(lkmax,i,j) = strg(lkmax-1,i,j)
2657 smds(:,:,:) = init_landwater_ratio
2669 albu(i,j,:) = albg(i,j,:)
2688 real(RP),
intent(out) :: gmask(:,:)
2689 real(RP),
intent(in) :: data(:,:)
2690 integer,
intent(in) :: nx
2691 integer,
intent(in) :: ny
2692 logical,
intent(in) :: landdata
2707 if( abs(
data(i,j) - undef) < sqrt(eps) )
then 2716 subroutine interp_oceanland_data( &
2727 integer,
intent(in) :: nx
2728 integer,
intent(in) :: ny
2729 real(RP),
intent(inout) :: data (nx,ny)
2730 real(RP),
intent(in) :: lsmask(nx,ny)
2731 logical,
intent(in) :: landdata
2732 integer,
intent(in) :: iter_max
2734 integer :: mask (nx,ny)
2735 integer :: mask_prev(nx,ny)
2736 real(RP) :: data_prev(nx,ny)
2737 real(RP) :: tmp, cnt, sw
2738 integer :: mask_target
2740 integer :: num_land, num_ocean, num_replaced
2741 integer :: istr, iend, jstr, jend
2742 integer :: i, j, ii, jj, ite
2746 if(
io_l )
write(
io_fid_log,*)
'*** [interp_OceanLand_data]/Categ[realinit]' 2748 if ( landdata )
then 2761 mask(i,j) = int( 0.5_rp - sign(0.5_rp,abs(lsmask(i,j)-1.0_rp)-eps) )
2762 num_land = num_land + ( mask(i,j) )
2763 num_ocean = num_ocean + ( 1-mask(i,j) )
2767 if(
io_l )
write(
io_fid_log,
'(1x,A,I3.3,A,3I8,A,I8)')
'*** ite = ', 0, &
2768 ', (land,ocean,replaced) = ', num_land, num_ocean, 0,
' / ', nx*ny
2771 do ite = 1, iter_max
2773 mask_prev(:,:) = mask(:,:)
2774 data_prev(:,:) =
data(:,:)
2780 if( mask(i,j) == mask_target ) cycle
2792 sw = 0.5_rp - sign(0.5_rp,
real(abs(mask_prev(ii,jj)-mask_target),kind=
rp)-eps)
2794 tmp = tmp + sw * data_prev(ii,jj)
2799 if ( cnt >= 3.0_rp )
then 2800 data(i,j) = tmp / cnt
2801 mask(i,j) = mask_target
2803 num_replaced = num_replaced + 1
2809 if ( landdata )
then 2810 num_land = num_land + num_replaced
2811 num_ocean = num_ocean - num_replaced
2813 num_land = num_land - num_replaced
2814 num_ocean = num_ocean + num_replaced
2816 if(
io_l )
write(
io_fid_log,
'(1x,A,I3.3,A,3I8,A,I8)')
'*** ite = ', ite, &
2817 ', (land,ocean,replaced) = ', num_land, num_ocean, num_replaced,
' / ', nx*ny
2819 if( num_replaced == 0 )
exit 2825 end subroutine interp_oceanland_data
2832 real(RP),
intent(inout) :: data(:,:)
2833 real(RP),
intent(in) :: maskval
2834 real(RP),
intent(in) :: frac_land(:,:)
2839 if( abs(frac_land(i,j)-0.0_rp) < eps )
then 2854 real(RP),
intent(inout) :: data(:,:)
2855 real(RP),
intent(in) :: maskval(:,:)
2856 integer,
intent(in) :: nx, ny
2857 character(len=*),
intent(in) :: elem
2863 if( abs(
data(i,j) - undef) < sqrt(eps) )
then 2864 if( abs(maskval(i,j) - undef) < sqrt(eps) )
then 2865 write(*,*)
"xxx data for mask of "//trim(elem)//
"(",i,
",",j,
") includes missing value." 2866 write(*,*)
"xxx Please check input data of SKINTEMP or SST. " 2869 data(i,j) = maskval(i,j)
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
real(rp), dimension(qa_max), public tracer_r
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 ATMOSPHERE / Physics Cloud Microphysics
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
subroutine, public atmos_hydrometeor_diagnose_number_concentration(QTRC)
character(len=h_short), dimension(qa_max), public tracer_name
real(rp), dimension(qa_max), public tracer_cv
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
logical, public io_nml
output log or not? (for namelist, this process)
real(rp), dimension(:,:), allocatable, public urban_tr
integer, public ia
of whole cells: x, 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 whole cells: z, local, with HALO
real(rp), dimension(:,:,:), allocatable, public atmos_phy_sf_sfc_albedo
subroutine, public fileio_create(fid, basename, title, datatype, date, subsec, append, nozcoord)
Create/open a netCDF file.
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)
procedure(intrpnest_intfc_interp_3d), pointer, public intrpnest_interp_3d
real(rp), dimension(:,:,:), allocatable, public urban_sfc_albedo
character(len=h_short), public atmos_phy_mp_type
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:,:), allocatable, public urban_tc
real(rp), dimension(:,:,:), allocatable, target, public momy
subroutine, public fileio_enddef(fid)
Exit netCDF file define mode.
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]
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]
subroutine, public fileio_def_var(fid, vid, varname, desc, unit, axistype, datatype, timeintv, nsteps)
Define a variable to file.
real(rp), dimension(:), allocatable, public grid_lcz
center coordinate [m]: z, local=global
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.
integer, parameter, public rp
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]
integer, public io_fid_nml
Log file ID (only for output namelist)
real(rp), dimension(:,:), allocatable, public urban_rainb
real(rp), dimension(qa_max), public tracer_mass
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 whole cells: y, local, with HALO