source: trunk/LMDZ.GENERIC/libf/phystd/calc_rayleigh.F90 @ 135

Last change on this file since 135 was 135, checked in by aslmd, 14 years ago

CHANGEMENT ARBORESCENCE ETAPE 2 -- NON COMPLET

File size: 3.1 KB
Line 
1      subroutine calc_rayleigh
2
3!==================================================================
4!     
5!     Purpose
6!     -------
7!     Average the Rayleigh scattering in each band, weighting the
8!     average by the blackbody function at temperature tstellar.
9!     
10!     Authors
11!     -------
12!     Robin Wordsworth (2010)
13!     Benjamin Charnay (2010)
14!
15!     Called by
16!     ---------
17!     setspv.F
18!     
19!     Calls
20!     -----
21!     none
22!     
23!==================================================================
24
25      use radinc_h, only: L_NSPECTV
26      use radcommon_h, only: WAVEV, BWNV, DWNV, tstellar, gastype, tauray, scalep
27
28      implicit none
29
30#include "comcstfi.h"
31
32      real*8 wl
33      integer N,Nfine,ifine
34      parameter(Nfine=500.0)
35      real*8 :: P0 = 9.423D+6   ! Rayleigh scattering reference pressure in pascals.   
36
37      logical waverage
38      real*8 tauconst,tauvar,tausum,tauwei,bwidth,bstart
39      double precision df
40
41      waverage=.true. ! do we perform a blackbody weighted average by band?
42
43      if(waverage)then
44         if(gastype(1).eq.'CO2')then
45            print*,'Rayleigh scattering is for a CO2 atmosphere.'
46            tauconst = (8.7/g)*1.527*scalep/P0
47         elseif(gastype(1).eq.'AIR')then ! AIR = Earth air
48            print*,'Rayleigh scattering is for an Earth-like atmosphere.'
49            tauconst = (9.81/g)*8.569E-3*scalep/(P0/93.0)
50         else
51            print*,'Rayleigh scattering not defined for gas type ',gastype(n)
52            print*,'exiting.'
53            call abort
54         endif
55      endif
56 
57      do N=1,L_NSPECTV
58         
59         if(waverage)then
60            tausum = 0.0
61            tauwei = 0.0
62            bstart = 10000.0/BWNV(N+1)
63            bwidth = (10000.0/BWNV(N)) - (10000.0/BWNV(N+1))
64            do ifine=1,Nfine
65                wl=bstart+dble(ifine)*bwidth/Nfine
66
67                if(gastype(1).eq.'CO2')then
68                   tauvar = (1.0+0.013/wl**2)/wl**4
69                elseif(gastype(1).eq.'AIR')then
70                   tauvar = (1.0+0.0113/wl**2+0.00013/wl**4)/wl**4
71                endif
72
73                call blackl(dble(wl*1e-6),dble(tstellar),df)
74                df=df*bwidth/Nfine
75                tauwei=tauwei+df
76                tausum=tausum+tauvar*df
77            enddo
78            TAURAY(N)=tauconst*tausum/tauwei
79         else
80            wl = WAVEV(N)
81            if(gastype(1).eq.'CO2')then
82               if(N.eq.1) print*,'Rayleigh scattering is for a CO2 atmosphere.'
83               TAURAY(N) = (8.7/g)*(1.527*(1.0+0.013/wl**2)/wl**4)*scalep/P0
84            elseif(gastype(1).eq.'AIR')then ! AIR = Earth air
85               if(N.eq.1) print*,'Rayleigh scattering is for an Earth-like atmosphere.'
86               TAURAY(N) = (9.81/g)*(8.569E-3*(1.0+0.0113/wl**2+0.00013/wl**4)/wl**4)*scalep/(P0/93.0)
87            else
88               print*,'Rayleigh scattering not defined for gas type ',gastype(n)
89               print*,'exiting.'
90               call abort
91            endif
92         endif       
93
94         ! we multiply by scalep here (100) because plev, which is used in optcv,
95         ! is in units of mBar, so we need to convert.
96      end do
97
98    end subroutine calc_rayleigh
Note: See TracBrowser for help on using the repository browser.