48 integer,
private,
parameter :: handle = 1
50 real(RP),
private,
allocatable :: read2D (:,:)
51 real(RP),
private,
allocatable :: read3D (:,:,:)
52 real(RP),
private,
allocatable :: read3DL(:,:,:)
53 real(RP),
private,
allocatable :: read3DO(:,:,:)
56 real(RP),
private,
allocatable :: rotc_cos(:,:), rotc_sin(:,:)
72 integer,
intent(out) :: dims(6)
75 log_info(
"ParentAtmosSetupSCALE",*)
'Real Case/Atmos Input File Type: SCALE-RM'
89 allocate( rotc_cos(dims(2),dims(3)), rotc_sin(dims(2),dims(3)) )
119 mapprojection_rotcoef
122 real(rp),
intent(out) :: lon_org(:,:)
123 real(rp),
intent(out) :: lat_org(:,:)
124 real(rp),
intent(out) :: cz_org (:,:,:)
125 character(len=*),
intent(in) :: basename_org
126 integer,
intent(in) :: dims(6)
129 character(len=H_SHORT) :: vname
134 integer :: xloc, yloc
135 integer :: xs, xe, ys, ye
143 do i = 1,
size( nest_tile_id(:) )
145 rank = nest_tile_id(i)
147 xloc = mod( i-1, nest_tile_num_x ) + 1
148 yloc = int( real(i-1) / real(nest_tile_num_x) ) + 1
157 aggregate=.false., rankid=rank )
159 call file_cartesc_read( fid,
"lon", read2d(:,:) )
160 lon_org(xs:xe,ys:ye) = read2d(:,:) * d2r
162 call file_cartesc_read( fid,
"lat", read2d(:,:) )
163 lat_org(xs:xe,ys:ye) = read2d(:,:) * d2r
165 call file_cartesc_read( fid,
"height", read3d(:,:,:) )
166 cz_org(3:dims(1)+2,xs:xe,ys:ye) = read3d(:,:,:)
168 call file_cartesc_read( fid,
"topo", read2d(:,:), existed=existed )
169 cz_org(2,xs:xe,ys:ye) = read2d(:,:)
172 call file_get_attribute( fid,
"DENS",
"grid_mapping", vname, existed=existed )
174 call file_get_attribute( fid, vname,
"grid_mapping_name", mapping_info%mapping_name )
175 call file_get_attribute( fid, vname,
"false_easting", mapping_info%false_easting, existed=existed )
176 call file_get_attribute( fid, vname,
"false_northing", mapping_info%false_northing, existed=existed )
177 call file_get_attribute( fid, vname,
"longitude_of_central_meridian", mapping_info%longitude_of_central_meridian, existed=existed )
178 call file_get_attribute( fid, vname,
"longitude_of_projection_origin", mapping_info%longitude_of_projection_origin, existed=existed )
179 call file_get_attribute( fid, vname,
"latitude_of_projection_origin", mapping_info%latitude_of_projection_origin, existed=existed )
180 call file_get_attribute( fid, vname,
"straight_vertical_longitude_from_pole", mapping_info%straight_vertical_longitude_from_pole, existed=existed )
181 call file_get_attribute( fid, vname,
"standard_parallel", mapping_info%standard_parallel(:), existed=existed )
182 if ( .not. existed )
then
183 call file_get_attribute( fid, vname,
"standard_parallel", mapping_info%standard_parallel(1), existed=existed )
185 call file_get_attribute( fid, vname,
"rotation", mapping_info%rotation, existed=existed )
186 if ( .not. existed ) mapping_info%rotation = 0.0_dp
188 mapping_info%mapping_name =
""
194 cz_org(1,:,:) = 0.0_rp
196 if ( mapping_info%mapping_name .ne.
"" )
then
199 call mapprojection_rotcoef( dims(2), 1, dims(2), dims(3), 1, dims(3), &
200 lon_org(:,:), lat_org(:,:), &
201 mapping_info%mapping_name, &
203 rotc_cos(:,:), rotc_sin(:,:) )
209 rotc_cos(i,j) = 1.0_rp
210 rotc_sin(i,j) = 0.0_rp
256 thermodyn_specific_heat => atmos_thermodyn_specific_heat, &
257 thermodyn_rhot2temp_pres => atmos_thermodyn_rhot2temp_pres
270 real(rp),
intent(out) :: velz_org(:,:,:)
271 real(rp),
intent(out) :: velx_org(:,:,:)
272 real(rp),
intent(out) :: vely_org(:,:,:)
273 real(rp),
intent(out) :: pres_org(:,:,:)
274 real(rp),
intent(out) :: dens_org(:,:,:)
275 real(rp),
intent(out) :: pott_org(:,:,:)
276 real(rp),
intent(out) :: qv_org (:,:,:)
277 real(rp),
intent(out) :: qtrc_org(:,:,:,:)
278 real(rp),
intent(in) :: cz_org (:,:,:)
279 character(len=*),
intent(in) :: basename_org
280 logical,
intent(in) :: sfc_diagnoses
281 logical,
intent(in) :: same_mptype
282 integer,
intent(in) :: dims(6)
283 integer,
intent(in) :: it
285 real(rp) :: momz_org(dims(1)+2,dims(2),dims(3))
286 real(rp) :: momx_org(dims(1)+2,dims(2),dims(3))
287 real(rp) :: momy_org(dims(1)+2,dims(2),dims(3))
288 real(rp) :: rhot_org(dims(1)+2,dims(2),dims(3))
289 real(rp) :: tsfc_org( dims(2),dims(3))
290 real(rp) :: qhyd_org(dims(1)+2,dims(2),dims(3),
n_hyd)
291 real(rp) :: qnum_org(dims(1)+2,dims(2),dims(3),
n_hyd)
292 real(rp) :: qdry (dims(1)+2)
293 real(rp) :: rtot (dims(1)+2)
294 real(rp) :: cvtot (dims(1)+2)
295 real(rp) :: cptot (dims(1)+2)
296 real(rp) :: temp_org(dims(1)+2)
304 integer :: xloc, yloc
310 logical :: existed, existed_t2, existed_mslp
311 integer ::
k, i, j, iq
316 do i = 1,
size( nest_tile_id(:) )
318 rank = nest_tile_id(i)
320 xloc = mod( i-1, nest_tile_num_x ) + 1
321 yloc = int( real(i-1) / real(nest_tile_num_x) ) + 1
333 aggregate=.false., rankid=rank )
335 if ( sfc_diagnoses )
then
336 call file_cartesc_read( fid,
"T2", read2d(:,:), step=it, existed=existed_t2 )
337 if ( existed_t2 )
then
339 tsfc_org(xs:xe,ys:ye) = read2d(:,:)
342 call file_cartesc_read( fid,
"MSLP", read2d(:,:), step=it, existed=existed_mslp )
343 if ( existed_mslp )
then
345 pres_org(1,xs:xe,ys:ye) = read2d(:,:)
349 call file_cartesc_read( fid,
"DENS", read3d(:,:,:), step=it )
351 dens_org(3:dims(1)+2,xs:xe,ys:ye) = read3d(:,:,:)
353 call file_cartesc_read( fid,
"MOMZ", read3d(:,:,:), step=it )
355 momz_org(3:dims(1)+2,xs:xe,ys:ye) = read3d(:,:,:)
357 call file_cartesc_read( fid,
"MOMX", read3d(:,:,:), step=it )
359 momx_org(3:dims(1)+2,xs:xe,ys:ye) = read3d(:,:,:)
361 call file_cartesc_read( fid,
"MOMY", read3d(:,:,:), step=it )
363 momy_org(3:dims(1)+2,xs:xe,ys:ye) = read3d(:,:,:)
366 call file_cartesc_read( fid,
"RHOT", read3d(:,:,:), step=it )
368 rhot_org(3:dims(1)+2,xs:xe,ys:ye) = read3d(:,:,:)
371 if ( same_mptype )
then
374 call file_cartesc_read( fid,
tracer_name(iq), read3d(:,:,:), step=it )
376 qtrc_org(3:dims(1)+2,xs:xe,ys:ye,iq) = read3d(:,:,:)
378 qtrc_org(2,xs:xe,ys:ye,iq) = qtrc_org(3,xs:xe,ys:ye,iq)
380 qtrc_org(1,xs:xe,ys:ye,iq) = qtrc_org(3,xs:xe,ys:ye,iq)
387 qhyd_org(:,xs:xe,ys:ye,iq) = 0.0_rp
388 qnum_org(:,xs:xe,ys:ye,iq) = 0.0_rp
391 call file_cartesc_read( fid,
"QV", read3d(:,:,:), step=it, existed=existed )
394 qv_org(3:dims(1)+2,xs:xe,ys:ye) = read3d(:,:,:)
396 qv_org(2,xs:xe,ys:ye) = qv_org(3,xs:xe,ys:ye)
398 qv_org(1,xs:xe,ys:ye) = qv_org(3,xs:xe,ys:ye)
401 qv_org(:,:,:) = 0.0_rp
405 call file_cartesc_read( fid,
hyd_name(iq), read3d(:,:,:), step=it, existed=existed )
408 qhyd_org(3:dims(1)+2,xs:xe,ys:ye,iq) = read3d(:,:,:)
410 qhyd_org(2,xs:xe,ys:ye,iq) = qhyd_org(3,xs:xe,ys:ye,iq)
412 qhyd_org(1,xs:xe,ys:ye,iq) = qhyd_org(3,xs:xe,ys:ye,iq)
415 qhyd_org(:,:,:,iq) = 0.0_rp
419 call file_cartesc_read( fid,
num_name(iq), read3d(:,:,:), step=it, existed=existed )
422 qnum_org(3:dims(1)+2,xs:xe,ys:ye,iq) = read3d(:,:,:)
424 qnum_org(2,xs:xe,ys:ye,iq) = qnum_org(3,xs:xe,ys:ye,iq)
426 qnum_org(1,xs:xe,ys:ye,iq) = qnum_org(3,xs:xe,ys:ye,iq)
430 qnum_org(:,:,:,iq) = undef
446 velz_org(
k,i,j) = ( momz_org(
k-1,i,j) + momz_org(
k,i,j) ) / dens_org(
k,i,j) * 0.5_rp
453 velz_org(1:3 ,i,j) = 0.0_rp
454 velz_org(dims(1)+2,i,j) = 0.0_rp
463 velx_org(
k,i,j) = ( momx_org(
k,i-1,j) + momx_org(
k,i,j) ) / dens_org(
k,i,j) * 0.5_rp
470 velx_org(
k,1,j) = momx_org(
k,1,j) / dens_org(
k,1,j)
473 if ( sfc_diagnoses )
then
475 velx_org(1:2,:,:) = 0.0_rp
478 velx_org(1:2,:,:) = undef
486 vely_org(
k,i,j) = ( momy_org(
k,i,j-1) + momy_org(
k,i,j) ) / dens_org(
k,i,j) * 0.5_rp
493 vely_org(
k,i,1) = momy_org(
k,i,1) / dens_org(
k,i,1)
496 if ( sfc_diagnoses )
then
498 vely_org(1:2,:,:) = 0.0_rp
501 vely_org(1:2,:,:) = undef
513 if ( u .ne. undef .and. v .ne.undef )
then
514 velx_org(
k,i,j) = u * rotc_cos(i,j) - v * rotc_sin(i,j)
515 vely_org(
k,i,j) = u * rotc_sin(i,j) + v * rotc_cos(i,j)
517 velx_org(
k,i,j) = undef
518 vely_org(
k,i,j) = undef
525 do iq = 1,
size(qtrc_org,4)
528 qtrc_org(:,:,:,iq) = 0.0_rp
531 if (
qa_mp > 0 .AND. .NOT. same_mptype )
then
532 if ( qnum_flag )
then
534 qv_org(:,:,:), qhyd_org(:,:,:,:), &
536 qnum=qnum_org(:,:,:,:) )
539 qv_org(:,:,:), qhyd_org(:,:,:,:), &
553 call thermodyn_specific_heat( dims(1)+2, 3, dims(1)+2,
qa, &
556 qdry(:), rtot(:), cvtot(:), cptot(:) )
558 call thermodyn_rhot2temp_pres( dims(1), 1, dims(1), &
559 dens_org(3:dims(1)+2,i,j), rhot_org(3:dims(1)+2,i,j), &
560 rtot(3:dims(1)+2), cvtot(3:dims(1)+2), cptot(3:dims(1)+2), &
561 temp_org(3:dims(1)+2), pres_org(3:dims(1)+2,i,j) )
565 pott_org(
k,i,j) = rhot_org(
k,i,j) / dens_org(
k,i,j)
568 if ( sfc_diagnoses )
then
570 dz = cz_org(3,i,j) - cz_org(2,i,j)
572 if ( .not. existed_t2 )
then
573 tsfc_org(i,j) = temp_org(3) + laps * dz
575 dens_org(2,i,j) = ( pres_org(3,i,j) + grav * dens_org(3,i,j) * dz * 0.5_rp ) &
576 / ( rdry * tsfc_org(i,j) - grav * dz * 0.5_rp )
577 pres_org(2,i,j) = dens_org(2,i,j) * rdry * tsfc_org(i,j)
578 pott_org(2,i,j) = tsfc_org(i,j) * ( p00 / pres_org(2,i,j) )**(rdry/cpdry)
581 temp_org(1) = tsfc_org(i,j) + laps * cz_org(2,i,j)
582 if ( existed_mslp )
then
583 pott_org(1,i,j) = temp_org(1) * ( p00 / pres_org(1,i,j) )**(rdry/cpdry)
584 dens_org(1,i,j) = pres_org(1,i,j) / ( rdry * temp_org(1) )
586 dens_org(1,i,j) = ( pres_org(2,i,j) + grav * dens_org(2,i,j) * cz_org(2,i,j) * 0.5_rp ) &
587 / ( rdry * temp_org(1) - grav * cz_org(2,i,j) * 0.5_rp )
588 pres_org(1,i,j) = dens_org(1,i,j) * rdry * temp_org(1)
589 pott_org(1,i,j) = temp_org(1) * ( p00 / pres_org(1,i,j) )**(rdry/cpdry)
592 dens_org(1:2,i,j) = undef
593 pres_org(1:2,i,j) = undef
594 pott_org(1:2,i,j) = undef
615 integer,
intent(out) :: ldims(3)
618 log_info(
"ParentLandSetupSCALE",*)
'Real Case/Land Input File Type: SCALE-RM'
624 if ( .NOT.
allocated(read2d) )
then
647 use_file_landwater, &
665 real(rp),
intent(out) :: tg_org (:,:,:)
666 real(rp),
intent(out) :: strg_org (:,:,:)
667 real(rp),
intent(out) :: lst_org (:,:)
668 real(rp),
intent(out) :: ust_org (:,:)
669 real(rp),
intent(out) :: albg_org (:,:,:,:)
670 real(rp),
intent(out) :: topo_org (:,:)
671 real(rp),
intent(out) :: lmask_org(:,:)
672 real(rp),
intent(out) :: llon_org (:,:)
673 real(rp),
intent(out) :: llat_org (:,:)
674 real(rp),
intent(out) :: lz_org (:)
675 character(len=*),
intent(in) :: basename_land
676 integer,
intent(in) :: ldims(3)
677 logical,
intent(in) :: use_file_landwater
678 integer,
intent(in) :: it
682 integer :: xloc, yloc
690 do i = 1,
size( nest_tile_id(:) )
692 rank = nest_tile_id(i)
694 xloc = mod( i-1, nest_tile_num_x ) + 1
695 yloc = int( real(i-1) / real(nest_tile_num_x) ) + 1
704 aggregate=.false., rankid=rank )
706 call file_cartesc_read( fid,
"LAND_TEMP", read3dl(:,:,:), step=it )
707 tg_org(1:ldims(1),xs:xe,ys:ye) = read3dl(:,:,:)
709 if( use_file_landwater )
then
710 call file_cartesc_read( fid,
"LAND_WATER", read3dl(:,:,:), step=it )
711 strg_org(1:ldims(1),xs:xe,ys:ye) = read3dl(:,:,:)
714 call file_cartesc_read( fid,
"lon", read2d(:,:) )
715 llon_org(xs:xe,ys:ye) = read2d(:,:) * d2r
717 call file_cartesc_read( fid,
"lat", read2d(:,:) )
718 llat_org(xs:xe,ys:ye) = read2d(:,:) * d2r
720 call file_cartesc_read( fid,
"LAND_SFC_TEMP", read2d(:,:), step=it )
721 lst_org(xs:xe,ys:ye) = read2d(:,:)
723 call file_get_datainfo( fid,
"URBAN_SFC_TEMP", istep=it, existed=existed )
725 call file_cartesc_read( fid,
"URBAN_SFC_TEMP", read2d(:,:), step=it )
726 ust_org(xs:xe,ys:ye) = read2d(:,:)
728 ust_org(xs:xe,ys:ye) = undef
731 call file_cartesc_read( fid,
"LAND_SFC_ALB_IR_dir", read2d(:,:), step=it )
734 call file_cartesc_read( fid,
"LAND_SFC_ALB_IR_dif", read2d(:,:), step=it )
737 call file_cartesc_read( fid,
"LAND_SFC_ALB_NIR_dir", read2d(:,:), step=it )
740 call file_cartesc_read( fid,
"LAND_SFC_ALB_NIR_dif", read2d(:,:), step=it )
743 call file_cartesc_read( fid,
"LAND_SFC_ALB_VIS_dir", read2d(:,:), step=it )
746 call file_cartesc_read( fid,
"LAND_SFC_ALB_VIS_dif", read2d(:,:), step=it )
749 call file_cartesc_read( fid,
"topo", read2d(:,:) )
750 topo_org(xs:xe,ys:ye) = read2d(:,:)
752 call file_cartesc_read( fid,
"lsmask", read2d(:,:) )
753 lmask_org(xs:xe,ys:ye) = read2d(:,:)
757 call file_read( fid,
"lz", lz_org(:) )
773 integer,
intent(out) :: odims(2)
776 log_info(
"ParentOceanSetupSCALE",*)
'Real Case/Ocean Input File Type: SCALE-RM'
781 if ( .NOT.
allocated(read2d) )
then
809 real(rp),
intent(out) :: olon_org (:,:)
810 real(rp),
intent(out) :: olat_org (:,:)
811 real(rp),
intent(out) :: omask_org(:,:)
812 character(len=*),
intent(in) :: basename_ocean
815 integer :: xloc, yloc
816 integer :: xs, xe, ys, ye
822 do i = 1,
size( nest_tile_id(:) )
824 rank = nest_tile_id(i)
826 xloc = mod( i-1, nest_tile_num_x ) + 1
827 yloc = int( real(i-1) / real(nest_tile_num_x) ) + 1
836 aggregate=.false., rankid=rank )
838 call file_cartesc_read( fid,
"lon", read2d(:,:) )
839 olon_org(xs:xe,ys:ye) = read2d(:,:) * d2r
841 call file_cartesc_read( fid,
"lat", read2d(:,:) )
842 olat_org(xs:xe,ys:ye) = read2d(:,:) * d2r
844 call file_cartesc_read( fid,
"lsmask", read2d(:,:) )
845 omask_org(xs:xe,ys:ye) = read2d(:,:)
873 real(rp),
intent(out) :: tw_org (:,:)
874 real(rp),
intent(out) :: sst_org (:,:)
875 real(rp),
intent(out) :: albw_org (:,:,:,:)
876 real(rp),
intent(out) :: z0w_org (:,:)
877 real(rp),
intent(out) :: omask_org(:,:)
878 character(len=*),
intent(in) :: basename_ocean
879 integer,
intent(in) :: it
886 integer :: xloc, yloc
891 do i = 1,
size( nest_tile_id(:) )
893 rank = nest_tile_id(i)
895 xloc = mod( i-1, nest_tile_num_x ) + 1
896 yloc = int( real(i-1) / real(nest_tile_num_x) ) + 1
905 aggregate=.false., rankid=rank )
907 call file_get_datainfo( fid,
"OCEAN_TEMP", dim_rank=ndim )
910 call file_cartesc_read( fid,
"OCEAN_TEMP", read2d(:,:), step=it )
911 tw_org(xs:xe,ys:ye) = read2d(:,:)
913 call file_cartesc_read( fid,
"OCEAN_TEMP", read3do(:,:,:), step=it )
914 tw_org(xs:xe,ys:ye) = read3do(1,:,:)
917 call file_cartesc_read( fid,
"OCEAN_SFC_TEMP", read2d(:,:), step=it )
918 sst_org(xs:xe,ys:ye) = read2d(:,:)
920 call file_cartesc_read( fid,
"OCEAN_SFC_ALB_IR_dir", read2d(:,:), step=it )
923 call file_cartesc_read( fid,
"OCEAN_SFC_ALB_IR_dif", read2d(:,:), step=it )
926 call file_cartesc_read( fid,
"OCEAN_SFC_ALB_NIR_dir", read2d(:,:), step=it )
929 call file_cartesc_read( fid,
"OCEAN_SFC_ALB_NIR_dif", read2d(:,:), step=it )
932 call file_cartesc_read( fid,
"OCEAN_SFC_ALB_VIS_dir", read2d(:,:), step=it )
935 call file_cartesc_read( fid,
"OCEAN_SFC_ALB_VIS_dif", read2d(:,:), step=it )
938 call file_cartesc_read( fid,
"OCEAN_SFC_Z0M", read2d(:,:), step=it )
939 z0w_org(xs:xe,ys:ye) = read2d(:,:)
941 call file_cartesc_read( fid,
"lsmask", read2d(:,:) )
942 omask_org(xs:xe,ys:ye) = read2d(:,:)