| 1 | subroutine blendrad(ngrid, nlayer, pplay, |
|---|
| 2 | & zdtsw, zdtlw, zdtnirco2, zdtnlte, dtrad) |
|---|
| 3 | c |
|---|
| 4 | c Combine radiative tendencies. LTE contributions (zdtsw and zdtlw) |
|---|
| 5 | c have been calculated for the first NLAYLTE layers, zdtnirco2 and |
|---|
| 6 | c zdtnlte have been calculated for all nlayer layers (but zdtnlte may |
|---|
| 7 | c be zero low down). zdtlw is phased out in favour of zdtnlte with |
|---|
| 8 | c height; zdtsw is also phased out to remove possible spurious heating |
|---|
| 9 | c at low pressures. The pressure at which the transition occurs and |
|---|
| 10 | c the scale over which this happens are set in the nlteparams.h file. |
|---|
| 11 | c Above layer NLAYLTE the tendency is purely the sum of NLTE contributions. |
|---|
| 12 | c (Note : nlaylte is calculated by "nlthermeq" and stored in module "yomlw_h") |
|---|
| 13 | c Stephen Lewis 6/2000 FF |
|---|
| 14 | c |
|---|
| 15 | use yomlw_h, only: nlaylte |
|---|
| 16 | implicit none |
|---|
| 17 | #include "nlteparams.h" |
|---|
| 18 | |
|---|
| 19 | c Input: |
|---|
| 20 | integer ngrid, nlayer |
|---|
| 21 | real pplay(ngrid, nlayer) |
|---|
| 22 | real zdtlw(ngrid, nlayer) |
|---|
| 23 | real zdtsw(ngrid, nlayer) |
|---|
| 24 | real zdtnirco2(ngrid, nlayer) |
|---|
| 25 | real zdtnlte(ngrid, nlayer) |
|---|
| 26 | c |
|---|
| 27 | c Output: |
|---|
| 28 | real dtrad(ngrid, nlayer) |
|---|
| 29 | c |
|---|
| 30 | c Local: |
|---|
| 31 | integer l, ig |
|---|
| 32 | real alpha |
|---|
| 33 | c |
|---|
| 34 | c This is split into two loops to minimize number of calculations, |
|---|
| 35 | c but for vector machines it may be faster to perform one big |
|---|
| 36 | c loop from 1 to nlayer and remove the second loop. |
|---|
| 37 | c |
|---|
| 38 | c Loop over layers for which zdtsw/lw have been calculated. |
|---|
| 39 | do l = 1,nlaylte |
|---|
| 40 | do ig = 1, ngrid |
|---|
| 41 | c alpha is actually 0.5*(1+tanh((z-ztrans)/zw)) |
|---|
| 42 | c written here in a simpler form, with z=-ln(p) and zwi=2/zw |
|---|
| 43 | alpha = 1./(1.+(pplay(ig,l)/ptrans)**zwi) |
|---|
| 44 | dtrad(ig,l) = (1.-alpha)*(zdtsw(ig,l)+zdtlw(ig,l)) |
|---|
| 45 | & + zdtnirco2(ig,l) + alpha*zdtnlte(ig,l) |
|---|
| 46 | enddo |
|---|
| 47 | enddo |
|---|
| 48 | c |
|---|
| 49 | c Faster loop over any remaining layers. |
|---|
| 50 | do l = nlaylte+1, nlayer |
|---|
| 51 | do ig = 1, ngrid |
|---|
| 52 | dtrad(ig,l) = zdtnirco2(ig,l) + zdtnlte(ig,l) |
|---|
| 53 | enddo |
|---|
| 54 | enddo |
|---|
| 55 | c |
|---|
| 56 | return |
|---|
| 57 | end |
|---|