OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
main.f
Go to the documentation of this file.
1 c***********************************************************************
2 c
3 c
4 c radiative transfer program (part 2)
5 c
6 c
7 c***********************************************************************
8 c.....include the common and declaration statemnets.....................
9  implicit real*8 (a-h,o-z)
10 c
11  real*8 glint_tmp(4,50,46),nrhum,nsd
12  include 'common_all.cmn'
13 c***********************************************************************
14 c
15 c
16 c get the upper and lower indices for wavelength, size dist. and
17 c optical thickness. also, flags for wind speed, foam, water leaving
18 c radiances and chlorophyll conc.
19 c
20  nrhum = 8
21  nsd = 80
22  izia=1
23 c iglint=1 !subtract the glint radiance
24  iocn=1 !wind speed in sigma of slope dist.
25  call inusr
26  if(iref.lt.2)then
27  iwnd1=1
28  iwnd2=1
29  endif
30 c
31  do 878 ilm=ilm1,ilm2,1
32  do 877 isd=isd1,isd2,1
33 c do 874 irh=irh1,irh2,1
34  do 876 itau=itau1,itau2,1
35  do 875 iwnd=iwnd1,iwnd2,1
36 
37  irh = (isd-1)*nrhum/nsd + 1
38  write(*,*) ilm, isd, irh, itau, iwnd
39 c
40 c open files and read input created in part 1 of the program
41  iwind=iwnd
42  call readin(ilm,irh,isd,itau)
43 c
44  if(icrft.eq.1)then
45  call crftlvl
46  endif
47 c
48  xlam=wvlth
49  alw=albwat(ilm)
50 c
51 c loop over solar zenith angle
52  nsza=0
53  do 5566 ksza=ithe01,ithe02,1
54  isza=ksza-ithe01+1
55  msza(isza)=ksza
56  nsza=nsza+1
57  call iniclz
58  call angl
59  if(isza.eq.1)then
60  call hdrmds(ithe01,ithe02)
61  endif
62 c
63 c if ipsudo=1 then determine optical path length for
64 c spherical atmosphere
65  if(ipsudo.eq.1)then
66  call spathz(amuo,htp,taur,taum,tauabs,totsp,nmodl)
67  endif
68 c
69 c determine an average value of phase matrix in the forward/
70 c backward direction
71  if(ifc.eq.1)then
72  call hump (const,t,pp,nmum1,lphi,rmu,thd,0,nmu)
73  call hump (const,t,qq,nmum1,lphi,rmu,thd,1,nmu)
74  endif
75 c
76 c print summry of the input parameters
77 c call summry
78 c
79 c if iref=2 then read the rough ocean input created in
80 c part 1 of the program
81 c
82 c if(itrans.eq.1)then
83 c call anglw
84 c endif
85 c
86  if(iref .eq.2)then
87  read(19)xrw,xiw,vz,mtha,mphi
88  call anglw
89  endif
90 c
91 c compute the attenuation parameters
92  call attenew
93 c
94 c compute the scattering phase matrices (rayleigh/aerosol)
95  call phase
96 c
97 c begin radiative transfer calculations
98 c
99  ibgn=1
100  iend=1
101  if(nsza.eq.1 .and. (iref.eq.0 .or. itrans.eq.1) )then
102  iend=2
103  endif
104 c
105 c illumination from the top of the atmosphere(kzz=1)
106 c illumination from the bottom of the atmosphere(kzz=2)
107 c
108  do 20 kzz=ibgn,iend,1
109  jpass=1
110  nump=npass1
111  call iniclz2
112  if(nsza.eq.1 .and. (iref.eq.0 .or. itrans.eq.1) )then
113  nump=npass2
114  endif
115  if(kzz.eq.1)then
116  call single
117  minitr=4
118  endif
119  if(kzz.eq.2 .and. iref.eq.0)then
120  call grefl
121  call snglup
122  minitr=4
123  endif
124  if(kzz.eq.2 .and. itrans.eq.1)then
125  call focn_below
126  call snglup
127  minitr=4
128  endif
129 c
130  call getrad
131 c
132  do 15 ka=1,nump
133 c initialize the disk units
134  kdx=ka-(ka/2)*2
135  if(kdx.eq.1)then
136  irad=64
137  iwrt=65
138  else
139  irad=65
140  iwrt=64
141  endif
142  if(kzz.eq.1)then
143  call multp1d
144  elseif(kzz.eq.2 .and. iref.eq.0)then
145  call multp2d
146  elseif(kzz.eq.2 .and. itrans.eq.1)then
147  call multp2d_trans
148  endif
149  jpass=jpass+1
150  call getrad
151  call contst
152  call fiotb
153  if(iactflx.eq.1)then
154  call actflx
155  endif
156  if(jpass.ge.minitr)then
157  if(d3.le.0.1 .or. jpass.ge.20)goto 17
158  endif
159  15 continue
160  17 continue
161 c
162  if(kzz.eq.1 .and. iglint.eq.1)then
163  do k=1,4
164  do i=jjj,nmum1
165  do j=1,jpart
166  glint_tmp(k,i,j)=fglint(k,i,j)*
167  1 dexp(-tautot/dabs(bmu(i)))
168  enddo
169  enddo
170  enddo
171 c if(kzz .eq.2)then
172 c do i=jjj,nmum1
173 c call radnce(pi,conv,bmu,the,fio,i,jpart,jphi)
174 c enddo
175 c endif
176  endif
177 c
178  call geocor
179  if(icrft.eq.1)then
180  call crftgcr
181  endif
182 c
183  if(iactflx.eq.1)then
184  call actfgrc
185  endif
186 c
187  if(isurf.eq.1)then
188  call surfgcr
189  endif
190 c
191 c illumination brom botom is done only once
192  if(kzz.eq.2)goto 30
193 20 continue
194 c
195 30 continue
196 c
197  rewind 21
198  if (ifc.eq.1) then
199  rewind 5
200  endif
201  rewind 11
202  rewind 12
203  rewind 18
204  rewind 19
205 c
206 5566 continue
207 c
208 c create output datasets for upwelling and downwelling radiances
209 c leaving the top and bottom of the atmosphere
210 c
211  if(iref.eq.1 .and. itrans.eq.1)then
212  call outdt_trans
213  endif
214 c
215  if((iref.eq.1 .or. iref.eq.2 .or. iref.eq.3) .and.itrans.eq.0)then
216  call outdty
217  if(icrft.eq.1)then
218  call outcrfty
219  endif
220  if(iactflx.eq.1)then
221  call outactfy
222  endif
223  if(isurf.eq.1)then
224  call outsurfy
225  if(iref.eq.2)then
226 c call outsurfdir
227  call outsurfocn
228 c call outsurfsky
229  endif
230  endif
231  endif
232 c
233  if(iref.eq.0 .and.itrans.eq.0)then
234  call outdtz
235  if(icrft.eq.1)then
236  write(*,*)'ready to call outcrftz'
237  call outcrftz
238  endif
239  if(iactflx.eq.1)then
240  call outactfz
241  endif
242  endif
243 c
244 c close the temp files
245 c
246  call closeunits
247  call closemore
248 c
249 875 continue
250 876 continue
251 874 continue
252 877 continue
253 878 continue
254 c
255 c**********************************************************************
256 c format statements
257 355 format( t10,'fresnel reflection (by a rough surface)',1x,
258  1 'at the lower boundary '/ t10,'refractive index',t45,'=',1pe15.5,
259  2 '-',1pe15.5,'i' / t10,'velocity',t45,'=', 1pe15.5,'meter/sec'/)
260 c***********************************************************************
261  end
262 c**********************************************************************
subroutine actflx
Definition: actflx.f:2
subroutine multp2d_trans
Definition: multp2d_trans.f:2
subroutine attenew
Definition: attenew.f:2
subroutine hump(const, t, tp, nm, lp, rmu, thd, ixy, nmu)
Definition: hump.f:2
subroutine closeunits
Definition: closeunits.f:2
subroutine focn_below
Definition: focn_below.f:2
subroutine outactfz(tmf1, tmf2)
Definition: outactfz.f:2
subroutine fiotb
Definition: fiotb.f:2
subroutine anglw
Definition: anglw.f:2
subroutine grefl
Definition: grefl.f:2
subroutine snglup
Definition: snglup.f:2
subroutine angl
Definition: angl.f:2
subroutine readin(ilm, irh, isd, itau)
Definition: readin.f:2
subroutine spathz(amu0, htp, taur, taum, taua, totsp, nmodl)
Definition: spathz.f:2
subroutine hdrmds(nthe01, nthe02, ebfr1)
Definition: hdrmds.f:2
#define real
Definition: DbAlgOcean.cpp:26
subroutine const(NGAUSS, NMAX, MMAX, P, X, W, AN, ANN, S, SS, NP, EPS)
Definition: ampld.lp.f:924
subroutine multp2d
Definition: multp2d.f:2
subroutine contst
Definition: contst.f:2
subroutine surfgcr
Definition: surfgcr.f:2
subroutine outdtz(otupz, oxzeroz, otdwnz, oxzerod)
Definition: outdtz.f:2
subroutine outsurfy(osurfzu)
Definition: outsurfy.f:2
subroutine geocor
Definition: geocor.f:2
subroutine inusr
Definition: inusr.f:2
subroutine multp1d
Definition: multp1d.f:2
subroutine outdty(oxzeroz, oxzerod)
Definition: outdty.f:2
subroutine outactfy(tmf1)
Definition: outactfy.f:2
subroutine outsurfocn(oradocn)
Definition: outsurfocn.f:2
subroutine crftgcr
Definition: crftgcr.f:2
subroutine single
Definition: single.f:2
subroutine phase
Definition: phase.f:2
subroutine iniclz2
Definition: iniclz2.f:2
subroutine iniclz
Definition: iniclz.f:2
subroutine outcrftz(tmcfd, tmcfu, ocrfttup, ocrftzu, ocrfttdn, ocrftzd)
Definition: outcrftz.f:2
subroutine outdt_trans(transm, oxzeroz)
Definition: outdt_trans.f:2
subroutine crftlvl
Definition: crftlvl.f:2
subroutine getrad
Definition: getrad.f:2
subroutine actfgrc
Definition: actfgrc.f:2
subroutine closemore
Definition: closemore.f:2
subroutine outcrfty(tmcfd, tmcfu, ocrftzu, ocrftzd)
Definition: outcrfty.f:2