6 SUBROUTINE af_ocn_read(infile,nww,iopt,isig,isolz,nsza,nthe,nphi,nsig,
7 1 ibgn,iend,dlth,dlph,xr,xi,v,thcel,phcel,wav,tha,sig_hg,solz)
11 implicit real*8(a-h,o-z)
12 integer*4 nww,iopt,isig,isolz,nsza,nthe,nphi,nsig,ibgn,iend
13 integer*4 izx(2),iwav(20)
14 real*8 dlth,dlph,xr,xi,v,thcel,phcel
15 real*8 wav(nw),tha(nth),sig_hg(nsg),solz(25)
19 len1=
index(infile,
' ')-1
25 open(unit=3,file=infile(1:len1),status=
'old')
29 read(3,24) iopt,nww,ibgn,iend,isig,isolz
37 nphi=180.0d0/dlph+2.0d0+0.01d0
40 read(3,26) xr,xi,v,thcel,phcel
43 read(3,15)(wav(i),i=1,nww)
45 read(3,16)nthe,(tha(i),i=1,nthe)
47 read(3,35)nsig,(sig_hg(i),i=1,nsg)
49 iwav(i)=int((wav(i)+0.0001)*1000.0 )
53 read(3,16)nsolz,(solz(i),i=1,nsolz)
66 26
format(2e10.3,4f10.4)
70 30
format(1x,2i3,1p8d15.4/1x,6x,1p8d15.4/)
72 500
format(1x,f6.2,1x,f6.2,2x,1p4d11.3,1x,1p3d11.3,1x,1p2d11.3)
74 510
format(
'Cox-Monk Rough Ocean (Wind Direction Independent)'/
75 1
'wind speed (m/sec)'/f10.2)
79 SUBROUTINE af_ocn_process(outdir,alam,asig,iopt,isig,isolz,insza,inthe,inphi,
80 1 dlth,dlph,xr,xi,v,thcel,phcel,wav,tha,sig_hg,solz,iprob,othp,ophcnd,othcnd,
81 2 otxx,opti,oxin1pi,oxi_hgpi,oxin2pi,oxin2top)
83 include
'afrt_ocn.cmn'
85 implicit real*8(a-h,o-z)
86 integer*4 iopt,isig,isolz,insza,inthe,inphi,alam,asig
87 real*8 dlth,dlph,xr,xi,v,thcel,phcel,wav(nw),tha(nth),sig_hg(nsg)
88 real*8 ez(nsam),pha(nph+1),thp(nth),phcnd(nph),thcnd(nth),solz(25
89 real*8 ftrx(ntrx,nth,nph),pti(npti,nth,nph)
90 real*8 xz(3),athcnd(nth),aphcnd(nph)
91 real*8 othp(nsz),othcnd(nth),ophcnd(nph)
92 real*8 otxx(ntrx,nph,nth,nsz),opti(npti,nph,nth,nsz)
93 real*8 oxin1pi(nph,nth,nsz),oxi_hgpi(nph,nth,nsz),
94 1 oxin2pi(nph,nth,nsz),oxin2top(nph,nth,nsz)
95 real*8 txin1pi(nth,nph),txi_hgpi(nth,nph),txin2pi(nth,nph),
97 integer*4 izx(2),iwav(nw),nloop
100 data ez/0.5d0,0.5d0,0.0d0,0.0d0/
113 len2=
index(outdir,
' ')-1
121 iwav(i)=int((wav(i)+0.0001)*1000.0 )
130 nphi=180.0d0/dlph+2.0d0+0.01d0
134 call rtang(tha,pha,thcnd,phcnd,thp,dlth,dlph,intha,nphi,
135 1 nthcnd,nphcnd,nthp,nloop)
139 jwave=wav(ii)*1.0d3+0.01
141 v=sig_hg(mm)**2/5.34d-3
144 call riwat(wav(ii),xsal,xr,xi)
151 call convtc(iwav(ii),4,xwc)
152 call convtc(isolz,2,solzc)
155 1 outdir(1:len2)//
'/ol'//xw//
'x'//vc//
'solz'//solzc//
'.dat',
158 1 outdir(1:len2)//
'/sumrywl'//xwc//
'x'//vc//
'solz'//solzc//
'.dat',
159 2 status=
'unknown',convert=
'big_endian')
161 1 outdir(1:len2)//
'/rufrtwl'//xwc//
'x'//vc//
'solz'//solzc//
'.dat',
162 2 access=
'sequential',form=
'unformatted',
163 3 status=
'unknown',convert=
'big_endian')
182 write (20) xz,izx,athcnd,aphcnd
187 amuo=dcos(thp(k)*con)
188 call rufocn(ez,thp(k),phip,xr,xi,v,pha,tha,phcnd,
189 1 thcnd,thcel,phcel,opt,ftrx,pti,
pi,con,
190 2 ntha,nphi,iprob,nthcnd,nphcnd,
191 3 txin1pi,txi_hgpi,txin2pi,txin2top)
193 write (20) thetap,ftrx,pti
199 opti(i,jt,k,it) = pti(i,it,jt)
202 otxx(i,jt,k,it) = ftrx(i,it,jt)
204 oxin1pi(jt,it,k) = txin1pi(it,jt)
205 oxi_hgpi(jt,it,k) = txi_hgpi(it,jt)
206 oxin2pi(jt,it,k) = txin2pi(it,jt)
207 oxin2top(jt,it,k) = txin2top(it,jt)
217 510
format(
'Cox-Monk Rough Ocean (Wind Direction Independent)'/
218 1
'wind speed (m/sec)'/f10.2)
225 subroutine probl(zx,zy,v,prob,pi,sig,iprob)
226 implicit real *8(a-h),
real*8(o-z)
231 go to(100,150,200),iprob
239 sigsqx = 0.003d0 + 5.12d-3 *v
245 sigsqx = 0.003d0 + 1.92d-3*v
250 if(dabs(zx ) .lt. 1.0d-06) zx =0.0d0
251 if(dabs(zy ) .lt. 1.0d-06) zy =0.0d0
257 pqr= -dlog( aaa*
pi*sigx*sigy*1.0d-6)
258 eee=(zeta**2 + eata**2 )/aaa
259 if(eee .gt. pqr)
go to 81
262 if(iprob .eq.1 .or. iprob .eq.2)
go to 300
265 c21 = 0.01d0 - 0.0086d0 * v
266 c03 = 0.04d0 - 0.033d0 * v
271 c1 = c21*(zeta**2-1.0d0)*eata *0.5d0
272 c2 = (c03*(eata**3 -3.0d0*eata))/6.0d0
273 c3 = (c40*( zeta**4 - 6.0d0*zeta**2 + 3.0d0))/24.0d0
274 c4 = ( c22*(zeta**2-1.0d0)*(eata**2-1.0d0))/4.0d0
275 c5 = (c04 * (eata**4 - 6.0d0*eata**2 + 3.0d0) )/24.0d0
278 csum = -c1-c2+c3+c4+c5
280 prob1 = dexp(-(zeta**2 + eata**2)/aaa)/( aaa*
pi*sigx*sigy)
281 prob = prob1*(1.0d0+csum)
289 subroutine rufocn(ei,thpd,phpd,xr,xi,v,pha,tha,phcnd,thcnd,
290 1 thcel,phcel,opt, ftrx,pti,pi,con,ntha,nphi,iprob,
291 2 nthcnd,nphcnd,txin1pi,txi_hgpi,txin2pi,txin2top)
293 include
'afrt_ocn.cmn'
294 implicit real*8(a-h),
real*8(o-z)
296 real*8 ftrx(16,nth,nph),pti(8,nth,nph),a(6)
297 real*8
ei(4),zint(4,nth,nph),zmio(4),tha(nth),pha(nph+1),thx(15),
298 1 phx(35),
rint(4,nth,nph),phsl(3),thsl(3),sang(nth,nph),snside(5),
299 2 phnl(3,3),thnl(3,3),coside(5),side(5),cosang(6),angtri(6),
300 3 tmio(4),xint(4),tzm(4,4),tint(4,4),phcnd(nph),apti(4),thcnd(nth),
301 4 frac(10),axz(16),amul(2),amulsq(2),xi_hgcnt(nth,nph)
302 real*8 txin1pi(nth,nph),txi_hgpi(nth,nph),txin2pi(nth,nph),
305 data frac/0.0d0,0.1d0,0.2d0,0.3d0,0.4d0,0.5d0,0.6d0,
317 sinthp=dsqrt(1.0d0-costhp**2)
329 sthcnt=dsqrt(1.0d0-cthcnt**2)
339 thx(i1)=thx(i1-1)+thcel
340 dif1 = dabs(tha(ii+1) - thx(i1) )
341 if(dif1 .lt. 1.0d-6 .or. thx(i1) .gt. tha(ii+1) )
go to 101
353 sphcnt=dsqrt(1.0d0-cphcnt**2)
356 sang3=(dcos(tha(ii)*con)-dcos(tha(ii+1)*con))*
357 1 (pha(jj+1)-pha(jj))*con
373 phx(i2)=phx(i2-1)+phcel
374 dif2 = dabs(pha(jj+1) - phx(i2) )
375 if( dif2 .lt. 1.0d-10 .or. phx(i2) .gt. pha(jj+1) )
goto 104
383 phx(i2+1)=phcntd-phcel/2.0d0
384 phx(i2+2)=phcntd+phcel/2.0d0
385 thx(i1+1)=thcntd-thcel/2.0d0
386 thx(i1+2)=thcntd+thcel/2.0d0
394 if(mmnn .eq.1)
goto 260
411 do 10 i=limth1,limth2
412 thsd = (thx(i)+thx(i+1))/2.0d0
413 if(thx(i) .lt. 0.0d0) thx(i)=0.0d0
415 thsl(2) = thx(i+1)*con
419 sinths=dsqrt(1.0d0-cosths**2)
420 amul(1) = dcos(thsl(1))
421 amul(2) = dcos(thsl(2))
422 amulsq(1) = amul(1) ** 2
423 amulsq(2) = amul(2) ** 2
426 do 11 j=limfi1,limfi2
432 phsd = (phx(j)+phx(j+1))/2.0d0
433 if(phx(j+1) .gt. 180.0d0) phx(j+1)=180.0d0
434 if(phx(j) .lt. 0.0d0)phx(j)=0.0d0
436 phsl(2) = phx(j+1)*con
439 delphi = phsl(2)-phsl(1)
447 if(thpd .gt. 1.0d-3)
go to 74
452 domgan=(dcos(thnl1)-dcos(thnl2) )*(phsl(2)-phsl(1))
453 sang(i,j)=(dcos(thsl(1))-dcos(thsl(2)))*
455 thnl(3,3)=thsl(3)/2.0d0
459 if(thsd .gt.1.0d-3)
go to 75
460 call solidz(thp,php,thsl,phsl,domgan,sang(i,j),con)
470 sang(i,j)=(dcos(thx(i)*con)-dcos(thx(i+1)*con))*
471 1 (phx(j+1)-phx(j))*con
479 if(iy .eq. 3 .and. ix .ne. 3)
go to 32
480 if(ix .eq. 3 .and. iy .ne. 3)
go to 32
482 sthsl=dsqrt(1.0d0-cthsl**2)
486 cos_scat=-costhp*cthsl+sinthp*sthsl*dcos(php-phsl(iy))
488 if(costwo.ge.1.0d0)costwo=1.0d0
489 if(costwo.le. -1.0d0)costwo=-1.0d0
490 sintwo=dsqrt(1.0d0-costwo**2)
491 scath = 0.5d0*dacos(costwo)
493 if(cscath.ge.1.0d0)cscath=1.0d0
494 if(cscath.le. -1.0d0)cscath=-1.0d0
495 sscath=dsqrt(1.0d0-cscath**2)
497 diff =dabs(php-phsl(iy))
498 cons = dabs(dsin(
diff) )
499 if(sintwo.lt.1.0d-10)
goto 37
500 cosai1=(cthsl-costhp*costwo)/(sintwo*sinthp)
502 if(cosai1 .gt. 1.0d0 ) cosai1=1.0d0
504 if(cosai1 .lt. -1.0d0 ) cosai1=-1.0d0
506 costhn=costhp*cscath+sinthp*sscath*cosai1
507 if(costhn.ge.1.0d0)costhn=1.0d0
508 if(costhn.le. -1.0d0)costhn=-1.0d0
509 sinthn=dsqrt(1.0d0-costhn**2)
510 thnl(ix,iy) = dacos(costhn)
512 if(thnl(ix,iy) .lt.1.0d-10 .and. scath .le. thp)
514 if(thnl(ix,iy) .lt.1.0d-10.and. scath .gt.thp)
516 if(thnl(ix,iy).lt. 1.0d-10 )
go to 150
519 if(sinthn.le.0.0d0)
goto 150
520 cosxx=(cscath-costhp*costhn)/( sinthp*sinthn )
522 if(cosxx .gt. 1.0d0) cosxx=1.0d0
523 if(cosxx .lt.-1.0d0) cosxx = -1.0d0
529 call znorml(thnl,phnl,domgan )
530 if(iphsd .eq. 0 .or. iphsd .eq. 180) domgan=2.0d0*domgan
531 if(iphsd .eq. 0 .or. iphsd .eq.180)sang(i,j)=
538 sinphn=dsqrt(1.0d0-cosphn**2)
544 dzxdzy=domgan/cosnnn**3
550 call probl(zx,zy,v,probx,
pi,sig,iprob)
551 call ufunc(
pi,cosths,sig,uuff_ths)
552 call ufunc(
pi,costhp,sig,uuff_thp)
553 prob=probx*uuff_ths*uuff_thp
556 1 alfa_hg,proby,xi_hg)
557 call ufunc(
pi,cthcnt,sig,uuff_thcnt)
558 call ufunc(
pi,costhp,sig,uuff_thp)
559 xi_hg_corr=xi_hg*uuff_thcnt*uuff_thp
560 xi_hgcnt(ii,jj)=xi_hg_corr
571 call zangl(thp,php,ths,phs,thn,phn,xr,xi,zmio,
572 1
ei,cost,thcnt,phcnt,tzm)
580 rint(im,i,j) =(cost/(cosnnn*cosths))*
581 1 prob*dzxdzy*zmio(im)*r2
582 if(im.eq.1 .or. im.eq.2)
rint(im,i,j)=
rint(im,i,j)+
583 1 r1*costhp*sang(i,j)/(2.0d0*
pi)
584 xint(im)=
rint(im,i,j)/sang(i,j)
585 if (ithpd.eq.0)
go to 15
586 if(iphsd.eq.0 .or. iphsd.eq.180)
590 if(mmnn .eq. 1)
go to 26
591 pfluxs=pfluxs+(
rint(1,i,j)+
rint(2,i,j) )*cosths*2.0d0
592 pfluxz=pfluxz+(amulsq(1)-amulsq(2))*delphi*xin
594 cccc = ((cost*prob*dzxdzy)/(cosnnn*cosths*sang3))
597 tint(ij,ik)=tint(ij,ik)+tzm(ij,ik)*cccc
623 zint(im,ii,jj)=zint(im,ii,jj)+
rint(im,i,j)/sang3
633 pti(ij,ii,ll)=apti(ij)
634 pti(ij+4,ii,ll) = zint(ij,ii,jj)
637 ftrx(kk,ii,ll) = tint(ij,ik)*r2
638 if(kk.eq.1 .or.kk.eq.6)ftrx(kk,ii,ll)=ftrx(kk,ii,ll)+
643 a(1)=0.5d0*(ftrx(1,ii,ll)+ftrx(2,ii,ll))
644 a(2)=0.5d0*(ftrx(5,ii,ll)+ftrx(6,ii,ll))
645 a(3)=0.5d0*(ftrx(9,ii,ll)+ftrx(10,ii,ll))
646 a(4)=0.5d0*(ftrx(13,ii,ll)+ftrx(14,ii,ll))
653 refl=pfluxs/dcos(thp)
654 reflz = pfluxz / dcos(thp)
655 azn=zint(1,ii,jj)+zint(2,ii,jj)
658 701
format(
'ii,jj,nmtha,zint,azn,bzn,sang3',3i4/1p7e11.3)
661 if(thcntd .gt. 1.0d-1)
go to 50
663 axz(ib)= (ftrx(ib,ii,1)+ftrx(ib,ii,nmphi))/2.0
667 ftrx(ib,ii,ia)=axz(ib)
669 pti(5,ii,ia)=( ftrx(1,ii,ia)+ftrx(2,ii,ia) )/2.0
670 pti(6,ii,ia)=( ftrx(5,ii,ia)+ftrx(6,ii,ia) )/2.0
671 pti(7,ii,ia)=( ftrx(9,ii,ia)+ftrx(10,ii,ia))/2.0
672 pti(8,ii,ia)=( ftrx(13,ii,ia)+ftrx(14,ii,ia))/2.0
679 write(7,151)thpd,refl
685 1 xi_hgcnt,nthcnd,nphcnd,txin1pi,txi_hgpi,txin2pi,txin2top)
691 136
format( /1x,1p11d10.2/ )
692 139
format(1x,
' the avrg.value of stokes parameter for big cell no.',
693 1 5x,i2,
',',i2,
'are')
694 143
format(1x,
' the cosine of',2i2,
' angle is large',1pd15.5)
695 145
format(t2,
'ang',t11,
'mu',t17,
'phi',t25,
'i sub l',t38,
'i sub r',
696 1 t52,
' u',t64,
' v',t76,
'i',t88,
'p',t97,
' pi*i ',t110,
'prob' /)
698 147
format(1x,20x,1p4d12.4)
699 148
format(1x,f5.2,1x,f6.2,1x,1p4d11.3,1p5d12.4 )
700 149
format(1x,
' sea surface reflectivity for solar'
701 1 ,
' zenith angle = ',0pf8.2,
' is =',1p2d12.3/)
702 151
format(f10.1,2f10.3)
703 155
format(1x,
'fraction of incident flux reflected according to
704 1lambert law (in percent)',0pf7.1/
705 2 1x,
'fraction of incident flux reflected according to fresnel
706 3 law (inpercent)',0pf7.1//)
707 180
format(1x,1p8e14.4/1x,1p8e14.4//)
708 200
format(1x,1p10e12.4)
709 500
format(1x,0pf7.2,0pf8.4,0pf7.1,0p2f7.2,1p9e11.4)
710 515
format(t7,
'sza',t15,
'h. ref1')
711 600
format(1x,2i5,1p4e15.4)
717 subroutine rtang(tha,pha,thcnd,phcnd,thp,dlth,dlph,ntha,nphi,
718 1 nthcnd,nphcnd,nthp,nloop)
720 include
'afrt_ocn.cmn'
721 implicit real*8 (a-h,o-z)
722 real*8 tha(nth),pha(nph),thp(nsz),phcnd(nph),thcnd(nth),solz(25)
726 thcnd(i)=(tha(i+1)+tha(i))/2.0d0
734 pha(2)=pha(1)+dlph/2.0d0
738 phcnd(i)=(pha(i+1)+pha(i))/2.0d0
739 if(pha(i+1).gt.180.0d0)pha(i+1)=180.0d0
740 if(phcnd(i).ge.180.0d0)phcnd(i)=180.0d0
747 subroutine rufint(pi,con,amuo,thcnd,phcnd,opt,pti,
748 1 xi_hgcnt,nthcnd,nphcnd)
750 include
'afrt_ocn.cmn'
752 implicit real * 8 (a-h,o-z)
753 real*8 thcnd(nth),phcnd(nph),xi_hgcnt(nth,nph)
754 real * 8 pti(8,nth,nph)
765 amu = dcos(thcnd(i) * con)
767 xin = pti(l,i,j) + pti(l+1,i,j)
770 xinsea = xinpi * dexp(-opt/amuo)
771 xintop = xinsea * dexp(-xpt/amu)
772 if (xin .gt. 1.0d-10) poln=sqrt((pti(l,i,j) - pti(l+1,i,j))
773 1 **2 + pti(l+2,i,j)**2 + pti(l+3,i,j)**2 )
774 if (xin .gt. 1.0d-10) pol = poln/xin
775 if (pti(l,i,j) .gt. pti(l+1,i,j) ) pol = -pol
776 write (7,500) thcnd(i),phcnd(j),(pti(m,i,j),m=l,n),xin,pol,
777 1 xinpi,xi_hgcnt(i,jr)*
pi,xintop
785 500
format(1x,f6.2,1x,f6.2,2x,1p4d11.3,1x,1p3d11.3,1x,1p3d11.3)
792 subroutine solidz(thp,php,thsl,phsl,domgan,domega,con)
793 implicit real * 8(a-h,o-z)
794 real*8 thsl(3),phsl(3)
798 sinthp=dsqrt(1.0d0-costhp**2)
799 costh2=dcos(thsl(2) )
801 sn1=(thp+thsl(2) )/2.0d0
803 sintci=dsqrt(1.0d0-costci**2)
804 chi=0.50d0*dacos(costci)
809 sinchi=dsqrt(1.0d0-coschi**2)
810 cosai=(costh2-costhp*costci)/(sinthp*sintci)
813 sinsn=dsqrt(1.0d0-cossn**2)
815 sinsn1=dsqrt(1.0d0-cossn1**2)
816 coss1=cossn*coschi+sinsn*sinchi*cosai
817 coss2=cossn1* coschi+sinsn1*sinchi*cosai
828 st=dtan(ss/2.0d0)*dtan((ss-s1)/2.0d0)*
829 1 dtan((ss-s2)/2.0d0)*dtan((ss-s3)/2.0d0)
830 se=dsqrt(1.0d0/(1.0d0+st) )
831 domgan=4.0d0*dacos(se)
834 r3=dacos(costh2*costh2)
836 sr=dtan(rr/2.0d0)*dtan((rr-r1)/2.0d0)**2 *
837 1 dtan((rr-r3)/2.0d0)
838 re=dsqrt(1.0d0/(1.0d0+sr) )
839 domega=4.0d0*dacos(
re)
843 126
format(1x,1p10d12.4/)
849 subroutine zangl(thp,php,ths,phs,thn,phn,xr,xi,tmio,ei,cost,
852 implicit real*8(a-h),
real*8(o-z)
853 real*8 zmio(4),
ei(4),tmio(4),z(4,4),t(4,4),tzm(4,4)
859 cost = dcos(thn)*dcos(thp) + dsin(thn)*dsin(thp)*dcos(php-phn)
863 sinsq = (1.0d0-cost**2)
865 a = (xr**2-xi**2 -1.0d0 + cost**2)
866 b = (-2.0d0 * xr * xi)
867 r = dsqrt(a**2 + b**2)
869 xp = dsqrt(2.0d0*r + 2.0d0*a)
870 xmm = (2.0d0*r - 2.0d0*a)
871 if(xmm .lt. 0.0d0 .and. xmm .gt. xzx) xmm=-xmm
873 dnmr1 = (sinsq2 + tmr + cost*sinsq*xp)
874 qrmu = (sinsq2 - tmr)/dnmr1
875 qimu = (cost*sinsq*xm)/dnmr1
876 dnmr2 = (cost**2 + r + cost*xp)
877 rrr = (cost**2 - r)/dnmr2
878 rri = (cost*xm)/dnmr2
879 rer = qrmu*rrr - qimu*rri
880 rei = qimu*rrr + qrmu*rri
881 r11 = rer**2 + rei**2
882 r22 = rrr**2 + rri**2
883 r33 = rer*rrr + rei*rri
884 r34 = rri*rer - rei*rrr
889 costot = dcos(2.0d0*thetac)
890 sintot = dsin(2.0d0*thetac)
893 if(thp .le.1.0d-6 .or. ths .le. 1.0d-6)
go to 65
896 if(cons .lt.1.0d-10)
go to 65
897 cosai1 = (dcos(ths) - dcos(thp)*costot)/(dsin(thp)*sintot)
898 cosai2 = (dcos(thp) - dcos(ths)*costot)/(dsin(ths)*sintot)
905 ssqai1 = dsin(ai1)**2
906 csqai1 = dcos(ai1)**2
907 stoai1 = dsin(2.0d0*ai1)
908 ctoai1 = dcos(2.0d0*ai1)
909 ssqai2 = dsin(ai2)**2
910 csqai2 = dcos(ai2)**2
911 stoai2 = dsin(2.0d0*ai2)
912 ctoai2 = dcos(2.0d0*ai2)
921 rl13 =-0.5d0*r11*stoai1
922 rl23 = 0.5d0*r22*stoai1
931 z(1,1)= csqai2*rl11 + ssqai2*rl21 - 0.5d0*stoai2*rl31
932 z(2,1)= ssqai2*rl11 + csqai2*rl21 + 0.5d0*stoai2*rl31
933 z(3,1) = stoai2*rl11- stoai2*rl21+ ctoai2*rl31
935 z(1,2)= csqai2*rl12 + ssqai2*rl22 - 0.5d0*stoai2*rl32
936 z(2,2)= ssqai2*rl12 + csqai2*rl22 + 0.5d0*stoai2*rl32
937 z(3,2) = stoai2*rl12- stoai2*rl22+ ctoai2*rl32
939 z(1,3)= csqai2*rl13 + ssqai2*rl23 - 0.5d0*stoai2*rl33
940 z(2,3)= ssqai2*rl13 + csqai2*rl23 + 0.5d0*stoai2*rl33
941 z(3,3) = stoai2*rl13- stoai2*rl23+ ctoai2*rl33
943 z(1,4)= csqai2*rl14 + ssqai2*rl24 - 0.5d0*stoai2*rl34
944 z(2,4)= ssqai2*rl14 + csqai2*rl24 + 0.5d0*stoai2*rl34
945 z(3,4) = stoai2*rl14- stoai2*rl24+ ctoai2*rl34
952 if(ths .le.1.0d-6 .or. thcnt .le. 1.0d-6)
go to 75
953 cons = dsin(phcnt-phs)
955 if(cons .lt.1.0d-10)
go to 75
956 thtx = dcos(thcnt)*dcos(ths) + dsin(thcnt)*dsin(ths)*
960 costi1 = (dcos(thcnt)-dcos(ths)*thtx)/(dsin(ths)*thty)
961 costi2 = (dcos(ths) - dcos(thcnt)*thtx) / (dsin(thcnt)*thty)
968 stoti1= dsin(2.0d0*ti1)
969 ctoti1= dcos(2.0d0*ti1)
972 stoti2= dsin(2.0d0*ti2)
973 ctoti2= dcos(2.0d0*ti2)
975 t(1,1)= (csqti2*csqti1 +ssqti2*ssqti1 - 0.5d0*stoti2*stoti1)
976 t(2,1)= (ssqti2*csqti1 +csqti2*ssqti1 + 0.5d0*stoti2*stoti1)
977 t(3,1)=stoti2*csqti1 - stoti2*ssqti1 + ctoti2*stoti1
979 t(1,2)= (csqti2*ssqti1 +ssqti2*csqti1 + 0.5d0*stoti2*stoti1)
980 t(2,2)= (ssqti2*ssqti1 +csqti2*csqti1 - 0.5d0*stoti2*stoti1)
981 t(3,2)=stoti2*ssqti1 - stoti2*csqti1 - ctoti2*stoti1
983 t(1,3)= (-0.5d0*csqti2*stoti1+0.5d0*ssqti2*stoti1-
984 1 0.5d0*stoti2*ctoti1)
985 t(2,3)= (-0.5d0*ssqti2*stoti1+0.5d0*csqti2*stoti1+
986 1 0.5d0*stoti2*ctoti1)
987 t(3,3)= (-0.5d0*stoti2*stoti1-0.5d0*stoti2*stoti1+
997 tzm(i,j) = tzm(i,j) + t(i,k)*z(k,j)
1002 tmio(i) = tmio(i) + tzm(i,j)*
ei(j)
1010 subroutine znorml(thnl,phnl,domgan)
1012 implicit real*8(a-h),
real*8(o-z)
1013 real*8 thnl(3,3),phnl(3,3), coside(5),snside(5), cosang(6),
1021 coside(1) = dcos(thnl(1,1))*dcos(thnl(2,1))+dsin(thnl(1,1))*
1022 1 dsin(thnl(2,1))*dcos(phnl(1,1) -phnl(2,1))
1023 coside(2) = dcos(thnl(2,1))*dcos(thnl(2,2))+dsin(thnl(2,1))*
1024 1 dsin(thnl(2,2))*dcos(phnl(2,1) -phnl(2,2))
1025 coside(3) = dcos(thnl(2,2))*dcos(thnl(1,2))+dsin(thnl(2,2))*
1026 1 dsin(thnl(1,2))*dcos(phnl(2,2) -phnl(1,2))
1027 coside(4) = dcos(thnl(1,2))*dcos(thnl(1,1))+dsin(thnl(1,2))*
1028 1 dsin(thnl(1,1))*dcos(phnl(1,2) -phnl(1,1))
1029 coside(5) = dcos(thnl(1,1))*dcos(thnl(2,2))+dsin(thnl(1,1))*
1030 1 dsin(thnl(2,2))*dcos(phnl(1,1) -phnl(2,2))
1032 if(coside(iz) .gt. 1.000000d0)
then
1033 coside(iz)=1.000000d0
1035 if(coside(iz) .lt. -1.000000d0)
then
1036 coside(iz)=-1.000000d0
1038 side(iz) = dacos(coside(iz))
1039 snside(iz)=dsin(side(iz))
1042 36 cosang(k) = 1.0d0
1043 if(side(1).lt.1.0d-10 .or. side(2).lt.1.0d-10) cosang(5)=-1.0d0
1044 if(side(1).lt.1.0d-10 .or. side(2).lt.1.0d-10)
go to 45
1045 cosang(1) = (coside(1) -coside(2)*coside(5))/
1046 1 (snside(2)*snside(5))
1047 cosang(2) = (coside(2) -coside(1)*coside(5))/
1048 1 (snside(1)*snside(5))
1049 cosang(5) = (coside(5) -coside(1)*coside(2))/
1050 1 (snside(1)*snside(2))
1052 if(side(3).lt.1.0d-10 .or. side(4).lt.1.0d-10) cosang(6)=-1.0d0
1053 if(side(3).lt.1.0d-10 .or. side(4).lt.1.0d-10)
go to 55
1054 cosang(3) = (coside(3) -coside(4)*coside(5))/
1055 1 (snside(4)*snside(5))
1056 cosang(4) = (coside(4) -coside(3)*coside(5))/
1057 1 (snside(3)*snside(5))
1058 cosang(6) = (coside(5) -coside(3)*coside(4))/
1059 1 (snside(3)*snside(4))
1063 difabs=dabs(dabs(cosang(iz) ) -1.0d0 )
1064 if(difabs .lt. 1.0d-10 .and. cosang(iz) .gt. 1.0d0)
1066 if(difabs .lt. 1.0d-10 .and. cosang(iz) .lt.aaaaa )
1068 34 angtri(iz)=dacos(cosang(iz))
1070 area1 =(angtri(1)+angtri(2)+angtri(5) -
pi)
1071 area2 =(angtri(3)+angtri(4)+angtri(6) -
pi)
1072 domgan = area1+area2
1073 if(phnl(1,1).lt.1.0d-6)
then
1084 subroutine riwat(wl,xsal,nr,ni)
1086 implicit real*8 (a-h,o-z)
1087 real*8 twl(62),tnr(62),tni(62)
1088 real*8 nr,ni,nrc,nic
1101 s 0.250,0.275,0.300,0.325,0.345,0.375,0.400,0.425,0.445,0.475,
1102 s 0.500,0.525,0.550,0.575,0.600,0.625,0.650,0.675,0.700,0.725,
1103 s 0.750,0.775,0.800,0.825,0.850,0.875,0.900,0.925,0.950,0.975,
1104 s 1.000,1.200,1.400,1.600,1.800,2.000,2.200,2.400,2.600,2.650,
1105 s 2.700,2.750,2.800,2.850,2.900,2.950,3.000,3.050,3.100,3.150,
1106 s 3.200,3.250,3.300,3.350,3.400,3.450,3.500,3.600,3.700,3.800,
1109 s 1.362,1.354,1.349,1.346,1.343,1.341,1.339,1.338,1.337,1.336,
1110 s 1.335,1.334,1.333,1.333,1.332,1.332,1.331,1.331,1.331,1.330,
1111 s 1.330,1.330,1.329,1.329,1.329,1.328,1.328,1.328,1.327,1.327,
1112 s 1.327,1.324,1.321,1.317,1.312,1.306,1.296,1.279,1.242,1.219,
1113 s 1.188,1.157,1.142,1.149,1.201,1.292,1.371,1.426,1.467,1.483,
1114 s 1.478,1.467,1.450,1.432,1.420,1.410,1.400,1.385,1.374,1.364,
1117 s 3.35e-08,2.35e-08,1.60e-08,1.08e-08,6.50e-09,
1118 s 3.50e-09,1.86e-09,1.30e-09,1.02e-09,9.35e-10,
1119 s 1.00e-09,1.32e-09,1.96e-09,3.60e-09,1.09e-08,
1120 s 1.39e-08,1.64e-08,2.23e-08,3.35e-08,9.15e-08,
1121 s 1.56e-07,1.48e-07,1.25e-07,1.82e-07,2.93e-07,
1122 s 3.91e-07,4.86e-07,1.06e-06,2.93e-06,3.48e-06,
1123 s 2.89e-06,9.89e-06,1.38e-04,8.55e-05,1.15e-04,
1124 s 1.10e-03,2.89e-04,9.56e-04,3.17e-03,6.70e-03,
1125 s 1.90e-02,5.90e-02,1.15e-01,1.85e-01,2.68e-01,
1126 s 2.98e-01,2.72e-01,2.40e-01,1.92e-01,1.35e-01,
1127 s 9.24e-02,6.10e-02,3.68e-02,2.61e-02,1.95e-02,
1128 s 1.32e-02,9.40e-03,5.15e-03,3.60e-03,3.40e-03,
1129 s 3.80e-03,4.60e-03/
1131 10
if (wl.lt.twl(i))
goto 20
1140 nr=tnr(i-1)+(wl-twl(i-1))*yr/xwl
1141 ni=tni(i-1)+(wl-twl(i-1))*yi/xwl
1161 nr=nr+nrc*(xsal/34.3)
1162 ni=ni+nic*(xsal/34.3)
1167 subroutine ufunc(pi,xmu,sig,uu)
1168 implicit real*8 (a-h,o-z)
1171 gnu=xmu/(sig*dsqrt(1.0d0-xmu**2))
1173 ff1=dexp(-gnusq)/(dsqrt(
pi)*gnu)
1174 ff2=(1.0d0-
erfz(gnu))
1175 ffnu=0.5d0*(ff1-ff2)
1176 uu=1.0d0/(1.0d0+ffnu)
1184 subroutine probl_hg(pi,xmup,phirpx,xmux,phirx,sig,alfa,prob,
1187 implicit real*8 (a-h,o-z)
1199 cos2chi=-xmup*xmu-dsqrt((1.0d0-xmup**2)*(1.0d0-xmu**2))*
1202 alfa=(1.0d0+cos2chi)/(xmup-xmu)**2
1203 arg_exp=(1.0d0-2.0d0*alfa)/sig**2
1204 exp_term=dexp(arg_exp)
1205 prob=exp_term/(
pi*sig**2)
1207 chii=dacos(cos2chi)/2.0d0
1215 sinthipsq=sinthip**2
1216 sinthimsq=sinthim**2
1217 costhipsq=1.0d0-sinthipsq
1218 costhimsq=1.0d0-sinthimsq
1219 tanthipsq=sinthipsq/costhipsq
1220 tanthimsq=sinthimsq/costhimsq
1221 if(dabs(chii).lt.1.0d-6)
then
1222 rho_pls=((1.0d0-xn1)/(1.0d0+xn1))**2
1224 rho_pls=0.5d0*(tanthimsq/tanthipsq +
1225 1 sinthimsq/sinthipsq)
1227 xi_hg=(rho_pls*alfa**2*prob)/dabs(xmu)
1231 99
format(
'xmup,phirp,xmu,phir,sig',5f10.4)
1233 100
format(
'cos2chi,alfa,sig,arg_exp,exp_term,prob'/1p6e12.4)
1235 101
format(
'sinthipsq,sinthimsq,costhipsq,costhimsq'/1p4e12.4)
1237 102
format(
'tanthipsq,tanthimsq,rho_pls,xi_hg'/1p4e12.4)
1244 subroutine rufint_new (pi,con,amuo,thcnd,phcnd,opt,pti,
1245 1 xi_hgcnt,nthcnd,nphcnd,txin1pi,txi_hgpi,txin2pi,txin2top)
1247 include
'afrt_ocn.cmn'
1248 implicit real * 8 (a-h,o-z)
1249 real*8 thcnd(nth),phcnd(nph),xi_hgcnt(nth,nph)
1250 real*8 pti(8,nth,nph)
1251 real*8 txin1pi(nth,nph),txi_hgpi(nth,nph),
1252 1 txin2pi(nth,nph),txin2top(nth,nph)
1260 amu = dcos(thcnd(i)*con)
1262 xin1=pti(1,i,j)+pti(2,i,j)
1263 xin2=pti(5,i,j)+pti(6,i,j)
1265 xi_hgpi=xi_hgcnt(i,jr)*
pi
1267 xin1sea=xin1pi*dexp(-opt/amuo)
1268 xin1top =xin1sea*dexp(-xpt/amu)
1270 xin2sea=xin2pi*dexp(-opt/amuo)
1271 xin2top =xin2sea*dexp(-xpt/amu)
1272 write(7,500) thcnd(i),phcnd(j),xin1pi,xi_hgpi,
1275 txin1pi(j,i) = xin1pi
1276 txi_hgpi(j,i) = xi_hgpi
1277 txin2pi(j,i) = xin2pi
1278 txin2top(j,i) = xin2top
1285 100
format(
' the phi I_ZA I_HG',
1286 1
' Avg_I_ZA Avg_I_ZA_Top')
1287 500
format(1x,f6.2,1x,f6.2,2x,1p4d13.4)