OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
matrx.f
Go to the documentation of this file.
1  subroutine matrx
2 c
3  implicit real*8 (a-h,o-z)
4  include 'afrt_rt2.cmn'
5 c***********************************************************************
6  amusq=cosmu(ii)**2
7  amumu=cosmu(ii)*cosmu(kk)
8  amups=cosmu(kk)**2
9  do l=1,jpart
10  copsi=sinmu(ii)*sinmu(kk)+cosmu(ii)*cosmu(kk)*costh(l)
11  copsq=copsi**2
12  cfisq=costh(l)**2
13  copcs=copsi*costh(l)
14  sfisq=sinth(l)**2
15  if((cosmu(kk)-cosmu(ii)).eq.0) then
16  if((l-1).eq.0) then
17  if((ii-nx).lt.0) then
18  iq=4*(ii-1)
19  else
20  iq=(nmum1-ii)*4
21  endif
22  mn=0
23  do ik=1,16
24  jp=((ik-1)/4)*4
25  ip=iq+jp/4+1
26  ir=ik-jp
27  p(ik,l)=pp(ip,ir)
28  enddo
29  call depol(l)
30  if((ii-nx).lt.0) then
31  if((l-1).eq.0) then
32  call mats(jpart+1)
33  endif
34  endif
35  else
36  call mats(l)
37  endif
38  else if((cosmu(ii)+cosmu(kk)).eq.0) then
39  if((l-jpart).eq.0) then
40  if((ii-nx).lt.0) then
41  iq=4*(ii-1)
42  else
43  iq=(nmum1-ii)*4
44  endif
45  mn=jpart*32-31
46  do ik=mn,mn+15
47  jp=((ik-mn)/4)*4
48  ip=iq+jp/4+1
49  ir=ik-jp-mn+1
50  p(ik-mn+1,l)=qq(ip,ir)
51  enddo
52  mn=mn-1
53  call depol(l)
54  if((ii-nx).lt.0) then
55  if((l-1).eq.0) then
56  call mats(jpart+1)
57  endif
58  endif
59  else
60  call mats(l)
61  endif
62  else
63  call mats(l)
64  endif
65  enddo
66  return
67  end
68 c***********************************************************************
69 c***********************************************************************
70 
71  subroutine mats(l)
72 c***********************************************************************
73  implicit real*8 (a-h,o-z)
74  include 'afrt_rt2.cmn'
75 c***********************************************************************
76  x = cosmu(ii)*cosmu(kk)+sinmu(ii)*sinmu(kk)*costh(l)
77  if(x.gt.1.0d0)x=1.0d0
78  if(x.lt.-1.0d0)x=-1.0d0
79  if(dabs(x) .lt. 1.0e-6)x=0.0
80  tf=10.0d0*(dacos(x)/conv)+1.0
81  tfm1=idint(tf+0.01d0)
82  tfp1=tfm1+1.0d0
83  if((l-jpart)>0) then
84  mt=1
85  mn=jpart*32
86  else
87  mt=tfm1
88  mn=(l-1)*32
89  endif
90  call xntpln(tf,tfm1,tfp1,t(mt,1),t(mt+1,1),tmt1)
91  call xntpln(tf,tfm1,tfp1,t(mt,2),t(mt+1,2),tmt2)
92  call xntpln(tf,tfm1,tfp1,t(mt,3),t(mt+1,3),tmt3)
93  call xntpln(tf,tfm1,tfp1,t(mt,4),t(mt+1,4),tmt4)
94  p(1,l)=cfisq*tmt1+copsq*tmt2+2.0d0*copcs*tmt3
95  p(2,l)=sfisq*(amups*tmt1+amusq*tmt2+2.0d0*amumu*tmt3)
96  p(3,l)=-sinth(l)*(cosmu(kk)*costh(l)*tmt1+cosmu(ii)*copsi*tmt2+
97  1 (cosmu(kk)*copsi+cosmu(ii)*costh(l))*tmt3)
98  p(4,l)=sinth(l)*(cosmu(kk)*copsi-cosmu(ii)*costh(l))*tmt4
99  p(5,l)=sfisq*(amups*tmt2+amusq*tmt1+2.0d0*amumu*tmt3)
100  p(6,l)=copsq*tmt1+cfisq*tmt2+2.0d0*copcs*tmt3
101  pmats=const*0.5d0*(p(1,l)+p(2,l)+p(5,l)+p(6,l))*4.0d0*pi
102  p(7,l)=sinth(l)*(cosmu(kk)*costh(l)*tmt2+cosmu(ii)*copsi*tmt1+
103  1 (cosmu(kk)*copsi+cosmu(ii)*costh(l))*tmt3)
104  p(8,l)=-p(4,l)
105  p(9,l)=2.0d0*sinth(l)*(cosmu(ii)*costh(l)*tmt1+cosmu(kk)*copsi*tmt2+
106  1 (cosmu(kk)*costh(l)+cosmu(ii)*copsi)*tmt3)
107  p(10,l)=-2.0d0*sinth(l)*(cosmu(ii)*costh(l)*tmt2+cosmu(kk)*copsi*tmt1+
108  1 (cosmu(kk)*costh(l)+cosmu(ii)*copsi)*tmt3)
109  p(11,l)=(copcs-amumu*sfisq)*(tmt1+tmt2)+(cfisq+copsq-sfisq
110  1 *(amusq+amups))*tmt3
111  p(12,l)=(cfisq-copsq-sfisq*(amusq-amups))*tmt4
112  p(13,l)=2.0d0*sinth(l)*(cosmu(ii)*copsi-cosmu(kk)*costh(l))*tmt4
113  p(14,l)=-p(13,l)
114  p(15,l)=(copsq-cfisq-sfisq*(amusq-amups))*tmt4
115  p(16,l)=(copcs+amumu*sfisq)*(tmt1+tmt2)+(cfisq+copsq+sfisq
116  1 *(amusq+amups))*tmt3
117  call depol(l)
118  return
119  end
120 c
121 c************************************************************************
122 c***********************************************************************
123 
124  subroutine depol(l)
125 c***********************************************************************
126  implicit real*8 (a-h,o-z)
127  include 'afrt_rt2.cmn'
128 c***********************************************************************
129  p(17,l)=copsq
130  p(18,l)=amusq*sfisq
131  p(19,l)=-cosmu(ii)*copsi*sinth(l)
132  p(20,l)=0.0d0
133  p(21,l)=amups*sfisq
134  p(22,l)=cfisq
135  p(23,l)=cosmu(kk)*costh(l)*sinth(l)
136  p(24,l)=0.0d0
137  p(25,l)=2.0d0*cosmu(kk)*copsi*sinth(l)
138  p(26,l)=-2.0d0*cosmu(ii)*costh(l)*sinth(l)
139  p(27,l)=-amumu*sfisq+copcs
140  p(28,l)=0.0d0
141  p(29,l)=0.0d0
142  p(30,l)=0.0d0
143  p(31,l)=0.0d0
144  p(32,l)=amumu*sfisq+copcs
145 c apply molecular depolarization correction
146  if(ipol.eq.1)then
147  do i=1,3
148  do j=1,3
149  k=16+(i-1)*4+j
150  dgm=bgm
151  if(i.eq.3 .or. j.eq.3) dgm=0.0d0
152  p(k,l)=agm*p(k,l)+dgm
153  enddo
154  enddo
155  p(32,l)=p(32,l)+cgm
156  endif
157  return
158  end
159 c
160 c************************************************************************
161 
subroutine const(NGAUSS, NMAX, MMAX, P, X, W, AN, ANN, S, SS, NP, EPS)
Definition: ampld.lp.f:924
subroutine matrx
Definition: matrx.f:2
subroutine xntpln(x, x1, x2, y1, y2, y)
Definition: xntpln.f:2
#define pi
Definition: vincenty.c:23
subroutine mats(l)
Definition: matrx.f:72
subroutine depol(l)
Definition: matrx.f:125