6 PUBLIC ::
irrad,
planck,
plancd,
h2oexps,
conexps,
n2oexps,
ch4exps,
comexps,
cfcexps,
b10exps, &
7 tablup,
h2okdis,
n2okdis,
ch4kdis,
comkdis,
cfckdis,
b10kdis,
cldovlp,
sfcflux,
mkicx,
sortit,
getirtau1 11 subroutine irrad ( np , & !Number of layers (LM)
44 aib_ir, awb_ir, aiw_ir, &
45 aww_ir, aig_ir, awg_ir, &
46 xkw, xke, mw, aw, bw, pm, &
48 w11, w12, w13, p11, p12, &
59 real(8),
intent(IN) :: aib_ir(3,10), awb_ir(4,10), aiw_ir(4,10)
60 real(8),
intent(IN) :: aww_ir(4,10), aig_ir(4,10), awg_ir(4,10)
62 integer,
intent(IN) :: mw(9)
63 real(8),
intent(IN) :: xkw(9), xke(9), aw(9), bw(9), pm(9)
64 real(8),
intent(IN) :: fkw(6,9), gkw(6,3), cb(6,10), dcb(5,10)
65 real(8),
intent(IN) :: w11, w12, w13, p11, p12
66 real(8),
intent(IN) :: p13, dwe, dpe
67 real(8),
intent(IN) :: c1(26,30), c2(26,30), c3(26,30)
68 real(8),
intent(IN) :: oo1(26,21), oo2(26,21), oo3(26,21)
69 real(8),
intent(IN) :: h11(26,31), h12(26,31), h13(26,31)
70 real(8),
intent(IN) :: h21(26,31), h22(26,31), h23(26,31)
71 real(8),
intent(IN) :: h81(26,31), h82(26,31), h83(26,31)
74 INTEGER,
INTENT(IN) :: np, ict, icb, ns, na, nb
75 LOGICAL,
INTENT(IN) :: trace
77 real(8),
INTENT(IN) :: co2
80 real(8),
INTENT(IN) :: tb_dev
83 real(8),
DIMENSION(np),
INTENT(IN) :: ta_dev, wa_dev, oa_dev, fcld_dev
84 real(8),
DIMENSION(np),
INTENT(IN) :: n2o_dev, ch4_dev, cfc11_dev, cfc12_dev, cfc22_dev
85 real(8),
DIMENSION(np+1),
INTENT(IN) :: ple_dev
88 real(8),
DIMENSION(ns),
INTENT(IN) :: fs_dev, tg_dev, tv_dev
89 real(8),
DIMENSION(ns,10),
INTENT(IN) :: eg_dev, ev_dev, rv_dev
92 real(8),
DIMENSION(np,4),
INTENT(IN) :: cwc_dev, reff_dev
95 real(8),
DIMENSION(np,nb),
INTENT(INOUT) :: taua_dev, ssaa_dev, asya_dev
99 real(8),
DIMENSION(np+1),
INTENT(OUT) :: flxu_dev
100 real(8),
DIMENSION(np+1),
INTENT(OUT) :: flxd_dev
101 real(8),
DIMENSION(np+1),
INTENT(OUT) :: dfdts_dev
104 real(8),
parameter :: cons_grav = 9.80665
106 integer,
parameter :: nx1 = 26
107 integer,
parameter :: no1 = 21
108 integer,
parameter :: nc1 = 30
109 integer,
parameter :: nh1 = 31
113 real(8) :: pa(0:np),dt(0:np)
115 real(8) :: dh2o(0:np),dcont(0:np),dco2(0:np),do3(0:np)
116 real(8) :: dn2o(0:np),dch4(0:np)
117 real(8) :: df11(0:np),df12(0:np),df22(0:np)
118 real(8) :: th2o(6),tcon(3),tco2(6)
119 real(8) :: tn2o(4),tch4(4),tcom(6)
120 real(8) :: tf11,tf12,tf22
121 real(8) :: blayer(0:np+1),blevel(0:np+1)
122 real(8) :: bd(0:np+1),bu(0:np+1)
123 real(8) :: bs,dbs,rflxs
125 real(8) :: trant,tranal
126 real(8) :: transfc(0:np+1)
127 real(8) :: flxu(0:np+1),flxd(0:np+1)
128 real(8) :: taerlyr(0:np)
136 integer :: k,l,
ip,iw,ibn,ik,iq,isb,k1,k2,ne
139 real(8) :: cldhi,cldmd,cldlw,tcldlyr(0:np),fclr
140 real(8) :: x,xx,yy,p1,a1,b1,fk1,a2,b2,fk2
143 logical :: oznbnd,co2bnd,h2otable,conbnd,n2obnd
144 logical :: ch4bnd,combnd,f11bnd,f12bnd,f22bnd,b10bnd
145 logical :: do_aerosol
148 integer,
parameter :: max_num_tables = 17
149 real(8) :: exptbl(0:np,max_num_tables)
154 type(band_table) :: h2oexp
155 type(band_table) :: conexp
156 type(band_table) :: co2exp
157 type(band_table) :: n2oexp
158 type(band_table) :: ch4exp
159 type(band_table) :: comexp
160 type(band_table) :: f11exp
161 type(band_table) :: f12exp
162 type(band_table) :: f22exp
166 real(8) :: fcld_col(np)
167 real(8) :: reff_col(np,4)
168 real(8) :: cwc_col(np,4)
170 real(8) :: h2oexp_tmp(0:np,5),conexp_tmp(0:np),co2exp_tmp(0:np,6),n2oexp_tmp(0:np,2)
176 pa(k) = 0.5*(ple_dev(k+1)+ple_dev(k))*0.01
177 dp(k) = (ple_dev(k+1)-ple_dev(k))*0.01
178 dp_pa(k) = (ple_dev(k+1)-ple_dev(k))
179 dt(k) = ta_dev(k)-250.0
198 dh2o(k) = 1.02*wa_dev(k)*dp(k)
199 do3(k) = 476.*oa_dev(k)*dp(k)
200 dco2(k) = 789.*co2 *dp(k)
201 dch4(k) = 789.*ch4_dev(k)*dp(k)
202 dn2o(k) = 789.*n2o_dev(k)*dp(k)
203 df11(k) = 789.*cfc11_dev(k)*dp(k)
204 df12(k) = 789.*cfc12_dev(k)*dp(k)
205 df22(k) = 789.*cfc22_dev(k)*dp(k)
207 dh2o(k) =
max(dh2o(k),1.e-10)
208 do3(k) =
max(do3(k),1.e-6)
209 dco2(k) =
max(dco2(k),1.e-4)
214 xx=pa(k)*0.001618*wa_dev(k)*wa_dev(k)*dp(k)
215 dcont(k) = xx*exp(1800./ta_dev(k)-6.081)
218 fcld_col(k) = fcld_dev(k)
220 reff_col(k,l) = reff_dev(k,l)
221 cwc_col(k,l) = cwc_dev(k,l)
229 dp(0) =
max(ple_dev(1)*0.01,0.005)
231 dt(0) = ta_dev(1)-250.0
233 dh2o(0) = 1.02*wa_dev(1)*dp(0)
234 do3(0) = 476.*oa_dev(1)*dp(0)
235 dco2(0) = 789.*co2 *dp(0)
236 dch4(0) = 789.*ch4_dev(1)*dp(0)
237 dn2o(0) = 789.*n2o_dev(1)*dp(0)
238 df11(0) = 789.*cfc11_dev(1)*dp(0)
239 df12(0) = 789.*cfc12_dev(1)*dp(0)
240 df22(0) = 789.*cfc22_dev(1)*dp(0)
242 dh2o(0) =
max(dh2o(0),1.e-10)
243 do3(0) =
max(do3(0),1.e-6)
244 dco2(0) =
max(dco2(0),1.e-4)
246 xx=pa(0)*0.001618*wa_dev(1)*wa_dev(1)*dp(0)
247 dcont(0) = xx*exp(1800./ta_dev(1)-6.081)
264 if (ibn == 10 .and. .not. trace)
return 278 h2otable=ibn == 1 .or. ibn == 2 .or. ibn == 8
279 conbnd =ibn >= 2 .and. ibn <= 7
282 n2obnd =ibn == 6 .or. ibn == 7
283 ch4bnd =ibn == 6 .or. ibn == 7
284 combnd =ibn == 4 .or. ibn == 5
285 f11bnd =ibn == 4 .or. ibn == 5
286 f12bnd =ibn == 4 .or. ibn == 6
287 f22bnd =ibn == 4 .or. ibn == 6
368 call planck(ibn,cb,ta_dev(k),blayer(k))
377 call sfcflux (ibn,cb,dcb,ns,fs_dev,tg_dev,eg_dev,tv_dev,ev_dev,rv_dev,&
385 blevel(k)=(blayer(k-1)*dp(k)+blayer(k)*dp(k-1))/(dp(k-1)+dp(k))
390 blevel(1)=blayer(1)+(blayer(1)-blayer(2))*dp(1)/(dp(1)+dp(2))
394 call planck(ibn,cb,tb_dev,blevel(np+1))
405 call getirtau1(ibn,np,dp_pa,fcld_col,reff_col,cwc_col,&
406 tcldlyr,enn,aib_ir,awb_ir, &
407 aiw_ir, aww_ir, aig_ir, awg_ir, cons_grav)
413 call mkicx(np,ict,icb,enn,icx,ncld)
424 if (taua_dev(k,ibn) > 0.001)
then 425 if (ssaa_dev(k,ibn) > 0.001)
then 426 asya_dev(k,ibn)=asya_dev(k,ibn)/ssaa_dev(k,ibn)
427 ssaa_dev(k,ibn)=ssaa_dev(k,ibn)/taua_dev(k,ibn)
430 ff=.5+(.3739+(0.0076+0.1185*asya_dev(k,ibn))*asya_dev(k,ibn))*asya_dev(k,ibn)
431 taua_dev(k,ibn)=taua_dev(k,ibn)*(1.-ssaa_dev(k,ibn)*ff)
433 taerlyr(k)=exp(-1.66*taua_dev(k,ibn))
440 if (.not. h2otable .and. .not. b10bnd)
then 441 call h2oexps(ibn,np,dh2o,pa,dt,xkw,aw,bw,pm,mw,exptbl(:,h2oexp%start:h2oexp%end))
451 call conexps(ibn,np,dcont,xke,exptbl(:,conexp%start:conexp%end))
459 call n2oexps(ibn,np,dn2o,pa,dt,exptbl(:,n2oexp%start:n2oexp%end))
464 call ch4exps(ibn,np,dch4,pa,dt,exptbl(:,ch4exp%start:ch4exp%end))
469 call comexps(ibn,np,dco2,dt,exptbl(:,comexp%start:comexp%end))
481 call cfcexps(ibn,np,a1,b1,fk1,a2,b2,fk2,df11,dt,&
482 exptbl(:,f11exp%start:f11exp%end))
493 call cfcexps(ibn,np,a1,b1,fk1,a2,b2,fk2,df12,dt,&
494 exptbl(:,f12exp%start:f12exp%end))
505 call cfcexps(ibn,np,a1,b1,fk1,a2,b2,fk2,df22,dt,&
506 exptbl(:,f22exp%start:f22exp%end))
513 call b10exps(np,dh2o,dcont,dco2,dn2o,pa,dt, &
514 h2oexp_tmp,exptbl(:,conexp%start:conexp%end),co2exp_tmp,n2oexp_tmp)
516 exptbl(:,h2oexp%start:h2oexp%end) = h2oexp_tmp
517 exptbl(:,co2exp%start:co2exp%end) = co2exp_tmp
518 exptbl(:,n2oexp%start:n2oexp%end) = n2oexp_tmp
527 bu(np+1)=blayer(np+1)
534 if (.not. h2otable)
then 550 call tablup(nx1,nh1,dh2o(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
551 w11,p11,dwe,dpe,h11,h12,h13,trant)
554 call tablup(nx1,nh1,dh2o(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
555 w11,p11,dwe,dpe,h21,h22,h23,trant)
558 call tablup(nx1,nh1,dh2o(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
559 w11,p11,dwe,dpe,h81,h82,h83,trant)
564 tcon(1)=tcon(1)*exptbl(k2-1,conexp%start)
571 if (.not. b10bnd)
then 572 call h2okdis(ibn,np,k2-1,fkw,gkw,ne,&
573 exptbl(:,h2oexp%start:h2oexp%end), &
574 exptbl(:,conexp%start:conexp%end), &
582 call tablup(nx1,nc1,dco2(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
583 w12,p12,dwe,dpe,c1,c2,c3,trant)
588 call tablup(nx1,no1,do3(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
589 w13,p13,dwe,dpe,oo1,oo2,oo3,trant)
594 trant=trant*taerlyr(k2-1)
598 xx=(1.-enn(k2-1))*trant
601 xx=(blevel(k2-1)-blevel(k2))/log(yy)
602 bd(k2-1)=(blevel(k2)-blevel(k2-1)*yy)/(1.0-yy)-xx
603 bu(k2-1)=(blevel(k2-1)+blevel(k2))-bd(k2-1)
621 if (.not. h2otable)
then 679 call tablup(nx1,nh1,dh2o(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
680 w11,p11,dwe,dpe,h11,h12,h13,trant)
683 call tablup(nx1,nh1,dh2o(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
684 w11,p11,dwe,dpe,h21,h22,h23,trant)
687 call tablup(nx1,nh1,dh2o(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
688 w11,p11,dwe,dpe,h81,h82,h83,trant)
692 tcon(1)=tcon(1)*exptbl(k2-1,conexp%start)
699 if (.not. b10bnd)
then 700 call h2okdis(ibn,np,k2-1,fkw,gkw,ne,&
701 exptbl(:,h2oexp%start:h2oexp%end), &
702 exptbl(:,conexp%start:conexp%end), &
711 call tablup(nx1,nc1,dco2(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
712 w12,p12,dwe,dpe,c1,c2,c3,trant)
717 call tablup(nx1,no1,do3(k2-1),pa(k2-1),dt(k2-1),x1,x2,x3, &
718 w13,p13,dwe,dpe,oo1,oo2,oo3,trant)
724 call n2okdis(ibn,np,k2-1,exptbl(:,n2oexp%start:n2oexp%end),tn2o,trant)
728 call ch4kdis(ibn,np,k2-1,exptbl(:,ch4exp%start:ch4exp%end),tch4,trant)
732 call comkdis(ibn,np,k2-1,exptbl(:,comexp%start:comexp%end),tcom,trant)
736 call cfckdis(np,k2-1,exptbl(:,f11exp%start:f11exp%end),tf11,trant)
740 call cfckdis(np,k2-1,exptbl(:,f12exp%start:f12exp%end),tf12,trant)
744 call cfckdis(np,k2-1,exptbl(:,f22exp%start:f22exp%end),tf22,trant)
749 exptbl(:,h2oexp%start:h2oexp%end),&
750 exptbl(:,conexp%start:conexp%end),&
751 exptbl(:,co2exp%start:co2exp%end),&
752 exptbl(:,n2oexp%start:n2oexp%end),&
753 th2o,tcon,tco2,tn2o,trant)
760 tranal=tranal*taerlyr(k2-1)
764 if (enn(k2-1) >= 0.001)
then 765 call cldovlp (np,k1,k2,ict,icb,icx,ncld,enn,tcldlyr,cldhi,cldmd,cldlw)
768 fclr=(1.0-cldhi)*(1.0-cldmd)*(1.0-cldlw)
770 if (k2 == k1+1 .and. ibn /= 10)
then 771 flxu(k1)=flxu(k1)-bu(k1)
772 flxd(k2)=flxd(k2)+bd(k1)
775 xx=trant*(bu(k2-1)-bu(k2))
776 flxu(k1)=flxu(k1)+xx*fclr
781 xx= trant*(bd(k1-1)-bd(k1))
783 flxd(k2)=flxd(k2)+xx*fclr
787 transfc(k1) =trant*fclr
790 dfdts_dev(k1) =dfdts_dev(k1)-dbs*transfc(k1)
795 if (.not. b10bnd)
then 797 flxu(np+1) = -blayer(np+1)
798 dfdts_dev(np+1)= dfdts_dev(np+1)-dbs
801 flxu(k) = flxu(k)-flxd(np+1)*transfc(k)*rflxs
808 flxu_dev(k) = flxu_dev(k) + flxu(k)
809 flxd_dev(k) = flxd_dev(k) + flxd(k)
818 subroutine planck(ibn,cb,t,xlayer)
825 integer,
intent(in) :: ibn
826 real(8),
intent(in) :: cb(6,10)
827 real(8),
intent(in) :: t
828 real(8),
intent(out) :: xlayer
830 xlayer=t*(t*(t*(t*(t*cb(6,ibn)+cb(5,ibn))+cb(4,ibn))+cb(3,ibn))+cb(2,ibn))+cb(1,ibn)
836 subroutine plancd(ibn,dcb,t,dbdt)
843 integer,
intent(in) :: ibn
844 real(8),
intent(in) :: dcb(5,10)
845 real(8),
intent(in) :: t
846 real(8),
intent(out) :: dbdt
848 dbdt=t*(t*(t*(t*dcb(5,ibn)+dcb(4,ibn))+dcb(3,ibn))+dcb(2,ibn))+dcb(1,ibn)
854 subroutine h2oexps(ib,np,dh2o,pa,dt,xkw,aw,bw,pm,mw,h2oexp)
876 integer :: ib,np,ik,k
880 real(8) :: dh2o(0:np),pa(0:np),dt(0:np)
884 real(8) :: h2oexp(0:np,6)
889 real(8) :: xkw(9),aw(9),bw(9),pm(9)
905 xh = dh2o(k)*(pa(k)/500.)**pm(ib) &
906 * ( 1.+(aw(ib)+bw(ib)* dt(k))*dt(k) )
911 h2oexp(k,1) = exp(-xh*xkw(ib))
916 if (mw(ib) == 6)
then 917 xh = h2oexp(k,ik-1)*h2oexp(k,ik-1)
918 h2oexp(k,ik) = xh*xh*xh
919 elseif (mw(ib) == 8)
then 920 xh = h2oexp(k,ik-1)*h2oexp(k,ik-1)
923 elseif (mw(ib) == 9)
then 924 xh=h2oexp(k,ik-1)*h2oexp(k,ik-1)*h2oexp(k,ik-1)
925 h2oexp(k,ik) = xh*xh*xh
927 xh = h2oexp(k,ik-1)*h2oexp(k,ik-1)
939 subroutine conexps(ib,np,dcont,xke,conexp)
959 real(8) :: dcont(0:np)
963 real(8) :: conexp(0:np,3)
973 conexp(k,1) = exp(-dcont(k)*xke(ib))
980 conexp(k,2) = conexp(k,1) *conexp(k,1)
981 conexp(k,3) = conexp(k,2) *conexp(k,2)
990 subroutine n2oexps(ib,np,dn2o,pa,dt,n2oexp)
1010 real(8) :: dn2o(0:np),pa(0:np),dt(0:np)
1014 real(8) :: n2oexp(0:np,4)
1018 real(8) :: xc,xc1,xc2
1029 xc=dn2o(k)*(1.+(1.9297e-3+4.3750e-6*dt(k))*dt(k))
1030 n2oexp(k,1)=exp(-xc*6.31582e-2)
1032 xc=n2oexp(k,1)*n2oexp(k,1)*n2oexp(k,1)
1035 n2oexp(k,2)=xc*xc1*xc2
1041 xc=dn2o(k)*(pa(k)/500.0)**0.48 &
1042 *(1.+(1.3804e-3+7.4838e-6*dt(k))*dt(k))
1043 n2oexp(k,1)=exp(-xc*5.35779e-2)
1045 xc=n2oexp(k,1)*n2oexp(k,1)
1048 xc=n2oexp(k,2)*n2oexp(k,2)
1051 xc=n2oexp(k,3)*n2oexp(k,3)
1062 subroutine ch4exps(ib,np,dch4,pa,dt,ch4exp)
1082 real(8) :: dch4(0:np),pa(0:np),dt(0:np)
1086 real(8) :: ch4exp(0:np,4)
1100 xc=dch4(k)*(1.+(1.7007e-2+1.5826e-4*dt(k))*dt(k))
1101 ch4exp(k,1)=exp(-xc*5.80708e-3)
1107 xc=dch4(k)*(pa(k)/500.0)**0.65 &
1108 *(1.+(5.9590e-4-2.2931e-6*dt(k))*dt(k))
1109 ch4exp(k,1)=exp(-xc*6.29247e-2)
1111 xc=ch4exp(k,1)*ch4exp(k,1)*ch4exp(k,1)
1115 xc=ch4exp(k,2)*ch4exp(k,2)*ch4exp(k,2)
1119 xc=ch4exp(k,3)*ch4exp(k,3)*ch4exp(k,3)
1131 subroutine comexps(ib,np,dcom,dt,comexp)
1147 integer :: ib,ik,np,k
1151 real(8) :: dcom(0:np),dt(0:np)
1155 real(8) :: comexp(0:np,6)
1166 xc=dcom(k)*(1.+(3.5775e-2+4.0447e-4*dt(k))*dt(k))
1170 xc=dcom(k)*(1.+(3.4268e-2+3.7401e-4*dt(k))*dt(k))
1173 comexp(k,1)=exp(-xc*1.922e-7)
1176 xc=comexp(k,ik-1)*comexp(k,ik-1)
1178 comexp(k,ik)=xc*comexp(k,ik-1)
1187 subroutine cfcexps(ib,np,a1,b1,fk1,a2,b2,fk2,dcfc,dt,cfcexp)
1210 real(8) :: dcfc(0:np),dt(0:np)
1214 real(8) :: cfcexp(0:np)
1218 real(8) :: a1,b1,fk1,a2,b2,fk2
1231 xf=dcfc(k)*(1.+(a1+b1*dt(k))*dt(k))
1232 cfcexp(k)=exp(-xf*fk1)
1234 xf=dcfc(k)*(1.+(a2+b2*dt(k))*dt(k))
1235 cfcexp(k)=exp(-xf*fk2)
1244 subroutine b10exps(np,dh2o,dcont,dco2,dn2o,pa,dt, &
1245 h2oexp,conexp,co2exp,n2oexp)
1268 real(8) :: dh2o(0:np),dcont(0:np),dn2o(0:np)
1269 real(8) :: dco2(0:np),pa(0:np),dt(0:np)
1273 real(8) :: h2oexp(0:np,5),conexp(0:np),co2exp(0:np,6),n2oexp(0:np,2)
1277 real(8) :: xx,xx1,xx2,xx3
1285 xx=dh2o(k)*(pa(k)/500.0) &
1286 *(1.+(0.0149+6.20e-5*dt(k))*dt(k))
1290 h2oexp(k,1)=exp(-xx*0.10624)
1292 xx=h2oexp(k,1)*h2oexp(k,1)
1296 xx=h2oexp(k,2)*h2oexp(k,2)
1300 xx=h2oexp(k,3)*h2oexp(k,3)
1304 xx=h2oexp(k,4)*h2oexp(k,4)
1310 conexp(k)=exp(-dcont(k)*109.0)
1314 xx=dco2(k)*(pa(k)/300.0)**0.5 &
1315 *(1.+(0.0179+1.02e-4*dt(k))*dt(k))
1319 co2exp(k,1)=exp(-xx*2.656e-5)
1321 xx=co2exp(k,1)*co2exp(k,1)
1325 xx=co2exp(k,2)*co2exp(k,2)
1329 xx=co2exp(k,3)*co2exp(k,3)
1333 xx=co2exp(k,4)*co2exp(k,4)
1337 xx=co2exp(k,5)*co2exp(k,5)
1343 xx=dn2o(k)*(1.+(1.4476e-3+3.6656e-6*dt(k))*dt(k))
1347 n2oexp(k,1)=exp(-xx*0.25238)
1349 xx=n2oexp(k,1)*n2oexp(k,1)
1354 n2oexp(k,2)=xx*xx1*xx2*xx3
1362 subroutine tablup(nx1,nh1,dw,p,dt,s1,s2,s3,w1,p1, &
1363 dwe,dpe,coef1,coef2,coef3,tran)
1400 real(8) :: w1,p1,dwe,dpe
1402 real(8) :: coef1(nx1,nh1),coef2(nx1,nh1),coef3(nx1,nh1)
1406 real(8) :: s1,s2,s3,tran
1410 real(8) :: we,pe,fw,
fp,pa,pb,pc,ax,ba,bb,t1,ca,cb,t2
1411 real(8) :: x1,x2,x3,xx, x1c
1430 we=(log10(x1)-w1)*dwe
1431 pe=(log10(x2)-p1)*dpe
1435 we=
min(we,
real(nh1-1))
1436 pe=
min(pe,
real(nx1-1))
1453 pa = coef1(
ip,iw-1)+(coef1(
ip+1,iw-1)-coef1(
ip,iw-1))*
fp 1454 pb = coef1(
ip, iw)+(coef1(
ip+1, iw)-coef1(
ip, iw))*
fp 1455 pc = coef1(
ip,iw+1)+(coef1(
ip+1,iw+1)-coef1(
ip,iw+1))*
fp 1459 ax = ( (pc+pa)*fw + (pc-pa) ) *fw*0.5 + pb*(1.-fw*fw)
1463 ba = coef2(
ip, iw)+(coef2(
ip+1, iw)-coef2(
ip, iw))*
fp 1464 bb = coef2(
ip,iw+1)+(coef2(
ip+1,iw+1)-coef2(
ip,iw+1))*
fp 1467 ca = coef3(
ip, iw)+(coef3(
ip+1, iw)-coef3(
ip, iw))*
fp 1468 cb = coef3(
ip,iw+1)+(coef3(
ip+1,iw+1)-coef3(
ip,iw+1))*
fp 1469 t2 = ca + (cb-ca)*fw
1473 xx=(ax + (t1+t2*x3) * x3)
1474 xx=
min(xx,0.9999999)
1475 xx=
max(xx,0.0000001)
1482 subroutine h2okdis(ib,np,k,fkw,gkw,ne,h2oexp,conexp, &
1512 integer :: ib,ne,np,k
1513 real(8) :: h2oexp(0:np,6),conexp(0:np,3)
1514 real(8) :: fkw(6,9),gkw(6,3)
1518 real(8) :: th2o(6),tcon(3),tran
1538 th2o(1) = th2o(1)*h2oexp(k,1)
1539 th2o(2) = th2o(2)*h2oexp(k,2)
1540 th2o(3) = th2o(3)*h2oexp(k,3)
1541 th2o(4) = th2o(4)*h2oexp(k,4)
1542 th2o(5) = th2o(5)*h2oexp(k,5)
1543 th2o(6) = th2o(6)*h2oexp(k,6)
1549 trnth2o =(fkw(1,ib)*th2o(1) &
1550 + fkw(2,ib)*th2o(2) &
1551 + fkw(3,ib)*th2o(3) &
1552 + fkw(4,ib)*th2o(4) &
1553 + fkw(5,ib)*th2o(5) &
1554 + fkw(6,ib)*th2o(6))
1559 elseif (ne == 1)
then 1563 tcon(1) = tcon(1)*conexp(k,1)
1565 trnth2o =(fkw(1,ib)*th2o(1) &
1566 + fkw(2,ib)*th2o(2) &
1567 + fkw(3,ib)*th2o(3) &
1568 + fkw(4,ib)*th2o(4) &
1569 + fkw(5,ib)*th2o(5) &
1570 + fkw(6,ib)*th2o(6))*tcon(1)
1578 tcon(1)= tcon(1)*conexp(k,1)
1579 tcon(2)= tcon(2)*conexp(k,2)
1580 tcon(3)= tcon(3)*conexp(k,3)
1584 trnth2o = ( gkw(1,1)*th2o(1) &
1585 + gkw(2,1)*th2o(2) &
1586 + gkw(3,1)*th2o(3) &
1587 + gkw(4,1)*th2o(4) &
1588 + gkw(5,1)*th2o(5) &
1589 + gkw(6,1)*th2o(6) ) * tcon(1) &
1590 + ( gkw(1,2)*th2o(1) &
1591 + gkw(2,2)*th2o(2) &
1592 + gkw(3,2)*th2o(3) &
1593 + gkw(4,2)*th2o(4) &
1594 + gkw(5,2)*th2o(5) &
1595 + gkw(6,2)*th2o(6) ) * tcon(2) &
1596 + ( gkw(1,3)*th2o(1) &
1597 + gkw(2,3)*th2o(2) &
1598 + gkw(3,3)*th2o(3) &
1599 + gkw(4,3)*th2o(4) &
1600 + gkw(5,3)*th2o(5) &
1601 + gkw(6,3)*th2o(6) ) * tcon(3)
1611 subroutine n2okdis(ib,np,k,n2oexp,tn2o,tran)
1633 real(8) :: n2oexp(0:np,4)
1637 real(8) :: tn2o(4),tran
1651 tn2o(1)=tn2o(1)*n2oexp(k,1)
1652 xc= 0.940414*tn2o(1)
1654 tn2o(2)=tn2o(2)*n2oexp(k,2)
1655 xc=xc+0.059586*tn2o(2)
1661 tn2o(1)=tn2o(1)*n2oexp(k,1)
1662 xc= 0.561961*tn2o(1)
1664 tn2o(2)=tn2o(2)*n2oexp(k,2)
1665 xc=xc+0.138707*tn2o(2)
1667 tn2o(3)=tn2o(3)*n2oexp(k,3)
1668 xc=xc+0.240670*tn2o(3)
1670 tn2o(4)=tn2o(4)*n2oexp(k,4)
1671 xc=xc+0.058662*tn2o(4)
1681 subroutine ch4kdis(ib,np,k,ch4exp,tch4,tran)
1703 real(8) :: ch4exp(0:np,4)
1707 real(8) :: tch4(4),tran
1721 tch4(1)=tch4(1)*ch4exp(k,1)
1728 tch4(1)=tch4(1)*ch4exp(k,1)
1729 xc= 0.610650*tch4(1)
1731 tch4(2)=tch4(2)*ch4exp(k,2)
1732 xc=xc+0.280212*tch4(2)
1734 tch4(3)=tch4(3)*ch4exp(k,3)
1735 xc=xc+0.107349*tch4(3)
1737 tch4(4)=tch4(4)*ch4exp(k,4)
1738 xc=xc+0.001789*tch4(4)
1748 subroutine comkdis(ib,np,k,comexp,tcom,tran)
1770 real(8) :: comexp(0:np,6)
1774 real(8) :: tcom(6),tran
1788 tcom(1)=tcom(1)*comexp(k,1)
1790 tcom(2)=tcom(2)*comexp(k,2)
1791 xc=xc+0.24359*tcom(2)
1792 tcom(3)=tcom(3)*comexp(k,3)
1793 xc=xc+0.24981*tcom(3)
1794 tcom(4)=tcom(4)*comexp(k,4)
1795 xc=xc+0.26427*tcom(4)
1796 tcom(5)=tcom(5)*comexp(k,5)
1797 xc=xc+0.07807*tcom(5)
1798 tcom(6)=tcom(6)*comexp(k,6)
1799 xc=xc+0.04267*tcom(6)
1805 tcom(1)=tcom(1)*comexp(k,1)
1807 tcom(2)=tcom(2)*comexp(k,2)
1808 xc=xc+0.14795*tcom(2)
1809 tcom(3)=tcom(3)*comexp(k,3)
1810 xc=xc+0.19512*tcom(3)
1811 tcom(4)=tcom(4)*comexp(k,4)
1812 xc=xc+0.33446*tcom(4)
1813 tcom(5)=tcom(5)*comexp(k,5)
1814 xc=xc+0.17199*tcom(5)
1815 tcom(6)=tcom(6)*comexp(k,6)
1816 xc=xc+0.08179*tcom(6)
1826 subroutine cfckdis(np,k,cfcexp,tcfc,tran)
1847 real(8) :: cfcexp(0:np)
1851 real(8) :: tcfc,tran
1862 subroutine b10kdis(np,k,h2oexp,conexp,co2exp,n2oexp, &
1863 th2o,tcon,tco2,tn2o,tran)
1897 real(8) :: h2oexp(0:np,5),conexp(0:np),co2exp(0:np,6), &
1902 real(8) :: th2o(6),tcon(3),tco2(6),tn2o(4), &
1911 th2o(1)=th2o(1)*h2oexp(k,1)
1914 th2o(2)=th2o(2)*h2oexp(k,2)
1915 xx=xx+0.4604*th2o(2)
1917 th2o(3)=th2o(3)*h2oexp(k,3)
1918 xx=xx+0.1326*th2o(3)
1920 th2o(4)=th2o(4)*h2oexp(k,4)
1921 xx=xx+0.0798*th2o(4)
1923 th2o(5)=th2o(5)*h2oexp(k,5)
1924 xx=xx+0.0119*th2o(5)
1930 tcon(1)=tcon(1)*conexp(k)
1935 tco2(1)=tco2(1)*co2exp(k,1)
1938 tco2(2)=tco2(2)*co2exp(k,2)
1939 xx=xx+ 0.2201*tco2(2)
1941 tco2(3)=tco2(3)*co2exp(k,3)
1942 xx=xx+ 0.2106*tco2(3)
1944 tco2(4)=tco2(4)*co2exp(k,4)
1945 xx=xx+ 0.2409*tco2(4)
1947 tco2(5)=tco2(5)*co2exp(k,5)
1948 xx=xx+ 0.0196*tco2(5)
1950 tco2(6)=tco2(6)*co2exp(k,6)
1951 xx=xx+ 0.0415*tco2(6)
1957 tn2o(1)=tn2o(1)*n2oexp(k,1)
1958 xx= 0.970831*tn2o(1)
1960 tn2o(2)=tn2o(2)*n2oexp(k,2)
1961 xx=xx+0.029169*tn2o(2)
1971 subroutine cldovlp (np,k1,k2,ict,icb,icx,ncld,enn,ett, &
2001 integer,
intent(IN ) :: np,k1,k2,ict,icb,icx(0:np),ncld(3)
2002 real(8),
intent(IN ) :: enn(0:np), ett(0:np)
2004 real(8),
intent(INOUT) :: cldhi,cldmd,cldlw
2006 integer :: j,k,km,kx
2014 if(kx==1 .or. cldhi==0.)
then 2022 if(j>=k1 .and. j<=km) cldhi=enn(j)+ett(j)*cldhi
2027 elseif(km >= ict .and. km < icb)
then 2031 if(kx==1 .or. cldmd==0.)
then 2039 if(j>=k1 .and. j<=km) cldmd=enn(j)+ett(j)*cldmd
2048 if(kx==1 .or. cldlw==0.)
then 2056 if(j>=k1 .and. j<=km) cldlw=enn(j)+ett(j)*cldlw
2066 subroutine sfcflux (ibn,cb,dcb,ns,fs,tg,eg,tv,ev,rv,bs,dbs,rflxs)
2092 real(8) :: dcb(5,10)
2093 real(8) :: fs(ns),tg(ns),eg(ns,10)
2094 real(8) :: tv(ns),ev(ns,10),rv(ns,10)
2097 real(8) :: bs,dbs,rflxs
2101 real(8) :: bg(ns),bv(ns),dbg(ns),dbv(ns)
2110 call planck(ibn,cb,tg(j),bg(j))
2111 call planck(ibn,cb,tv(j),bv(j))
2112 call plancd(ibn,dcb,tg(j),dbg(j))
2113 call plancd(ibn,dcb,tv(j),dbv(j))
2118 if (fs(1) > 0.9999)
then 2119 if (ev(1,ibn) < 0.0001 .and. rv(1,ibn) < 0.0001)
then 2125 dbs=eg(1,ibn)*dbg(1)
2133 yy=1.0-ev(1,ibn)-rv(1,ibn)
2135 bs=yy*(eg(1,ibn)*bg(1)+zz*xx)+xx
2138 dbs=yy*(eg(1,ibn)*dbg(1)+zz*xx)+xx
2140 rflxs=rv(1,ibn)+zz*yy*yy/(1.0-rv(1,ibn)*zz)
2150 if (ev(1,ibn) < 0.0001 .and. rv(1,ibn) < 0.0001)
then 2155 bs=bs+fs(j)*eg(j,ibn)*bg(j)
2156 dbs=dbs+fs(j)*eg(j,ibn)*dbg(j)
2157 rflxs=rflxs+fs(j)*(1.0-eg(j,ibn))
2165 yy=1.0-ev(j,ibn)-rv(j,ibn)
2167 bs=bs+fs(j)*(yy*(eg(j,ibn)*bg(j)+zz*xx)+xx)
2170 dbs=dbs+fs(j)*(yy*(eg(j,ibn)*dbg(j)+zz*xx)+xx)
2172 rflxs=rflxs+fs(j)*(rv(j,ibn)+zz*yy*yy &
2173 /(1.0-rv(j,ibn)*zz))
2184 subroutine mkicx(np,ict,icb,enn,icx,ncld)
2189 integer,
intent(IN ) :: np, ict, icb
2190 real(8),
intent(IN ) :: enn(0:np)
2191 integer,
intent(INOUT) :: icx(0:np)
2192 integer,
intent( OUT) :: ncld(3)
2194 call sortit(enn( 0:ict-1),icx( 0:ict-1),ncld(1), 0, ict-1)
2195 call sortit(enn(ict:icb-1),icx(ict:icb-1),ncld(2),ict, icb-1)
2196 call sortit(enn(icb:np ),icx(icb: np),ncld(3),icb, np)
2198 end subroutine mkicx 2201 subroutine sortit(ENN,LST,NCL,ibg,iend)
2206 integer,
intent( OUT) :: ncl
2207 integer,
intent(IN ) :: ibg, iend
2208 real(8),
intent(IN ) :: enn(ibg:iend)
2209 integer,
intent(INOUT) :: lst(ibg:iend)
2228 if (enn(lst(i))<=eno)
exit 2238 subroutine getirtau1(ib,nlevs,dp,fcld,reff,hydromets,&
2242 aig_ir1, awg_ir1, CONS_GRAV)
2249 integer,
intent(IN ) :: ib
2250 integer,
intent(IN ) :: nlevs
2251 real(8),
intent(IN ) :: dp(nlevs)
2252 real(8),
intent(IN ) :: fcld(nlevs)
2253 real(8),
intent(IN ) :: reff(nlevs,4)
2254 real(8),
intent(IN ) :: hydromets(nlevs,4)
2255 real(8),
intent(IN ) :: aib_ir1(3,10), awb_ir1(4,10), aiw_ir1(4,10)
2256 real(8),
intent(IN ) :: aww_ir1(4,10), aig_ir1(4,10), awg_ir1(4,10)
2257 real(8),
intent(IN ) :: cons_grav
2260 real(8),
intent(OUT) :: tcldlyr(0:nlevs )
2261 real(8),
intent(OUT) :: enn(0:nlevs )
2282 real(8) :: taucld1,taucld2,taucld3,taucld4
2283 real(8) :: g1,g2,g3,g4,gg
2284 real(8) :: w1,w2,w3,w4,ww
2287 real(8) :: reff_snow
2298 if(reff(k,1)<=0.0)
then 2301 taucld1=(((dp(k)*1.0e3)/cons_grav)*hydromets(k,1))*(aib_ir1(1,ib)+aib_ir1(2,ib)/&
2302 reff(k,1)**aib_ir1(3,ib))
2305 taucld2=(((dp(k)*1.0e3)/cons_grav)*hydromets(k,2))*(awb_ir1(1,ib)+(awb_ir1(2,ib)+&
2306 (awb_ir1(3,ib)+awb_ir1(4,ib)*reff(k,2))*reff(k,2))*reff(k,2))
2308 taucld3=0.00307*(((dp(k)*1.0e3)/cons_grav)*hydromets(k,3))
2317 reff_snow =
min(reff(k,4),112.0)
2319 if(reff_snow<=0.0)
then 2322 taucld4=(((dp(k)*1.0e3)/cons_grav)*hydromets(k,4))*(aib_ir1(1,ib)+aib_ir1(2,ib)/&
2323 reff_snow**aib_ir1(3,ib))
2333 tauc=taucld1+taucld2+taucld3+taucld4
2335 if (tauc > 0.02 .and. fcld(k) > 0.01)
then 2337 w1=taucld1*(aiw_ir1(1,ib)+(aiw_ir1(2,ib)+(aiw_ir1(3,ib) &
2338 +aiw_ir1(4,ib)*reff(k,1))*reff(k,1))*reff(k,1))
2339 w2=taucld2*(aww_ir1(1,ib)+(aww_ir1(2,ib)+(aww_ir1(3,ib)&
2340 +aww_ir1(4,ib)*reff(k,2))*reff(k,2))*reff(k,2))
2342 w4=taucld4*(aiw_ir1(1,ib)+(aiw_ir1(2,ib)+(aiw_ir1(3,ib) &
2343 +aiw_ir1(4,ib)*reff_snow)*reff_snow)*reff_snow)
2344 ww=(w1+w2+w3+w4)/tauc
2347 g1=w1*(aig_ir1(1,ib)+(aig_ir1(2,ib)+(aig_ir1(3,ib)&
2348 +aig_ir1(4,ib)*reff(k,1))*reff(k,1))*reff(k,1))
2349 g2=w2*(awg_ir1(1,ib)+(awg_ir1(2,ib)+(awg_ir1(3,ib) &
2350 +awg_ir1(4,ib)*reff(k,2))*reff(k,2))*reff(k,2))
2352 g4=w4*(aig_ir1(1,ib)+(aig_ir1(2,ib)+(aig_ir1(3,ib)&
2353 +aig_ir1(4,ib)*reff_snow)*reff_snow)*reff_snow)
2355 if (abs(w1+w2+w3+w4).gt.0.0)
then 2356 gg=(g1+g2+g3+g4)/(w1+w2+w3+w4)
2364 ff=0.5+(0.3739+(0.0076+0.1185*gg)*gg)*gg
2368 tauc=
max((1.-ww*ff),0.0)*tauc
2373 tcldlyr(k) = exp(-1.66*tauc)
2374 enn(k) = fcld(k)*(1.0-tcldlyr(k))
subroutine, public b10exps(np, dh2o, dcont, dco2, dn2o, pa, dt, h2oexp, conexp, co2exp, n2oexp)
subroutine, public h2okdis(ib, np, k, fkw, gkw, ne, h2oexp, conexp, th2o, tcon, tran)
subroutine, public ch4exps(ib, np, dch4, pa, dt, ch4exp)
subroutine, public cfckdis(np, k, cfcexp, tcfc, tran)
subroutine, public ch4kdis(ib, np, k, ch4exp, tch4, tran)
subroutine, public cfcexps(ib, np, a1, b1, fk1, a2, b2, fk2, dcfc, dt, cfcexp)
integer, parameter, public fp
integer, parameter, public ip
subroutine, public n2oexps(ib, np, dn2o, pa, dt, n2oexp)
subroutine, public n2okdis(ib, np, k, n2oexp, tn2o, tran)
subroutine, public comexps(ib, np, dcom, dt, comexp)
subroutine, public cldovlp(np, k1, k2, ict, icb, icx, ncld, enn, ett, cldhi, cldmd, cldlw)
subroutine, public planck(ibn, cb, t, xlayer)
subroutine, public conexps(ib, np, dcont, xke, conexp)
subroutine, public irrad(np, ple_dev, ta_dev, wa_dev, oa_dev, tb_dev, co2, trace, n2o_dev, ch4_dev, cfc11_dev, cfc12_dev, cfc22_dev, cwc_dev, fcld_dev, ict, icb, reff_dev, ns, fs_dev, tg_dev, eg_dev, tv_dev, ev_dev, rv_dev, na, nb, taua_dev, ssaa_dev, asya_dev, flxu_dev, flxd_dev, dfdts_dev, aib_ir, awb_ir, aiw_ir, aww_ir, aig_ir, awg_ir, xkw, xke, mw, aw, bw, pm, fkw, gkw, cb, dcb, w11, w12, w13, p11, p12, p13, dwe, dpe, c1, c2, c3, oo1, oo2, oo3, h11, h12, h13, h21, h22, h23, h81, h82, h83)
subroutine, public h2oexps(ib, np, dh2o, pa, dt, xkw, aw, bw, pm, mw, h2oexp)
subroutine, public tablup(nx1, nh1, dw, p, dt, s1, s2, s3, w1, p1, dwe, dpe, coef1, coef2, coef3, tran)
subroutine, public sfcflux(ibn, cb, dcb, ns, fs, tg, eg, tv, ev, rv, bs, dbs, rflxs)
subroutine, public sortit(ENN, LST, NCL, ibg, iend)
subroutine, public getirtau1(ib, nlevs, dp, fcld, reff, hydromets, tcldlyr, enn, aib_ir1, awb_ir1, aiw_ir1, aww_ir1, aig_ir1, awg_ir1, CONS_GRAV)
subroutine, public b10kdis(np, k, h2oexp, conexp, co2exp, n2oexp, th2o, tcon, tco2, tn2o, tran)
subroutine, public comkdis(ib, np, k, comexp, tcom, tran)
subroutine, public plancd(ibn, dcb, t, dbdt)
subroutine, public mkicx(np, ict, icb, enn, icx, ncld)