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