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 "dimensions.h" |
---|
18 | !#include "dimphys.h" |
---|
19 | !#include "dimradmars.h" |
---|
20 | #include "nlteparams.h" |
---|
21 | !#include "yomlw.h" |
---|
22 | |
---|
23 | c Input: |
---|
24 | integer ngrid, nlayer |
---|
25 | real pplay(ngrid, nlayer) |
---|
26 | real zdtlw(ngrid, nlayer) |
---|
27 | real zdtsw(ngrid, nlayer) |
---|
28 | real zdtnirco2(ngrid, nlayer) |
---|
29 | real zdtnlte(ngrid, nlayer) |
---|
30 | c |
---|
31 | c Output: |
---|
32 | real dtrad(ngrid, nlayer) |
---|
33 | c |
---|
34 | c Local: |
---|
35 | integer l, ig |
---|
36 | real alpha |
---|
37 | c |
---|
38 | c This is split into two loops to minimize number of calculations, |
---|
39 | c but for vector machines it may be faster to perform one big |
---|
40 | c loop from 1 to nlayer and remove the second loop. |
---|
41 | c |
---|
42 | c Loop over layers for which zdtsw/lw have been calculated. |
---|
43 | do l = 1,nlaylte |
---|
44 | do ig = 1, ngrid |
---|
45 | c alpha is actually 0.5*(1+tanh((z-ztrans)/zw)) |
---|
46 | c written here in a simpler form, with z=-ln(p) and zwi=2/zw |
---|
47 | alpha = 1./(1.+(pplay(ig,l)/ptrans)**zwi) |
---|
48 | dtrad(ig,l) = (1.-alpha)*(zdtsw(ig,l)+zdtlw(ig,l)) |
---|
49 | & + zdtnirco2(ig,l) + alpha*zdtnlte(ig,l) |
---|
50 | enddo |
---|
51 | enddo |
---|
52 | c |
---|
53 | c Faster loop over any remaining layers. |
---|
54 | do l = nlaylte+1, nlayer |
---|
55 | do ig = 1, ngrid |
---|
56 | dtrad(ig,l) = zdtnirco2(ig,l) + zdtnlte(ig,l) |
---|
57 | enddo |
---|
58 | enddo |
---|
59 | c |
---|
60 | return |
---|
61 | end |
---|