OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
hump.f
Go to the documentation of this file.
1  subroutine hump(const,t,tp,nm,lp,rmu,thd,ixy,nmu)
2 c
3 c***********************************************************************
4  implicit real*8(a-h,o-z)
5  real*8 t(1801,4),am(2500),cosn(2500),sn(2500),p(4,4)
6  real*8 tp(1000,4),cthr(2500),thr(2500),dmu(2500),rmu(51),thd(1801)
7 c***********************************************************************
8 c program to compute pbar for each mup when mu=mup and delfi=0
9 c
10  izia=0
11 c write(6,*)'entering hump'
12  pi=dacos(-1.0d0 )
13  conv =pi/180.0d0
14 c
15 c for debug purposes, const=alambd**2/(4*pi**2*qs)
16  do 300 i=3,4
17  do 300 j=1,2
18  p(i,j)=0.0d0
19  300 p(j,i)=0.0d0
20  dp=0.10d0
21  dt=0.10d0
22  i1=lp/2
23  fi1=i1
24  ni1=fi1/dp
25  ni1=ni1+1
26  dp=fi1/dfloat(ni1)
27  c=180-i1
28  i2=nm/2
29 c write(*,*)'i1,i2,ni1',i1,i2,ni1
30  do 2 k=1,ni1
31  fk=dfloat(k-1)*dp
32  if(ixy)60,61,60
33  60 phi=(c+fk+dp/2.0d0)*conv
34  go to 62
35  61 phi=(fk+dp/2.0d0)*conv
36 62 sn(k) = dsin(phi)
37 2 cosn(k) = dcos(phi)
38 c write(6,600) sn
39  600 format(1x,'sn',1p10e12.4)
40  deldeg=dt
41  do 7 kl=1,i2
42  deg=rmu(kl+1) - rmu(kl)
43  nodeg=deg/deldeg
44  deldeg=deg/dfloat(nodeg)
45  nodp1=nodeg+1
46  xx=deg/2.0d0
47  yy=xx-deldeg/2.0d0
48 c
49  thetd=(rmu(kl)+rmu(kl+1))/2.0d0
50  amup = dcos(thetd*conv)
51 c if(thetd .lt. 3.1d0) amup=1.0d0
52 c write(6,9988)rmu(kl),rmu(kl+1),deg,thetd,nodeg
53 9988 format('rmuk1,rmuk2,deg,thetd,nodeg',1p4e11.3,i4)
54  do 200 i=1,nodp1
55  fi=dfloat(i-1)*deldeg
56  200 cthr(i)=(thetd-xx+fi)*conv
57  do 201 i=1,nodeg
58  fi=dfloat(i-1)*deldeg
59  thr(i)=(thetd-yy+fi)*conv
60  am(i) = dcos(thr(i))
61  201 dmu(i)=dcos(cthr(i))-dcos(cthr(i+1))
62 c write(6,602)(cthr(iz)/conv,iz=1,nodp1)
63 c write(6,603)(thr(iz)/conv,iz=1,nodeg)
64 602 format('cthr',1p6e11.3)
65 603 format('thr ',1p6e11.3)
66  ddmu =dcos(rmu(kl)*conv) -dcos(rmu(kl+1)*conv)
67  amups=amup**2
68  do 40 i=1,4
69  k=(kl-1)*4+i
70  do 40 j=1,4
71  40 tp(k,j)=0.0d0
72  do 1 i=1,nodeg
73  if(ixy)500,501,500
74  500 amu=-am(i)
75  go to 502
76  501 amu=am(i)
77  502 do 90 k=1,4
78  do 90 l=1,4
79  90 p(k,l)=0.0d0
80  amusq=amu**2
81  amumu=amu*amup
82  anunu = dsqrt( (1.0d0 - amups)*(1.0d0 - amusq))
83  do 150 j=1,ni1
84  siin=sn(j)
85  coosn=cosn(j)
86  copsi=anunu+amumu*coosn
87  sifi=copsi*coosn
88  sfisq=siin**2
89  cfisq=coosn**2
90  sisq=copsi**2
91  a=amup*coosn
92  b=amup*copsi
93  c=amu*coosn
94  d=amu*copsi
95  e=sfisq*(amusq+amups)
96  g=amumu*sfisq
97  h=sfisq*(amusq-amups)
98  x=amumu+anunu*coosn
99 12 yz= dacos(x)/conv
100  yzz=10.0d0*yz
101  m=idint(yzz)+1
102  if(m.eq.0)m=1
103 c181 continue
104 c182 continue
105  ya=yz-thd(m)
106  dthd=thd(m)-thd(m+1)
107  call xntpln(yz,thd(m),thd(m+1),t(m,1),t(m+1,1),t1)
108  call xntpln(yz,thd(m),thd(m+1),t(m,2),t(m+1,2),t2)
109  call xntpln(yz,thd(m),thd(m+1),t(m,3),t(m+1,3),t3)
110  call xntpln(yz,thd(m),thd(m+1),t(m,4),t(m+1,4),t4)
111 c if(kl.le.1)then
112 c write( 6,403)m,t(m,1),t(m+1,2),t1,yz,thd(m)
113 c endif
114 c
115  p(3,3)=p(3,3)+(sifi-g)*(t1+t2)+(cfisq+sisq-e)*t3
116  p(2,2)=p(2,2)+sisq*t1+cfisq*t2+2.0d0 *sifi * t3
117  p(1,2)=p(1,2)+sfisq*(amups*t1+amusq*t2+2.0d0 * amumu *t3 )
118  p(2,1)=p(2,1)+sfisq*(amups*t2+amusq*t1+2.0d0 * amumu *t3)
119  p(1,1)=p(1,1)+cfisq*t1+sisq*t2+2.0d0 * sifi *t3
120  p(4,3)=p(4,3)+(sisq-cfisq-h)*t4
121  p(3,4)=p(3,4)+(cfisq-sisq-h)*t4
122  p(4,4)=p(4,4)+(sifi+g)*(t1+t2)+(cfisq+sisq+e)*t3
123  if(kl.eq.1)then
124 c write(6,951)t1,t2,t3,cfisq,sisq,sifi,p(1,1)
125 951 format('t1,t2,t3,cfisq,sisq,sifi,p11'/1p7e11.3)
126  endif
127  150 continue
128  do 1 k=1,4
129  kk=(kl-1)*4+k
130  do 1 l=1,4
131  ttpp1=const*p(k,1)*dmu(i)*dp/fi1
132  ttpp2=const*p(k,2)*dmu(i)*dp/fi1
133  ttpp=0.5d0*(ttpp1+ttpp2)
134  tp(kk,l)=p(k,l)*dmu(i)*dp/fi1+tp(kk,l)
135  km=kk-(kl-1)*4
136 c if(km.eq.1 .and. l.eq.1)then
137 c write(6,952)i,kk,l,dmu(i),p(k,l),tp(kk,l),ttpp
138 952 format('i,kk,l,dmu,p,tp,ttpp',3i3,1x,1p4e11.3)
139 c endif
140  1 continue
141  do 99 k=1,4
142  kk=(kl-1)*4+k
143  do 99 l=1,4
144  tp(kk,l)=tp(kk,l)/ddmu
145 c if(kk.eq.1 .and. l.eq.1)then
146 c write(6,953)kk,l,ddmu,fi1,tp(kk,l)
147 953 format('kk,l,ddmu,fi1,tp(kk,l)',2i3,1x,1p3e11.3)
148 c endif
149 99 continue
150  id=(kl-1)*4
151 c for debug purposes, const=alambd**2/(4*pi**2*qs)
152  ppbar=const*(tp(id+1,1)+tp(id+1,2)+tp(id+2,1)+tp(id+2,2))*0.5d0
153 c write(6,404)thetd,ppbar, ppbar*pi
154 c do ia=1,4
155 c ib=(kl-1)*4+ia
156 c write(6,405)(tp(ib,j),j=1,4)
157 c average value of the phase function
158 c enddo
159  7 continue
160 c write(6,*)'leaving hump'
161  if(izia.eq.1)stop
162 c***********************************************************************
163 c.....format statements.................................................
164  23 format(80a1)
165  24 format(10x,80a1)
166  25 format(1p2d18.12,1p2d19.12,0pf6.2)
167  26 format(1x,1p2d18.12,1p2d19.12,0pf6.2)
168  404 format(1x,'tp-hump..thetd,ppbar',f8.2,1p2e12.4/)
169  405 format(1p4e12.4)
170  403 format(1x,'t func',i5,1p6e11.3)
171 c***********************************************************************
172  return
173  end
174 c***********************************************************************
subroutine hump(const, t, tp, nm, lp, rmu, thd, ixy, nmu)
Definition: hump.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 xntpln(x, x1, x2, y1, y2, y)
Definition: xntpln.f:2
#define pi
Definition: vincenty.c:23