OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
multp1d.f
Go to the documentation of this file.
1  subroutine multp1d
2 c
3 c compute the multiple scattering contribution when the atmosphere is
4 c illuminated from the top. also, for each level, store the
5 c upwelling/downwelling diffuse radiation.
6 c
7 c*************************************************************************
8 c.....includes the common blocks
9  implicit real*8 (a-h,o-z)
10  include 'afrt_rt2.cmn'
11 c
12 c**************************************************************************
13 c
14 c compute the downward diffuse radiation at each level
15 c
16  do i=1,4
17  do j=1,2*nsz
18  do k=1,nph
19  sngla(i,j,k) = 0.0
20  snglb(i,j,k) = 0.0
21  enddo
22  enddo
23  enddo
24 
25  isng=53
26  read(irad,rec=1)fiib
27  write(iwrt,rec=1)fiib
28  do il=1,nolyr
29  ilp=il+1
30  ilm=il-1
31  if(il.eq.1)then
32  read(iwrt,rec=il)fiib
33  read(irad,rec=ilp)fio
34  read(isng,rec=il)sngla
35  read(isng,rec=ilp)snglb
36 c determine average intensity at the center of the layer il
37  do i=1,nmum1
38  do j=1,jpart
39  do k=1,4
40  fiic(k,i,j)=0.50d0*(fio(k,i,j)+fiib(k,i,j))
41  ftmp(k,i,j)=0.0d0
42  enddo
43  enddo
44  enddo
45  tmsl=dtmm(il)*qsqt*const
46  trsl=dtrr(il)*conr
47  dlyr=dtot(il)
48  if(ifc.eq.0)tmsl=0.0d0
49  call mdiffn(1,nx-1,il,dlyr)
50  do i=1,nx-1
51  do j=1,jpart
52  do k=1,4
53  fio(k,i,j)=fiib(k,i,j)*emdtm(il,i)+
54  1 ftmp(k,i,j)*(1.0d0-emdtm(il,i))+
55  2 snglb(k,i,j)-sngla(k,i,j)*emdtm(il,i)
56  enddo
57  enddo
58  enddo
59  write(iwrt,rec=ilp)fio
60  else
61  read(iwrt,rec=ilm)fiib
62  read(isng,rec=ilm)sngla
63  read(isng,rec=ilp)snglb
64  do i=1,nmum1
65  do j=1,jpart
66  do k=1,4
67  fiic(k,i,j)=fio(k,i,j)
68  ftmp(k,i,j)=0.0d0
69  enddo
70  enddo
71  enddo
72  read(irad,rec=ilp)fio
73  tmsl=(dtmm(ilm)+dtmm(il))*qsqt*const
74  trsl=(dtrr(ilm)+dtrr(il))*conr
75  dlyr=(dtot(ilm)+dtot(il))
76  if(ifc.eq.0)tmsl=0.0d0
77  call mdiffn(1,nx-1,il,dlyr)
78  do i=1,nx-1
79  do j=1,jpart
80  do k=1,4
81  fio(k,i,j)=fiib(k,i,j)*emdtm(ilm,i)*emdtm(il,i)+
82  1 ftmp(k,i,j)*(1.0d0-emdtm(ilm,i)*emdtm(il,i))+
83  2 snglb(k,i,j)-sngla(k,i,j)*emdtm(ilm,i)*emdtm(il,i)
84  enddo
85  enddo
86  enddo
87  write(iwrt,rec=ilp)fio
88 c
89  endif
90  enddo
91 c
92  if(iref.eq.1)then
93  call fltocn_new
94  write(iwrt,rec=nolyr+1)fio
95  endif
96 
97  if(iref.eq.2)then
98 c call rsea_new
99  if(iocn.eq.1) then
100  call rsea_new
101  else
102 c call RSEA
103  endif
104  write(iwrt,rec=nolyr+1)fio
105  endif
106 c
107  if(iref.eq.3)then
108  call brdfg(fio,brdfx,cosmu,dcmu,dcmusq,eo,ddphi,amuo,pi,sumc,
109  1 sumcpi,sumdwn,calb,kkx,nx-1,nmum1,jpart)
110  write(iwrt,rec=nolyr+1)fio
111  endif
112 c
113 c compute the upward diffuse radiation at each level
114 c
115  do il=1,nolyr
116  im=nolyr-il+1
117  imp=im+1
118  impp=imp+1
119  if(il.eq.1)then
120  read(iwrt,rec=imp)fiib
121  read(iwrt,rec=im)fio
122  read(isng,rec=imp)sngla
123  read(isng,rec=im)snglb
124  do i=1,nmum1
125  do j=1,jpart
126  do k=1,4
127  fiic(k,i,j)=0.50d0*(fio(k,i,j)+fiib(k,i,j))
128  ftmp(k,i,j)=0.0d0
129  enddo
130  enddo
131  enddo
132  tmsl=dtmm(im)*qsqt*const
133  trsl=dtrr(im)*conr
134  dlyr=dtot(im)
135  if(ifc.eq.0)tmsl=0.0d0
136  call mdiffn(nx,nmum1,im,dlyr)
137  do i=nx,nmum1
138  do j=1,jpart
139  do k=1,4
140  fio(k,i,j)=fiib(k,i,j)*emdtm(im,i)+
141  1 ftmp(k,i,j)*(1.0d0-emdtm(im,i))+
142  2 snglb(k,i,j)-sngla(k,i,j)*emdtm(im,i)
143  enddo
144  enddo
145  enddo
146  write(iwrt,rec=im)fio
147  else
148  read(iwrt,rec=impp)fiib
149  read(isng,rec=impp)sngla
150  read(isng,rec=im)snglb
151  do i=1,nmum1
152  do j=1,jpart
153  do k=1,4
154  fiic(k,i,j)=fio(k,i,j)
155  ftmp(k,i,j)=0.0d0
156  enddo
157  enddo
158  enddo
159  read(iwrt,rec=im)fio
160  tmsl=(dtmm(imp)+dtmm(im))*qsqt*const
161  trsl=(dtrr(imp)+dtrr(im))*conr
162  dlyr=(dtot(imp)+dtot(im))
163  if(ifc.eq.0)tmsl=0.0d0
164  call mdiffn(nx,nmum1,im,dlyr)
165  do i=nx,nmum1
166  do j=1,jpart
167  do k=1,4
168  fio(k,i,j)=fiib(k,i,j)*emdtm(imp,i)*emdtm(im,i)+
169  1 ftmp(k,i,j)*(1.0d0-emdtm(imp,i)*emdtm(im,i))+
170  2 snglb(k,i,j)-sngla(k,i,j)*emdtm(imp,i)*emdtm(im,i)
171  enddo
172  enddo
173  enddo
174  write(iwrt,rec=im)fio
175 c
176  endif
177  enddo
178 c
179  return
180  end
181 c
182 c************************************************************************
subroutine brdfg(fio, brdfx, bmu, dmu, dmus2, eo, ddphi, amuo, pi, sumc, sumcpi, sumdwn, calb, kkx, nx, nmum1, jpart)
Definition: brdfg.f:3
subroutine fltocn_new
Definition: fltocn_new.f:2
subroutine const(NGAUSS, NMAX, MMAX, P, X, W, AN, ANN, S, SS, NP, EPS)
Definition: ampld.lp.f:924
subroutine mdiffn(ib, ie, il, dlyr)
Definition: mdiffn.f:2
subroutine multp1d
Definition: multp1d.f:2
subroutine rsea_new
Definition: rsea_new.f:2
#define pi
Definition: vincenty.c:23
Definition: RsViirs.h:71