54 real(RP),
parameter :: t0 = 300.0_rp
55 real(RP),
parameter :: p0 = 1000.0e+2_rp
56 real(RP),
parameter :: rd = 287.04_rp
57 real(RP),
parameter :: cp = 7.0_rp * rd / 2.0_rp
58 real(RP),
parameter :: rcp = rd / cp
60 integer,
parameter :: cosin = 1
61 integer,
parameter :: sine = 2
63 real(RP),
allocatable :: read_xy (:,:)
64 real(RP),
allocatable :: read_xyz(:,:,:)
65 real(RP),
allocatable :: read_xyw(:,:,:)
66 real(RP),
allocatable :: read_xyl(:,:,:)
68 real(RP),
allocatable :: p_org (:,:,:)
69 real(RP),
allocatable :: pb_org (:,:,:)
70 real(RP),
allocatable :: ph_org (:,:,:)
71 real(RP),
allocatable :: phb_org (:,:,:)
73 logical,
private :: wrfout = .false.
88 integer,
intent(out) :: dims(6)
89 integer,
intent(out) :: timelen
90 character(len=*),
intent(in) :: basename_org
92 logical :: WRF_FILE_TYPE = .false.
94 namelist / param_mkinit_real_wrfarw / &
103 log_info(
"ParentAtmosSetupWRFARW",*)
'Setup' 107 read(
io_fid_conf,nml=param_mkinit_real_wrfarw,iostat=ierr)
109 log_error(
"ParentAtmosSetupWRFARW",*)
'Not appropriate names in namelist PARAM_MKINIT_REAL_WRFARW. Check!' 112 log_nml(param_mkinit_real_wrfarw)
114 call file_open( basename_org, fid, rankid=myrank, single=.true., postfix=
"" )
125 if ( error ) timelen = 0
127 if ( wrf_file_type )
then 129 log_info(
"ParentAtmosSetupWRFARW",*)
'WRF-ARW FILE-TYPE: WRF History Output' 132 log_info(
"ParentAtmosSetupWRFARW",*)
'WRF-ARW FILE-TYPE: WRF Restart' 136 allocate( read_xy(dims(2),dims(3)) )
137 allocate( read_xyz(dims(2),dims(3),dims(1)) )
138 allocate( read_xyw(dims(2),dims(3),dims(4)) )
140 allocate( p_org(dims(1),dims(2),dims(3)) )
141 allocate( pb_org(dims(1),dims(2),dims(3)) )
142 allocate( ph_org(dims(4),dims(2),dims(3)) )
143 allocate( phb_org(dims(4),dims(2),dims(3)) )
188 real(RP),
intent(out) :: velz_org(:,:,:)
189 real(RP),
intent(out) :: llvelx_org(:,:,:)
190 real(RP),
intent(out) :: llvely_org(:,:,:)
191 real(RP),
intent(out) :: pres_org(:,:,:)
192 real(RP),
intent(out) :: temp_org(:,:,:)
193 real(RP),
intent(out) :: qv_org(:,:,:)
194 real(RP),
intent(out) :: qhyd_org(:,:,:,:)
195 real(RP),
intent(out) :: qnum_org(:,:,:,:)
196 real(RP),
intent(out) :: lon_org(:,:)
197 real(RP),
intent(out) :: lat_org(:,:)
198 real(RP),
intent(out) :: cz_org(:,:,:)
199 character(len=*),
intent(in) :: basename
200 integer,
intent(in) :: dims(6)
201 integer,
intent(in) :: it
204 real(RP) :: velx_org(dims(1)+2,dims(2),dims(3))
205 real(RP) :: vely_org(dims(1)+2,dims(2),dims(3))
206 real(RP) :: pott_org(dims(1)+2,dims(2),dims(3))
207 real(RP) :: topo_org( dims(2),dims(3))
208 real(RP) :: geof_org(dims(4) ,dims(2),dims(3))
212 real(RP) :: velzs_org(dims(2),dims(3),dims(4))
213 real(RP) :: velxs_org(dims(5),dims(3),dims(1))
214 real(RP) :: velys_org(dims(2),dims(6),dims(1))
219 integer :: k, i, j, iq
221 character(len=H_MID) :: varname_T
222 character(len=H_MID) :: varname_W
223 character(len=H_MID) :: varname_U
224 character(len=H_MID) :: varname_V
242 call file_open( basename, fid, rankid=myrank, single=.true., postfix=
"" )
244 call file_read( fid,
"XLAT", lat_org(:,:), step=it )
245 lat_org(:,:) = lat_org(:,:) * d2r
247 call file_read( fid,
"XLONG", lon_org(:,:), step=it )
248 lon_org(:,:) = lon_org(:,:) * d2r
250 call file_read( fid,
"HGT", topo_org(:,:), step=it )
252 call file_read( fid,
"PH", read_xyw(:,:,:), step=it )
256 ph_org(k,i,j) = read_xyw(i,j,k)
261 call file_read( fid,
"PHB", read_xyw(:,:,:), step=it )
265 phb_org(k,i,j) = read_xyw(i,j,k)
270 call file_read( fid,
"P", read_xyz(:,:,:), step=it )
274 p_org(k,i,j) = read_xyz(i,j,k)
279 call file_read( fid,
"PB", read_xyz(:,:,:), step=it )
283 pb_org(k,i,j) = read_xyz(i,j,k)
288 call file_read( fid, varname_w, velzs_org(:,:,:), step=it )
290 call file_read( fid, varname_u, velxs_org(:,:,:), step=it )
292 call file_read( fid, varname_v, velys_org(:,:,:), step=it )
299 velz_org(k+2,i,j) = ( velzs_org(i,j,k) + velzs_org(i,j,k+1) ) * 0.5_rp
300 velx_org(k+2,i,j) = ( velxs_org(i,j,k) + velxs_org(i+1,j,k) ) * 0.5_rp
301 vely_org(k+2,i,j) = ( velys_org(i,j,k) + velys_org(i,j+1,k) ) * 0.5_rp
303 velz_org(1:2,i,j) = 0.0_rp
304 velx_org(1:2,i,j) = 0.0_rp
305 vely_org(1:2,i,j) = 0.0_rp
310 velx_org, vely_org, &
313 dims(1)+2, dims(2), dims(3) )
315 qhyd_org(:,:,:,:) = 0.0_rp
317 call file_read( fid,
"Q2", read_xy(:,:), step=it )
320 qv_org(1,i,j) = read_xy(i,j)
321 qv_org(2,i,j) = read_xy(i,j)
325 call file_read( fid,
"QVAPOR", read_xyz(:,:,:), step=it )
329 qv_org(k+2,i,j) = read_xyz(i,j,k)
335 call file_read( fid,
"QCLOUD", read_xyz(:,:,:), step=it, allow_missing=.true. )
339 qhyd_org(k+2,i,j,
i_hc) = read_xyz(i,j,k)
344 call file_read( fid,
"QRAIN", read_xyz(:,:,:), step=it, allow_missing=.true. )
348 qhyd_org(k+2,i,j,
i_hc) = read_xyz(i,j,k)
353 call file_read( fid,
"QICE", read_xyz(:,:,:), step=it, allow_missing=.true. )
357 qhyd_org(k+2,i,j,
i_hi) = read_xyz(i,j,k)
362 call file_read( fid,
"QSNOW", read_xyz(:,:,:), step=it, allow_missing=.true. )
366 qhyd_org(k+2,i,j,
i_hs) = read_xyz(i,j,k)
371 call file_read( fid,
"QGRAUP", read_xyz(:,:,:), step=it, allow_missing=.true. )
375 qhyd_org(k+2,i,j,
i_hg) = read_xyz(i,j,k)
387 qtot = qtot + qhyd_org(k,i,j,iq)
389 qv_org(k,i,j) = qv_org(k,i,j) / ( 1.0_rp + qtot )
391 qhyd_org(k,i,j,iq) = qhyd_org(k,i,j,iq) / ( 1.0_rp + qtot )
397 call file_read( fid,
"NC", read_xyz(:,:,:), step=it, allow_missing=.true. )
401 qnum_org(k+2,i,j,
i_hc) = read_xyz(i,j,k)
406 call file_read( fid,
"NR", read_xyz(:,:,:), step=it, allow_missing=.true. )
410 qnum_org(k+2,i,j,
i_hr) = read_xyz(i,j,k)
415 call file_read( fid,
"NI", read_xyz(:,:,:), step=it, allow_missing=.true. )
419 qnum_org(k+2,i,j,
i_hi) = read_xyz(i,j,k)
424 call file_read( fid,
"NS", read_xyz(:,:,:), step=it, allow_missing=.true. )
428 qnum_org(k+2,i,j,
i_hs) = read_xyz(i,j,k)
433 call file_read( fid,
"NG", read_xyz(:,:,:), step=it, allow_missing=.true. )
437 qnum_org(k+2,i,j,
i_hg) = read_xyz(i,j,k)
446 qhyd_org(k,i,j,iq) = max( qhyd_org(k,i,j,iq), 0.0_rp )
447 qnum_org(k,i,j,iq) = max( qnum_org(k,i,j,iq), 0.0_rp )
454 call file_read( fid, varname_t, read_xyz(:,:,:), step=it, allow_missing=.true. )
458 pott_org(k+2,i,j) = read_xyz(i,j,k) + t0
462 call file_read( fid,
"T2", read_xy(:,:), step=it, allow_missing=.true. )
465 temp_org(2,i,j) = read_xy(i,j)
469 call file_read( fid,
"PSFC", read_xy(:,:), step=it, allow_missing=.true. )
472 pres_org(2,i,j) = read_xy(i,j)
479 pres_org(k,i,j) = p_org(k-2,i,j) + pb_org(k-2,i,j)
480 temp_org(k,i,j) = pott_org(k,i,j) * ( pres_org(k,i,j) / p0 )**rcp
482 pott_org(2,i,j) = temp_org(2,i,j) * ( p0/pres_org(2,i,j) )**rcp
483 temp_org(1,i,j) = temp_org(2,i,j) + laps * topo_org(i,j)
484 dens = pres_org(2,i,j) / ( rdry * temp_org(2,i,j) )
485 pres_org(1,i,j) = ( pres_org(2,i,j) + grav * dens * cz_org(2,i,j) * 0.5_rp ) &
486 / ( rdry * temp_org(1,i,j) - grav * cz_org(2,i,j) * 0.5_rp ) &
487 * rdry * temp_org(1,i,j)
495 geof_org(k,i,j) = ( ph_org(k,i,j) + phb_org(k,i,j) ) / grav
499 cz_org(k+2,i,j) = ( geof_org(k,i,j) + geof_org(k+1,i,j) ) * 0.5_rp
501 cz_org(2,i,j) = topo_org(i,j)
502 cz_org(1,i,j) = 0.0_rp
510 log_info(
"ParentAtmosInputWRFARW",*)
"read 3D wrf data",i,j,k
511 log_info(
"ParentAtmosInputWRFARW",*)
"lon_org ",lon_org(i,j)/d2r
512 log_info(
"ParentAtmosInputWRFARW",*)
"lat_org ",lat_org(i,j)/d2r
513 log_info(
"ParentAtmosInputWRFARW",*)
"cz_org ",cz_org(k,i,j)
514 log_info(
"ParentAtmosInputWRFARW",*)
"pres_org ",pres_org(k,i,j)
515 log_info(
"ParentAtmosInputWRFARW",*)
"velx_org ",llvelx_org(k,i,j)
516 log_info(
"ParentAtmosInputWRFARW",*)
"vely_org ",llvely_org(k,i,j)
517 log_info(
"ParentAtmosInputWRFARW",*)
"velz_org ",velz_org(k,i,j)
518 log_info(
"ParentAtmosInputWRFARW",*)
"temp_org ",temp_org(k,i,j)
519 log_info(
"ParentAtmosInputWRFARW",*)
"qv_org ",qv_org(k,i,j)
520 k=3 ; i=3 ; j=3 ; iq = 1
521 log_info(
"ParentAtmosInputWRFARW",*)
"read 3D wrf data",i,j,k
522 log_info(
"ParentAtmosInputWRFARW",*)
"lon_org ",lon_org(i,j)/d2r
523 log_info(
"ParentAtmosInputWRFARW",*)
"lat_org ",lat_org(i,j)/d2r
524 log_info(
"ParentAtmosInputWRFARW",*)
"cz_org ",cz_org(k,i,j)
525 log_info(
"ParentAtmosInputWRFARW",*)
"pres_org ",pres_org(k,i,j)
526 log_info(
"ParentAtmosInputWRFARW",*)
"velx_org ",llvelx_org(k,i,j)
527 log_info(
"ParentAtmosInputWRFARW",*)
"vely_org ",llvely_org(k,i,j)
528 log_info(
"ParentAtmosInputWRFARW",*)
"velz_org ",velz_org(k,i,j)
529 log_info(
"ParentAtmosInputWRFARW",*)
"temp_org ",temp_org(k,i,j)
530 log_info(
"ParentAtmosInputWRFARW",*)
"qv_org ",qv_org(k,i,j)
546 integer,
intent(out) :: ldims(3)
547 character(len=*),
intent(in) :: basename_land
549 logical :: WRF_FILE_TYPE = .false.
551 namelist / param_mkinit_real_wrfarw / &
558 log_info(
"ParentLandSetupWRFARW",*)
'Real Case/Atmos Input File Type: WRF-ARW' 562 read(
io_fid_conf,nml=param_mkinit_real_wrfarw,iostat=ierr)
564 log_error(
"ParentLandSetupWRFARW",*)
'Not appropriate names in namelist PARAM_MKINIT_REAL_WRFARW. Check!' 567 log_nml(param_mkinit_real_wrfarw)
570 call file_open( basename_land, fid, rankid=myrank, single=.true., postfix=
"" )
576 if ( wrf_file_type )
then 578 log_info(
"ParentLandSetupWRFARW",*)
'WRF-ARW FILE-TYPE: WRF History Output' 581 log_info(
"ParentLandSetupWRFARW",*)
'WRF-ARW FILE-TYPE: WRF Restart' 585 if ( .not.
allocated(read_xy) )
then 586 allocate( read_xy(ldims(2),ldims(3)) )
589 allocate( read_xyl(ldims(2),ldims(3),ldims(1)) )
608 use_file_landwater, &
617 real(RP),
intent(out) :: tg_org(:,:,:)
618 real(RP),
intent(out) :: sh2o_org(:,:,:)
619 real(RP),
intent(out) :: lst_org(:,:)
620 real(RP),
intent(out) :: ust_org(:,:)
621 real(RP),
intent(out) :: albg_org(:,:,:,:)
622 real(RP),
intent(out) :: topo_org(:,:)
623 real(RP),
intent(out) :: lmask_org(:,:)
624 real(RP),
intent(out) :: llon_org(:,:)
625 real(RP),
intent(out) :: llat_org(:,:)
626 real(RP),
intent(out) :: lz_org(:)
627 character(len=*),
intent( in) :: basename
628 integer,
intent( in) :: ldims(3)
629 logical,
intent( in) :: use_file_landwater
630 integer,
intent( in) :: it
636 call file_open( basename, fid, rankid=myrank, single=.true., postfix=
"" )
638 call file_read( fid,
"XLAT", llat_org(:,:), step=it )
639 llat_org(:,:) = llat_org(:,:) * d2r
641 call file_read( fid,
"XLONG", llon_org(:,:), step=it )
642 llon_org(:,:) = llon_org(:,:) * d2r
644 call file_read( fid,
"HGT", topo_org(:,:), step=it )
648 call file_read( fid,
"ZS", lz_org(:), step=it )
651 call file_read( fid,
"LANDMASK", lmask_org(:,:), step=it )
654 call file_read( fid,
"TSLB", read_xyl(:,:,:), step=it )
658 tg_org(k,i,j) = read_xyl(i,j,k)
664 if( use_file_landwater )
then 665 call file_read( fid,
"SH2O", read_xyl(:,:,:), step=it, allow_missing=.true., missing_value=undef )
669 sh2o_org(k,i,j) = read_xyl(i,j,k)
685 call file_read( fid,
"TSK", lst_org(:,:), step=it )
687 ust_org(:,:) = lst_org(:,:)
696 call file_read( fid,
"EMISS", read_xy(:,:), step=it )
729 integer,
intent(out) :: odims(2)
730 integer,
intent(out) :: timelen
731 character(len=*),
intent(in) :: basename_org
733 logical :: WRF_FILE_TYPE = .false.
735 namelist / param_mkinit_real_wrfarw / &
743 log_info(
"ParentOceanSetupWRFARW",*)
'Real Case/Ocean Input File Type: WRF-ARW' 747 read(
io_fid_conf,nml=param_mkinit_real_wrfarw,iostat=ierr)
749 log_error(
"ParentOceanSetupWRFARW",*)
'Not appropriate names in namelist PARAM_MKINIT_REAL_WRFARW. Check!' 752 log_nml(param_mkinit_real_wrfarw)
755 call file_open( basename_org, fid, rankid=myrank, single=.true., postfix=
"" )
762 if ( error ) timelen = 0
764 if ( wrf_file_type )
then 766 log_info(
"ParentOceanSetupWRFARW",*)
'WRF-ARW FILE-TYPE: WRF History Output' 769 log_info(
"ParentOceanSetupWRFARW",*)
'WRF-ARW FILE-TYPE: WRF Restart' 773 if ( .not.
allocated(read_xy) )
then 774 allocate( read_xy(odims(1),odims(2)) )
806 real(RP),
intent(out) :: tw_org(:,:)
807 real(RP),
intent(out) :: sst_org(:,:)
808 real(RP),
intent(out) :: albw_org(:,:,:,:)
809 real(RP),
intent(out) :: z0w_org(:,:)
810 real(RP),
intent(out) :: omask_org(:,:)
811 real(RP),
intent(out) :: olon_org(:,:)
812 real(RP),
intent(out) :: olat_org(:,:)
813 character(len=*),
intent( in) :: basename
814 integer,
intent( in) :: odims(2)
815 integer,
intent( in) :: it
821 call file_open( basename, fid, rankid=myrank, single=.true., postfix=
"" )
823 call file_read( fid,
"XLAT", olat_org(:,:), step=it )
824 olat_org(:,:) = olat_org(:,:) * d2r
826 call file_read( fid,
"XLONG", olon_org(:,:), step=it )
827 olon_org(:,:) = olon_org(:,:) * d2r
831 call file_read( fid,
"LANDMASK", omask_org(:,:), step=it )
834 call file_read( fid,
"SST", sst_org(:,:), step=it )
836 tw_org(:,:) = sst_org(:,:)
845 call file_read( fid,
"EMISS", read_xy(:,:), step=it )
854 call file_read( fid,
"ZNT", z0w_org(:,:), step=it, allow_missing=.true., missing_value=undef )
879 real(RP),
intent(out) :: u_latlon(:,:,:)
880 real(RP),
intent(out) :: v_latlon(:,:,:)
881 real(RP),
intent(in ) :: u_on_map(:,:,:)
882 real(RP),
intent(in ) :: v_on_map(:,:,:)
883 real(RP),
intent(in ) :: xlon(:,:)
884 real(RP),
intent(in ) :: xlat(:,:)
885 integer ,
intent(in ) :: K1, I1, J1
887 character(len=*),
intent( in) :: basename
891 real(RP) :: truelat1, truelat2
892 real(RP) :: stand_lon
895 real(RP) :: sine(i1,j1)
896 real(RP) :: cose(i1,j1)
907 call file_open( basename, fid, rankid=myrank, single=.true., postfix=
"" )
909 call file_get_attribute( fid,
"global",
"MAP_PROJ", dum_i(:) )
912 call file_get_attribute( fid,
"global",
"TRUELAT1", dum_r(:) )
913 truelat1 = dum_r(1) * d2r
914 call file_get_attribute( fid,
"global",
"TRUELAT2", dum_r(:) )
915 truelat2 = dum_r(1) * d2r
916 call file_get_attribute( fid,
"global",
"STAND_LON", dum_r(:) )
917 stand_lon = dum_r(1) * d2r
920 if ( map_proj .ge. 3 )
then 921 u_latlon(:,:,:) = u_on_map(:,:,:)
922 v_latlon(:,:,:) = v_on_map(:,:,:)
929 if ( map_proj .eq. 1 )
then 930 if ( abs(truelat1-truelat2) .gt. 0.1_rp*d2r )
then 931 cone = ( log(cos(truelat1)) - &
932 log(cos(truelat2)) ) / &
933 ( log(tan((pi*0.5_rp-abs(truelat1))*0.5_rp )) - &
934 log(tan((pi*0.5_rp-abs(truelat2))*0.5_rp )) )
936 cone = sin( abs(truelat1) )
942 diff = xlon(i,j) - stand_lon
943 if ( diff .gt. pi )
then 944 diff = diff - pi*2.0_rp
946 if ( diff .lt. -pi )
then 947 diff = diff + pi*2.0_rp
949 alpha = diff * cone * sign(1.0_rp, xlat(i,j))
950 sine(i,j) = sin( alpha )
951 cose(i,j) = cos( alpha )
958 u_latlon(k,i,j) = v_on_map(k,i,j)*sine(i,j) + u_on_map(k,i,j)*cose(i,j)
959 v_latlon(k,i,j) = v_on_map(k,i,j)*cose(i,j) - u_on_map(k,i,j)*sine(i,j)
module coupler / surface-atmospehre
integer, parameter, public i_hs
snow
integer, parameter, public i_r_vis
integer, parameter, public i_hr
liquid water rain
integer, parameter, public i_hi
ice water cloud
integer, public io_fid_conf
Config file ID.
real(rp), public const_d2r
degree to radian
real(rp), public const_laps
lapse rate of ISA [K/m]
subroutine, public file_open(basename, fid, mode, single, aggregate, rankid, postfix)
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
real(rp), public const_undef
module atmosphere / hydrometeor
real(rp), public const_grav
standard acceleration of gravity [m/s2]
integer, public prc_myrank
process num in local communicator
subroutine, public prc_abort
Abort Process.
integer, parameter, public i_hc
liquid water cloud
integer, parameter, public i_r_direct
integer, parameter, public i_r_nir
real(rp), public const_pi
pi
integer, parameter, public i_r_ir
integer, parameter, public i_r_diffuse
integer, parameter, public n_hyd
integer, parameter, public i_hg
graupel
subroutine, public file_get_dimlength(fid, dimname, len, error)
get length of dimension