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

Last change on this file since 2040 was 2040, checked in by jvatant, 6 years ago

Fix a bug on a haze opt properties in case of vertical extension.
--JVO

File size: 4.3 KB
RevLine 
[1648]1subroutine disr_haze(dz,press,wno,taeros,ssa,cbar)
[1663]2
[1648]3use datafile_mod, only: datadir
[1663]4
[1648]5IMPLICIT NONE
6
[1663]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! ==========================================================================
[1648]20
[1663]21real*8,intent(in)   :: dz, press, wno
22real*8,intent(inout):: taeros, ssa, cbar
23
[1648]24!---------------------------
[1663]25! NB !!
[1648]26! taeros is the integrated extinction over the layer
27! (extinction * thickness of layer)
28!---------------------------
29
[1663]30integer             :: i, j, iw, ip, ierr
31real*8              :: wln, factw, factp
[1681]32real*8              :: tmp_p, fact_t
[1663]33integer,parameter   :: nbwl_PL=328, nblev_PL=162
[1792]34real*8,save         :: ext_PL(nblev_PL,nbwl_PL), ssa_PL(nblev_PL,nbwl_PL), asf_PL(nblev_PL,nbwl_PL)
[1663]35real*8,save         :: wl_PL(nbwl_PL), press_PL(nblev_PL)
[1648]36logical,save        :: firstcall=.true.
37character(len=15)   :: dummy
38
[1792]39!$OMP THREADPRIVATE(ext_PL,ssa_PL,asf_PL,wl_PL,press_PL,firstcall)
40
[1648]41if (firstcall) then
[1663]42   print*,"We use DISR haze mean profile from P.Lavvas"
[1648]43
44! read PL table   
45! wl_PL in nm
46! press_PL in Pa
47   open(11,file=TRIM(datadir)//'/hazetable_PL_original.dat',status="old",iostat=ierr)
48   read(11,*) dummy,wl_PL
49   do i=1,nblev_PL
50     read(11,*) press_PL(i),ext_PL(i,:)  ! in cm-1
51   enddo
52   do i=1,nblev_PL
53     read(11,*) press_PL(i),ssa_PL(i,:)
54   enddo
55   do i=1,nblev_PL
56     read(11,*) press_PL(i),asf_PL(i,:)
57   enddo
58   close(11)
[1663]59   ! convert press_PL into millibar for comparison to press in the generic
[1648]60   press_PL(:)=press_PL(:)*1E-2
[1663]61   
[1648]62   firstcall=.false.
63endif
64
65! convert wno (in cm-1) into wln (nm)
66wln=1E7/wno
67
68! interpolate the needed values from the table
69
70iw=1
71do i=2,nbwl_PL
72  if(wln.gt.wl_PL(i)) then
73    iw=i
74  endif
75enddo
76
77ip=1
78do j=2,nblev_PL
79  if(press.lt.press_PL(j)) then
80    ip=j
81  endif
82enddo
83
[1663]84!----------------- Interpolate values from the hazetable  --------------------
[1681]85if (iw.ne. nbwl_PL) then
[1663]86  factw = (wln-wl_PL(iw)) / (wl_PL(iw+1)-wl_PL(iw))
[1648]87endif
[1681]88
89if (ip .ne. nblev_PL) then
[1663]90  factp = (press-press_PL(ip)) / (press_PL(ip+1)-press_PL(ip))
[1648]91endif
92
[1663]93! Lin-Log interpolation : linear on wln, logarithmic on press
94
[1681]95if((ip.ne.nblev_PL) .and. (iw.ne.nbwl_PL)) then
96
[1663]97taeros = ( ext_PL(ip,iw)*(1.-factw)   + ext_PL(ip,iw+1)  *factw ) ** (1.-factp) &
98        *( ext_PL(ip+1,iw)*(1.-factw) + ext_PL(ip+1,iw+1)*factw ) ** factp
99
100ssa    = ( ssa_PL(ip,iw)*(1.-factw)   + ssa_PL(ip,iw+1)  *factw ) ** (1.-factp) &
101        *( ssa_PL(ip+1,iw)*(1.-factw) + ssa_PL(ip+1,iw+1)*factw ) ** factp
102
103cbar   = ( asf_PL(ip,iw)*(1.-factw)   + asf_PL(ip,iw+1)  *factw ) ** (1.-factp) &
104        *( asf_PL(ip+1,iw)*(1.-factw) + asf_PL(ip+1,iw+1)*factw ) ** factp
105
[1681]106else if ((ip.ne.nblev_PL) .and. (iw.eq.nbwl_PL)) then
[1672]107
[2040]108taeros =  ext_PL(ip,iw)**(1.-factp) * ext_PL(ip+1,iw)**factp
[1681]109ssa    =  ssa_PL(ip,iw)**(1.-factp) * ssa_PL(ip+1,iw)**factp
110cbar   =  asf_PL(ip,iw)**(1.-factp) * asf_PL(ip+1,iw)**factp
[1672]111
[1681]112
[1663]113! In case of vertical extension over the max of the table
114! We take the scale height on the last 5 levels (more it's not quite log)
115! Arbitray threshold pressure value, just to deal with the last level press=0
[1681]116! We do not touch to ssa and cbar and let them at the value of last level
117! (extrap would lead to too dark aerosols)
[1663]118
[1672]119else if(ip.eq.nblev_PL) then
[1663]120
121  tmp_p = press
122
123  if ( tmp_p .lt. 1.E-15 ) then
124    tmp_p = 1.E-15
125  endif
126
[1681]127  if(iw.ne.nbwl_PL) then 
[1663]128
[1681]129     fact_t = log10( ( ext_PL(ip,iw)*(1.-factw) + ext_PL(ip,iw+1)  *factw )   &
130           / ( ext_PL(ip-5,iw)*(1.-factw) + ext_PL(ip-5,iw+1)  *factw ) )
[1792]131           
[2040]132     taeros =  ext_PL(ip,iw)*(1.-factw) + ext_PL(ip,iw+1)*factw
133     ssa    =  ssa_PL(ip,iw)*(1.-factw) + ssa_PL(ip,iw+1)*factw
134     cbar   =  asf_PL(ip,iw)*(1.-factw) + asf_PL(ip,iw+1)*factw
[1681]135
136  else if (iw.eq.nbwl_PL) then
137
[1792]138     fact_t = log10( ext_PL(ip,iw) / ext_PL(ip-5,iw) )
139   
[2040]140     taeros =  ext_PL(ip,iw)
141     ssa    =  ssa_PL(ip,iw)
142     cbar   =  asf_PL(ip,iw)
[1681]143
144  endif
145
[1663]146  fact_t = fact_t / log10( press_PL(ip) / press_PL(ip-5) )
147
148  taeros = taeros * ( tmp_p / press_PL(ip) ) ** fact_t
149
[1648]150endif
151
152taeros=taeros*dz*1.E2 ! ext in cm-1 * thickness in m * 1E2
153
154end subroutine disr_haze
Note: See TracBrowser for help on using the repository browser.