1 | subroutine disr_haze(dz,press,wno,taeros,ssa,cbar) |
---|
2 | use datafile_mod, only: datadir |
---|
3 | IMPLICIT NONE |
---|
4 | |
---|
5 | real*8,intent(in) :: dz,press,wno |
---|
6 | real*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 | |
---|
14 | integer :: i,j,iw,ip,ierr |
---|
15 | real*8 :: wln,factw,factp |
---|
16 | integer,parameter :: nbwl_PL=328,nblev_PL=162 |
---|
17 | real*8,save :: ext_PL(nblev_PL,nbwl_PL),ssa_PL(nblev_PL,nbwl_PL) |
---|
18 | real*8,save :: asf_PL(nblev_PL,nbwl_PL) |
---|
19 | real*8,save :: wl_PL(nbwl_PL),press_PL(nblev_PL) |
---|
20 | logical,save :: firstcall=.true. |
---|
21 | character(len=15) :: dummy |
---|
22 | |
---|
23 | if (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. |
---|
46 | endif |
---|
47 | |
---|
48 | ! convert wno (in cm-1) into wln (nm) |
---|
49 | wln=1E7/wno |
---|
50 | |
---|
51 | ! interpolate the needed values from the table |
---|
52 | |
---|
53 | iw=1 |
---|
54 | do i=2,nbwl_PL |
---|
55 | if(wln.gt.wl_PL(i)) then |
---|
56 | iw=i |
---|
57 | endif |
---|
58 | enddo |
---|
59 | |
---|
60 | ip=1 |
---|
61 | do j=2,nblev_PL |
---|
62 | if(press.lt.press_PL(j)) then |
---|
63 | ip=j |
---|
64 | endif |
---|
65 | enddo |
---|
66 | |
---|
67 | if(iw.ne.nbwl_PL) then |
---|
68 | factw=(wln-wl_PL(iw))/(wl_PL(iw+1)-wl_PL(iw)) |
---|
69 | endif |
---|
70 | if(ip.ne.nblev_PL) then |
---|
71 | factp=(log10(press)-log10(press_PL(ip)))/(log10(press_PL(ip+1))-log10(press_PL(ip))) |
---|
72 | else |
---|
73 | ! factp=(log10(press)-log10(press_PL(nblev_PL)))/(log10(1.e-10)-log10(press_PL(nblev_PL))) |
---|
74 | factp=0. |
---|
75 | endif |
---|
76 | |
---|
77 | if ((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 |
---|
84 | else 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 |
---|
88 | else 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) |
---|
95 | else 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) |
---|
99 | endif |
---|
100 | |
---|
101 | taeros=taeros*dz*1.E2 ! ext in cm-1 * thickness in m * 1E2 |
---|
102 | |
---|
103 | end subroutine disr_haze |
---|