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

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

Modifications to custom radiative transfer to Titan
+ Enables an altitude dependant gfrac for CIA computations

-> many radical changes in su_gases and co ..
-> read vertical CH4 profile with call_profilgases
-> Now you need a 'profile.def' that I will add in the deftank

+ Added interpolate CIA routines for CH4
+ Added temporary mean aerosol profile opacity routine (disr_haze)

File size: 3.2 KB
Line 
1subroutine disr_haze(dz,press,wno,taeros,ssa,cbar)
2use datafile_mod, only: datadir
3IMPLICIT NONE
4
5real*8,intent(in)   :: dz,press,wno
6real*8,intent(inout):: taeros,ssa,cbar
7
8!---------------------------
9! Attention !!
10! taeros is the integrated extinction over the layer
11! (extinction * thickness of layer)
12!---------------------------
13
14integer             :: i,j,iw,ip,ierr
15real*8              :: wln,factw,factp
16integer,parameter   :: nbwl_PL=328,nblev_PL=162
17real*8,save         :: ext_PL(nblev_PL,nbwl_PL),ssa_PL(nblev_PL,nbwl_PL)
18real*8,save         :: asf_PL(nblev_PL,nbwl_PL)
19real*8,save         :: wl_PL(nbwl_PL),press_PL(nblev_PL)
20logical,save        :: firstcall=.true.
21character(len=15)   :: dummy
22
23if (firstcall) then
24   print*,"DISR HAZE - PANAYOTIS LAVVAS"
25
26
27! read PL table   
28! wl_PL in nm
29! press_PL in Pa
30   open(11,file=TRIM(datadir)//'/hazetable_PL_original.dat',status="old",iostat=ierr)
31   read(11,*) dummy,wl_PL
32   do i=1,nblev_PL
33     read(11,*) press_PL(i),ext_PL(i,:)  ! in cm-1
34   enddo
35   do i=1,nblev_PL
36     read(11,*) press_PL(i),ssa_PL(i,:)
37   enddo
38   do i=1,nblev_PL
39     read(11,*) press_PL(i),asf_PL(i,:)
40   enddo
41   close(11)
42   ! convert press_PL into millibar for comparison to press in the generic (wtf press in mbar but ok ... to be modified at some point anyway)
43   press_PL(:)=press_PL(:)*1E-2
44
45   firstcall=.false.
46endif
47
48! convert wno (in cm-1) into wln (nm)
49wln=1E7/wno
50
51! interpolate the needed values from the table
52
53iw=1
54do i=2,nbwl_PL
55  if(wln.gt.wl_PL(i)) then
56    iw=i
57  endif
58enddo
59
60ip=1
61do j=2,nblev_PL
62  if(press.lt.press_PL(j)) then
63    ip=j
64  endif
65enddo
66
67if(iw.ne.nbwl_PL) then
68  factw=(wln-wl_PL(iw))/(wl_PL(iw+1)-wl_PL(iw))
69endif
70if(ip.ne.nblev_PL) then
71  factp=(log10(press)-log10(press_PL(ip)))/(log10(press_PL(ip+1))-log10(press_PL(ip)))
72else
73!  factp=(log10(press)-log10(press_PL(nblev_PL)))/(log10(1.e-10)-log10(press_PL(nblev_PL)))
74  factp=0.
75endif
76
77if ((iw.ne.nbwl_PL).and.(ip.ne.nblev_PL)) then
78  taeros= ext_PL(ip,iw)  *(1-factw)*(1-factp)+ext_PL(ip+1,iw)  *(1-factw)*factp &
79         +ext_PL(ip,iw+1)*factw    *(1-factp)+ext_PL(ip+1,iw+1)*factw    *factp
80  ssa   = ssa_PL(ip,iw)  *(1-factw)*(1-factp)+ssa_PL(ip+1,iw)  *(1-factw)*factp &
81         +ssa_PL(ip,iw+1)*factw    *(1-factp)+ssa_PL(ip+1,iw+1)*factw    *factp
82  cbar  = asf_PL(ip,iw)  *(1-factw)*(1-factp)+asf_PL(ip+1,iw)  *(1-factw)*factp &
83         +asf_PL(ip,iw+1)*factw    *(1-factp)+asf_PL(ip+1,iw+1)*factw    *factp
84else if ((iw.eq.nbwl_PL).and.(ip.ne.nblev_PL)) then
85  taeros= ext_PL(ip,iw)*(1-factp)+ext_PL(ip+1,iw)*factp
86  ssa   = ssa_PL(ip,iw)*(1-factp)+ssa_PL(ip+1,iw)*factp
87  cbar  = asf_PL(ip,iw)*(1-factp)+asf_PL(ip+1,iw)*factp
88else if ((iw.ne.nbwl_PL).and.(ip.eq.nblev_PL)) then
89  taeros= ext_PL(ip,iw)  *(1-factw)*(1-factp) &
90         +ext_PL(ip,iw+1)*factw    *(1-factp)
91  ssa   = ssa_PL(ip,iw)  *(1-factw)*(1-factp) &
92         +ssa_PL(ip,iw+1)*factw    *(1-factp)
93  cbar  = asf_PL(ip,iw)  *(1-factw)*(1-factp) &
94         +asf_PL(ip,iw+1)*factw    *(1-factp)
95else if ((iw.eq.nbwl_PL).and.(ip.eq.nblev_PL)) then
96  taeros= ext_PL(ip,iw)*(1-factp)
97  ssa   = ssa_PL(ip,iw)*(1-factp)
98  cbar  = asf_PL(ip,iw)*(1-factp)
99endif
100
101taeros=taeros*dz*1.E2 ! ext in cm-1 * thickness in m * 1E2
102
103end subroutine disr_haze
Note: See TracBrowser for help on using the repository browser.