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

Last change on this file since 1524 was 1266, checked in by aslmd, 11 years ago

LMDZ.MARS
IMPORTANT CHANGE

  • Remove all reference/use of nlayermx and dimphys.h
  • Made use of automatic arrays whenever arrays are needed with dimension nlayer
  • Remove lots of obsolete reference to dimensions.h
  • Converted iono.h and param_v4.h into corresponding modules

(with embedded subroutine to allocate arrays)
(no arrays allocated if thermosphere not used)

  • Deleted param.h and put contents into module param_v4_h
  • Adapted testphys1d, newstart, etc...
  • Made DATA arrays in param_read to be initialized by subroutine

fill_data_thermos in module param_v4_h

  • Optimized computations in paramfoto_compact (twice less dlog10 calculations)
  • Checked consistency before/after modification in debug mode
  • Checked performance is not impacted (same as before)
File size: 2.0 KB
Line 
1      subroutine blendrad(ngrid, nlayer, pplay,
2     &                    zdtsw, zdtlw, zdtnirco2, zdtnlte, dtrad)
3c
4c  Combine radiative tendencies.  LTE contributions (zdtsw and zdtlw)
5c  have been calculated for the first NLAYLTE layers, zdtnirco2 and
6c  zdtnlte have been calculated for all nlayer layers (but zdtnlte may
7c  be zero low down).  zdtlw is phased out in favour of zdtnlte with
8c  height; zdtsw is also phased out to remove possible spurious heating
9c  at low pressures.  The pressure at which the transition occurs and
10c  the scale over which this happens are set in the nlteparams.h file.
11c  Above layer NLAYLTE the tendency is purely the sum of NLTE contributions.
12c  (Note : nlaylte is calculated by "nlthermeq" and stored in module "yomlw_h")
13c  Stephen Lewis 6/2000 FF
14c
15      use yomlw_h, only: nlaylte
16      implicit none
17#include "nlteparams.h"
18
19c     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)
26c
27c     Output:
28      real dtrad(ngrid, nlayer)
29c
30c     Local:
31      integer l, ig
32      real alpha
33c
34c     This is split into two loops to minimize number of calculations,
35c     but for vector machines it may be faster to perform one big
36c     loop from 1 to nlayer and remove the second loop.
37c
38c     Loop over layers for which zdtsw/lw have been calculated.
39      do l = 1,nlaylte
40         do ig = 1, ngrid
41c           alpha is actually 0.5*(1+tanh((z-ztrans)/zw))
42c           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
48c
49c     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
55c
56      return
57      end
Note: See TracBrowser for help on using the repository browser.