source: trunk/LMDZ.MARS/libf/phymars/blendrad.F @ 3026

Last change on this file since 3026 was 3016, checked in by emillour, 17 months ago

Mars PCM:
Code cleanup: nltedata.h is only included in nltecool.F so turn this data
into module data there. Also convert lteparams.h into module nlteparams_h.F90.
And while at it also turn nlthermeq.F and blendrad.F into modules.
EM

File size: 2.1 KB
RevLine 
[3016]1      MODULE blendrad_mod
2     
3      IMPLICIT NONE
4     
5      CONTAINS
6     
[38]7      subroutine blendrad(ngrid, nlayer, pplay,
8     &                    zdtsw, zdtlw, zdtnirco2, zdtnlte, dtrad)
9c
10c  Combine radiative tendencies.  LTE contributions (zdtsw and zdtlw)
11c  have been calculated for the first NLAYLTE layers, zdtnirco2 and
12c  zdtnlte have been calculated for all nlayer layers (but zdtnlte may
13c  be zero low down).  zdtlw is phased out in favour of zdtnlte with
14c  height; zdtsw is also phased out to remove possible spurious heating
15c  at low pressures.  The pressure at which the transition occurs and
16c  the scale over which this happens are set in the nlteparams.h file.
17c  Above layer NLAYLTE the tendency is purely the sum of NLTE contributions.
[1047]18c  (Note : nlaylte is calculated by "nlthermeq" and stored in module "yomlw_h")
[38]19c  Stephen Lewis 6/2000 FF
20c
[1047]21      use yomlw_h, only: nlaylte
[3016]22      use nlteparams_h, only: ptrans, zwi
[38]23      implicit none
24
25c     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)
32c
33c     Output:
34      real dtrad(ngrid, nlayer)
35c
36c     Local:
37      integer l, ig
38      real alpha
39c
40c     This is split into two loops to minimize number of calculations,
41c     but for vector machines it may be faster to perform one big
42c     loop from 1 to nlayer and remove the second loop.
43c
44c     Loop over layers for which zdtsw/lw have been calculated.
45      do l = 1,nlaylte
46         do ig = 1, ngrid
47c           alpha is actually 0.5*(1+tanh((z-ztrans)/zw))
48c           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
54c
55c     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
61c
[3016]62      end subroutine blendrad
63
64      END MODULE blendrad_mod
Note: See TracBrowser for help on using the repository browser.