54 private :: rd_mstrn_setup
55 private :: rd_mstrn_dtrn3
56 private :: rd_mstrn_two_stream
62 real(RP),
private,
parameter :: RD_cosSZA_min = 0.017_rp
63 real(RP),
private,
parameter :: RD_EPS = 1.e-4_rp
65 real(RP),
private :: RD_TOA = 100.0_rp
66 integer,
private :: RD_KADD = 10
67 integer,
private,
parameter :: RD_naero =
n_hyd +
n_ae
68 integer,
private,
parameter :: RD_hydro_str = 1
69 integer,
private,
parameter :: RD_hydro_end =
n_hyd
70 integer,
private,
parameter :: RD_aero_str =
n_hyd + 1
71 integer,
private,
parameter :: RD_aero_end =
n_hyd +
n_ae
73 integer,
private :: RD_KMAX
75 real(RP),
private,
allocatable :: RD_zh (:)
76 real(RP),
private,
allocatable :: RD_z (:)
77 real(RP),
private,
allocatable :: RD_rhodz (:)
78 real(RP),
private,
allocatable :: RD_pres (:)
79 real(RP),
private,
allocatable :: RD_presh (:)
80 real(RP),
private,
allocatable :: RD_temp (:)
81 real(RP),
private,
allocatable :: RD_temph (:)
82 real(RP),
private,
allocatable :: RD_gas (:,:)
83 real(RP),
private,
allocatable :: RD_cfc (:,:)
84 real(RP),
private,
allocatable :: RD_aerosol_conc(:,:)
85 real(RP),
private,
allocatable :: RD_aerosol_radi(:,:)
86 real(RP),
private,
allocatable :: RD_cldfrac (:)
88 integer,
private :: I_MPAE2RD(RD_naero)
90 character(len=H_LONG),
private :: MSTRN_GASPARA_INPUTFILE =
'PARAG.29'
91 character(len=H_LONG),
private :: MSTRN_AEROPARA_INPUTFILE =
'PARAPC.29'
92 character(len=H_LONG),
private :: MSTRN_HYGROPARA_INPUTFILE =
'VARDATA.RM29'
94 integer,
private :: MSTRN_nband = 29
96 integer,
private,
parameter :: MSTRN_nstream = 1
97 integer,
private,
parameter :: MSTRN_ch_limit = 10
98 integer,
private,
parameter :: MSTRN_nflag = 7
99 integer,
private,
parameter :: MSTRN_nfitP = 26
100 integer,
private,
parameter :: MSTRN_nfitT = 3
102 integer,
private,
parameter :: MSTRN_ngas = 7
110 integer,
private,
parameter :: MSTRN_ncfc = 28
138 integer,
private :: MSTRN_nptype = 9
149 integer,
private,
parameter :: MSTRN_nsfc = 7
157 integer,
private,
parameter :: MSTRN_nfitPLK = 5
158 integer,
private,
parameter :: MSTRN_nplkord = 3
159 integer,
private,
parameter :: MSTRN_nmoment = 6
160 integer,
private :: MSTRN_nradius = 8
161 integer,
private,
parameter :: MSTRN_ncloud = 2
163 logical,
private :: ATMOS_PHY_RD_MSTRN_ONLY_QCI = .false.
164 logical,
private :: ATMOS_PHY_RD_MSTRN_ONLY_TROPOCLOUD = .false.
165 logical,
private :: ATMOS_PHY_RD_MSTRN_USE_AERO = .false.
169 real(RP),
private,
allocatable :: waveh (:)
171 real(RP),
private,
allocatable :: logfitP (:)
172 real(RP),
private,
allocatable :: fitT (:)
173 real(RP),
private,
allocatable :: logfitT (:)
174 integer,
private,
allocatable :: iflgb (:,:)
175 integer,
private,
allocatable :: nch (:)
176 real(RP),
private,
allocatable :: wgtch (:,:)
177 integer,
private,
allocatable :: ngasabs (:)
178 integer,
private,
allocatable :: igasabs (:,:)
180 real(RP),
private,
allocatable :: akd (:,:,:,:,:)
181 real(RP),
private,
allocatable :: skd (:,:,:,:)
182 real(RP),
private,
allocatable :: acfc_pow(:,:)
184 real(RP),
private,
allocatable :: fitPLK (:,:)
185 real(RP),
private,
allocatable :: fsol (:)
186 real(RP),
private :: fsol_tot
187 real(RP),
private,
allocatable :: sfc (:,:)
188 real(RP),
private,
allocatable :: rayleigh(:)
189 real(RP),
private,
allocatable :: qmol (:,:)
190 real(RP),
private,
allocatable :: q (:,:,:,:)
192 integer,
private,
allocatable :: hygro_flag(:)
193 real(RP),
private,
allocatable :: radmode (:,:)
195 integer,
private,
allocatable :: ptype_nradius(:)
199 integer,
private,
parameter :: I_SWLW = 4
200 integer,
private,
parameter :: I_H2O_continuum = 5
201 integer,
private,
parameter :: I_CFC_continuum = 7
203 integer,
private,
parameter :: I_ClearSky = 1
204 integer,
private,
parameter :: I_Cloud = 2
207 real(RP),
private :: RHO_std
209 real(RP),
private :: M(2)
210 real(RP),
private :: W(2)
211 real(RP),
private :: Wmns(2), Wpls(2)
212 real(RP),
private :: Wbar(2), Wscale(2)
237 integer,
intent(in) :: ka, ks, ke
239 real(rp),
intent(in) :: cz(ka)
240 real(rp),
intent(in) :: fz(0:ka)
242 real(rp) :: atmos_phy_rd_mstrn_toa
243 integer :: atmos_phy_rd_mstrn_kadd
244 character(len=H_LONG) :: atmos_phy_rd_mstrn_gaspara_in_filename
245 character(len=H_LONG) :: atmos_phy_rd_mstrn_aeropara_in_filename
246 character(len=H_LONG) :: atmos_phy_rd_mstrn_hygropara_in_filename
247 integer :: atmos_phy_rd_mstrn_nband
248 integer :: atmos_phy_rd_mstrn_nptype
249 integer :: atmos_phy_rd_mstrn_nradius
250 integer :: atmos_phy_rd_mstrn_nradius_cloud
251 integer :: atmos_phy_rd_mstrn_nradius_aero
253 namelist / param_atmos_phy_rd_mstrn / &
254 atmos_phy_rd_mstrn_toa, &
255 atmos_phy_rd_mstrn_kadd, &
256 atmos_phy_rd_mstrn_gaspara_in_filename, &
257 atmos_phy_rd_mstrn_aeropara_in_filename, &
258 atmos_phy_rd_mstrn_hygropara_in_filename, &
259 atmos_phy_rd_mstrn_nband, &
260 atmos_phy_rd_mstrn_nptype, &
261 atmos_phy_rd_mstrn_nradius, &
262 atmos_phy_rd_mstrn_nradius_cloud, &
263 atmos_phy_rd_mstrn_nradius_aero, &
264 atmos_phy_rd_mstrn_only_qci, &
265 atmos_phy_rd_mstrn_only_tropocloud, &
266 atmos_phy_rd_mstrn_use_aero
269 integer :: ngas, ncfc
274 log_info(
"ATMOS_PHY_RD_mstrnx_setup",*)
'Setup'
275 log_info(
"ATMOS_PHY_RD_mstrnx_setup",*)
'Sekiguchi and Nakajima (2008) mstrnX radiation process'
278 atmos_phy_rd_mstrn_toa = rd_toa
279 atmos_phy_rd_mstrn_kadd = rd_kadd
280 atmos_phy_rd_mstrn_gaspara_in_filename = mstrn_gaspara_inputfile
281 atmos_phy_rd_mstrn_aeropara_in_filename = mstrn_aeropara_inputfile
282 atmos_phy_rd_mstrn_hygropara_in_filename = mstrn_hygropara_inputfile
283 atmos_phy_rd_mstrn_nband = mstrn_nband
284 atmos_phy_rd_mstrn_nptype = mstrn_nptype
285 atmos_phy_rd_mstrn_nradius = mstrn_nradius
286 atmos_phy_rd_mstrn_nradius_cloud = -1
287 atmos_phy_rd_mstrn_nradius_aero = -1
290 read(
io_fid_conf,nml=param_atmos_phy_rd_mstrn,iostat=ierr)
292 log_info(
"ATMOS_PHY_RD_mstrnx_setup",*)
'Not found namelist. Default used.'
293 elseif( ierr > 0 )
then
294 log_error(
"ATMOS_PHY_RD_mstrnx_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_RD_MSTRN. Check!'
297 log_nml(param_atmos_phy_rd_mstrn)
299 rd_toa = atmos_phy_rd_mstrn_toa
300 rd_kadd = atmos_phy_rd_mstrn_kadd
301 mstrn_gaspara_inputfile = atmos_phy_rd_mstrn_gaspara_in_filename
302 mstrn_aeropara_inputfile = atmos_phy_rd_mstrn_aeropara_in_filename
303 mstrn_hygropara_inputfile = atmos_phy_rd_mstrn_hygropara_in_filename
304 mstrn_nband = atmos_phy_rd_mstrn_nband
305 mstrn_nptype = atmos_phy_rd_mstrn_nptype
307 if ( atmos_phy_rd_mstrn_nradius_cloud < 0 )
then
308 atmos_phy_rd_mstrn_nradius_cloud = atmos_phy_rd_mstrn_nradius
310 if ( atmos_phy_rd_mstrn_nradius_aero < 0 )
then
311 atmos_phy_rd_mstrn_nradius_aero = atmos_phy_rd_mstrn_nradius
314 mstrn_nradius = max( atmos_phy_rd_mstrn_nradius, &
315 atmos_phy_rd_mstrn_nradius_cloud, &
316 atmos_phy_rd_mstrn_nradius_aero )
319 allocate( ptype_nradius(mstrn_nptype) )
321 if ( mstrn_nptype == 9 )
then
337 ptype_nradius( 1) = atmos_phy_rd_mstrn_nradius_cloud
338 ptype_nradius( 2) = atmos_phy_rd_mstrn_nradius_cloud
339 ptype_nradius( 3) = atmos_phy_rd_mstrn_nradius_aero
340 ptype_nradius( 4) = atmos_phy_rd_mstrn_nradius_aero
341 ptype_nradius( 5) = atmos_phy_rd_mstrn_nradius_aero
342 ptype_nradius( 6) = atmos_phy_rd_mstrn_nradius_aero
343 ptype_nradius( 7) = atmos_phy_rd_mstrn_nradius_aero
344 ptype_nradius( 8) = atmos_phy_rd_mstrn_nradius_aero
345 ptype_nradius( 9) = atmos_phy_rd_mstrn_nradius_aero
347 elseif( mstrn_nptype == 12 )
then
363 ptype_nradius( 1) = atmos_phy_rd_mstrn_nradius_cloud
364 ptype_nradius( 2) = atmos_phy_rd_mstrn_nradius_cloud
365 ptype_nradius( 3) = atmos_phy_rd_mstrn_nradius_cloud
366 ptype_nradius( 4) = atmos_phy_rd_mstrn_nradius_cloud
367 ptype_nradius( 5) = atmos_phy_rd_mstrn_nradius_cloud
368 ptype_nradius( 6) = atmos_phy_rd_mstrn_nradius_aero
369 ptype_nradius( 7) = atmos_phy_rd_mstrn_nradius_aero
370 ptype_nradius( 8) = atmos_phy_rd_mstrn_nradius_aero
371 ptype_nradius( 9) = atmos_phy_rd_mstrn_nradius_aero
372 ptype_nradius(10) = atmos_phy_rd_mstrn_nradius_aero
373 ptype_nradius(11) = atmos_phy_rd_mstrn_nradius_aero
374 ptype_nradius(12) = atmos_phy_rd_mstrn_nradius_aero
380 call rd_mstrn_setup( ngas, &
384 call rd_profile_setup
387 rd_kmax = kmax + rd_kadd
391 allocate( rd_zh(rd_kmax+1) )
392 allocate( rd_z(rd_kmax ) )
394 allocate( rd_rhodz(rd_kmax ) )
395 allocate( rd_pres(rd_kmax ) )
396 allocate( rd_presh(rd_kmax+1) )
397 allocate( rd_temp(rd_kmax ) )
398 allocate( rd_temph(rd_kmax+1) )
400 allocate( rd_gas(rd_kmax,ngas ) )
401 allocate( rd_cfc(rd_kmax,ncfc ) )
402 allocate( rd_aerosol_conc(rd_kmax,rd_naero) )
403 allocate( rd_aerosol_radi(rd_kmax,rd_naero) )
404 allocate( rd_cldfrac(rd_kmax ) )
407 call rd_profile_setup_zgrid( &
410 rd_toa, cz(:), fz(:), &
414 call rd_profile_read( rd_kmax, &
429 rd_aerosol_conc(:,:), &
430 rd_aerosol_radi(:,:), &
452 deallocate( ptype_nradius )
456 deallocate( rd_rhodz )
457 deallocate( rd_pres )
458 deallocate( rd_presh )
459 deallocate( rd_temp )
460 deallocate( rd_temph )
464 deallocate( rd_aerosol_conc )
465 deallocate( rd_aerosol_radi )
466 deallocate( rd_cldfrac )
469 deallocate( logfitp )
471 deallocate( logfitt )
476 deallocate( ngasabs )
477 deallocate( igasabs )
481 deallocate( acfc_pow )
486 deallocate( rayleigh )
491 deallocate( hygro_flag )
492 deallocate( radmode )
500 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
501 DENS, TEMP, PRES, QV, &
506 temp_sfc, albedo_sfc, &
508 CLDFRAC, MP_Re, MP_Qe, &
539 integer,
intent(in) :: ka, ks, ke
540 integer,
intent(in) :: ia, is, ie
541 integer,
intent(in) :: ja, js, je
543 real(rp),
intent(in) :: dens (ka,ia,ja)
544 real(rp),
intent(in) :: temp (ka,ia,ja)
545 real(rp),
intent(in) :: pres (ka,ia,ja)
546 real(rp),
intent(in) :: qv (ka,ia,ja)
547 real(rp),
intent(in) :: cz ( ka,ia,ja)
548 real(rp),
intent(in) :: fz (0:ka,ia,ja)
549 real(rp),
intent(in) :: fact_ocean (ia,ja)
550 real(rp),
intent(in) :: fact_land (ia,ja)
551 real(rp),
intent(in) :: fact_urban (ia,ja)
552 real(rp),
intent(in) :: temp_sfc (ia,ja)
554 real(rp),
intent(in) :: solins (ia,ja)
555 real(rp),
intent(in) :: cossza (ia,ja)
556 real(rp),
intent(in) :: cldfrac (ka,ia,ja)
557 real(rp),
intent(in) :: mp_re (ka,ia,ja,
n_hyd)
558 real(rp),
intent(in) :: mp_qe (ka,ia,ja,
n_hyd)
559 real(rp),
intent(in) :: ae_re (ka,ia,ja,
n_ae)
560 real(rp),
intent(in) :: ae_qe (ka,ia,ja,
n_ae)
561 real(rp),
intent(out) :: flux_rad (ka,ia,ja,2,2,2)
562 real(rp),
intent(out) :: flux_rad_top (ia,ja,2,2,2)
565 real(rp),
intent(out),
optional :: dtau_s(ka,ia,ja)
566 real(rp),
intent(out),
optional :: dem_s (ka,ia,ja)
569 integer :: tropopause(ia,ja)
572 real(rp),
parameter :: min_cldfrac = 1.e-8_rp
574 real(rp) :: rhodz_merge (rd_kmax,ia,ja)
575 real(rp) :: pres_merge (rd_kmax,ia,ja)
576 real(rp) :: temp_merge (rd_kmax,ia,ja)
577 real(rp) :: temph_merge (rd_kmax+1,ia,ja)
579 real(rp) :: gas_merge (rd_kmax,ia,ja,mstrn_ngas)
580 real(rp) :: cfc_merge (rd_kmax,ia,ja,mstrn_ncfc)
581 real(rp) :: aerosol_conc_merge(rd_kmax,ia,ja,rd_naero )
582 real(rp) :: aerosol_radi_merge(rd_kmax,ia,ja,rd_naero )
583 real(rp) :: cldfrac_merge (rd_kmax,ia,ja)
586 real(rp) :: flux_rad_merge(rd_kmax+1,ia,ja,2,2,mstrn_ncloud)
587 real(rp) :: taucld_067u (rd_kmax,ia,ja)
588 real(rp) :: emiscld_105u (rd_kmax,ia,ja)
592 integer :: ihydro, iaero
593 integer :: rd_k, k, i, j, v, ic
596 log_progress(*)
'atmosphere / physics / radiation / mstrnX'
607 if ( atmos_phy_rd_mstrn_only_tropocloud )
then
616 tropopause(i,j) = ke+1
618 if ( pres(k,i,j) >= 300.e+2_rp )
then
620 elseif( pres(k,i,j) < 50.e+2_rp )
then
623 gamma = ( temp(k+1,i,j) - temp(k,i,j) ) / ( cz(k+1,i,j) - cz(k,i,j) )
624 if( gamma > 1.e-4_rp ) tropopause(i,j) = k
639 tropopause(i,j) = ke+1
647 if ( rd_profile_use_climatology )
then
648 call rd_profile_read( rd_kmax, &
663 rd_aerosol_conc(:,:), &
664 rd_aerosol_radi(:,:), &
676 temph_merge(rd_k,i,j) = rd_temph(rd_k)
679 temph_merge(rd_kadd+1,i,j) = temp(ke,i,j)
680 do rd_k = rd_kadd+2, rd_kmax
681 k = ks + rd_kmax - rd_k
683 temph_merge(rd_k,i,j) = ( temp(k ,i,j) * (cz(k+1,i,j)-fz(k,i,j)) / (cz(k+1,i,j)-cz(k,i,j)) &
684 + temp(k+1,i,j) * (fz(k ,i,j)-cz(k,i,j)) / (cz(k+1,i,j)-cz(k,i,j)) )
686 temph_merge(rd_kmax+1,i,j) = temp(ks,i,j)
701 rhodz_merge(rd_k,i,j) = rd_rhodz(rd_k)
702 pres_merge(rd_k,i,j) = rd_pres(rd_k)
703 temp_merge(rd_k,i,j) = rd_temp(rd_k)
706 do rd_k = rd_kadd+1, rd_kmax
707 k = ks + rd_kmax - rd_k
709 rhodz_merge(rd_k,i,j) = dens(k,i,j) * ( fz(k,i,j)-fz(k-1,i,j) )
710 pres_merge(rd_k,i,j) = pres(k,i,j) * 1.e-2_rp
711 temp_merge(rd_k,i,j) = temp(k,i,j)
728 gas_merge(rd_k,i,j,v) = rd_gas(rd_k,v)
745 do rd_k = rd_kadd+1, rd_kmax
746 k = ks + rd_kmax - rd_k
747 zerosw = sign(0.5_rp, qv(k,i,j)-eps) + 0.5_rp
748 gas_merge(rd_k,i,j,1) = qv(k,i,j) / mvap * mdry / ppm * zerosw
765 cfc_merge(rd_k,i,j,v) = rd_cfc(rd_k,v)
782 cldfrac_merge(rd_k,i,j) = rd_cldfrac(rd_k)
785 do rd_k = rd_kadd+1, rd_kmax
786 k = ks + rd_kmax - rd_k
788 cldfrac_merge(rd_k,i,j) = min( max( cldfrac(k,i,j), 0.0_rp ), 1.0_rp )
806 aerosol_conc_merge(rd_k,i,j,v) = rd_aerosol_conc(rd_k,v)
807 aerosol_radi_merge(rd_k,i,j,v) = rd_aerosol_radi(rd_k,v)
822 if ( atmos_phy_rd_mstrn_only_qci .and. &
823 ( ihydro /=
i_hc .and. ihydro /=
i_hi ) )
then
829 do rd_k = rd_kadd+1, rd_kmax
830 aerosol_conc_merge(rd_k,i,j,ihydro) = 0.0_rp
841 do rd_k = rd_kadd+1, rd_kadd+1 + ke - tropopause(i,j)
842 aerosol_conc_merge(rd_k,i,j,ihydro) = 0.0_rp
845 do rd_k = rd_kadd+1 + ke - tropopause(i,j) + 1, rd_kmax
846 k = ks + rd_kmax - rd_k
847 aerosol_conc_merge(rd_k,i,j,ihydro) = max( mp_qe(k,i,j,ihydro), 0.0_rp ) &
866 do rd_k = rd_kadd+1, rd_kmax
867 k = ks + rd_kmax - rd_k
868 aerosol_radi_merge(rd_k,i,j,ihydro) = mp_re(k,i,j,ihydro)
883 if ( atmos_phy_rd_mstrn_use_aero )
then
888 do rd_k = rd_kadd+1, rd_kmax
889 k = ks + rd_kmax - rd_k
890 aerosol_conc_merge(rd_k,i,j,
n_hyd+iaero) = max( ae_qe(k,i,j,iaero), 0.0_rp ) &
891 /
ae_dens(iaero) * rho_std / ppm
892 aerosol_radi_merge(rd_k,i,j,
n_hyd+iaero) = ae_re(k,i,j,iaero)
903 do rd_k = rd_kadd+1, rd_kmax
904 aerosol_conc_merge(rd_k,i,j,
n_hyd+iaero) = rd_aerosol_conc(rd_k,
n_hyd+iaero)
905 aerosol_radi_merge(rd_k,i,j,
n_hyd+iaero) = rd_aerosol_radi(rd_k,
n_hyd+iaero)
925 call rd_mstrn_dtrn3( rd_kmax, &
927 ia, is, ie, ja, js, je, &
929 ia, i, i, ja, j, j, &
932 mstrn_ngas, mstrn_ncfc, rd_naero, &
933 rd_hydro_str, rd_hydro_end, rd_aero_str, rd_aero_end, &
934 solins(:,:), cossza(:,:), &
935 rhodz_merge(:,:,:), pres_merge(:,:,:), &
936 temp_merge(:,:,:), temph_merge(:,:,:), temp_sfc(:,:), &
937 gas_merge(:,:,:,:), cfc_merge(:,:,:,:), &
938 aerosol_conc_merge(:,:,:,:), aerosol_radi_merge(:,:,:,:), &
940 cldfrac_merge(:,:,:), &
941 albedo_sfc(:,:,:,:), &
942 fact_ocean(:,:), fact_land(:,:), fact_urban(:,:), &
943 flux_rad_merge(:,:,:,:,:,:), flux_rad_sfc_dn(:,:,:,:), &
944 taucld_067u(:,:,:), emiscld_105u(:,:,:) )
964 do rd_k = rd_kadd+1, rd_kmax+1
965 k = ks + rd_kmax - rd_k
967 flux_rad(k,i,j,
i_lw,
i_up,ic) = flux_rad_merge(rd_k,i,j,
i_lw,
i_up,ic)
968 flux_rad(k,i,j,
i_lw,
i_dn,ic) = flux_rad_merge(rd_k,i,j,
i_lw,
i_dn,ic)
969 flux_rad(k,i,j,
i_sw,
i_up,ic) = flux_rad_merge(rd_k,i,j,
i_sw,
i_up,ic)
970 flux_rad(k,i,j,
i_sw,
i_dn,ic) = flux_rad_merge(rd_k,i,j,
i_sw,
i_dn,ic)
1000 if (
present( dtau_s ) )
then
1009 do rd_k = rd_kadd+1, rd_kmax
1010 k = ks + rd_kmax - rd_k
1011 dtau_s(k,i,j) = taucld_067u(rd_k,i,j)
1018 if (
present( dem_s ) )
then
1027 do rd_k = rd_kadd+1, rd_kmax
1028 k = ks + rd_kmax - rd_k
1029 dem_s(k,i,j) = emiscld_105u(rd_k,i,j)
1045 subroutine rd_mstrn_setup( &
1057 integer,
intent(out) :: ngas
1058 integer,
intent(out) :: ncfc
1060 real(rp) :: acfc(mstrn_ncfc)
1062 integer :: nband, nstream, nfitp, nfitt, nflag
1063 integer :: nsfc, nptype, nplkord, nfitplk
1066 character(len=H_LONG) :: dummy, fname
1068 integer :: fid, ierr
1069 integer :: iw, ich, ip, it, igas, icfc, iptype, im
1076 allocate( waveh(mstrn_nband+1) )
1077 allocate( logfitp(mstrn_nfitp) )
1078 allocate( fitt(mstrn_nfitt) )
1079 allocate( logfitt(mstrn_nfitt) )
1081 allocate( iflgb(mstrn_nflag, mstrn_nband) )
1082 allocate( nch( mstrn_nband) )
1083 allocate( wgtch(mstrn_ch_limit,mstrn_nband) )
1084 allocate( ngasabs( mstrn_nband) )
1085 allocate( igasabs(mstrn_ngas, mstrn_nband) )
1087 allocate( akd(mstrn_nfitp,mstrn_ch_limit,mstrn_nfitt,mstrn_ngas,mstrn_nband) )
1088 allocate( skd(mstrn_nfitp,mstrn_ch_limit,mstrn_nfitt, mstrn_nband) )
1089 allocate( acfc_pow(mstrn_ncfc,mstrn_nband) )
1095 form =
'formatted', &
1099 if ( ierr /= 0 )
then
1100 log_error(
"RD_MSTRN_setup",*)
'Input data file does not found! ', trim(fname)
1105 read(fid,*) nband, nstream, nfitp, nfitt, nflag, ncfc
1107 if ( nband /= mstrn_nband )
then
1108 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nband(given,file)=', mstrn_nband, nband
1111 if ( nstream /= mstrn_nstream )
then
1112 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nstream(given,file)=', mstrn_nstream, nstream
1115 if ( nfitp /= mstrn_nfitp )
then
1116 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nfitP(given,file)=', mstrn_nfitp, nfitp
1119 if ( nfitt /= mstrn_nfitt )
then
1120 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nfitT(given,file)=', mstrn_nfitt, nfitt
1123 if ( nflag /= mstrn_nflag )
then
1124 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nflag(given,file)=', mstrn_nflag, nflag
1127 if ( ncfc /= mstrn_ncfc )
then
1128 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! ncfc(given,file)=', mstrn_ncfc, ncfc
1134 read(fid,*) waveh(:)
1137 read(fid,*) logfitp(:)
1142 logfitt(:) = log10( fitt(:) )
1145 do iw = 1, mstrn_nband
1149 read(fid,*) iflgb(:,iw)
1155 read(fid,*) (wgtch(ich,iw),ich=1,nch(iw))
1158 read(fid,*) ngasabs(iw)
1161 if ( ngasabs(iw) > 0 )
then
1162 do igas = 1, ngasabs(iw)
1163 read(fid,*) igasabs(igas,iw)
1164 do it = 1, mstrn_nfitt
1165 do ip = 1, mstrn_nfitp
1166 read(fid,*) (akd(ip,ich,it,igasabs(igas,iw),iw),ich=1,nch(iw))
1173 if ( iflgb(i_h2o_continuum,iw) > 0 )
then
1175 do it = 1, mstrn_nfitt
1176 do ip = 1, mstrn_nfitp
1177 read(fid,*) (skd(ip,ich,it,iw),ich=1,nch(iw))
1183 if ( iflgb(i_cfc_continuum,iw) > 0 )
then
1185 read(fid,*) (acfc(icfc),icfc=1,mstrn_ncfc)
1187 do icfc = 1, mstrn_ncfc
1188 acfc_pow(icfc,iw) = 10.0_rp**acfc(icfc)
1199 allocate( fitplk(mstrn_nfitplk,mstrn_nband) )
1200 allocate( fsol( mstrn_nband) )
1201 allocate( sfc(mstrn_nsfc, mstrn_nband) )
1202 allocate( rayleigh( mstrn_nband) )
1204 allocate( qmol( mstrn_nmoment,mstrn_nband) )
1205 allocate( q(-1:mstrn_nradius+1,mstrn_nptype,mstrn_nmoment,mstrn_nband) )
1206 do iptype = 1, mstrn_nptype
1207 nradius = ptype_nradius(iptype)
1209 q( -1:0 ,iptype,:,:) = 0.d0
1210 q(nradius+1:mstrn_nradius+1,iptype,:,:) = 0.d0
1217 form =
'formatted', &
1221 if ( ierr /= 0 )
then
1222 log_error(
"RD_MSTRN_setup",*)
'Input data file does not found! ', trim(fname)
1227 read(fid,*) nband, nsfc, nptype, nstream, nplkord, nfitplk
1229 if ( nband /= mstrn_nband )
then
1230 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nband(given,file)=', mstrn_nband, nband
1233 if ( nsfc /= mstrn_nsfc )
then
1234 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nsfc(given,file)=', mstrn_nsfc, nsfc
1237 if ( nptype /= mstrn_nptype )
then
1238 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nptype(given,file)=', mstrn_nptype, nptype
1241 if ( nstream /= mstrn_nstream )
then
1242 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nstream(given,file)=', mstrn_nstream, nstream
1245 if ( nplkord /= mstrn_nplkord )
then
1246 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nplkord(given,file)=', mstrn_nplkord, nplkord
1249 if ( nfitplk /= mstrn_nfitplk )
then
1250 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nfitPLK(given,file)=', mstrn_nfitplk, nfitplk
1256 read(fid,*) waveh(:)
1259 do iw = 1, mstrn_nband
1263 read(fid,*) fitplk(:,iw)
1266 read(fid,*) fsol(iw)
1269 read(fid,*) sfc(:,iw)
1272 read(fid,*) rayleigh(iw)
1276 do im = 1, mstrn_nmoment
1278 read(fid,*) qmol(im,iw)
1280 do iptype = 1, mstrn_nptype
1281 nradius = ptype_nradius(iptype)
1282 read(fid,*) q(1:nradius,iptype,im,iw)
1291 do iw = 1, mstrn_nband
1292 fsol_tot = fsol_tot + fsol(iw)
1298 allocate( hygro_flag(mstrn_nptype) )
1299 allocate( radmode(mstrn_nptype,mstrn_nradius) )
1304 form =
'formatted', &
1308 if ( ierr /= 0 )
then
1309 log_error(
"RD_MSTRN_setup",*)
'Input data file does not found! ', trim(fname)
1315 if ( nptype /= mstrn_nptype )
then
1316 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nptype(given,file)=', mstrn_nptype, nptype
1320 do iptype = 1, mstrn_nptype
1322 read(fid,*) hygro_flag(iptype), nradius
1324 if ( nradius /= ptype_nradius(iptype) )
then
1325 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nradius(given,file)=', ptype_nradius(iptype), nradius
1329 read(fid,*) radmode(iptype,1:nradius)
1336 log_info(
"RD_MSTRN_setup",
'(1x,A,F12.7)')
'Baseline of total solar insolation : ', fsol_tot
1339 rho_std = pstd / ( rdry * tem00 )
1341 m(
i_sw) = 1.0_rp / sqrt(3.0_rp)
1345 m(
i_lw) = 1.0_rp / 1.66_rp
1350 wmns(im) = sqrt( w(im) / m(im) )
1351 wpls(im) = sqrt( w(im) * m(im) )
1352 wscale(im) = wpls(im) / wbar(im)
1363 end subroutine rd_mstrn_setup
1368 subroutine rd_mstrn_dtrn3( &
1369 rd_kmax, IA, IS, IE, JA, JS, JE, &
1408 integer,
intent(in) :: rd_kmax
1409 integer,
intent(in) :: ia, is, ie
1410 integer,
intent(in) :: ja, js, je
1412 integer,
intent(in) :: i, j
1415 integer,
intent(in) :: ngas
1416 integer,
intent(in) :: ncfc
1417 integer,
intent(in) :: naero
1418 integer,
intent(in) :: hydro_str
1419 integer,
intent(in) :: hydro_end
1420 integer,
intent(in) :: aero_str
1421 integer,
intent(in) :: aero_end
1422 real(rp),
intent(in) :: solins (ia,ja)
1423 real(rp),
intent(in) :: cossza0 (ia,ja)
1424 real(rp),
intent(in) :: rhodz (rd_kmax ,ia,ja)
1425 real(rp),
intent(in) :: pres (rd_kmax ,ia,ja)
1426 real(rp),
intent(in) :: temp (rd_kmax ,ia,ja)
1427 real(rp),
intent(in) :: temph (rd_kmax+1,ia,ja)
1428 real(rp),
intent(in) :: temp_sfc (ia,ja)
1429 real(rp),
intent(in) :: gas (rd_kmax,ia,ja,ngas )
1430 real(rp),
intent(in) :: cfc (rd_kmax,ia,ja,ncfc )
1431 real(rp),
intent(in) :: aerosol_conc(rd_kmax,ia,ja,naero)
1432 real(rp),
intent(in) :: aerosol_radi(rd_kmax,ia,ja,naero)
1433 integer,
intent(in) :: aero2ptype (naero)
1434 real(rp),
intent(in) :: cldfrac (rd_kmax,ia,ja)
1436 real(rp),
intent(in) :: fact_ocean (ia,ja)
1437 real(rp),
intent(in) :: fact_land (ia,ja)
1438 real(rp),
intent(in) :: fact_urban (ia,ja)
1439 real(rp),
intent(inout) :: rflux (rd_kmax+1,ia,ja,2,2,mstrn_ncloud)
1441 real(rp),
intent(inout) :: taucld_067u (rd_kmax,ia,ja)
1442 real(rp),
intent(inout) :: emiscld_105u(rd_kmax,ia,ja)
1445 #define LOOP_INNER do j=JS,JE; do i=IS,IE
1446 #define LOOP_END_INNER end do; end do
1449 #define LOOP_END_INNER
1453 real(rp) :: dz_std (rd_kmax,is:ie,js:je)
1456 integer :: indexp (rd_kmax,is:ie,js:je)
1457 real(rp) :: factp (rd_kmax,is:ie,js:je)
1458 real(rp) :: factt32(rd_kmax,is:ie,js:je)
1459 real(rp) :: factt21(rd_kmax,is:ie,js:je)
1460 integer :: indexr (rd_kmax,naero,is:ie,js:je)
1461 real(rp) :: factr (rd_kmax,naero,is:ie,js:je)
1464 real(rp) :: taugas(rd_kmax,mstrn_ch_limit,is:ie,js:je)
1465 real(rp) :: a1, a2, a3, factpt
1466 real(rp) :: qv, length
1470 real(rp) :: taupr (rd_kmax,mstrn_ncloud)
1471 real(rp) :: omgpr (rd_kmax,mstrn_ncloud)
1472 real(
dp) :: optparam(rd_kmax,mstrn_nmoment,mstrn_ncloud,is:ie,js:je)
1473 real(rp) :: q_fit, dp_p
1476 real(rp) :: bbar (rd_kmax )
1477 real(rp) :: bbarh(rd_kmax+1)
1479 real(rp) :: wl, beta
1482 real(rp) :: tau(rd_kmax, mstrn_ncloud,mstrn_ch_limit)
1483 real(rp) :: omg(rd_kmax, mstrn_ncloud,mstrn_ch_limit)
1484 real(rp) :: g (rd_kmax,0:2,mstrn_ncloud )
1488 real(rp) :: b (rd_kmax,0:2,mstrn_ncloud,mstrn_ch_limit)
1489 real(rp) :: fsol_rgn
1491 real(rp) :: flux (rd_kmax+1,2,mstrn_ncloud,mstrn_ch_limit)
1492 real(rp) :: flux_direct(rd_kmax+1, mstrn_ncloud,mstrn_ch_limit)
1495 real(rp) :: emiscld(rd_kmax,mstrn_ch_limit)
1498 real(rp) :: cossza(ia,ja)
1502 real(rp) :: tdir0(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
1503 real(rp) :: r0 (rd_kmax,mstrn_ncloud,mstrn_ch_limit)
1504 real(rp) :: t0 (rd_kmax,mstrn_ncloud,mstrn_ch_limit)
1505 real(rp) :: em_lw(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
1506 real(rp) :: em_sw(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
1507 real(rp) :: ep_lw(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
1508 real(rp) :: ep_sw(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
1510 real(rp) :: cf (rd_kmax ,mstrn_ncloud*mstrn_ch_limit)
1511 real(rp) :: tau_bar_sol(rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
1512 real(rp) :: r (rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
1513 real(rp) :: t (rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
1514 real(rp) :: em (rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
1515 real(rp) :: ep (rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
1516 real(rp) :: em0 (mstrn_ncloud)
1518 real(rp) :: r12mns(mstrn_ncloud*mstrn_ch_limit,rd_kmax+1)
1519 real(rp) :: r12pls(mstrn_ncloud*mstrn_ch_limit,rd_kmax+1)
1520 real(rp) :: e12mns(mstrn_ncloud*mstrn_ch_limit,rd_kmax+1)
1521 real(rp) :: e12pls(mstrn_ncloud*mstrn_ch_limit,rd_kmax+1)
1525 real(rp) :: valsum(rd_kmax)
1527 integer :: ip, ir, irgn, irgn_alb
1528 integer :: igas, icfc, iaero, iptype, nradius
1529 integer :: iw, ich, iplk, icloud, im, idir
1545 cossza(i,j) = max( cossza0(i,j), rd_cossza_min )
1552 dz_std(k,i,j) = rhodz(k,i,j) / rho_std * 100.0_rp
1554 logp = log10( pres(k,i,j) )
1555 logt = log10( temp(k,i,j) )
1557 indexp(k,i,j) = mstrn_nfitp
1559 do ip = mstrn_nfitp, 2, -1
1560 if( logp >= logfitp(ip) ) indexp(k,i,j) = ip
1565 factp(k,i,j) = ( logp - logfitp(ip-1) ) / ( logfitp(ip) - logfitp(ip-1) )
1567 factt32(k,i,j) = ( logt - logfitt(2) ) / ( logfitt(3) - logfitt(2) ) &
1568 * ( temp(k,i,j) - fitt(1) ) / ( fitt(3) - fitt(1) )
1569 factt21(k,i,j) = ( logt - logfitt(2) ) / ( logfitt(2) - logfitt(1) ) &
1570 * ( fitt(3) - temp(k,i,j) ) / ( fitt(3) - fitt(1) )
1580 iptype = aero2ptype(iaero)
1581 nradius = ptype_nradius(iptype)
1584 if ( aerosol_radi(k,i,j,iaero) <= radmode(iptype,1) )
then
1585 indexr(k,iaero,i,j) = 1
1586 factr(k,iaero,i,j) = 0.0_rp
1587 elseif( aerosol_radi(k,i,j,iaero) > radmode(iptype,nradius) )
then
1588 indexr(k,iaero,i,j) = nradius
1589 factr(k,iaero,i,j) = 1.0_rp
1591 indexr(k,iaero,i,j) = -1
1593 do ir = 1, nradius-1
1594 if ( aerosol_radi(k,i,j,iaero) <= radmode(iptype,ir+1) &
1595 .AND. aerosol_radi(k,i,j,iaero) > radmode(iptype,ir ) )
then
1596 indexr(k,iaero,i,j) = ir
1597 factr(k,iaero,i,j) = ( aerosol_radi(k,i,j,iaero) - radmode(iptype,ir) ) &
1598 / ( radmode(iptype,ir+1) - radmode(iptype,ir) )
1610 do icloud = 1, mstrn_ncloud
1615 rflux(k,i,j,irgn,idir,icloud) = 0.0_rp
1626 rflux_sfc_dn(i,j,idir,irgn_alb) = 0.0_rp
1632 do iw = 1, mstrn_nband
1633 if ( iflgb(i_swlw,iw) == 0 )
then
1638 if ( waveh(iw) >= 10000.0_rp / 0.7_rp )
then
1653 taugas(k,ich,i,j) = 0.0_rp
1663 do igas = 1, ngasabs(iw)
1664 gasno = igasabs(igas,iw)
1669 a1 = akd(ip-1,ich,1,gasno,iw) * ( 1.0_rp - factp(k,i,j) )&
1670 + akd(ip ,ich,1,gasno,iw) * ( factp(k,i,j) )
1671 a2 = akd(ip-1,ich,2,gasno,iw) * ( 1.0_rp - factp(k,i,j) )&
1672 + akd(ip ,ich,2,gasno,iw) * ( factp(k,i,j) )
1673 a3 = akd(ip-1,ich,3,gasno,iw) * ( 1.0_rp - factp(k,i,j) )&
1674 + akd(ip ,ich,3,gasno,iw) * ( factp(k,i,j) )
1675 factpt = factt32(k,i,j)*(a3-a2) + a2 + factt21(k,i,j)*(a2-a1)
1677 length = gas(k,i,j,igasabs(igas,iw)) * ppm * dz_std(k,i,j)
1678 taugas(k,ich,i,j) = taugas(k,ich,i,j) + 10.0_rp**factpt * length
1686 if ( iflgb(i_h2o_continuum,iw) == 1 )
then
1693 a1 = skd(ip-1,ich,1,iw) * ( 1.0_rp-factp(k,i,j) )&
1694 + skd(ip ,ich,1,iw) * ( factp(k,i,j) )
1695 a2 = skd(ip-1,ich,2,iw) * ( 1.0_rp-factp(k,i,j) )&
1696 + skd(ip ,ich,2,iw) * ( factp(k,i,j) )
1697 a3 = skd(ip-1,ich,3,iw) * ( 1.0_rp-factp(k,i,j) )&
1698 + skd(ip ,ich,3,iw) * ( factp(k,i,j) )
1699 factpt = factt32(k,i,j)*(a3-a2) + a2 + factt21(k,i,j)*(a2-a1)
1701 qv = gas(k,i,j,1) * ppm * dz_std(k,i,j)
1702 length = qv*qv / ( qv + dz_std(k,i,j) )
1703 taugas(k,ich,i,j) = taugas(k,ich,i,j) + 10.0_rp**factpt * length
1710 if ( iflgb(i_cfc_continuum,iw) == 1 )
then
1719 valsum(k) = valsum(k) + acfc_pow(icfc,iw) * cfc(k,i,j,icfc)
1723 valsum(k) = valsum(k) * ppm * dz_std(k,i,j)
1728 taugas(k,ich,i,j) = taugas(k,ich,i,j) + valsum(k)
1745 do im = 1, mstrn_nstream*2+2
1747 dp_p = rhodz(k,i,j) * grav / pstd
1748 length = rayleigh(iw) * dp_p
1750 optparam(k,im,i_cloud ,i,j) = qmol(im,iw) * length
1751 optparam(k,im,i_clearsky,i,j) = qmol(im,iw) * length
1761 taucld_067u(k,i,j) = 0.0_rp
1768 do iaero = hydro_str, hydro_end
1769 iptype = aero2ptype(iaero)
1771 do im = 1, mstrn_nstream*2+2
1773 ir = indexr(k,iaero,i,j)
1774 length = aerosol_conc(k,i,j,iaero) * ppm * dz_std(k,i,j)
1776 q_fit = q(ir ,iptype,im,iw) * ( 1.0_rp-factr(k,iaero,i,j) ) &
1777 + q(ir+1,iptype,im,iw) * ( factr(k,iaero,i,j) )
1778 q_fit = max( q_fit, 0.0_rp )
1780 optparam(k,im,i_cloud,i,j) = optparam(k,im,i_cloud,i,j) + q_fit * length
1784 if ( waveh(iw) <= 1.493e+4_rp .AND. 1.493e+4_rp < waveh(iw+1) )
then
1786 ir = indexr(k,iaero,i,j)
1787 length = aerosol_conc(k,i,j,iaero) * ppm * dz_std(k,i,j)
1789 q_fit = q(ir ,iptype,1,iw) * ( 1.0_rp-factr(k,iaero,i,j) ) &
1790 + q(ir+1,iptype,1,iw) * ( factr(k,iaero,i,j) )
1791 q_fit = max( q_fit, 0.0_rp )
1793 taucld_067u(k,i,j) = taucld_067u(k,i,j) + q_fit * length
1805 do iaero = aero_str, aero_end
1806 iptype = aero2ptype(iaero)
1808 do im = 1, mstrn_nstream*2+2
1810 ir = indexr(k,iaero,i,j)
1811 length = aerosol_conc(k,i,j,iaero) * ppm * dz_std(k,i,j)
1813 q_fit = q(ir ,iptype,im,iw) * ( 1.0_rp-factr(k,iaero,i,j) ) &
1814 + q(ir+1,iptype,im,iw) * ( factr(k,iaero,i,j) )
1815 q_fit = max( q_fit, 0.0_rp )
1817 optparam(k,im,i_cloud ,i,j) = optparam(k,im,i_cloud ,i,j) + q_fit * length
1818 optparam(k,im,i_clearsky,i,j) = optparam(k,im,i_clearsky,i,j) + q_fit * length
1834 do icloud = 1, mstrn_ncloud
1836 taupr(k,icloud) = optparam(k,1,icloud,i,j)
1837 omgpr(k,icloud) = optparam(k,1,icloud,i,j) - optparam(k,2,icloud,i,j)
1840 zerosw = 0.5_rp - sign(0.5_rp,omgpr(k,icloud)-rd_eps)
1842 g(k,0,icloud) = 1.0_rp
1843 g(k,1,icloud) = optparam(k,3,icloud,i,j) * ( 1.0_rp-zerosw ) / ( omgpr(k,icloud)+zerosw )
1844 g(k,2,icloud) = optparam(k,4,icloud,i,j) * ( 1.0_rp-zerosw ) / ( omgpr(k,icloud)+zerosw )
1850 if ( irgn ==
i_sw )
then
1854 fsol_rgn = fsol(iw) / fsol_tot * solins(i,j)
1856 elseif( irgn ==
i_lw )
then
1858 wl = 10000.0_rp / sqrt( waveh(iw) * waveh(iw+1) )
1864 do iplk = mstrn_nfitplk, 1, -1
1865 beta = beta / ( wl*temp(k,i,j) ) + fitplk(iplk,iw)
1867 bbar(k) = exp(-beta) * temp(k,i,j) / (wl*wl)
1874 do iplk = mstrn_nfitplk, 1, -1
1875 beta = beta / ( wl*temph(k,i,j) ) + fitplk(iplk,iw)
1877 bbarh(k) = exp(-beta) * temph(k,i,j) / (wl*wl)
1883 do iplk = mstrn_nfitplk, 1, -1
1884 beta = beta / ( wl*temp_sfc(i,j) ) + fitplk(iplk,iw)
1887 b_sfc = exp(-beta) * temp_sfc(i,j) / (wl*wl)
1895 do icloud = 1, mstrn_ncloud
1897 tau(k,icloud,ich) = taugas(k,ich,i,j) + taupr(k,icloud)
1900 zerosw = 0.5_rp - sign( 0.5_rp, tau(k,icloud,ich)-rd_eps )
1902 omg(k,icloud,ich) = ( 1.0_rp-zerosw ) * omgpr(k,icloud) / ( tau(k,icloud,ich)-zerosw ) &
1903 + ( zerosw ) * 1.0_rp
1910 if( irgn ==
i_lw )
then
1913 do icloud = 1, mstrn_ncloud
1915 zerosw = 0.5_rp - sign( 0.5_rp, tau(k,icloud,ich)-rd_eps )
1917 b(k,0,icloud,ich) = bbarh(k)
1918 b(k,1,icloud,ich) = ( 1.0_rp-zerosw ) &
1920 + 4.0_rp * bbar(k ) &
1921 - 3.0_rp * bbarh(k ) &
1922 ) / ( tau(k,icloud,ich)-zerosw )
1923 b(k,2,icloud,ich) = ( 1.0_rp-zerosw ) &
1925 - 2.0_rp * bbar(k ) &
1927 ) / ( tau(k,icloud,ich)**2-zerosw ) * 2.0_rp
1937 call rd_mstrn_two_stream( ia, is, ie, ja, js, je, &
1941 tau(:,:,:), omg(:,:,:), &
1942 g(:,:,:), b(:,:,:,:), b_sfc, &
1946 flux(:,:,:,:), flux_direct(:,:,:), &
1948 tdir0(:,:,:), r0(:,:,:), t0(:,:,:), &
1949 em_lw(:,:,:), em_sw(:,:,:), &
1950 ep_lw(:,:,:), ep_sw(:,:,:), &
1951 cf(:,:), tau_bar_sol(:,:), &
1953 em(:,:), ep(:,:), em0(:), &
1954 r12mns(:,:), r12pls(:,:), &
1955 e12mns(:,:), e12pls(:,:) )
1961 do icloud = 1, mstrn_ncloud
1963 rflux(k,i,j,irgn,
i_up,icloud) = rflux(k,i,j,irgn,
i_up,icloud) + flux(k,
i_up,icloud,ich) * wgtch(ich,iw)
1964 rflux(k,i,j,irgn,
i_dn,icloud) = rflux(k,i,j,irgn,
i_dn,icloud) + flux(k,
i_dn,icloud,ich) * wgtch(ich,iw)
1972 + ( flux_direct(rd_kmax+1,i_cloud,ich) ) * wgtch(ich,iw)
1974 + ( flux(rd_kmax+1,
i_dn,i_cloud,ich) - flux_direct(rd_kmax+1,i_cloud,ich) ) * wgtch(ich,iw)
1977 if ( waveh(iw) <= 952.0_rp .AND. 952.0_rp < waveh(iw+1) )
then
1981 emiscld_105u(k,i,j) = 0.0_rp
1986 emiscld_105u(k,i,j) = emiscld_105u(k,i,j) + emiscld(k,ich) * wgtch(ich,iw)
1999 end subroutine rd_mstrn_dtrn3
2004 subroutine rd_mstrn_two_stream( &
2005 IA, IS, IE, JA, JS, JE, &
2011 albedo_sfc_direct, &
2012 albedo_sfc_diffuse, &
2014 flux, flux_direct, &
2031 integer,
intent(in) :: ia, is, ie, ja, js, je
2032 integer,
intent(in) :: rd_kmax
2033 integer,
intent(in),
value :: chmax
2034 real(rp),
intent(in) :: cossza
2035 real(rp),
intent(in),
value :: fsol
2036 integer,
intent(in),
value :: irgn
2037 real(rp),
intent(in) :: tau (rd_kmax, mstrn_ncloud,mstrn_ch_limit)
2038 real(rp),
intent(in) :: omg (rd_kmax, mstrn_ncloud,mstrn_ch_limit)
2039 real(rp),
intent(in) :: g (rd_kmax,0:2,mstrn_ncloud )
2040 real(rp),
intent(in) :: b (rd_kmax,0:2,mstrn_ncloud,mstrn_ch_limit)
2041 real(rp),
intent(in),
value :: b_sfc
2042 real(rp),
intent(in) :: albedo_sfc_direct
2043 real(rp),
intent(in) :: albedo_sfc_diffuse
2044 real(rp),
intent(in) :: cldfrac (rd_kmax)
2045 real(rp),
intent(out) :: flux (rd_kmax+1,2,mstrn_ncloud,mstrn_ch_limit)
2046 real(rp),
intent(out) :: flux_direct(rd_kmax+1, mstrn_ncloud,mstrn_ch_limit)
2047 real(rp),
intent(out) :: emiscld (rd_kmax, mstrn_ch_limit)
2051 real(rp),
intent(out) :: tdir0(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
2052 real(rp),
intent(out) :: r0 (rd_kmax,mstrn_ncloud,mstrn_ch_limit)
2053 real(rp),
intent(out) :: t0 (rd_kmax,mstrn_ncloud,mstrn_ch_limit)
2054 real(rp),
intent(out) :: em_lw(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
2055 real(rp),
intent(out) :: em_sw(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
2056 real(rp),
intent(out) :: ep_lw(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
2057 real(rp),
intent(out) :: ep_sw(rd_kmax,mstrn_ncloud,mstrn_ch_limit)
2059 real(rp),
intent(out) :: cf (rd_kmax ,mstrn_ncloud*mstrn_ch_limit)
2060 real(rp),
intent(out) :: tau_bar_sol(rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
2061 real(rp),
intent(out) :: r (rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
2062 real(rp),
intent(out) :: t (rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
2063 real(rp),
intent(out) :: em (rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
2064 real(rp),
intent(out) :: ep (rd_kmax+1,mstrn_ncloud*mstrn_ch_limit)
2065 real(rp),
intent(out) :: em0 (mstrn_ncloud)
2067 real(rp),
intent(out) :: r12mns(mstrn_ncloud*mstrn_ch_limit,rd_kmax+1)
2068 real(rp),
intent(out) :: r12pls(mstrn_ncloud*mstrn_ch_limit,rd_kmax+1)
2069 real(rp),
intent(out) :: e12mns(mstrn_ncloud*mstrn_ch_limit,rd_kmax+1)
2070 real(rp),
intent(out) :: e12pls(mstrn_ncloud*mstrn_ch_limit,rd_kmax+1)
2083 real(rp) :: pmns, ppls
2084 real(rp) :: smns, spls
2090 real(rp) :: apls_mns, bpls_mns
2091 real(
dp) :: v0mns, v0pls
2092 real(
dp) :: v1mns, v1pls
2093 real(
dp) :: dmns0, dmns1, dmns2
2094 real(
dp) :: dpls0, dpls1, dpls2
2095 real(rp) :: sigmns, sigpls
2097 real(rp) :: zerosw, tmp
2101 real(rp) :: umns, upls
2104 real(rp) :: wmns_irgn, m_irgn, w_irgn, wpls_irgn, wscale_irgn
2106 integer,
parameter :: i_sfc2toa = 1
2107 integer,
parameter :: i_toa2sfc = 2
2110 integer :: k, kk, icloud, ich, ic
2115 wmns_irgn = wmns(irgn)
2116 wpls_irgn = wpls(irgn)
2117 wscale_irgn = wscale(irgn)
2121 do icloud = 1, mstrn_ncloud
2126 tau_new = ( 1.0_rp - omg(k,icloud,ich)*g(k,2,icloud) ) * tau(k,icloud,ich)
2128 omg_new = ( 1.0_rp - g(k,2,icloud) ) / ( 1.0_rp - omg(k,icloud,ich)*g(k,2,icloud) ) * omg(k,icloud,ich)
2129 omg_new = min( omg_new, eps1 )
2131 g_new = ( g(k,1,icloud) - g(k,2,icloud) ) / ( 1.0_rp - g(k,2,icloud) )
2133 #if defined(NVIDIA) || defined(SX)
2134 tdir0(k,icloud,ich) = exp( -min( tau_new/cossza, 1.e+3_rp ) )
2136 tdir0(k,icloud,ich) = exp(-tau_new/cossza)
2139 factor = ( 1.0_rp - omg(k,icloud,ich)*g(k,2,icloud) )
2140 b_new0 = b(k,0,icloud,ich)
2141 b_new1 = b(k,1,icloud,ich) / factor
2142 b_new2 = b(k,2,icloud,ich) / (factor*factor)
2143 c0 = wmns_irgn * 2.0_rp * pi * ( 1.0_rp - omg_new ) * b_new0
2144 c1 = wmns_irgn * 2.0_rp * pi * ( 1.0_rp - omg_new ) * b_new1
2145 c2 = wmns_irgn * 2.0_rp * pi * ( 1.0_rp - omg_new ) * b_new2
2148 pmns = omg_new * 0.5_rp * ( 1.0_rp - 3.0_rp * g_new * m_irgn*m_irgn )
2149 ppls = omg_new * 0.5_rp * ( 1.0_rp + 3.0_rp * g_new * m_irgn*m_irgn )
2152 smns = omg_new * 0.5_rp * ( 1.0_rp - 3.0_rp * g_new * m_irgn*cossza )
2153 spls = omg_new * 0.5_rp * ( 1.0_rp + 3.0_rp * g_new * m_irgn*cossza )
2156 sw = 0.5_rp + sign(0.5_rp,tau_new-rd_eps)
2159 x = ( 1.0_rp - w_irgn * ( ppls - pmns ) ) / m_irgn
2160 y = ( 1.0_rp - w_irgn * ( ppls + pmns ) ) / m_irgn
2164 #if defined(NVIDIA) || defined(SX)
2165 e = exp( -min( lamda*tau_new, 1.e+3_rp ) )
2167 e = exp(-lamda*tau_new)
2171 apls_mns = ( x * ( 1.0_dp+e ) - lamda * ( 1.0_dp-e ) ) &
2172 / ( x * ( 1.0_dp+e ) + lamda * ( 1.0_dp-e ) )
2173 bpls_mns = ( x * ( 1.0_dp-e ) - lamda * ( 1.0_dp+e ) ) &
2174 / ( x * ( 1.0_dp-e ) + lamda * ( 1.0_dp+e ) )
2177 r0(k,icloud,ich) = ( sw ) * 0.5_rp * ( apls_mns + bpls_mns ) &
2178 + ( 1.0_rp-sw ) * ( tau_new * ( pmns ) / m_irgn )
2179 t0(k,icloud,ich) = ( sw ) * 0.5_rp * ( apls_mns - bpls_mns ) &
2180 + ( 1.0_rp-sw ) * ( 1.0_rp - tau_new * ( 1.0_rp - ppls ) / m_irgn )
2183 dmns0 = c0 / y + 2.0_rp * c2 / (x*y*y) + c1 / (x*y)
2184 dpls0 = c0 / y + 2.0_rp * c2 / (x*y*y) - c1 / (x*y)
2185 dmns1 = c1 / y + 2.0_rp * c2 / (x*y)
2186 dpls1 = c1 / y - 2.0_rp * c2 / (x*y)
2192 v1mns = dmns0 + dmns1*tau_new + dmns2*tau_new*tau_new
2193 v1pls = dpls0 + dpls1*tau_new + dpls2*tau_new*tau_new
2195 em_lw(k,icloud,ich) = ( sw ) * ( v0mns - r0(k,icloud,ich) * v0pls - t0(k,icloud,ich) * v1mns ) &
2196 + ( 1.0_rp-sw ) * 0.5_rp * tau_new * ( 2.0_rp*c0 + c1*tau_new + c2*tau_new*tau_new )
2197 ep_lw(k,icloud,ich) = ( sw ) * ( v1pls - t0(k,icloud,ich) * v0pls - r0(k,icloud,ich) * v1mns ) &
2198 + ( 1.0_rp-sw ) * 0.5_rp * tau_new * ( 2.0_rp*c0 + c1*tau_new + c2*tau_new*tau_new )
2201 sigmns = wmns_irgn * ( spls - smns )
2202 sigpls = wmns_irgn * ( spls + smns )
2204 tmp = x*y*cossza - 1.0/cossza
2205 zerosw = 1.0_rp - sign(1.0_rp,abs(tmp)-eps)
2206 qgamma = ( sigpls*x*cossza + sigmns ) / ( tmp + zerosw*eps )
2208 v0pls = 0.5_rp * ( ( 1.0_rp + 1.0_rp/(x*cossza) ) * qgamma + sigmns / x )
2209 v0mns = 0.5_rp * ( ( 1.0_rp - 1.0_rp/(x*cossza) ) * qgamma - sigmns / x )
2211 v1pls = v0pls * tdir0(k,icloud,ich)
2212 v1mns = v0mns * tdir0(k,icloud,ich)
2214 em_sw(k,icloud,ich) = ( sw ) * ( v0mns - r0(k,icloud,ich) * v0pls - t0(k,icloud,ich) * v1mns ) &
2215 + ( 1.0_rp-sw ) * wmns_irgn * smns * tau_new * sqrt( tdir0(k,icloud,ich) )
2216 ep_sw(k,icloud,ich) = ( sw ) * ( v1pls - t0(k,icloud,ich) * v0pls - r0(k,icloud,ich) * v1mns ) &
2217 + ( 1.0_rp-sw ) * wmns_irgn * spls * tau_new * sqrt( tdir0(k,icloud,ich) )
2225 do icloud = 1, mstrn_ncloud
2226 if ( icloud == i_clearsky )
then
2230 ic = icloud + ( ich - 1 ) * mstrn_ncloud
2238 ic = icloud + ( ich - 1 ) * mstrn_ncloud
2239 cf(k,ic) = cldfrac(k)
2248 do icloud = 1, mstrn_ncloud
2249 ic = icloud + ( ich - 1 ) * mstrn_ncloud
2250 tau_bar_sol(1,ic) = fsol
2253 tdir = ( cf(k-1,ic) ) * tdir0(k-1,i_cloud ,ich) &
2254 + ( 1.0_rp-cf(k-1,ic) ) * tdir0(k-1,i_clearsky,ich)
2255 tau_bar_sol(k,ic) = tau_bar_sol(k-1,ic) * tdir
2262 do icloud = 1, mstrn_ncloud
2264 ic = icloud + ( ich - 1 ) * mstrn_ncloud
2265 flux_direct(k,icloud,ich) = cossza * tau_bar_sol(k,ic)
2272 do icloud = 1, mstrn_ncloud
2274 ic = icloud + ( ich - 1 ) * mstrn_ncloud
2275 em(k,ic) = ( cf(k,ic) ) * ( em_lw(k,i_cloud, ich) &
2276 + em_sw(k,i_cloud, ich) * tau_bar_sol(k,ic) ) &
2277 + ( 1.0_rp-cf(k,ic) ) * ( em_lw(k,i_clearsky,ich) &
2278 + em_sw(k,i_clearsky,ich) * tau_bar_sol(k,ic) )
2280 ep(k,ic) = ( cf(k,ic) ) * ( ep_lw(k,i_cloud, ich) &
2281 + ep_sw(k,i_cloud, ich) * tau_bar_sol(k,ic) ) &
2282 + ( 1.0_rp-cf(k,ic) ) * ( ep_lw(k,i_clearsky,ich) &
2283 + ep_sw(k,i_clearsky,ich) * tau_bar_sol(k,ic) )
2285 r(k,ic) = ( cf(k,ic) ) * r0(k,i_cloud ,ich) &
2286 + ( 1.0_rp-cf(k,ic) ) * r0(k,i_clearsky,ich)
2287 t(k,ic) = ( cf(k,ic) ) * t0(k,i_cloud ,ich) &
2288 + ( 1.0_rp-cf(k,ic) ) * t0(k,i_clearsky,ich)
2297 do icloud = 1, mstrn_ncloud
2299 ic = icloud + ( ich - 1 ) * mstrn_ncloud
2300 r(rd_kmax+1,ic) = ( cf(rd_kmax,ic) ) * albedo_sfc_diffuse &
2301 + ( 1.0_rp-cf(rd_kmax,ic) ) * albedo_sfc_diffuse
2302 t(rd_kmax+1,ic) = 0.0_rp
2305 em0(i_cloud ) = wpls_irgn * ( flux_direct(rd_kmax+1,icloud,ich) * albedo_sfc_direct / (w_irgn*m_irgn) &
2306 + 2.0_rp * pi * ( 1.0_rp-albedo_sfc_diffuse ) * b_sfc )
2307 em0(i_clearsky) = wpls_irgn * ( flux_direct(rd_kmax+1,icloud,ich) * albedo_sfc_direct / (w_irgn*m_irgn) &
2308 + 2.0_rp * pi * ( 1.0_rp-albedo_sfc_diffuse ) * b_sfc )
2310 em(rd_kmax+1,ic) = ( cf(rd_kmax,ic) ) * em0(i_cloud ) &
2311 + ( 1.0_rp-cf(rd_kmax,ic) ) * em0(i_clearsky)
2312 ep(rd_kmax+1,ic) = 0.0_rp
2315 r12pls(ic,rd_kmax+1) = r(rd_kmax+1,ic)
2316 e12mns(ic,rd_kmax+1) = em(rd_kmax+1,ic)
2317 r12mns(ic,1) = r(1,ic)
2318 e12pls(ic,1) = ep(1,ic)
2328 ic = icloud + ( ich - 1 ) * mstrn_ncloud
2329 emiscld(k,ich) = 1.0_rp - r(k,ic) - t(k,ic)
2336 do ic = 1, chmax * mstrn_ncloud
2338 k = rd_kmax - kk + 1
2339 r12pls(ic,k) = r(k,ic) + t(k,ic) / ( 1.0_rp - r12pls(ic,k+1) * r(k,ic) ) &
2340 * ( r12pls(ic,k+1) * t(k,ic) )
2341 e12mns(ic,k) = em(k,ic) + t(k,ic) / ( 1.0_rp - r12pls(ic,k+1) * r(k,ic) ) &
2342 * ( r12pls(ic,k+1) * ep(k,ic) + e12mns(ic,k+1) )
2345 r12mns(ic,k) = r(k,ic) + t(k,ic) / ( 1.0_rp - r12mns(ic,k-1) * r(k,ic) ) &
2346 * ( r12mns(ic,k-1) * t(k,ic) )
2347 e12pls(ic,k) = ep(k,ic) + t(k,ic) / ( 1.0_rp - r12mns(ic,k-1) * r(k,ic) ) &
2348 * ( r12mns(ic,k-1) * em(k,ic) + e12pls(ic,k-1) )
2355 do icloud = 1, mstrn_ncloud
2356 ic = icloud + ( ich - 1 ) * mstrn_ncloud
2359 umns = e12mns(ic,1) + r12pls(ic,1) * upls
2360 flux(1,
i_up,icloud,ich) = wscale_irgn * umns
2361 flux(1,
i_dn,icloud,ich) = wscale_irgn * upls + flux_direct(1,icloud,ich)
2367 do icloud = 1, mstrn_ncloud
2369 ic = icloud + ( ich - 1 ) * mstrn_ncloud
2370 upls = ( e12pls(ic,k-1) + r12mns(ic,k-1)*e12mns(ic,k) ) / ( 1.0_rp - r12mns(ic,k-1)*r12pls(ic,k) )
2371 umns = e12mns(ic,k) + r12pls(ic,k) * upls
2372 flux(k,
i_up,icloud,ich) = wscale_irgn * umns
2373 flux(k,
i_dn,icloud,ich) = wscale_irgn * upls + flux_direct(k,icloud,ich)
2379 end subroutine rd_mstrn_two_stream