OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
rsea_new.f
Go to the documentation of this file.
1  subroutine rsea_new
2 c
3 c treat the lower boundary of the atmosphere as non lambertian
4 c surface (rough ocean surface) and reflect all incident light
5 c (diffuse and direct light)
6 c using the reflection matrix of the surface
7 c
8 c***********************************************************************
9  implicit real*8 (a-h,o-z)
10  include 'common_all.cmn'
11  real*8 fiit(4,50,46),tempa(4,50,46),tempb(4,50,46),tempc(4,50,46)
12  real*8 tss(4,50,46),temph(4,50,46),tempg(4,50,46)
13  real*8 glint_diff(4,50,46),tempd(4,50,46)
14 c***********************************************************************
15 c
16 c write(*,*)'welcome to rsea_new'
17 c initialize the buffers
18  do i=1,nmum1
19  do j=1,jpart
20  do k=1,4
21  tempa(k,i,j)=0.0d0
22  tempb(k,i,j)=0.0d0
23  tempc(k,i,j)=0.0d0
24  tempd(k,i,j)=0.0d0
25  tempg(k,i,j)=0.0d0
26  temph(k,i,j)=0.0d0
27  tss(k,i,j)=0.0d0
28  enddo
29  enddo
30  enddo
31 c total downward flux
32  call fluxlvl(fio,sumdnz,0)
33  pflx0=(eo(1)+eo(2))*bmu(kkx)
34  pflx=pflx0+sumdnz
35 c
36 c write(*,*)'pflx0,sumdnz,pflx',pflx0,sumdnz,pflx
37 
38 c
39 c contribution from the direct beam
40  do it=1,jjjj
41  itt=nmum1-it+1
42  do ip=1,jpart
43  do is=1,4
44  do k=1,4
45  ms=(is-1)*4+k
46  tempa(is,itt,ip)=tempa(is,itt,ip)+
47  1 txx(ms,ip,kkx,it)*eo(k)
48  enddo
49  enddo
50  enddo
51  enddo
52 c
53 c
54  call fluxlvl(tempa,flxtempa,1)
55 c print the upwelling radiance due to dir. flux
56 c do i=jjj,nmum1
57 c call radnce(pi,conv,bmu,the,tempa,i,jpart,jphi)
58 c enddo
59 c
60 c contribution from diffuse beam (integrate over thetaprime & phiprime)
61  do it=1,jjjj
62  itt=nmum1-it+1
63  do ip=1,jpart
64  do is=1,4
65  do itp=1,jjjj
66  sangi=dabs(dmu(itp))*ddphi
67  do ipp=1,nophi
68  jpp=ipp
69  jpx=iabs(ipp-ip)+1
70  if(ipp.gt.jpart)jpp=nophi-jpp+2
71  if(jpx.gt.jpart)jpx=nophi-jpx+2
72  do i=1,2
73  fiit(i,itp,jpp)=fio(i,itp,jpp)
74  fiit(i+2,itp,jpp)=fio(i+2,itp,jpp)
75  if(ipp.gt.jpart)fiit(i+2,itp,jpp)=
76  1 -fiit(i+2,itp,jpp)
77  enddo
78  prodt3a=0.0d0
79  do k=1,4
80  m=(is-1)*4+k
81  prodt3a=prodt3a+txx(m,jpx,itp,it)*fiit(k,itp,jpp)
82  enddo
83  tempc(is,itt,ip)=tempc(is,itt,ip)+prodt3a*sangi
84  enddo
85  enddo
86  enddo
87  enddo
88  enddo
89 c
90 
91 c save the glint contribution from the direct beam
92 c into fglint buffer
93  do i=1,nmum1
94  do j=1,jpart
95  do k=1,4
96  fglint(k,i,j)=tempa(k,i,j)
97  enddo
98  enddo
99  enddo
100 c
101  call fluxlvl(tempc,flxtempc,1)
102 c write(*,*)'flux_tempc=',flxtempc
103 c
104  do i=jjj,nmum1
105  ii=i-jjjj
106  sang=dabs(dmus2(i))*ddphi
107  do j=1,jpart
108  do k=1,4
109  tss(k,i,j)=tempa(k,i,j)+tempc(k,i,j)
110  tss(k,ii,j)=0.0d0
111  enddo
112  enddo
113  enddo
114 c
115 c compute the upwelling fluxes due to each component
116  call fluxlvl(tempa,flxza,1)
117  call fluxlvl(tempc,flxzc,1)
118  albdtot=(flxza+flxzc)/pflx
119  albrdr(ksza)=flxza/pflx
120  albrdf(ksza)=flxzc/pflx
121 c
122 c correct the upwelling radiance for foam and underwater radiances
123 c foam correction
124 c
125  call foam
126 c
127 c underwater contribution
128 c compute the upwelling radiance from the albedo of water just
129 c below the ocean surface
130  if(iwatr.eq.1)then
131  call watlev
132  endif
133 c compute the flux of the water leaving radiance
134  qsumzz=0.0d0
135  do i=jjj,nmum1
136  qsumz=0.0d0
137  do j=1,jpart
138  if(j.eq.1 .or. j.eq.jpart)then
139  qsumz=qsumz+radxi(i,j)
140  else
141  qsumz=qsumz+2.0d0*radxi(i,j)
142  endif
143  enddo
144  qsumzz=qsumzz+qsumz*dabs(dmus2(i))*ddphi
145  enddo
146  albwl(ksza)=qsumzz
147 c write(*,176)qsumzz
148 176 format('flux of the waterleavin radiance',1pe12.4)
149 c
150  do it=jjj,nmum1
151  do ip=1,jpart
152  do ks=1,4
153  if(ks.le.2)then
154  fio(ks,it,ip)=(1.0d0-fracfm)*tss(ks,it,ip)+
155  1 0.5d0*xifm+0.5d0*radxi(it,ip)
156  else
157  fio(ks,it,ip)=(1.0d0-fracfm)*tss(ks,it,ip)
158  endif
159  enddo
160  enddo
161  enddo
162 c
163  do it=jjj,nmum1
164  itp=nmum1-it+1
165  do ip=1,jpart
166  raddir(ksza,itp,ip)=tempa(1,it,ip)+tempa(2,it,ip)
167  radocn(ksza,itp,ip)=radxi(it,ip)
168  radsky(ksza,itp,ip)=tempc(1,it,ip)+tempc(2,it,ip)
169  enddo
170  enddo
171 c
172  call fluxlvl(fio,sumc,1)
173 c write(*,*)'flux above the ocean surface',sumc
174 c compute the albedo of the surface
175  sumcpi=sumc*pi
176  sumd=pflx
177 c write(*,*)'sumc,sumcpi,sumdwn,sumd',sumc,sumcpi,sumdwn,sumd
178  calb=sumc/sumd
179 c write(*,*)'surface albedo=',calb
180  return
181  end
182 c***********************************************************************
subroutine foam
Definition: foam.f:2
subroutine fluxlvl(buft, sumg, iflag)
Definition: fluxlvl.f:2
#define real
Definition: DbAlgOcean.cpp:26
subroutine rsea_new
Definition: rsea_new.f:2
#define pi
Definition: vincenty.c:23
subroutine watlev
Definition: watlev.f:2
Definition: RsViirs.h:71