53 private :: rd_mstrn_setup
54 private :: rd_mstrn_dtrn3
55 private :: rd_mstrn_two_stream
61 real(RP),
private,
parameter :: RD_cosSZA_min = 0.017_rp
62 real(RP),
private,
parameter :: RD_EPS = 1.e-4_rp
64 real(RP),
private :: RD_TOA = 100.0_rp
65 integer,
private :: RD_KADD = 10
66 integer,
private,
parameter :: RD_naero =
n_hyd +
n_ae
67 integer,
private,
parameter :: RD_hydro_str = 1
68 integer,
private,
parameter :: RD_hydro_end =
n_hyd
69 integer,
private,
parameter :: RD_aero_str =
n_hyd + 1
70 integer,
private,
parameter :: RD_aero_end =
n_hyd +
n_ae
72 integer,
private :: RD_KMAX
74 real(RP),
private,
allocatable :: RD_zh (:)
75 real(RP),
private,
allocatable :: RD_z (:)
76 real(RP),
private,
allocatable :: RD_rhodz (:)
77 real(RP),
private,
allocatable :: RD_pres (:)
78 real(RP),
private,
allocatable :: RD_presh (:)
79 real(RP),
private,
allocatable :: RD_temp (:)
80 real(RP),
private,
allocatable :: RD_temph (:)
81 real(RP),
private,
allocatable :: RD_gas (:,:)
82 real(RP),
private,
allocatable :: RD_cfc (:,:)
83 real(RP),
private,
allocatable :: RD_aerosol_conc(:,:)
84 real(RP),
private,
allocatable :: RD_aerosol_radi(:,:)
85 real(RP),
private,
allocatable :: RD_cldfrac (:)
87 integer,
private :: I_MPAE2RD(RD_naero)
89 character(len=H_LONG),
private :: MSTRN_GASPARA_INPUTFILE =
'PARAG.29'
90 character(len=H_LONG),
private :: MSTRN_AEROPARA_INPUTFILE =
'PARAPC.29'
91 character(len=H_LONG),
private :: MSTRN_HYGROPARA_INPUTFILE =
'VARDATA.RM29'
93 integer,
private :: MSTRN_nband = 29
95 integer,
private,
parameter :: MSTRN_nstream = 1
96 integer,
private,
parameter :: MSTRN_ch_limit = 10
97 integer,
private,
parameter :: MSTRN_nflag = 7
98 integer,
private,
parameter :: MSTRN_nfitP = 26
99 integer,
private,
parameter :: MSTRN_nfitT = 3
101 integer,
private,
parameter :: MSTRN_ngas = 7
109 integer,
private,
parameter :: MSTRN_ncfc = 28
137 integer,
private :: MSTRN_nptype = 9
148 integer,
private,
parameter :: MSTRN_nsfc = 7
156 integer,
private,
parameter :: MSTRN_nfitPLK = 5
157 integer,
private,
parameter :: MSTRN_nplkord = 3
158 integer,
private,
parameter :: MSTRN_nmoment = 6
159 integer,
private :: MSTRN_nradius = 8
160 integer,
private,
parameter :: MSTRN_ncloud = 2
162 logical,
private :: ATMOS_PHY_RD_MSTRN_ONLY_QCI = .false.
163 logical,
private :: ATMOS_PHY_RD_MSTRN_ONLY_TROPOCLOUD = .false.
164 logical,
private :: ATMOS_PHY_RD_MSTRN_USE_AERO = .false.
168 real(RP),
private,
allocatable :: waveh (:)
170 real(RP),
private,
allocatable :: logfitP (:)
171 real(RP),
private,
allocatable :: fitT (:)
172 real(RP),
private,
allocatable :: logfitT (:)
173 integer,
private,
allocatable :: iflgb (:,:)
174 integer,
private,
allocatable :: nch (:)
175 real(RP),
private,
allocatable :: wgtch (:,:)
176 integer,
private,
allocatable :: ngasabs (:)
177 integer,
private,
allocatable :: igasabs (:,:)
179 real(RP),
private,
allocatable :: akd (:,:,:,:,:)
180 real(RP),
private,
allocatable :: skd (:,:,:,:)
181 real(RP),
private,
allocatable :: acfc_pow(:,:)
183 real(RP),
private,
allocatable :: fitPLK (:,:)
184 real(RP),
private,
allocatable :: fsol (:)
185 real(RP),
private :: fsol_tot
186 real(RP),
private,
allocatable :: sfc (:,:)
187 real(RP),
private,
allocatable :: rayleigh(:)
188 real(RP),
private,
allocatable :: qmol (:,:)
189 real(RP),
private,
allocatable :: q (:,:,:,:)
191 integer,
private,
allocatable :: hygro_flag(:)
192 real(RP),
private,
allocatable :: radmode (:,:)
194 integer,
private,
allocatable :: ptype_nradius(:)
198 integer,
private,
parameter :: I_SWLW = 4
199 integer,
private,
parameter :: I_H2O_continuum = 5
200 integer,
private,
parameter :: I_CFC_continuum = 7
202 integer,
private,
parameter :: I_ClearSky = 1
203 integer,
private,
parameter :: I_Cloud = 2
206 real(RP),
private :: RHO_std
208 real(RP),
private :: M(2)
209 real(RP),
private :: W(2)
210 real(RP),
private :: Wmns(2), Wpls(2)
211 real(RP),
private :: Wbar(2), Wscale(2)
236 integer,
intent(in) :: ka, ks, ke
238 real(rp),
intent(in) :: cz(ka)
239 real(rp),
intent(in) :: fz(0:ka)
241 real(rp) :: atmos_phy_rd_mstrn_toa
242 integer :: atmos_phy_rd_mstrn_kadd
243 character(len=H_LONG) :: atmos_phy_rd_mstrn_gaspara_in_filename
244 character(len=H_LONG) :: atmos_phy_rd_mstrn_aeropara_in_filename
245 character(len=H_LONG) :: atmos_phy_rd_mstrn_hygropara_in_filename
246 integer :: atmos_phy_rd_mstrn_nband
247 integer :: atmos_phy_rd_mstrn_nptype
248 integer :: atmos_phy_rd_mstrn_nradius
249 integer :: atmos_phy_rd_mstrn_nradius_cloud = -1
250 integer :: atmos_phy_rd_mstrn_nradius_aero = -1
252 namelist / param_atmos_phy_rd_mstrn / &
253 atmos_phy_rd_mstrn_toa, &
254 atmos_phy_rd_mstrn_kadd, &
255 atmos_phy_rd_mstrn_gaspara_in_filename, &
256 atmos_phy_rd_mstrn_aeropara_in_filename, &
257 atmos_phy_rd_mstrn_hygropara_in_filename, &
258 atmos_phy_rd_mstrn_nband, &
259 atmos_phy_rd_mstrn_nptype, &
260 atmos_phy_rd_mstrn_nradius, &
261 atmos_phy_rd_mstrn_nradius_cloud, &
262 atmos_phy_rd_mstrn_nradius_aero, &
263 atmos_phy_rd_mstrn_only_qci, &
264 atmos_phy_rd_mstrn_only_tropocloud, &
265 atmos_phy_rd_mstrn_use_aero
268 integer :: ngas, ncfc
273 log_info(
"ATMOS_PHY_RD_mstrnx_setup",*)
'Setup'
274 log_info(
"ATMOS_PHY_RD_mstrnx_setup",*)
'Sekiguchi and Nakajima (2008) mstrnX radiation process'
277 atmos_phy_rd_mstrn_toa = rd_toa
278 atmos_phy_rd_mstrn_kadd = rd_kadd
279 atmos_phy_rd_mstrn_gaspara_in_filename = mstrn_gaspara_inputfile
280 atmos_phy_rd_mstrn_aeropara_in_filename = mstrn_aeropara_inputfile
281 atmos_phy_rd_mstrn_hygropara_in_filename = mstrn_hygropara_inputfile
282 atmos_phy_rd_mstrn_nband = mstrn_nband
283 atmos_phy_rd_mstrn_nptype = mstrn_nptype
284 atmos_phy_rd_mstrn_nradius = mstrn_nradius
287 read(
io_fid_conf,nml=param_atmos_phy_rd_mstrn,iostat=ierr)
289 log_info(
"ATMOS_PHY_RD_mstrnx_setup",*)
'Not found namelist. Default used.'
290 elseif( ierr > 0 )
then
291 log_error(
"ATMOS_PHY_RD_mstrnx_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_RD_MSTRN. Check!'
294 log_nml(param_atmos_phy_rd_mstrn)
296 rd_toa = atmos_phy_rd_mstrn_toa
297 rd_kadd = atmos_phy_rd_mstrn_kadd
298 mstrn_gaspara_inputfile = atmos_phy_rd_mstrn_gaspara_in_filename
299 mstrn_aeropara_inputfile = atmos_phy_rd_mstrn_aeropara_in_filename
300 mstrn_hygropara_inputfile = atmos_phy_rd_mstrn_hygropara_in_filename
301 mstrn_nband = atmos_phy_rd_mstrn_nband
302 mstrn_nptype = atmos_phy_rd_mstrn_nptype
304 if ( atmos_phy_rd_mstrn_nradius_cloud < 0 )
then
305 atmos_phy_rd_mstrn_nradius_cloud = atmos_phy_rd_mstrn_nradius
307 if ( atmos_phy_rd_mstrn_nradius_aero < 0 )
then
308 atmos_phy_rd_mstrn_nradius_aero = atmos_phy_rd_mstrn_nradius
311 mstrn_nradius = max( atmos_phy_rd_mstrn_nradius, &
312 atmos_phy_rd_mstrn_nradius_cloud, &
313 atmos_phy_rd_mstrn_nradius_aero )
316 allocate( ptype_nradius(mstrn_nptype) )
318 if ( mstrn_nptype == 9 )
then
334 ptype_nradius( 1) = atmos_phy_rd_mstrn_nradius_cloud
335 ptype_nradius( 2) = atmos_phy_rd_mstrn_nradius_cloud
336 ptype_nradius( 3) = atmos_phy_rd_mstrn_nradius_aero
337 ptype_nradius( 4) = atmos_phy_rd_mstrn_nradius_aero
338 ptype_nradius( 5) = atmos_phy_rd_mstrn_nradius_aero
339 ptype_nradius( 6) = atmos_phy_rd_mstrn_nradius_aero
340 ptype_nradius( 7) = atmos_phy_rd_mstrn_nradius_aero
341 ptype_nradius( 8) = atmos_phy_rd_mstrn_nradius_aero
342 ptype_nradius( 9) = atmos_phy_rd_mstrn_nradius_aero
344 elseif( mstrn_nptype == 12 )
then
360 ptype_nradius( 1) = atmos_phy_rd_mstrn_nradius_cloud
361 ptype_nradius( 2) = atmos_phy_rd_mstrn_nradius_cloud
362 ptype_nradius( 3) = atmos_phy_rd_mstrn_nradius_cloud
363 ptype_nradius( 4) = atmos_phy_rd_mstrn_nradius_cloud
364 ptype_nradius( 5) = atmos_phy_rd_mstrn_nradius_cloud
365 ptype_nradius( 6) = atmos_phy_rd_mstrn_nradius_aero
366 ptype_nradius( 7) = atmos_phy_rd_mstrn_nradius_aero
367 ptype_nradius( 8) = atmos_phy_rd_mstrn_nradius_aero
368 ptype_nradius( 9) = atmos_phy_rd_mstrn_nradius_aero
369 ptype_nradius(10) = atmos_phy_rd_mstrn_nradius_aero
370 ptype_nradius(11) = atmos_phy_rd_mstrn_nradius_aero
371 ptype_nradius(12) = atmos_phy_rd_mstrn_nradius_aero
376 call rd_mstrn_setup( ngas, &
380 call rd_profile_setup
383 rd_kmax = kmax + rd_kadd
387 allocate( rd_zh(rd_kmax+1) )
388 allocate( rd_z(rd_kmax ) )
390 allocate( rd_rhodz(rd_kmax ) )
391 allocate( rd_pres(rd_kmax ) )
392 allocate( rd_presh(rd_kmax+1) )
393 allocate( rd_temp(rd_kmax ) )
394 allocate( rd_temph(rd_kmax+1) )
396 allocate( rd_gas(rd_kmax,ngas ) )
397 allocate( rd_cfc(rd_kmax,ncfc ) )
398 allocate( rd_aerosol_conc(rd_kmax,rd_naero) )
399 allocate( rd_aerosol_radi(rd_kmax,rd_naero) )
400 allocate( rd_cldfrac(rd_kmax ) )
403 call rd_profile_setup_zgrid( &
406 rd_toa, cz(:), fz(:), &
410 call rd_profile_read( rd_kmax, &
425 rd_aerosol_conc(:,:), &
426 rd_aerosol_radi(:,:), &
435 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
436 DENS, TEMP, PRES, QV, &
441 temp_sfc, albedo_sfc, &
443 CLDFRAC, MP_Re, MP_Qe, &
471 integer,
intent(in) :: ka, ks, ke
472 integer,
intent(in) :: ia, is, ie
473 integer,
intent(in) :: ja, js, je
475 real(rp),
intent(in) :: dens (ka,ia,ja)
476 real(rp),
intent(in) :: temp (ka,ia,ja)
477 real(rp),
intent(in) :: pres (ka,ia,ja)
478 real(rp),
intent(in) :: qv (ka,ia,ja)
479 real(rp),
intent(in) :: cz ( ka,ia,ja)
480 real(rp),
intent(in) :: fz (0:ka,ia,ja)
481 real(rp),
intent(in) :: fact_ocean (ia,ja)
482 real(rp),
intent(in) :: fact_land (ia,ja)
483 real(rp),
intent(in) :: fact_urban (ia,ja)
484 real(rp),
intent(in) :: temp_sfc (ia,ja)
486 real(rp),
intent(in) :: solins (ia,ja)
487 real(rp),
intent(in) :: cossza (ia,ja)
488 real(rp),
intent(in) :: cldfrac (ka,ia,ja)
489 real(rp),
intent(in) :: mp_re (ka,ia,ja,
n_hyd)
490 real(rp),
intent(in) :: mp_qe (ka,ia,ja,
n_hyd)
491 real(rp),
intent(in) :: ae_re (ka,ia,ja,
n_ae)
492 real(rp),
intent(in) :: ae_qe (ka,ia,ja,
n_ae)
493 real(rp),
intent(out) :: flux_rad (ka,ia,ja,2,2,2)
494 real(rp),
intent(out) :: flux_rad_top (ia,ja,2,2,2)
497 real(rp),
intent(out),
optional :: dtau_s(ka,ia,ja)
498 real(rp),
intent(out),
optional :: dem_s (ka,ia,ja)
501 integer :: tropopause(ia,ja)
504 real(rp),
parameter :: min_cldfrac = 1.e-8_rp
506 real(rp) :: rhodz_merge (rd_kmax,ia,ja)
507 real(rp) :: pres_merge (rd_kmax,ia,ja)
508 real(rp) :: temp_merge (rd_kmax,ia,ja)
509 real(rp) :: temph_merge (rd_kmax+1,ia,ja)
511 real(rp) :: gas_merge (rd_kmax,ia,ja,mstrn_ngas)
512 real(rp) :: cfc_merge (rd_kmax,ia,ja,mstrn_ncfc)
513 real(rp) :: aerosol_conc_merge(rd_kmax,ia,ja,rd_naero )
514 real(rp) :: aerosol_radi_merge(rd_kmax,ia,ja,rd_naero )
515 real(rp) :: cldfrac_merge (rd_kmax,ia,ja)
518 real(rp) :: flux_rad_merge(rd_kmax+1,ia,ja,2,2,mstrn_ncloud)
519 real(rp) :: taucld_067u (rd_kmax,ia,ja)
520 real(rp) :: emiscld_105u (rd_kmax,ia,ja)
524 integer :: ihydro, iaero
525 integer :: rd_k, k, i, j, v, ic
528 log_progress(*)
'atmosphere / physics / radiation / mstrnX'
532 if ( atmos_phy_rd_mstrn_only_tropocloud )
then
540 tropopause(i,j) = ke+1
542 if ( pres(k,i,j) >= 300.e+2_rp )
then
544 elseif( pres(k,i,j) < 50.e+2_rp )
then
547 gamma = ( temp(k+1,i,j) - temp(k,i,j) ) / ( cz(k+1,i,j) - cz(k,i,j) )
548 if( gamma > 1.e-4_rp ) tropopause(i,j) = k
561 tropopause(i,j) = ke+1
568 if ( rd_profile_use_climatology )
then
569 call rd_profile_read( rd_kmax, &
584 rd_aerosol_conc(:,:), &
585 rd_aerosol_radi(:,:), &
596 temph_merge(rd_k,i,j) = rd_temph(rd_k)
599 temph_merge(rd_kadd+1,i,j) = temp(ke,i,j)
600 do rd_k = rd_kadd+2, rd_kmax
601 k = ks + rd_kmax - rd_k
603 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)) &
604 + temp(k+1,i,j) * (fz(k ,i,j)-cz(k,i,j)) / (cz(k+1,i,j)-cz(k,i,j)) )
606 temph_merge(rd_kmax+1,i,j) = temp(ks,i,j)
619 rhodz_merge(rd_k,i,j) = rd_rhodz(rd_k)
620 pres_merge(rd_k,i,j) = rd_pres(rd_k)
621 temp_merge(rd_k,i,j) = rd_temp(rd_k)
624 do rd_k = rd_kadd+1, rd_kmax
625 k = ks + rd_kmax - rd_k
627 rhodz_merge(rd_k,i,j) = dens(k,i,j) * ( fz(k,i,j)-fz(k-1,i,j) )
628 pres_merge(rd_k,i,j) = pres(k,i,j) * 1.e-2_rp
629 temp_merge(rd_k,i,j) = temp(k,i,j)
645 gas_merge(rd_k,i,j,v) = rd_gas(rd_k,v)
658 do rd_k = rd_kadd+1, rd_kmax
659 k = ks + rd_kmax - rd_k
660 zerosw = sign(0.5_rp, qv(k,i,j)-eps) + 0.5_rp
661 gas_merge(rd_k,i,j,1) = qv(k,i,j) / mvap * mdry / ppm * zerosw
677 cfc_merge(rd_k,i,j,v) = rd_cfc(rd_k,v)
690 cldfrac_merge(rd_k,i,j) = rd_cldfrac(rd_k)
693 do rd_k = rd_kadd+1, rd_kmax
694 k = ks + rd_kmax - rd_k
696 cldfrac_merge(rd_k,i,j) = min( max( cldfrac(k,i,j), 0.0_rp ), 1.0_rp )
713 aerosol_conc_merge(rd_k,i,j,v) = rd_aerosol_conc(rd_k,v)
714 aerosol_radi_merge(rd_k,i,j,v) = rd_aerosol_radi(rd_k,v)
722 if ( atmos_phy_rd_mstrn_only_qci .and. &
723 ( ihydro /=
i_hc .and. ihydro /=
i_hi ) )
then
725 aerosol_conc_merge(:,:,:,ihydro) = 0.0_rp
735 do rd_k = rd_kadd+1, rd_kadd+1 + ke - tropopause(i,j)
736 aerosol_conc_merge(rd_k,i,j,ihydro) = 0.0_rp
738 do rd_k = rd_kadd+1 + ke - tropopause(i,j) + 1, rd_kmax
739 k = ks + rd_kmax - rd_k
740 aerosol_conc_merge(rd_k,i,j,ihydro) = max( mp_qe(k,i,j,ihydro), 0.0_rp ) &
756 do rd_k = rd_kadd+1, rd_kmax
757 k = ks + rd_kmax - rd_k
758 aerosol_radi_merge(rd_k,i,j,ihydro) = mp_re(k,i,j,ihydro)
767 if ( atmos_phy_rd_mstrn_use_aero )
then
775 do rd_k = rd_kadd+1, rd_kmax
776 k = ks + rd_kmax - rd_k
777 aerosol_conc_merge(rd_k,i,j,
n_hyd+iaero) = max( ae_qe(k,i,j,iaero), 0.0_rp ) &
778 /
ae_dens(iaero) * rho_std / ppm
779 aerosol_radi_merge(rd_k,i,j,
n_hyd+iaero) = ae_re(k,i,j,iaero)
791 do rd_k = rd_kadd+1, rd_kmax
792 aerosol_conc_merge(rd_k,i,j,
n_hyd+iaero) = rd_aerosol_conc(rd_k,
n_hyd+iaero)
793 aerosol_radi_merge(rd_k,i,j,
n_hyd+iaero) = rd_aerosol_radi(rd_k,
n_hyd+iaero)
805 call rd_mstrn_dtrn3( rd_kmax, ia, is, ie, ja, js, je, &
806 mstrn_ngas, mstrn_ncfc, rd_naero, &
807 rd_hydro_str, rd_hydro_end, rd_aero_str, rd_aero_end, &
808 solins(:,:), cossza(:,:), &
809 rhodz_merge(:,:,:), pres_merge(:,:,:), &
810 temp_merge(:,:,:), temph_merge(:,:,:), temp_sfc(:,:), &
811 gas_merge(:,:,:,:), cfc_merge(:,:,:,:), &
812 aerosol_conc_merge(:,:,:,:), aerosol_radi_merge(:,:,:,:), &
814 cldfrac_merge(:,:,:), &
815 albedo_sfc(:,:,:,:), &
816 fact_ocean(:,:), fact_land(:,:), fact_urban(:,:), &
817 flux_rad_merge(:,:,:,:,:,:), flux_rad_sfc_dn(:,:,:,:), &
818 taucld_067u(:,:,:), emiscld_105u(:,:,:) )
832 do rd_k = rd_kadd+1, rd_kmax+1
833 k = ks + rd_kmax - rd_k
835 flux_rad(k,i,j,
i_lw,
i_up,ic) = flux_rad_merge(rd_k,i,j,
i_lw,
i_up,ic)
836 flux_rad(k,i,j,
i_lw,
i_dn,ic) = flux_rad_merge(rd_k,i,j,
i_lw,
i_dn,ic)
837 flux_rad(k,i,j,
i_sw,
i_up,ic) = flux_rad_merge(rd_k,i,j,
i_sw,
i_up,ic)
838 flux_rad(k,i,j,
i_sw,
i_dn,ic) = flux_rad_merge(rd_k,i,j,
i_sw,
i_dn,ic)
862 if (
present( dtau_s ) )
then
869 do rd_k = rd_kadd+1, rd_kmax
870 k = ks + rd_kmax - rd_k
871 dtau_s(k,i,j) = taucld_067u(rd_k,i,j)
877 if (
present( dem_s ) )
then
884 do rd_k = rd_kadd+1, rd_kmax
885 k = ks + rd_kmax - rd_k
886 dem_s(k,i,j) = emiscld_105u(rd_k,i,j)
897 subroutine rd_mstrn_setup( &
909 integer,
intent(out) :: ngas
910 integer,
intent(out) :: ncfc
912 real(rp) :: acfc(mstrn_ncfc)
914 integer :: nband, nstream, nfitp, nfitt, nflag
915 integer :: nsfc, nptype, nplkord, nfitplk
918 character(len=H_LONG) :: dummy
921 integer :: iw, ich, ip, it, igas, icfc, iptype, im
928 allocate( waveh(mstrn_nband+1) )
929 allocate( logfitp(mstrn_nfitp) )
930 allocate( fitt(mstrn_nfitt) )
931 allocate( logfitt(mstrn_nfitt) )
933 allocate( iflgb(mstrn_nflag, mstrn_nband) )
934 allocate( nch( mstrn_nband) )
935 allocate( wgtch(mstrn_ch_limit,mstrn_nband) )
936 allocate( ngasabs( mstrn_nband) )
937 allocate( igasabs(mstrn_ngas, mstrn_nband) )
939 allocate( akd(mstrn_ch_limit,mstrn_nfitp,mstrn_nfitt,mstrn_ngas,mstrn_nband) )
940 allocate( skd(mstrn_ch_limit,mstrn_nfitp,mstrn_nfitt, mstrn_nband) )
941 allocate( acfc_pow(mstrn_ncfc,mstrn_nband) )
946 file = trim(mstrn_gaspara_inputfile), &
947 form =
'formatted', &
951 if ( ierr /= 0 )
then
952 log_error(
"RD_MSTRN_setup",*)
'Input data file does not found! ', trim(mstrn_gaspara_inputfile)
957 read(fid,*) nband, nstream, nfitp, nfitt, nflag, ncfc
959 if ( nband /= mstrn_nband )
then
960 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nband(given,file)=', mstrn_nband, nband
963 if ( nstream /= mstrn_nstream )
then
964 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nstream(given,file)=', mstrn_nstream, nstream
967 if ( nfitp /= mstrn_nfitp )
then
968 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nfitP(given,file)=', mstrn_nfitp, nfitp
971 if ( nfitt /= mstrn_nfitt )
then
972 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nfitT(given,file)=', mstrn_nfitt, nfitt
975 if ( nflag /= mstrn_nflag )
then
976 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nflag(given,file)=', mstrn_nflag, nflag
979 if ( ncfc /= mstrn_ncfc )
then
980 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! ncfc(given,file)=', mstrn_ncfc, ncfc
989 read(fid,*) logfitp(:)
994 logfitt(:) = log10( fitt(:) )
997 do iw = 1, mstrn_nband
1001 read(fid,*) iflgb(:,iw)
1007 read(fid,*) (wgtch(ich,iw),ich=1,nch(iw))
1010 read(fid,*) ngasabs(iw)
1013 if ( ngasabs(iw) > 0 )
then
1014 do igas = 1, ngasabs(iw)
1015 read(fid,*) igasabs(igas,iw)
1016 do it = 1, mstrn_nfitt
1017 do ip = 1, mstrn_nfitp
1018 read(fid,*) (akd(ich,ip,it,igasabs(igas,iw),iw),ich=1,nch(iw))
1025 if ( iflgb(i_h2o_continuum,iw) > 0 )
then
1027 do it = 1, mstrn_nfitt
1028 do ip = 1, mstrn_nfitp
1029 read(fid,*) (skd(ich,ip,it,iw),ich=1,nch(iw))
1035 if ( iflgb(i_cfc_continuum,iw) > 0 )
then
1037 read(fid,*) (acfc(icfc),icfc=1,mstrn_ncfc)
1039 do icfc = 1, mstrn_ncfc
1040 acfc_pow(icfc,iw) = 10.0_rp**acfc(icfc)
1051 allocate( fitplk(mstrn_nfitplk,mstrn_nband) )
1052 allocate( fsol( mstrn_nband) )
1053 allocate( sfc(mstrn_nsfc, mstrn_nband) )
1054 allocate( rayleigh( mstrn_nband) )
1056 allocate( qmol( mstrn_nmoment,mstrn_nband) )
1057 allocate( q(-1:mstrn_nradius+1,mstrn_nptype,mstrn_nmoment,mstrn_nband) )
1058 do iptype = 1, mstrn_nptype
1059 nradius = ptype_nradius(iptype)
1061 q( -1:0 ,iptype,:,:) = 0.d0
1062 q(nradius+1:mstrn_nradius+1,iptype,:,:) = 0.d0
1067 file = trim(mstrn_aeropara_inputfile), &
1068 form =
'formatted', &
1072 if ( ierr /= 0 )
then
1073 log_error(
"RD_MSTRN_setup",*)
'Input data file does not found! ', trim(mstrn_aeropara_inputfile)
1078 read(fid,*) nband, nsfc, nptype, nstream, nplkord, nfitplk
1080 if ( nband /= mstrn_nband )
then
1081 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nband(given,file)=', mstrn_nband, nband
1084 if ( nsfc /= mstrn_nsfc )
then
1085 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nsfc(given,file)=', mstrn_nsfc, nsfc
1088 if ( nptype /= mstrn_nptype )
then
1089 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nptype(given,file)=', mstrn_nptype, nptype
1092 if ( nstream /= mstrn_nstream )
then
1093 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nstream(given,file)=', mstrn_nstream, nstream
1096 if ( nplkord /= mstrn_nplkord )
then
1097 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nplkord(given,file)=', mstrn_nplkord, nplkord
1100 if ( nfitplk /= mstrn_nfitplk )
then
1101 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nfitPLK(given,file)=', mstrn_nfitplk, nfitplk
1107 read(fid,*) waveh(:)
1110 do iw = 1, mstrn_nband
1114 read(fid,*) fitplk(:,iw)
1117 read(fid,*) fsol(iw)
1120 read(fid,*) sfc(:,iw)
1123 read(fid,*) rayleigh(iw)
1127 do im = 1, mstrn_nmoment
1129 read(fid,*) qmol(im,iw)
1131 do iptype = 1, mstrn_nptype
1132 nradius = ptype_nradius(iptype)
1133 read(fid,*) q(1:nradius,iptype,im,iw)
1142 do iw = 1, mstrn_nband
1143 fsol_tot = fsol_tot + fsol(iw)
1149 allocate( hygro_flag(mstrn_nptype) )
1150 allocate( radmode(mstrn_nptype,mstrn_nradius) )
1153 file = trim(mstrn_hygropara_inputfile), &
1154 form =
'formatted', &
1158 if ( ierr /= 0 )
then
1159 log_error(
"RD_MSTRN_setup",*)
'Input data file does not found! ', trim(mstrn_hygropara_inputfile)
1165 if ( nptype /= mstrn_nptype )
then
1166 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nptype(given,file)=', mstrn_nptype, nptype
1170 do iptype = 1, mstrn_nptype
1172 read(fid,*) hygro_flag(iptype), nradius
1174 if ( nradius /= ptype_nradius(iptype) )
then
1175 log_error(
"RD_MSTRN_setup",*)
'Inconsistent parameter value! nradius(given,file)=', ptype_nradius(iptype), nradius
1179 read(fid,*) radmode(iptype,1:nradius)
1186 log_info(
"RD_MSTRN_setup",
'(1x,A,F12.7)')
'Baseline of total solar insolation : ', fsol_tot
1189 rho_std = pstd / ( rdry * tem00 )
1191 m(
i_sw) = 1.0_rp / sqrt(3.0_rp)
1195 m(
i_lw) = 1.0_rp / 1.66_rp
1200 wmns(im) = sqrt( w(im) / m(im) )
1201 wpls(im) = sqrt( w(im) * m(im) )
1202 wscale(im) = wpls(im) / wbar(im)
1212 end subroutine rd_mstrn_setup
1216 subroutine rd_mstrn_dtrn3( &
1217 rd_kmax, IA, IS, IE, JA, JS, JE, &
1253 integer,
intent(in) :: rd_kmax
1254 integer,
intent(in) :: ia, is, ie
1255 integer,
intent(in) :: ja, js, je
1257 integer,
intent(in) :: ngas
1258 integer,
intent(in) :: ncfc
1259 integer,
intent(in) :: naero
1260 integer,
intent(in) :: hydro_str
1261 integer,
intent(in) :: hydro_end
1262 integer,
intent(in) :: aero_str
1263 integer,
intent(in) :: aero_end
1264 real(rp),
intent(in) :: solins (ia,ja)
1265 real(rp),
intent(in) :: cossza (ia,ja)
1266 real(rp),
intent(in) :: rhodz (rd_kmax ,ia,ja)
1267 real(rp),
intent(in) :: pres (rd_kmax ,ia,ja)
1268 real(rp),
intent(in) :: temp (rd_kmax ,ia,ja)
1269 real(rp),
intent(in) :: temph (rd_kmax+1,ia,ja)
1270 real(rp),
intent(in) :: temp_sfc (ia,ja)
1271 real(rp),
intent(in) :: gas (rd_kmax,ia,ja,ngas )
1272 real(rp),
intent(in) :: cfc (rd_kmax,ia,ja,ncfc )
1273 real(rp),
intent(in) :: aerosol_conc(rd_kmax,ia,ja,naero)
1274 real(rp),
intent(in) :: aerosol_radi(rd_kmax,ia,ja,naero)
1275 integer,
intent(in) :: aero2ptype (naero)
1276 real(rp),
intent(in) :: cldfrac (rd_kmax,ia,ja)
1278 real(rp),
intent(in) :: fact_ocean (ia,ja)
1279 real(rp),
intent(in) :: fact_land (ia,ja)
1280 real(rp),
intent(in) :: fact_urban (ia,ja)
1281 real(rp),
intent(out) :: rflux (rd_kmax+1,ia,ja,2,2,mstrn_ncloud)
1283 real(rp),
intent(out) :: taucld_067u (rd_kmax,ia,ja)
1284 real(rp),
intent(out) :: emiscld_105u(rd_kmax,ia,ja)
1287 real(rp) :: dz_std (rd_kmax)
1290 integer :: indexp (rd_kmax)
1291 real(rp) :: factp (rd_kmax)
1292 real(rp) :: factt32(rd_kmax)
1293 real(rp) :: factt21(rd_kmax)
1294 integer :: indexr (rd_kmax,naero)
1295 real(rp) :: factr (rd_kmax,naero)
1298 real(rp) :: taugas(rd_kmax,mstrn_ch_limit)
1299 real(rp) :: a1, a2, a3, factpt
1300 real(rp) :: qv, length
1304 real(rp) :: taupr (rd_kmax,mstrn_ncloud)
1305 real(rp) :: omgpr (rd_kmax,mstrn_ncloud)
1306 real(
dp) :: optparam(rd_kmax,mstrn_nmoment,mstrn_ncloud)
1307 real(rp) :: q_fit, dp_p
1310 real(rp) :: bbar (rd_kmax )
1311 real(rp) :: bbarh(rd_kmax+1)
1313 real(rp) :: wl, beta
1316 real(rp) :: tau(rd_kmax, mstrn_ncloud)
1317 real(rp) :: omg(rd_kmax, mstrn_ncloud)
1318 real(rp) :: g (rd_kmax,0:2,mstrn_ncloud)
1322 real(rp) :: b (rd_kmax,0:2,mstrn_ncloud)
1323 real(rp) :: fsol_rgn
1325 real(rp) :: flux (rd_kmax+1,2,mstrn_ncloud)
1326 real(rp) :: flux_direct(rd_kmax+1, mstrn_ncloud)
1329 real(rp) :: taucld (rd_kmax)
1330 real(rp) :: emiscld(rd_kmax)
1335 integer :: ip, ir, irgn, irgn_alb
1336 integer :: igas, icfc, iaero, iptype, nradius
1337 integer :: iw, ich, iplk, icloud, im
1372 dz_std(k) = rhodz(k,i,j) / rho_std * 100.0_rp
1377 logp = log10( pres(k,i,j) )
1378 logt = log10( temp(k,i,j) )
1380 indexp(k) = mstrn_nfitp
1382 do ip = mstrn_nfitp, 2, -1
1383 if( logp >= logfitp(ip) ) indexp(k) = ip
1388 factp(k) = ( logp - logfitp(ip-1) ) / ( logfitp(ip) - logfitp(ip-1) )
1390 factt32(k) = ( logt - logfitt(2) ) / ( logfitt(3) - logfitt(2) ) &
1391 * ( temp(k,i,j) - fitt(1) ) / ( fitt(3) - fitt(1) )
1392 factt21(k) = ( logt - logfitt(2) ) / ( logfitt(2) - logfitt(1) ) &
1393 * ( fitt(3) - temp(k,i,j) ) / ( fitt(3) - fitt(1) )
1398 iptype = aero2ptype(iaero)
1399 nradius = ptype_nradius(iptype)
1404 if ( aerosol_radi(k,i,j,iaero) <= radmode(iptype,1) )
then
1407 factr(k,iaero) = 0.0_rp
1409 elseif( aerosol_radi(k,i,j,iaero) > radmode(iptype,nradius) )
then
1411 indexr(k,iaero) = nradius
1412 factr(k,iaero) = 1.0_rp
1415 indexr(k,iaero) = -1
1417 do ir = 1, nradius-1
1418 if ( aerosol_radi(k,i,j,iaero) <= radmode(iptype,ir+1) &
1419 .AND. aerosol_radi(k,i,j,iaero) > radmode(iptype,ir ) )
then
1421 indexr(k,iaero) = ir
1422 factr(k,iaero) = ( aerosol_radi(k,i,j,iaero) - radmode(iptype,ir) ) &
1423 / ( radmode(iptype,ir+1) - radmode(iptype,ir) )
1433 rflux(:,i,j,:,:,:) = 0.0_rp
1434 rflux_sfc_dn( i,j,:,: ) = 0.0_rp
1436 do iw = 1, mstrn_nband
1437 if ( iflgb(i_swlw,iw) == 0 )
then
1445 if ( waveh(iw) >= 10000.0_rp / 0.7_rp )
then
1459 taugas(k,ich) = 0.0_rp
1468 do igas = 1, ngasabs(iw)
1469 gasno = igasabs(igas,iw)
1475 length = gas(k,i,j,igasabs(igas,iw)) * ppm * dz_std(k)
1479 a1 = akd(ich,ip-1,1,gasno,iw) * ( 1.0_rp - factp(k) )&
1480 + akd(ich,ip ,1,gasno,iw) * ( factp(k) )
1481 a2 = akd(ich,ip-1,2,gasno,iw) * ( 1.0_rp - factp(k) )&
1482 + akd(ich,ip ,2,gasno,iw) * ( factp(k) )
1483 a3 = akd(ich,ip-1,3,gasno,iw) * ( 1.0_rp - factp(k) )&
1484 + akd(ich,ip ,3,gasno,iw) * ( factp(k) )
1486 factpt = factt32(k)*(a3-a2) + a2 + factt21(k)*(a2-a1)
1488 taugas(k,ich) = taugas(k,ich) + 10.0_rp**factpt * length
1494 if ( iflgb(i_h2o_continuum,iw) == 1 )
then
1499 qv = gas(k,i,j,1) * ppm * dz_std(k)
1500 length = qv*qv / ( qv + dz_std(k) )
1504 a1 = skd(ich,ip-1,1,iw) * ( 1.0_rp-factp(k) )&
1505 + skd(ich,ip ,1,iw) * ( factp(k) )
1506 a2 = skd(ich,ip-1,2,iw) * ( 1.0_rp-factp(k) )&
1507 + skd(ich,ip ,2,iw) * ( factp(k) )
1508 a3 = skd(ich,ip-1,3,iw) * ( 1.0_rp-factp(k) )&
1509 + skd(ich,ip ,3,iw) * ( factp(k) )
1511 factpt = factt32(k)*(a3-a2) + a2 + factt21(k)*(a2-a1)
1513 taugas(k,ich) = taugas(k,ich) + 10.0_rp**factpt * length
1518 if ( iflgb(i_cfc_continuum,iw) == 1 )
then
1524 valsum = valsum + acfc_pow(icfc,iw) * cfc(k,i,j,icfc)
1526 valsum = valsum * ppm * dz_std(k)
1530 taugas(k,ich) = taugas(k,ich) + valsum
1544 dp_p = rhodz(k,i,j) * grav / pstd
1545 length = rayleigh(iw) * dp_p
1548 do im = 1, mstrn_nstream*2+2
1549 optparam(k,im,i_cloud ) = qmol(im,iw) * length
1550 optparam(k,im,i_clearsky) = qmol(im,iw) * length
1555 do iaero = hydro_str, hydro_end
1556 iptype = aero2ptype(iaero)
1560 ir = indexr(k,iaero)
1562 length = aerosol_conc(k,i,j,iaero) * ppm * dz_std(k)
1565 do im = 1, mstrn_nstream*2+2
1566 q_fit = q(ir ,iptype,im,iw) * ( 1.0_rp-factr(k,iaero) ) &
1567 + q(ir+1,iptype,im,iw) * ( factr(k,iaero) )
1568 q_fit = max( q_fit, 0.0_rp )
1570 optparam(k,im,i_cloud) = optparam(k,im,i_cloud) + q_fit * length
1573 q_fit = q(ir ,iptype,1,iw) * ( 1.0_rp-factr(k,iaero) ) &
1574 + q(ir+1,iptype,1,iw) * ( factr(k,iaero) )
1575 q_fit = max( q_fit, 0.0_rp )
1577 taucld(k) = taucld(k) + q_fit * length
1582 do iaero = aero_str, aero_end
1583 iptype = aero2ptype(iaero)
1587 ir = indexr(k,iaero)
1589 length = aerosol_conc(k,i,j,iaero) * ppm * dz_std(k)
1592 do im = 1, mstrn_nstream*2+2
1593 q_fit = q(ir ,iptype,im,iw) * ( 1.0_rp-factr(k,iaero) ) &
1594 + q(ir+1,iptype,im,iw) * ( factr(k,iaero) )
1595 q_fit = max( q_fit, 0.0_rp )
1597 optparam(k,im,i_cloud ) = optparam(k,im,i_cloud ) + q_fit * length
1598 optparam(k,im,i_clearsky) = optparam(k,im,i_clearsky) + q_fit * length
1603 do icloud = 1, mstrn_ncloud
1606 taupr(k,icloud) = optparam(k,1,icloud)
1607 omgpr(k,icloud) = optparam(k,1,icloud) - optparam(k,2,icloud)
1610 zerosw = 0.5_rp - sign(0.5_rp,omgpr(k,icloud)-rd_eps)
1612 g(k,0,icloud) = 1.0_rp
1613 g(k,1,icloud) = optparam(k,3,icloud) * ( 1.0_rp-zerosw ) / ( omgpr(k,icloud)+zerosw )
1614 g(k,2,icloud) = optparam(k,4,icloud) * ( 1.0_rp-zerosw ) / ( omgpr(k,icloud)+zerosw )
1620 if ( waveh(iw) <= 1.493e+4_rp .AND. 1.493e+4_rp < waveh(iw+1) )
then
1623 taucld_067u(k,i,j) = taucld(k)
1627 if ( irgn ==
i_sw )
then
1631 b(k,0,icloud) = 0.0_rp
1632 b(k,1,icloud) = 0.0_rp
1633 b(k,2,icloud) = 0.0_rp
1638 fsol_rgn = fsol(iw) / fsol_tot * solins(i,j)
1640 elseif( irgn ==
i_lw )
then
1642 wl = 10000.0_rp / sqrt( waveh(iw) * waveh(iw+1) )
1649 do iplk = mstrn_nfitplk, 1, -1
1650 beta = beta / ( wl*temp(k,i,j) ) + fitplk(iplk,iw)
1652 bbar(k) = exp(-beta) * temp(k,i,j) / (wl*wl)
1660 do iplk = mstrn_nfitplk, 1, -1
1661 beta = beta / ( wl*temph(k,i,j) ) + fitplk(iplk,iw)
1663 bbarh(k) = exp(-beta) * temph(k,i,j) / (wl*wl)
1669 do iplk = mstrn_nfitplk, 1, -1
1670 beta = beta / ( wl*temp_sfc(i,j) ) + fitplk(iplk,iw)
1673 b_sfc = exp(-beta) * temp_sfc(i,j) / (wl*wl)
1685 tau(k,icloud) = taugas(k,ich) + taupr(k,icloud)
1688 zerosw = 0.5_rp - sign( 0.5_rp, tau(k,icloud)-rd_eps )
1690 omg(k,icloud) = ( 1.0_rp-zerosw ) * omgpr(k,icloud) / ( tau(k,icloud)-zerosw ) &
1691 + ( zerosw ) * 1.0_rp
1697 if( irgn ==
i_lw )
then
1702 zerosw = 0.5_rp - sign( 0.5_rp, tau(k,icloud)-rd_eps )
1704 b(k,0,icloud) = bbarh(k)
1705 b(k,1,icloud) = ( 1.0_rp-zerosw ) &
1707 + 4.0_rp * bbar(k ) &
1708 - 3.0_rp * bbarh(k ) &
1709 ) / ( tau(k,icloud)-zerosw )
1710 b(k,2,icloud) = ( 1.0_rp-zerosw ) &
1712 - 2.0_rp * bbar(k ) &
1714 ) / ( tau(k,icloud)*tau(k,icloud)-zerosw ) * 2.0_rp
1722 call rd_mstrn_two_stream( rd_kmax, &
1731 albedo_sfc(i,j,:,irgn_alb), &
1741 rflux(k,i,j,irgn,
i_up,icloud) = rflux(k,i,j,irgn,
i_up,icloud) + flux(k,
i_up,icloud) * wgtch(ich,iw)
1742 rflux(k,i,j,irgn,
i_dn,icloud) = rflux(k,i,j,irgn,
i_dn,icloud) + flux(k,
i_dn,icloud) * wgtch(ich,iw)
1747 + ( flux_direct(rd_kmax+1,i_cloud) ) * wgtch(ich,iw)
1749 + ( flux(rd_kmax+1,
i_dn,i_cloud) - flux_direct(rd_kmax+1,i_cloud) ) * wgtch(ich,iw)
1752 if ( waveh(iw) <= 952.0_rp .AND. 952.0_rp < waveh(iw+1) )
then
1755 emiscld_105u(k,i,j) = emiscld(k)
1771 end subroutine rd_mstrn_dtrn3
1776 subroutine rd_mstrn_two_stream( &
1798 integer,
intent(in) :: rd_kmax
1799 real(rp),
intent(in) :: cossza0
1800 real(rp),
intent(in) :: fsol
1801 integer,
intent(in) :: irgn
1802 real(rp),
intent(in) :: tau (rd_kmax, mstrn_ncloud)
1803 real(rp),
intent(in) :: omg (rd_kmax, mstrn_ncloud)
1804 real(rp),
intent(in) :: g (rd_kmax,0:2,mstrn_ncloud)
1805 real(rp),
intent(in) :: b (rd_kmax,0:2,mstrn_ncloud)
1806 real(rp),
intent(in) :: b_sfc
1807 real(rp),
intent(in) :: albedo_sfc (
n_rad_dir)
1808 real(rp),
intent(in) :: cldfrac (rd_kmax)
1809 real(rp),
intent(out) :: flux (rd_kmax+1,2,mstrn_ncloud)
1810 real(rp),
intent(out) :: flux_direct(rd_kmax+1, mstrn_ncloud)
1811 real(rp),
intent(out) :: emiscld (rd_kmax)
1823 real(rp) :: pmns, ppls
1824 real(rp) :: smns, spls
1831 real(rp) :: apls_mns, bpls_mns
1832 real(
dp) :: v0mns, v0pls
1833 real(
dp) :: v1mns, v1pls
1834 real(
dp) :: dmns0, dmns1, dmns2
1835 real(
dp) :: dpls0, dpls1, dpls2
1836 real(rp) :: sigmns, sigpls
1838 real(rp) :: zerosw, tmp
1841 real(rp) :: tdir0(rd_kmax,mstrn_ncloud)
1842 real(rp) :: r0 (rd_kmax,mstrn_ncloud)
1843 real(rp) :: t0 (rd_kmax,mstrn_ncloud)
1844 real(rp) :: em_lw(rd_kmax,mstrn_ncloud)
1845 real(rp) :: em_sw(rd_kmax,mstrn_ncloud)
1846 real(rp) :: ep_lw(rd_kmax,mstrn_ncloud)
1847 real(rp) :: ep_sw(rd_kmax,mstrn_ncloud)
1850 real(rp) :: cf (rd_kmax )
1851 real(rp) :: tau_bar_sol(rd_kmax+1)
1852 real(rp) :: tdir (rd_kmax+1)
1853 real(rp) :: r (rd_kmax+1)
1854 real(rp) :: t (rd_kmax+1)
1855 real(rp) :: em (rd_kmax+1)
1856 real(rp) :: ep (rd_kmax+1)
1859 real(rp) :: r12mns(rd_kmax+1)
1860 real(rp) :: r12pls(rd_kmax+1)
1861 real(rp) :: e12mns(rd_kmax+1)
1862 real(rp) :: e12pls(rd_kmax+1)
1863 real(rp) :: umns, upls
1865 real(rp) :: em0(mstrn_ncloud)
1867 real(rp) :: wmns_irgn, m_irgn, w_irgn, wpls_irgn, wscale_irgn
1869 integer,
parameter :: i_sfc2toa = 1
1870 integer,
parameter :: i_toa2sfc = 2
1873 integer :: k, icloud
1878 wmns_irgn = wmns(irgn)
1879 wpls_irgn = wpls(irgn)
1880 wscale_irgn = wscale(irgn)
1882 cossza = max( cossza0, rd_cossza_min )
1889 tau_new = ( 1.0_rp - omg(k,icloud)*g(k,2,icloud) ) * tau(k,icloud)
1891 omg_new = ( 1.0_rp - g(k,2,icloud) ) / ( 1.0_rp - omg(k,icloud)*g(k,2,icloud) ) * omg(k,icloud)
1892 omg_new = min( omg_new, eps1 )
1894 g_new = ( g(k,1,icloud) - g(k,2,icloud) ) / ( 1.0_rp - g(k,2,icloud) )
1896 #if defined(PGI) || defined(SX)
1897 tdir0(k,icloud) = exp( -min( tau_new/cossza, 1.e+3_rp ) )
1899 tdir0(k,icloud) = exp(-tau_new/cossza)
1902 factor = ( 1.0_rp - omg(k,icloud)*g(k,2,icloud) )
1903 b_new0 = b(k,0,icloud)
1904 b_new1 = b(k,1,icloud) / factor
1905 b_new2 = b(k,2,icloud) / (factor*factor)
1906 c0 = wmns_irgn * 2.0_rp * pi * ( 1.0_rp - omg_new ) * b_new0
1907 c1 = wmns_irgn * 2.0_rp * pi * ( 1.0_rp - omg_new ) * b_new1
1908 c2 = wmns_irgn * 2.0_rp * pi * ( 1.0_rp - omg_new ) * b_new2
1911 pmns = omg_new * 0.5_rp * ( 1.0_rp - 3.0_rp * g_new * m_irgn*m_irgn )
1912 ppls = omg_new * 0.5_rp * ( 1.0_rp + 3.0_rp * g_new * m_irgn*m_irgn )
1915 smns = omg_new * 0.5_rp * ( 1.0_rp - 3.0_rp * g_new * m_irgn*cossza )
1916 spls = omg_new * 0.5_rp * ( 1.0_rp + 3.0_rp * g_new * m_irgn*cossza )
1919 sw = 0.5_rp + sign(0.5_rp,tau_new-rd_eps)
1920 tau_new = max( tau_new, rd_eps )
1923 x = ( 1.0_rp - w_irgn * ( ppls - pmns ) ) / m_irgn
1924 y = ( 1.0_rp - w_irgn * ( ppls + pmns ) ) / m_irgn
1928 #if defined(PGI) || defined(SX)
1929 e = exp( -min( lamda*tau_new, 1.e+3_rp ) )
1931 e = exp(-lamda*tau_new)
1935 apls_mns = ( x * ( 1.0_dp+e ) - lamda * ( 1.0_dp-e ) ) &
1936 / ( x * ( 1.0_dp+e ) + lamda * ( 1.0_dp-e ) )
1937 bpls_mns = ( x * ( 1.0_dp-e ) - lamda * ( 1.0_dp+e ) ) &
1938 / ( x * ( 1.0_dp-e ) + lamda * ( 1.0_dp+e ) )
1941 r0(k,icloud) = ( sw ) * 0.5_rp * ( apls_mns + bpls_mns ) &
1942 + ( 1.0_rp-sw ) * ( tau_new * ( pmns ) / m_irgn )
1943 t0(k,icloud) = ( sw ) * 0.5_rp * ( apls_mns - bpls_mns ) &
1944 + ( 1.0_rp-sw ) * ( 1.0_rp - tau_new * ( 1.0_rp - ppls ) / m_irgn )
1947 dmns0 = c0 / y + 2.0_rp * c2 / (x*y*y) + c1 / (x*y)
1948 dpls0 = c0 / y + 2.0_rp * c2 / (x*y*y) - c1 / (x*y)
1949 dmns1 = c1 / y + 2.0_rp * c2 / (x*y)
1950 dpls1 = c1 / y - 2.0_rp * c2 / (x*y)
1956 v1mns = dmns0 + dmns1*tau_new + dmns2*tau_new*tau_new
1957 v1pls = dpls0 + dpls1*tau_new + dpls2*tau_new*tau_new
1959 em_lw(k,icloud) = ( sw ) * ( v0mns - r0(k,icloud) * v0pls - t0(k,icloud) * v1mns ) &
1960 + ( 1.0_rp-sw ) * 0.5_rp * tau_new * ( 2.0_rp*c0 + c1*tau_new + c2*tau_new*tau_new )
1961 ep_lw(k,icloud) = ( sw ) * ( v1pls - t0(k,icloud) * v0pls - r0(k,icloud) * v1mns ) &
1962 + ( 1.0_rp-sw ) * 0.5_rp * tau_new * ( 2.0_rp*c0 + c1*tau_new + c2*tau_new*tau_new )
1965 sigmns = wmns_irgn * ( spls - smns )
1966 sigpls = wmns_irgn * ( spls + smns )
1968 tmp = x*y*cossza-1.0/cossza
1969 zerosw = 1.0_rp - sign(1.0_rp,abs(tmp)-eps)
1970 qgamma = ( sigpls*x*cossza + sigmns ) / ( tmp + zerosw*eps )
1972 v0pls = 0.5_rp * ( ( 1.0_rp + 1.0_rp/(x*cossza) ) * qgamma + sigmns / x )
1973 v0mns = 0.5_rp * ( ( 1.0_rp - 1.0_rp/(x*cossza) ) * qgamma - sigmns / x )
1975 v1pls = v0pls * tdir0(k,icloud)
1976 v1mns = v0mns * tdir0(k,icloud)
1978 em_sw(k,icloud) = ( sw ) * ( v0mns - r0(k,icloud) * v0pls - t0(k,icloud) * v1mns ) &
1979 + ( 1.0_rp-sw ) * wmns_irgn * smns * tau_new * sqrt( tdir0(k,icloud) )
1980 ep_sw(k,icloud) = ( sw ) * ( v1pls - t0(k,icloud) * v0pls - r0(k,icloud) * v1mns ) &
1981 + ( 1.0_rp-sw ) * wmns_irgn * spls * tau_new * sqrt( tdir0(k,icloud) )
1989 if ( icloud == 1 )
then
2003 tdir(k) = ( cf(k) ) * tdir0(k,i_cloud ) &
2004 + ( 1.0_rp-cf(k) ) * tdir0(k,i_clearsky)
2007 tau_bar_sol(1) = fsol
2010 tau_bar_sol(k) = tau_bar_sol(k-1) * tdir(k-1)
2015 em(k) = ( cf(k) ) * ( em_lw(k,i_cloud ) &
2016 + em_sw(k,i_cloud ) * tau_bar_sol(k) ) &
2017 + ( 1.0_rp-cf(k) ) * ( em_lw(k,i_clearsky) &
2018 + em_sw(k,i_clearsky) * tau_bar_sol(k) )
2020 ep(k) = ( cf(k) ) * ( ep_lw(k,i_cloud ) &
2021 + ep_sw(k,i_cloud ) * tau_bar_sol(k) ) &
2022 + ( 1.0_rp-cf(k) ) * ( ep_lw(k,i_clearsky) &
2023 + ep_sw(k,i_clearsky) * tau_bar_sol(k) )
2025 flux_direct(k,icloud) = cossza * tau_bar_sol(k)
2029 r(rd_kmax+1) = ( cf(rd_kmax) ) * albedo_sfc(
i_r_diffuse) &
2030 + ( 1.0_rp-cf(rd_kmax) ) * albedo_sfc(
i_r_diffuse)
2031 t(rd_kmax+1) = 0.0_rp
2033 flux_direct(rd_kmax+1,icloud) = cossza * tau_bar_sol(rd_kmax+1)
2035 em0(i_cloud ) = wpls_irgn * ( flux_direct(rd_kmax+1,icloud) * albedo_sfc(
i_r_direct) / (w_irgn*m_irgn) &
2036 + 2.0_rp * pi * ( 1.0_rp-albedo_sfc(
i_r_diffuse) ) * b_sfc )
2037 em0(i_clearsky) = wpls_irgn * ( flux_direct(rd_kmax+1,icloud) * albedo_sfc(
i_r_direct) / (w_irgn*m_irgn) &
2038 + 2.0_rp * pi * ( 1.0_rp-albedo_sfc(
i_r_diffuse) ) * b_sfc )
2040 em(rd_kmax+1) = ( cf(rd_kmax) ) * em0(i_cloud ) &
2041 + ( 1.0_rp-cf(rd_kmax) ) * em0(i_clearsky)
2042 ep(rd_kmax+1) = 0.0_rp
2049 r12pls(rd_kmax+1) = r(rd_kmax+1)
2050 e12mns(rd_kmax+1) = em(rd_kmax+1)
2053 do k = rd_kmax, 1, -1
2054 r(k) = ( cf(k) ) * r0(k,i_cloud ) &
2055 + ( 1.0_rp-cf(k) ) * r0(k,i_clearsky)
2056 t(k) = ( cf(k) ) * t0(k,i_cloud ) &
2057 + ( 1.0_rp-cf(k) ) * t0(k,i_clearsky)
2059 r12pls(k) = r(k) + t(k) / ( 1.0_rp - r12pls(k+1) * r(k) ) &
2060 * ( r12pls(k+1) * t(k) )
2061 e12mns(k) = em(k) + t(k) / ( 1.0_rp - r12pls(k+1) * r(k) ) &
2062 * ( r12pls(k+1) * ep(k) + e12mns(k+1) )
2072 r12mns(k) = r(k) + t(k) / ( 1.0_rp - r12mns(k-1) * r(k) ) &
2073 * ( r12mns(k-1) *t(k) )
2074 e12pls(k) = ep(k) + t(k) / ( 1.0_rp - r12mns(k-1) * r(k) ) &
2075 * ( r12mns(k-1)*em(k) + e12pls(k-1) )
2085 umns = e12mns(1) + r12pls(1) * upls
2087 flux(1,
i_up,icloud) = wscale_irgn * umns
2088 flux(1,
i_dn,icloud) = wscale_irgn * upls + flux_direct(1,icloud)
2092 upls = ( e12pls(k-1) + r12mns(k-1)*e12mns(k) ) / ( 1.0_rp - r12mns(k-1)*r12pls(k) )
2093 umns = e12mns(k) + r12pls(k) * upls
2095 flux(k,
i_up,icloud) = wscale_irgn * umns
2096 flux(k,
i_dn,icloud) = wscale_irgn * upls + flux_direct(k,icloud)
2099 if ( icloud == 2 )
then
2102 emiscld(k) = 1.0_rp - r(k) - t(k)
2110 end subroutine rd_mstrn_two_stream