[526] | 1 | subroutine callcorrk(ngrid,nlayer,pq,nq,qsurf, & |
---|
[1482] | 2 | albedo,albedo_equivalent,emis,mu0,pplev,pplay,pt, & |
---|
[1788] | 3 | tsurf,fract,dist_star, & |
---|
[253] | 4 | dtlw,dtsw,fluxsurf_lw, & |
---|
[1482] | 5 | fluxsurf_sw,fluxsurfabs_sw,fluxtop_lw, & |
---|
| 6 | fluxabs_sw,fluxtop_dn, & |
---|
[538] | 7 | OLR_nu,OSR_nu, & |
---|
[1822] | 8 | lastcall) |
---|
[253] | 9 | |
---|
[1722] | 10 | use mod_phys_lmdz_para, only : is_master |
---|
[253] | 11 | use radinc_h |
---|
| 12 | use radcommon_h |
---|
[471] | 13 | use gases_h |
---|
[787] | 14 | USE tracer_h |
---|
[1822] | 15 | use callkeys_mod, only: global1d, szangle |
---|
[1384] | 16 | use comcstfi_mod, only: pi, mugaz, cpp |
---|
[1722] | 17 | use callkeys_mod, only: diurnal,tracer, & |
---|
[1647] | 18 | strictboundcorrk,specOLR |
---|
[787] | 19 | |
---|
[253] | 20 | implicit none |
---|
| 21 | |
---|
| 22 | !================================================================== |
---|
| 23 | ! |
---|
| 24 | ! Purpose |
---|
| 25 | ! ------- |
---|
| 26 | ! Solve the radiative transfer using the correlated-k method for |
---|
| 27 | ! the gaseous absorption and the Toon et al. (1989) method for |
---|
| 28 | ! scatttering due to aerosols. |
---|
| 29 | ! |
---|
| 30 | ! Authors |
---|
| 31 | ! ------- |
---|
| 32 | ! Emmanuel 01/2001, Forget 09/2001 |
---|
| 33 | ! Robin Wordsworth (2009) |
---|
| 34 | ! |
---|
| 35 | !================================================================== |
---|
| 36 | |
---|
| 37 | !----------------------------------------------------------------------- |
---|
| 38 | ! Declaration of the arguments (INPUT - OUTPUT) on the LMD GCM grid |
---|
| 39 | ! Layer #1 is the layer near the ground. |
---|
[1308] | 40 | ! Layer #nlayer is the layer at the top. |
---|
[1483] | 41 | !----------------------------------------------------------------------- |
---|
[253] | 42 | |
---|
[1483] | 43 | |
---|
| 44 | ! INPUT |
---|
| 45 | INTEGER,INTENT(IN) :: ngrid ! Number of atmospheric columns. |
---|
| 46 | INTEGER,INTENT(IN) :: nlayer ! Number of atmospheric layers. |
---|
[1897] | 47 | REAL,INTENT(IN) :: pq(ngrid,nlayer,nq) ! Tracers (X/m2). |
---|
[1483] | 48 | INTEGER,INTENT(IN) :: nq ! Number of tracers. |
---|
| 49 | REAL,INTENT(IN) :: qsurf(ngrid,nq) ! Tracers on surface (kg.m-2). |
---|
| 50 | REAL,INTENT(IN) :: albedo(ngrid,L_NSPECTV) ! Spectral Short Wavelengths Albedo. By MT2015 |
---|
| 51 | REAL,INTENT(IN) :: emis(ngrid) ! Long Wave emissivity. |
---|
| 52 | REAL,INTENT(IN) :: mu0(ngrid) ! Cosine of sun incident angle. |
---|
| 53 | REAL,INTENT(IN) :: pplev(ngrid,nlayer+1) ! Inter-layer pressure (Pa). |
---|
| 54 | REAL,INTENT(IN) :: pplay(ngrid,nlayer) ! Mid-layer pressure (Pa). |
---|
| 55 | REAL,INTENT(IN) :: pt(ngrid,nlayer) ! Air temperature (K). |
---|
| 56 | REAL,INTENT(IN) :: tsurf(ngrid) ! Surface temperature (K). |
---|
| 57 | REAL,INTENT(IN) :: fract(ngrid) ! Fraction of day. |
---|
| 58 | REAL,INTENT(IN) :: dist_star ! Distance star-planet (AU). |
---|
| 59 | logical,intent(in) :: lastcall ! Signals last call to physics. |
---|
| 60 | |
---|
| 61 | ! OUTPUT |
---|
| 62 | REAL,INTENT(OUT) :: dtlw(ngrid,nlayer) ! Heating rate (K/s) due to LW radiation. |
---|
| 63 | REAL,INTENT(OUT) :: dtsw(ngrid,nlayer) ! Heating rate (K/s) due to SW radiation. |
---|
| 64 | REAL,INTENT(OUT) :: fluxsurf_lw(ngrid) ! Incident LW flux to surf (W/m2). |
---|
| 65 | REAL,INTENT(OUT) :: fluxsurf_sw(ngrid) ! Incident SW flux to surf (W/m2) |
---|
| 66 | REAL,INTENT(OUT) :: fluxsurfabs_sw(ngrid) ! Absorbed SW flux by the surface (W/m2). By MT2015. |
---|
| 67 | REAL,INTENT(OUT) :: fluxtop_lw(ngrid) ! Outgoing LW flux to space (W/m2). |
---|
| 68 | REAL,INTENT(OUT) :: fluxabs_sw(ngrid) ! SW flux absorbed by the planet (W/m2). |
---|
| 69 | REAL,INTENT(OUT) :: fluxtop_dn(ngrid) ! Incident top of atmosphere SW flux (W/m2). |
---|
| 70 | REAL,INTENT(OUT) :: OLR_nu(ngrid,L_NSPECTI) ! Outgoing LW radition in each band (Normalized to the band width (W/m2/cm-1). |
---|
| 71 | REAL,INTENT(OUT) :: OSR_nu(ngrid,L_NSPECTV) ! Outgoing SW radition in each band (Normalized to the band width (W/m2/cm-1). |
---|
[1722] | 72 | REAL,INTENT(OUT) :: albedo_equivalent(ngrid) ! Spectrally Integrated Albedo. For Diagnostic. By MT2015 |
---|
[1483] | 73 | |
---|
| 74 | |
---|
[253] | 75 | !----------------------------------------------------------------------- |
---|
| 76 | ! Declaration of the variables required by correlated-k subroutines |
---|
[1483] | 77 | ! Numbered from top to bottom (unlike in the GCM) |
---|
| 78 | !----------------------------------------------------------------------- |
---|
[253] | 79 | |
---|
| 80 | REAL*8 tmid(L_LEVELS),pmid(L_LEVELS) |
---|
| 81 | REAL*8 tlevrad(L_LEVELS),plevrad(L_LEVELS) |
---|
| 82 | |
---|
[1483] | 83 | ! Optical values for the optci/cv subroutines |
---|
[253] | 84 | REAL*8 stel(L_NSPECTV),stel_fract(L_NSPECTV) |
---|
| 85 | REAL*8 dtaui(L_NLAYRAD,L_NSPECTI,L_NGAUSS) |
---|
| 86 | REAL*8 dtauv(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
| 87 | REAL*8 cosbv(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
| 88 | REAL*8 cosbi(L_NLAYRAD,L_NSPECTI,L_NGAUSS) |
---|
| 89 | REAL*8 wbari(L_NLAYRAD,L_NSPECTI,L_NGAUSS) |
---|
| 90 | REAL*8 wbarv(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
| 91 | REAL*8 tauv(L_NLEVRAD,L_NSPECTV,L_NGAUSS) |
---|
| 92 | REAL*8 taucumv(L_LEVELS,L_NSPECTV,L_NGAUSS) |
---|
| 93 | REAL*8 taucumi(L_LEVELS,L_NSPECTI,L_NGAUSS) |
---|
| 94 | |
---|
[961] | 95 | REAL*8 nfluxtopv,nfluxtopi,nfluxtop,fluxtopvdn |
---|
[1483] | 96 | REAL*8 nfluxoutv_nu(L_NSPECTV) ! Outgoing band-resolved VI flux at TOA (W/m2). |
---|
| 97 | REAL*8 nfluxtopi_nu(L_NSPECTI) ! Net band-resolved IR flux at TOA (W/m2). |
---|
| 98 | REAL*8 fluxupi_nu(L_NLAYRAD,L_NSPECTI) ! For 1D diagnostic. |
---|
[253] | 99 | REAL*8 fmneti(L_NLAYRAD),fmnetv(L_NLAYRAD) |
---|
| 100 | REAL*8 fluxupv(L_NLAYRAD),fluxupi(L_NLAYRAD) |
---|
| 101 | REAL*8 fluxdnv(L_NLAYRAD),fluxdni(L_NLAYRAD) |
---|
[1482] | 102 | REAL*8 albi,acosz |
---|
[1483] | 103 | REAL*8 albv(L_NSPECTV) ! Spectral Visible Albedo. |
---|
[253] | 104 | |
---|
[1788] | 105 | INTEGER ig,l,k,nw |
---|
[253] | 106 | |
---|
| 107 | real*8 taugsurf(L_NSPECTV,L_NGAUSS-1) |
---|
| 108 | real*8 taugsurfi(L_NSPECTI,L_NGAUSS-1) |
---|
| 109 | |
---|
| 110 | logical OLRz |
---|
| 111 | real*8 NFLUXGNDV_nu(L_NSPECTV) |
---|
[1648] | 112 | |
---|
[1483] | 113 | ! Included by MT for albedo calculations. |
---|
[1482] | 114 | REAL*8 albedo_temp(L_NSPECTV) ! For equivalent albedo calculation. |
---|
[1526] | 115 | REAL*8 surface_stellar_flux ! Stellar flux reaching the surface. Useful for equivalent albedo calculation. |
---|
[305] | 116 | |
---|
[1483] | 117 | |
---|
[253] | 118 | !======================================================================= |
---|
[1822] | 119 | ! I. Initialization on every call |
---|
[1483] | 120 | !======================================================================= |
---|
| 121 | |
---|
[1529] | 122 | |
---|
[1483] | 123 | ! How much light do we get ? |
---|
[253] | 124 | do nw=1,L_NSPECTV |
---|
| 125 | stel(nw)=stellarf(nw)/(dist_star**2) |
---|
| 126 | end do |
---|
| 127 | |
---|
| 128 | |
---|
[1483] | 129 | !----------------------------------------------------------------------- |
---|
| 130 | do ig=1,ngrid ! Starting Big Loop over every GCM column |
---|
[253] | 131 | !----------------------------------------------------------------------- |
---|
| 132 | |
---|
[1483] | 133 | |
---|
[253] | 134 | !======================================================================= |
---|
[1483] | 135 | ! II. Transformation of the GCM variables |
---|
| 136 | !======================================================================= |
---|
[253] | 137 | |
---|
[1483] | 138 | |
---|
| 139 | ! Albedo and Emissivity. |
---|
| 140 | albi=1-emis(ig) ! Long Wave. |
---|
| 141 | DO nw=1,L_NSPECTV ! Short Wave loop. |
---|
[1482] | 142 | albv(nw)=albedo(ig,nw) |
---|
[1529] | 143 | ENDDO |
---|
[253] | 144 | |
---|
[1483] | 145 | if ((ngrid.eq.1).and.(global1d)) then ! Fixed zenith angle 'szangle' in 1D simulations w/ globally-averaged sunlight. |
---|
[253] | 146 | acosz = cos(pi*szangle/180.0) |
---|
| 147 | print*,'acosz=',acosz,', szangle=',szangle |
---|
| 148 | else |
---|
[1483] | 149 | acosz=mu0(ig) ! Cosine of sun incident angle : 3D simulations or local 1D simulations using latitude. |
---|
[253] | 150 | endif |
---|
| 151 | |
---|
| 152 | !----------------------------------------------------------------------- |
---|
| 153 | ! Pressure and temperature |
---|
[1483] | 154 | !----------------------------------------------------------------------- |
---|
[253] | 155 | |
---|
| 156 | DO l=1,nlayer |
---|
| 157 | plevrad(2*l) = pplay(ig,nlayer+1-l)/scalep |
---|
| 158 | plevrad(2*l+1) = pplev(ig,nlayer+1-l)/scalep |
---|
| 159 | tlevrad(2*l) = pt(ig,nlayer+1-l) |
---|
| 160 | tlevrad(2*l+1) = (pt(ig,nlayer+1-l)+pt(ig,max(nlayer-l,1)))/2 |
---|
| 161 | END DO |
---|
| 162 | |
---|
[600] | 163 | plevrad(1) = 0. |
---|
[1483] | 164 | plevrad(2) = 0. !! Trick to have correct calculations of fluxes in gflux(i/v).F, but the pmid levels are not impacted by this change. |
---|
[253] | 165 | |
---|
| 166 | tlevrad(1) = tlevrad(2) |
---|
[1308] | 167 | tlevrad(2*nlayer+1)=tsurf(ig) |
---|
[253] | 168 | |
---|
[1423] | 169 | pmid(1) = max(pgasmin,0.0001*plevrad(3)) |
---|
| 170 | pmid(2) = pmid(1) |
---|
| 171 | |
---|
[253] | 172 | tmid(1) = tlevrad(2) |
---|
[1423] | 173 | tmid(2) = tmid(1) |
---|
| 174 | |
---|
| 175 | DO l=1,L_NLAYRAD-1 |
---|
| 176 | tmid(2*l+1) = tlevrad(2*l+1) |
---|
| 177 | tmid(2*l+2) = tlevrad(2*l+1) |
---|
| 178 | pmid(2*l+1) = plevrad(2*l+1) |
---|
| 179 | pmid(2*l+2) = plevrad(2*l+1) |
---|
[253] | 180 | END DO |
---|
[1423] | 181 | pmid(L_LEVELS) = plevrad(L_LEVELS) |
---|
| 182 | tmid(L_LEVELS) = tlevrad(L_LEVELS) |
---|
[253] | 183 | |
---|
[1423] | 184 | !!Alternative interpolation: |
---|
| 185 | ! pmid(3) = pmid(1) |
---|
| 186 | ! pmid(4) = pmid(1) |
---|
| 187 | ! tmid(3) = tmid(1) |
---|
| 188 | ! tmid(4) = tmid(1) |
---|
| 189 | ! DO l=2,L_NLAYRAD-1 |
---|
| 190 | ! tmid(2*l+1) = tlevrad(2*l) |
---|
| 191 | ! tmid(2*l+2) = tlevrad(2*l) |
---|
| 192 | ! pmid(2*l+1) = plevrad(2*l) |
---|
| 193 | ! pmid(2*l+2) = plevrad(2*l) |
---|
| 194 | ! END DO |
---|
| 195 | ! pmid(L_LEVELS) = plevrad(L_LEVELS-1) |
---|
| 196 | ! tmid(L_LEVELS) = tlevrad(L_LEVELS-1) |
---|
| 197 | |
---|
[1483] | 198 | ! Test for out-of-bounds pressure. |
---|
[253] | 199 | if(plevrad(3).lt.pgasmin)then |
---|
| 200 | print*,'Minimum pressure is outside the radiative' |
---|
| 201 | print*,'transfer kmatrix bounds, exiting.' |
---|
| 202 | call abort |
---|
| 203 | elseif(plevrad(L_LEVELS).gt.pgasmax)then |
---|
| 204 | print*,'Maximum pressure is outside the radiative' |
---|
| 205 | print*,'transfer kmatrix bounds, exiting.' |
---|
| 206 | call abort |
---|
| 207 | endif |
---|
| 208 | |
---|
[1483] | 209 | ! Test for out-of-bounds temperature. |
---|
[253] | 210 | do k=1,L_LEVELS |
---|
| 211 | if(tlevrad(k).lt.tgasmin)then |
---|
| 212 | print*,'Minimum temperature is outside the radiative' |
---|
[1145] | 213 | print*,'transfer kmatrix bounds' |
---|
[858] | 214 | print*,"k=",k," tlevrad(k)=",tlevrad(k) |
---|
| 215 | print*,"tgasmin=",tgasmin |
---|
[1145] | 216 | if (strictboundcorrk) then |
---|
| 217 | call abort |
---|
| 218 | else |
---|
| 219 | print*,'***********************************************' |
---|
| 220 | print*,'we allow model to continue with tlevrad=tgasmin' |
---|
| 221 | print*,' ... we assume we know what you are doing ... ' |
---|
| 222 | print*,' ... but do not let this happen too often ... ' |
---|
| 223 | print*,'***********************************************' |
---|
[1147] | 224 | !tlevrad(k)=tgasmin |
---|
[1145] | 225 | endif |
---|
[253] | 226 | elseif(tlevrad(k).gt.tgasmax)then |
---|
[1648] | 227 | ! print*,'Maximum temperature is outside the radiative' |
---|
| 228 | ! print*,'transfer kmatrix bounds, exiting.' |
---|
| 229 | ! print*,"k=",k," tlevrad(k)=",tlevrad(k) |
---|
| 230 | ! print*,"tgasmax=",tgasmax |
---|
[1145] | 231 | if (strictboundcorrk) then |
---|
| 232 | call abort |
---|
| 233 | else |
---|
[1648] | 234 | ! print*,'***********************************************' |
---|
| 235 | ! print*,'we allow model to continue with tlevrad=tgasmax' |
---|
| 236 | ! print*,' ... we assume we know what you are doing ... ' |
---|
| 237 | ! print*,' ... but do not let this happen too often ... ' |
---|
| 238 | ! print*,'***********************************************' |
---|
[1147] | 239 | !tlevrad(k)=tgasmax |
---|
[1145] | 240 | endif |
---|
[253] | 241 | endif |
---|
| 242 | enddo |
---|
[1016] | 243 | do k=1,L_NLAYRAD+1 |
---|
| 244 | if(tmid(k).lt.tgasmin)then |
---|
| 245 | print*,'Minimum temperature is outside the radiative' |
---|
| 246 | print*,'transfer kmatrix bounds, exiting.' |
---|
[1145] | 247 | print*,"k=",k," tmid(k)=",tmid(k) |
---|
[1016] | 248 | print*,"tgasmin=",tgasmin |
---|
[1145] | 249 | if (strictboundcorrk) then |
---|
| 250 | call abort |
---|
| 251 | else |
---|
| 252 | print*,'***********************************************' |
---|
| 253 | print*,'we allow model to continue with tmid=tgasmin' |
---|
| 254 | print*,' ... we assume we know what you are doing ... ' |
---|
| 255 | print*,' ... but do not let this happen too often ... ' |
---|
| 256 | print*,'***********************************************' |
---|
| 257 | tmid(k)=tgasmin |
---|
| 258 | endif |
---|
[1016] | 259 | elseif(tmid(k).gt.tgasmax)then |
---|
[1648] | 260 | ! print*,'Maximum temperature is outside the radiative' |
---|
| 261 | ! print*,'transfer kmatrix bounds, exiting.' |
---|
| 262 | ! print*,"k=",k," tmid(k)=",tmid(k) |
---|
| 263 | ! print*,"tgasmax=",tgasmax |
---|
[1145] | 264 | if (strictboundcorrk) then |
---|
| 265 | call abort |
---|
| 266 | else |
---|
[1648] | 267 | ! print*,'***********************************************' |
---|
| 268 | ! print*,'we allow model to continue with tmid=tgasmin' |
---|
| 269 | ! print*,' ... we assume we know what you are doing ... ' |
---|
| 270 | ! print*,' ... but do not let this happen too often ... ' |
---|
| 271 | ! print*,'***********************************************' |
---|
[1145] | 272 | tmid(k)=tgasmax |
---|
| 273 | endif |
---|
[1016] | 274 | endif |
---|
| 275 | enddo |
---|
[253] | 276 | |
---|
| 277 | !======================================================================= |
---|
[1483] | 278 | ! III. Calling the main radiative transfer subroutines |
---|
| 279 | !======================================================================= |
---|
[253] | 280 | |
---|
[1947] | 281 | Cmk(:) = 0.01 * 1.0 / (gzlat(ig,:) * mugaz * 1.672621e-27) ! q_main=1.0 assumed. |
---|
| 282 | gzlat_ig(:) = gzlat(ig,:) |
---|
[253] | 283 | |
---|
| 284 | !----------------------------------------------------------------------- |
---|
[1483] | 285 | ! Short Wave Part |
---|
| 286 | !----------------------------------------------------------------------- |
---|
[253] | 287 | |
---|
[1483] | 288 | if(fract(ig) .ge. 1.0e-4) then ! Only during daylight. |
---|
[787] | 289 | if((ngrid.eq.1).and.(global1d))then |
---|
[253] | 290 | do nw=1,L_NSPECTV |
---|
[1483] | 291 | stel_fract(nw)= stel(nw)* 0.25 / acosz ! globally averaged = divide by 4, and we correct for solar zenith angle |
---|
[253] | 292 | end do |
---|
| 293 | else |
---|
| 294 | do nw=1,L_NSPECTV |
---|
[1161] | 295 | stel_fract(nw)= stel(nw) * fract(ig) |
---|
[253] | 296 | end do |
---|
[1483] | 297 | endif |
---|
| 298 | |
---|
[1897] | 299 | call optcv(pq(ig,:,1:nmicro),nlayer,plevrad,tmid,pmid, & |
---|
[1822] | 300 | dtauv,tauv,taucumv,wbarv,cosbv,tauray,taugsurf) |
---|
[253] | 301 | |
---|
| 302 | call sfluxv(dtauv,tauv,taucumv,albv,dwnv,wbarv,cosbv, & |
---|
[1781] | 303 | acosz,stel_fract, & |
---|
| 304 | nfluxtopv,fluxtopvdn,nfluxoutv_nu,nfluxgndv_nu, & |
---|
[253] | 305 | fmnetv,fluxupv,fluxdnv,fzerov,taugsurf) |
---|
| 306 | |
---|
[1483] | 307 | else ! During the night, fluxes = 0. |
---|
[962] | 308 | nfluxtopv = 0.0d0 |
---|
[1529] | 309 | fluxtopvdn = 0.0d0 |
---|
[962] | 310 | nfluxoutv_nu(:) = 0.0d0 |
---|
| 311 | nfluxgndv_nu(:) = 0.0d0 |
---|
[253] | 312 | do l=1,L_NLAYRAD |
---|
[962] | 313 | fmnetv(l)=0.0d0 |
---|
| 314 | fluxupv(l)=0.0d0 |
---|
| 315 | fluxdnv(l)=0.0d0 |
---|
[253] | 316 | end do |
---|
| 317 | end if |
---|
| 318 | |
---|
[1482] | 319 | |
---|
[1526] | 320 | ! Equivalent Albedo Calculation (for OUTPUT). MT2015 |
---|
| 321 | if(fract(ig) .ge. 1.0e-4) then ! equivalent albedo makes sense only during daylight. |
---|
| 322 | surface_stellar_flux=sum(nfluxgndv_nu(1:L_NSPECTV)) |
---|
| 323 | if(surface_stellar_flux .gt. 1.0e-3) then ! equivalent albedo makes sense only if the stellar flux received by the surface is positive. |
---|
[1529] | 324 | DO nw=1,L_NSPECTV |
---|
| 325 | albedo_temp(nw)=albedo(ig,nw)*nfluxgndv_nu(nw) |
---|
[1526] | 326 | ENDDO |
---|
[1529] | 327 | albedo_temp(1:L_NSPECTV)=albedo_temp(1:L_NSPECTV)/surface_stellar_flux |
---|
[1526] | 328 | albedo_equivalent(ig)=sum(albedo_temp(1:L_NSPECTV)) |
---|
| 329 | else |
---|
| 330 | albedo_equivalent(ig)=0.0 ! Spectrally Integrated Albedo not defined for non-irradiated grid points. So we arbitrary set the equivalent albedo to 0. |
---|
| 331 | endif |
---|
[1529] | 332 | else |
---|
| 333 | albedo_equivalent(ig)=0.0 ! Spectrally Integrated Albedo not defined for non-irradiated grid points. So we arbitrary set the equivalent albedo to 0. |
---|
| 334 | endif |
---|
[1482] | 335 | |
---|
| 336 | |
---|
[253] | 337 | !----------------------------------------------------------------------- |
---|
[1483] | 338 | ! Long Wave Part |
---|
| 339 | !----------------------------------------------------------------------- |
---|
[253] | 340 | |
---|
[1897] | 341 | call optci(pq(ig,:,1:nmicro),nlayer,plevrad,tlevrad,tmid,pmid, & |
---|
[1822] | 342 | dtaui,taucumi,cosbi,wbari,taugsurfi) |
---|
[538] | 343 | |
---|
[253] | 344 | call sfluxi(plevrad,tlevrad,dtaui,taucumi,ubari,albi, & |
---|
[1781] | 345 | wnoi,dwni,cosbi,wbari,nfluxtopi,nfluxtopi_nu, & |
---|
[253] | 346 | fmneti,fluxupi,fluxdni,fluxupi_nu,fzeroi,taugsurfi) |
---|
| 347 | |
---|
| 348 | !----------------------------------------------------------------------- |
---|
| 349 | ! Transformation of the correlated-k code outputs |
---|
| 350 | ! (into dtlw, dtsw, fluxsurf_lw, fluxsurf_sw, fluxtop_lw, fluxtop_sw) |
---|
| 351 | |
---|
| 352 | ! Flux incident at the top of the atmosphere |
---|
[961] | 353 | fluxtop_dn(ig)=fluxtopvdn |
---|
[253] | 354 | |
---|
| 355 | fluxtop_lw(ig) = real(nfluxtopi) |
---|
| 356 | fluxabs_sw(ig) = real(-nfluxtopv) |
---|
| 357 | fluxsurf_lw(ig) = real(fluxdni(L_NLAYRAD)) |
---|
| 358 | fluxsurf_sw(ig) = real(fluxdnv(L_NLAYRAD)) |
---|
[1482] | 359 | |
---|
| 360 | ! Flux absorbed by the surface. By MT2015. |
---|
| 361 | fluxsurfabs_sw(ig) = fluxsurf_sw(ig)*(1.-albedo_equivalent(ig)) |
---|
[253] | 362 | |
---|
| 363 | if(fluxtop_dn(ig).lt.0.0)then |
---|
| 364 | print*,'Achtung! fluxtop_dn has lost the plot!' |
---|
| 365 | print*,'fluxtop_dn=',fluxtop_dn(ig) |
---|
| 366 | print*,'acosz=',acosz |
---|
| 367 | print*,'temp= ',pt(ig,:) |
---|
| 368 | print*,'pplay= ',pplay(ig,:) |
---|
| 369 | call abort |
---|
| 370 | endif |
---|
| 371 | |
---|
| 372 | ! Spectral output, for exoplanet observational comparison |
---|
| 373 | if(specOLR)then |
---|
| 374 | do nw=1,L_NSPECTI |
---|
[526] | 375 | OLR_nu(ig,nw)=nfluxtopi_nu(nw)/DWNI(nw) !JL Normalize to the bandwidth |
---|
[253] | 376 | end do |
---|
| 377 | do nw=1,L_NSPECTV |
---|
[366] | 378 | !GSR_nu(ig,nw)=nfluxgndv_nu(nw) |
---|
[526] | 379 | OSR_nu(ig,nw)=nfluxoutv_nu(nw)/DWNV(nw) !JL Normalize to the bandwidth |
---|
[253] | 380 | end do |
---|
| 381 | endif |
---|
| 382 | |
---|
| 383 | ! Finally, the heating rates |
---|
| 384 | |
---|
[586] | 385 | DO l=2,L_NLAYRAD |
---|
| 386 | dtsw(ig,L_NLAYRAD+1-l)=(fmnetv(l)-fmnetv(l-1)) & |
---|
[1947] | 387 | *gzlat(ig,L_NLAYRAD+1-l)/(cpp*scalep*(plevrad(2*l+1)-plevrad(2*l-1))) |
---|
[586] | 388 | dtlw(ig,L_NLAYRAD+1-l)=(fmneti(l)-fmneti(l-1)) & |
---|
[1947] | 389 | *gzlat(ig,L_NLAYRAD+1-l)/(cpp*scalep*(plevrad(2*l+1)-plevrad(2*l-1))) |
---|
[586] | 390 | END DO |
---|
[253] | 391 | |
---|
| 392 | ! These are values at top of atmosphere |
---|
[586] | 393 | dtsw(ig,L_NLAYRAD)=(fmnetv(1)-nfluxtopv) & |
---|
[1947] | 394 | *gzlat(ig,L_NLAYRAD)/(cpp*scalep*(plevrad(3)-plevrad(1))) |
---|
[586] | 395 | dtlw(ig,L_NLAYRAD)=(fmneti(1)-nfluxtopi) & |
---|
[1947] | 396 | *gzlat(ig,L_NLAYRAD)/(cpp*scalep*(plevrad(3)-plevrad(1))) |
---|
[253] | 397 | |
---|
| 398 | |
---|
[1483] | 399 | !----------------------------------------------------------------------- |
---|
| 400 | end do ! End of big loop over every GCM column. |
---|
| 401 | !----------------------------------------------------------------------- |
---|
[253] | 402 | |
---|
[1483] | 403 | |
---|
| 404 | |
---|
[253] | 405 | !----------------------------------------------------------------------- |
---|
| 406 | ! Additional diagnostics |
---|
[1483] | 407 | !----------------------------------------------------------------------- |
---|
[253] | 408 | |
---|
[1483] | 409 | ! IR spectral output, for exoplanet observational comparison |
---|
| 410 | if(lastcall.and.(ngrid.eq.1))then ! could disable the 1D output, they are in the diagfi and diagspec... JL12 |
---|
[253] | 411 | |
---|
[1483] | 412 | print*,'Saving scalar quantities in surf_vals.out...' |
---|
| 413 | print*,'psurf = ', pplev(1,1),' Pa' |
---|
| 414 | open(116,file='surf_vals.out') |
---|
| 415 | write(116,*) tsurf(1),pplev(1,1),fluxtop_dn(1), & |
---|
| 416 | real(-nfluxtopv),real(nfluxtopi) |
---|
| 417 | close(116) |
---|
[253] | 418 | |
---|
[526] | 419 | |
---|
[1483] | 420 | ! USEFUL COMMENT - Do Not Remove. |
---|
| 421 | ! |
---|
[526] | 422 | ! if(specOLR)then |
---|
| 423 | ! open(117,file='OLRnu.out') |
---|
| 424 | ! do nw=1,L_NSPECTI |
---|
| 425 | ! write(117,*) OLR_nu(1,nw) |
---|
| 426 | ! enddo |
---|
| 427 | ! close(117) |
---|
| 428 | ! |
---|
| 429 | ! open(127,file='OSRnu.out') |
---|
| 430 | ! do nw=1,L_NSPECTV |
---|
| 431 | ! write(127,*) OSR_nu(1,nw) |
---|
| 432 | ! enddo |
---|
| 433 | ! close(127) |
---|
| 434 | ! endif |
---|
[253] | 435 | |
---|
[1483] | 436 | ! OLR vs altitude: do it as a .txt file. |
---|
| 437 | OLRz=.false. |
---|
| 438 | if(OLRz)then |
---|
| 439 | print*,'saving IR vertical flux for OLRz...' |
---|
| 440 | open(118,file='OLRz_plevs.out') |
---|
| 441 | open(119,file='OLRz.out') |
---|
| 442 | do l=1,L_NLAYRAD |
---|
| 443 | write(118,*) plevrad(2*l) |
---|
| 444 | do nw=1,L_NSPECTI |
---|
| 445 | write(119,*) fluxupi_nu(l,nw) |
---|
| 446 | enddo |
---|
| 447 | enddo |
---|
| 448 | close(118) |
---|
| 449 | close(119) |
---|
| 450 | endif |
---|
[253] | 451 | |
---|
[305] | 452 | endif |
---|
[253] | 453 | |
---|
[1483] | 454 | ! See physiq.F for explanations about CLFvarying. This is temporary. |
---|
[1647] | 455 | if (lastcall) then |
---|
[470] | 456 | IF( ALLOCATED( gasi ) ) DEALLOCATE( gasi ) |
---|
| 457 | IF( ALLOCATED( gasv ) ) DEALLOCATE( gasv ) |
---|
[1315] | 458 | !$OMP BARRIER |
---|
| 459 | !$OMP MASTER |
---|
[470] | 460 | IF( ALLOCATED( pgasref ) ) DEALLOCATE( pgasref ) |
---|
| 461 | IF( ALLOCATED( tgasref ) ) DEALLOCATE( tgasref ) |
---|
| 462 | IF( ALLOCATED( pfgasref ) ) DEALLOCATE( pfgasref ) |
---|
[1315] | 463 | !$OMP END MASTER |
---|
[1529] | 464 | !$OMP BARRIER |
---|
[470] | 465 | endif |
---|
| 466 | |
---|
[716] | 467 | |
---|
[253] | 468 | end subroutine callcorrk |
---|