source: trunk/LMDZ.TITAN/libf/phytitan/disr_haze.F90 @ 1663

Last change on this file since 1663 was 1663, checked in by jvatant, 8 years ago

+ Modifs in haze routine

+ Interpolation corrected (log-lin instead of bilin)
+ Added the case of vertical extension

+ Output useful diagnostics in physiq_mod

File size: 4.3 KB
Line 
1subroutine disr_haze(dz,press,wno,taeros,ssa,cbar)
2
3use datafile_mod, only: datadir
4
5IMPLICIT NONE
6
7! ==========================================================================
8!
9!  Purpose :
10!    Interpolate values of extinction coefficient, single scattering albedo
11!    and asymetry factor from hazetable ( Lavvas et al. 2010, mean profile, no
12!    detached layer)
13!
14!    + JVO 2017 : Vertical extension out of table implemented
15!
16!  Author :
17!     Jan Vatant d'Ollone (2016)
18!
19! ==========================================================================
20
21real*8,intent(in)   :: dz, press, wno
22real*8,intent(inout):: taeros, ssa, cbar
23
24!---------------------------
25! NB !!
26! taeros is the integrated extinction over the layer
27! (extinction * thickness of layer)
28!---------------------------
29
30integer             :: i, j, iw, ip, ierr
31real*8              :: wln, factw, factp
32real*8              :: tmp_p, fact_t, fact_s, fact_c
33integer,parameter   :: nbwl_PL=328, nblev_PL=162
34real*8,save         :: ext_PL(nblev_PL,nbwl_PL), ssa_PL(nblev_PL,nbwl_PL)
35real*8,save         :: asf_PL(nblev_PL,nbwl_PL)
36real*8,save         :: wl_PL(nbwl_PL), press_PL(nblev_PL)
37logical,save        :: firstcall=.true.
38character(len=15)   :: dummy
39
40if (firstcall) then
41   print*,"We use DISR haze mean profile from P.Lavvas"
42
43! read PL table   
44! wl_PL in nm
45! press_PL in Pa
46   open(11,file=TRIM(datadir)//'/hazetable_PL_original.dat',status="old",iostat=ierr)
47   read(11,*) dummy,wl_PL
48   do i=1,nblev_PL
49     read(11,*) press_PL(i),ext_PL(i,:)  ! in cm-1
50   enddo
51   do i=1,nblev_PL
52     read(11,*) press_PL(i),ssa_PL(i,:)
53   enddo
54   do i=1,nblev_PL
55     read(11,*) press_PL(i),asf_PL(i,:)
56   enddo
57   close(11)
58   ! convert press_PL into millibar for comparison to press in the generic
59   press_PL(:)=press_PL(:)*1E-2
60   
61   ! Correction of the table according to Lavvas et al. 2010 (ext coeff = constant < 80 km / 20 mbar ) because of condensation
62!   do i=1,49
63!     ext_PL(i,:) = ext_PL(50,:)
64!   enddo
65
66   firstcall=.false.
67endif
68
69! convert wno (in cm-1) into wln (nm)
70wln=1E7/wno
71
72! interpolate the needed values from the table
73
74iw=1
75do i=2,nbwl_PL
76  if(wln.gt.wl_PL(i)) then
77    iw=i
78  endif
79enddo
80
81ip=1
82do j=2,nblev_PL
83  if(press.lt.press_PL(j)) then
84    ip=j
85  endif
86enddo
87
88!----------------- Interpolate values from the hazetable  --------------------
89
90if(iw.ne.nbwl_PL) then
91  factw = (wln-wl_PL(iw)) / (wl_PL(iw+1)-wl_PL(iw))
92else
93  factw = 0. ! If we reach the end of the table we keep the last value
94endif
95if(ip.ne.nblev_PL) then
96  factp = (press-press_PL(ip)) / (press_PL(ip+1)-press_PL(ip))
97else
98  factp=0.
99endif
100
101! Lin-Log interpolation : linear on wln, logarithmic on press
102
103taeros = ( ext_PL(ip,iw)*(1.-factw)   + ext_PL(ip,iw+1)  *factw ) ** (1.-factp) &
104        *( ext_PL(ip+1,iw)*(1.-factw) + ext_PL(ip+1,iw+1)*factw ) ** factp
105
106ssa    = ( ssa_PL(ip,iw)*(1.-factw)   + ssa_PL(ip,iw+1)  *factw ) ** (1.-factp) &
107        *( ssa_PL(ip+1,iw)*(1.-factw) + ssa_PL(ip+1,iw+1)*factw ) ** factp
108
109cbar   = ( asf_PL(ip,iw)*(1.-factw)   + asf_PL(ip,iw+1)  *factw ) ** (1.-factp) &
110        *( asf_PL(ip+1,iw)*(1.-factw) + asf_PL(ip+1,iw+1)*factw ) ** factp
111
112! In case of vertical extension over the max of the table
113! We take the scale height on the last 5 levels (more it's not quite log)
114! Arbitray threshold pressure value, just to deal with the last level press=0
115
116if(ip.eq.nblev_PL) then
117
118  tmp_p = press
119
120  if ( tmp_p .lt. 1.E-15 ) then
121    tmp_p = 1.E-15
122  endif
123
124  fact_t = log10( ( ext_PL(ip,iw)*(1.-factw) + ext_PL(ip,iw+1)  *factw )   &
125           / ( ext_PL(ip-5,iw)*(1.-factw) + ext_PL(ip-5,iw+1)  *factw ) )
126  fact_s = log10( ( ssa_PL(ip,iw)*(1.-factw) + ssa_PL(ip,iw+1)  *factw )   &
127           / ( ssa_PL(ip-5,iw)*(1.-factw) + ssa_PL(ip-5,iw+1)  *factw ) )
128  fact_c = log10( ( asf_PL(ip,iw)*(1.-factw) + asf_PL(ip,iw+1)  *factw )   &
129           / ( asf_PL(ip-5,iw)*(1.-factw) + asf_PL(ip-5,iw+1)  *factw ) )
130
131  fact_t = fact_t / log10( press_PL(ip) / press_PL(ip-5) )
132  fact_s = fact_s / log10( press_PL(ip) / press_PL(ip-5) )
133  fact_c = fact_c / log10( press_PL(ip) / press_PL(ip-5) )
134
135  taeros = taeros * ( tmp_p / press_PL(ip) ) ** fact_t
136  ssa    = ssa    * ( tmp_p / press_PL(ip) ) ** fact_s
137  cbar   = cbar   * ( tmp_p / press_PL(ip) ) ** fact_c
138
139endif
140
141taeros=taeros*dz*1.E2 ! ext in cm-1 * thickness in m * 1E2
142
143end subroutine disr_haze
Note: See TracBrowser for help on using the repository browser.