6 implicit real*8(a-h,o-z)
7 real*8 ez(4),tha(26),pha(47),thp(25), phcnd(46),thcnd(25)
8 real*8 ftrx(16,25,46),pti(8,25,46),xz(3),athcnd(25),aphcnd(46)
9 real*8 wav(20),sig_hg(10),solz(25)
10 integer*4 izx(2),iwav(20)
12 data ez/0.5d0,0.5d0,0.0d0,0.0d0/
25 open(5,file=
'ocn.dir',status=
'old')
28 len1=
index(dir1,
' ')-1
29 len2=
index(dir2,
' ')-1
36 open(unit=3,file=dir1(1:len1)//
'input.dat',status=
'old')
38 read(3,24)iopt,nww,ibgn,iend,isig,isolz
42 read(3,26) xr,xi,v,thcel,phcel
44 read(3,15)(wav(i),i=1,nww)
46 read(3,16)ntha,(tha(i),i=1,ntha)
48 read(3,35)nsig,(sig_hg(i),i=1,nsig)
51 iwav(i)=int((wav(i)+0.0001)*1000.0 )
56 read(3,16)nsolz,(solz(i),i=1,nsolz)
72 nphi=180.0d0/dlph+2.0d0+0.01d0
76 call rtang(tha,pha,thcnd,phcnd,thp,dlth,dlph,solz,ntha,nphi,
77 1 nthcnd,nphcnd,nthp,nloop)
85 v=sig_hg(mm)**2/5.34d-3
88 call riwat(wav(ii),xsal,xr,xi)
95 call convtc(iwav(ii),4,xwc)
99 1 dir2(1:len2)//
'owl'//xwc//
'x'//vc//
'solz'//solzc//
'.dat',
106 2 dir2(1:len2)//
'sumrywl'//xwc//
'x'//vc//
'solz'//solzc//
'.dat',
112 1 dir2(1:len2)//
'rufrtwl'//xwc//
'x'//vc//
'solz'//solzc//
'.dat',
113 2 access=
'sequential',form=
'unformatted',
132 write (20) xz,izx,athcnd,aphcnd
138 amuo=dcos(thp(k)*con)
139 call rufocn(ez,thp(k),phip,xr,xi,v,pha,tha,phcnd,
140 1 thcnd,thcel,phcel,opt,ftrx,pti,
pi,con,
141 2 ntha,nphi,iprob,nthcnd,nphcnd)
143 write (20) thetap,ftrx,pti
160 26
format(2e10.3,4f10.4)
164 30
format(1x,2i3,1p8d15.4/1x,6x,1p8d15.4/)
166 500
format(1x,f6.2,1x,f6.2,2x,1p4d11.3,1x,1p3d11.3,1x,1p2d11.3)
168 510
format(
'Cox-Monk Rough Ocean (Wind Direction Independent)'/
169 1
'wind speed (m/sec)'/f10.2)
175 subroutine convtc (num,nchar, loc)
217 integer istart, irem, itemp
232 do 100 i = nchar, istart, -1
234 loc(i) = char(irem - itemp * 10 + ichar(
'0'))
241 if (irem.ne.0) loc(1) =
'*'
247 subroutine probl(zx,zy,v,prob,pi,sig,iprob)
248 implicit real *8(a-h),
real*8(o-z)
255 sigsqx = 0.003d0 + 5.12d-3 *v
263 sigsqx = 0.003d0 + 1.92d-3*v
269 if(dabs(zx ) .lt. 1.0d-06) zx =0.0d0
270 if(dabs(zy ) .lt. 1.0d-06) zy =0.0d0
276 pqr= -dlog( aaa*
pi*sigx*sigy*1.0d-6)
277 eee=(zeta**2 + eata**2 )/aaa
278 if(eee .gt. pqr)
go to 81
281 if(iprob .eq.1)
go to 300
284 c21 = 0.01d0 - 0.0086d0 * v
285 c03 = 0.04d0 - 0.033d0 * v
290 c1 = c21*(zeta**2-1.0d0)*eata *0.5d0
291 c2 = (c03*(eata**3 -3.0d0*eata))/6.0d0
292 c3 = (c40*( zeta**4 - 6.0d0*zeta**2 + 3.0d0))/24.0d0
293 c4 = ( c22*(zeta**2-1.0d0)*(eata**2-1.0d0))/4.0d0
294 c5 = (c04 * (eata**4 - 6.0d0*eata**2 + 3.0d0) )/24.0d0
297 csum = -c1-c2+c3+c4+c5
299 prob1 = dexp(-(zeta**2 + eata**2)/aaa)/( aaa*
pi*sigx*sigy)
300 prob = prob1*(1.0d0+csum)
308 subroutine rufocn(ei,thpd,phpd,xr,xi,v,pha,tha,phcnd,thcnd,
309 1 thcel,phcel,opt, ftrx,pti,pi,con,ntha,nphi,iprob,
312 implicit real*8(a-h),
real*8(o-z)
314 real*8 ftrx(16,25,46),pti(8,25,46),a(6)
315 real*8
ei(4),zint(4,25,46),zmio(4),tha(26),pha(47),thx(15),
316 1 phx(35),
rint(4,25,46),phsl(3),thsl(3),sang(25,46),snside(5),
317 2 phnl(3,3),thnl(3,3),coside(5),side(5),cosang(6),angtri(6),
318 3 tmio(4),xint(4),tzm(4,4),tint(4,4),phcnd(46),apti(4),thcnd(25),
319 4 frac(10),axz(16),amul(2),amulsq(2),xi_hgcnt(25,46)
321 data frac/0.0d0,0.1d0,0.2d0,0.3d0,0.4d0,0.5d0,0.6d0,
333 sinthp=dsqrt(1.0d0-costhp**2)
345 sthcnt=dsqrt(1.0d0-cthcnt**2)
355 thx(i1)=thx(i1-1)+thcel
356 dif1 = dabs(tha(ii+1) - thx(i1) )
357 if(dif1 .lt. 1.0d-6 .or. thx(i1) .gt. tha(ii+1) )
go to 101
369 sphcnt=dsqrt(1.0d0-cphcnt**2)
372 sang3=(dcos(tha(ii)*con)-dcos(tha(ii+1)*con))*
373 1 (pha(jj+1)-pha(jj))*con
389 phx(i2)=phx(i2-1)+phcel
390 dif2 = dabs(pha(jj+1) - phx(i2) )
391 if( dif2 .lt. 1.0d-10 .or. phx(i2) .gt. pha(jj+1) )
goto 104
399 phx(i2+1)=phcntd-phcel/2.0d0
400 phx(i2+2)=phcntd+phcel/2.0d0
401 thx(i1+1)=thcntd-thcel/2.0d0
402 thx(i1+2)=thcntd+thcel/2.0d0
410 if(mmnn .eq.1)
goto 260
427 do 10 i=limth1,limth2
428 thsd = (thx(i)+thx(i+1))/2.0d0
429 if(thx(i) .lt. 0.0d0) thx(i)=0.0d0
431 thsl(2) = thx(i+1)*con
435 sinths=dsqrt(1.0d0-cosths**2)
436 amul(1) = dcos(thsl(1))
437 amul(2) = dcos(thsl(2))
438 amulsq(1) = amul(1) ** 2
439 amulsq(2) = amul(2) ** 2
442 do 11 j=limfi1,limfi2
448 phsd = (phx(j)+phx(j+1))/2.0d0
449 if(phx(j+1) .gt. 180.0d0) phx(j+1)=180.0d0
450 if(phx(j) .lt. 0.0d0)phx(j)=0.0d0
452 phsl(2) = phx(j+1)*con
455 delphi = phsl(2)-phsl(1)
463 if(thpd .gt. 1.0d-3)
go to 74
468 domgan=(dcos(thnl1)-dcos(thnl2) )*(phsl(2)-phsl(1))
469 sang(i,j)=(dcos(thsl(1))-dcos(thsl(2)))*
471 thnl(3,3)=thsl(3)/2.0d0
475 if(thsd .gt.1.0d-3)
go to 75
476 call solidz(thp,php,thsl,phsl,domgan,sang(i,j),con)
486 sang(i,j)=(dcos(thx(i)*con)-dcos(thx(i+1)*con))*
487 1 (phx(j+1)-phx(j))*con
495 if(iy .eq. 3 .and. ix .ne. 3)
go to 32
496 if(ix .eq. 3 .and. iy .ne. 3)
go to 32
498 sthsl=dsqrt(1.0d0-cthsl**2)
502 cos_scat=-costhp*cthsl+sinthp*sthsl*dcos(php-phsl(iy))
504 if(costwo.ge.1.0d0)costwo=1.0d0
505 if(costwo.le. -1.0d0)costwo=-1.0d0
506 sintwo=dsqrt(1.0d0-costwo**2)
507 scath = 0.5d0*dacos(costwo)
509 if(cscath.ge.1.0d0)cscath=1.0d0
510 if(cscath.le. -1.0d0)cscath=-1.0d0
511 sscath=dsqrt(1.0d0-cscath**2)
513 diff =dabs(php-phsl(iy))
514 cons = dabs(dsin(
diff) )
515 if(sintwo.lt.1.0d-10)
goto 37
516 cosai1=(cthsl-costhp*costwo)/(sintwo*sinthp)
518 if(cosai1 .gt. 1.0d0 ) cosai1=1.0d0
519 if(cosai1 .lt. -1.00001d0)
write(6,143) ix,iy,cosai1
520 if(cosai1 .lt. -1.0d0 ) cosai1=-1.0d0
522 costhn=costhp*cscath+sinthp*sscath*cosai1
523 if(costhn.ge.1.0d0)costhn=1.0d0
524 if(costhn.le. -1.0d0)costhn=-1.0d0
525 sinthn=dsqrt(1.0d0-costhn**2)
526 thnl(ix,iy) = dacos(costhn)
528 if(thnl(ix,iy) .lt.1.0d-10 .and. scath .le. thp)
530 if(thnl(ix,iy) .lt.1.0d-10.and. scath .gt.thp)
532 if(thnl(ix,iy).lt. 1.0d-10 )
go to 150
535 if(sinthn.le.0.0d0)
goto 150
536 cosxx=(cscath-costhp*costhn)/( sinthp*sinthn )
538 if(cosxx .gt. 1.0d0) cosxx=1.0d0
539 if(cosxx .lt.-1.0d0) cosxx = -1.0d0
545 call znorml(thnl,phnl,domgan )
546 if(iphsd .eq. 0 .or. iphsd .eq. 180) domgan=2.0d0*domgan
547 if(iphsd .eq. 0 .or. iphsd .eq.180)sang(i,j)=
554 sinphn=dsqrt(1.0d0-cosphn**2)
560 dzxdzy=domgan/cosnnn**3
566 call probl(zx,zy,v,probx,
pi,sig,iprob)
567 call ufunc(
pi,cosths,sig,uuff_ths)
568 call ufunc(
pi,costhp,sig,uuff_thp)
569 prob=probx*uuff_ths*uuff_thp
572 1 alfa_hg,proby,xi_hg)
573 call ufunc(
pi,cthcnt,sig,uuff_thcnt)
574 call ufunc(
pi,costhp,sig,uuff_thp)
575 xi_hg_corr=xi_hg*uuff_thcnt*uuff_thp
576 xi_hgcnt(ii,jj)=xi_hg_corr
587 call zangl(thp,php,ths,phs,thn,phn,xr,xi,zmio,
588 1
ei,cost,thcnt,phcnt,tzm)
596 rint(im,i,j) =(cost/(cosnnn*cosths))*
597 1 prob*dzxdzy*zmio(im)*r2
598 if(im.eq.1 .or. im.eq.2)
rint(im,i,j)=
rint(im,i,j)+
599 1 r1*costhp*sang(i,j)/(2.0d0*
pi)
600 xint(im)=
rint(im,i,j)/sang(i,j)
601 if (ithpd.eq.0)
go to 15
602 if(iphsd.eq.0 .or. iphsd.eq.180)
606 if(mmnn .eq. 1)
go to 26
607 pfluxs=pfluxs+(
rint(1,i,j)+
rint(2,i,j) )*cosths*2.0d0
608 pfluxz=pfluxz+(amulsq(1)-amulsq(2))*delphi*xin
610 cccc = ((cost*prob*dzxdzy)/(cosnnn*cosths*sang3))
613 tint(ij,ik)=tint(ij,ik)+tzm(ij,ik)*cccc
639 zint(im,ii,jj)=zint(im,ii,jj)+
rint(im,i,j)/sang3
649 pti(ij,ii,ll)=apti(ij)
650 pti(ij+4,ii,ll) = zint(ij,ii,jj)
653 ftrx(kk,ii,ll) = tint(ij,ik)*r2
654 if(kk.eq.1 .or.kk.eq.6)ftrx(kk,ii,ll)=ftrx(kk,ii,ll)+
659 a(1)=0.5d0*(ftrx(1,ii,ll)+ftrx(2,ii,ll))
660 a(2)=0.5d0*(ftrx(5,ii,ll)+ftrx(6,ii,ll))
661 a(3)=0.5d0*(ftrx(9,ii,ll)+ftrx(10,ii,ll))
662 a(4)=0.5d0*(ftrx(13,ii,ll)+ftrx(14,ii,ll))
669 refl=pfluxs/dcos(thp)
670 reflz = pfluxz / dcos(thp)
671 azn=zint(1,ii,jj)+zint(2,ii,jj)
674 701
format(
'ii,jj,nmtha,zint,azn,bzn,sang3',3i4/1p7e11.3)
677 if(thcntd .gt. 1.0d-1)
go to 50
679 axz(ib)= (ftrx(ib,ii,1)+ftrx(ib,ii,nmphi))/2.0
683 ftrx(ib,ii,ia)=axz(ib)
685 pti(5,ii,ia)=( ftrx(1,ii,ia)+ftrx(2,ii,ia) )/2.0
686 pti(6,ii,ia)=( ftrx(5,ii,ia)+ftrx(6,ii,ia) )/2.0
687 pti(7,ii,ia)=( ftrx(9,ii,ia)+ftrx(10,ii,ia))/2.0
688 pti(8,ii,ia)=( ftrx(13,ii,ia)+ftrx(14,ii,ia))/2.0
695 write(7,151)thpd,refl
701 1 xi_hgcnt,nthcnd,nphcnd)
707 136
format( /1x,1p11d10.2/ )
708 139
format(1x,
' the avrg.value of stokes parameter for big cell no.',
709 1 5x,i2,
',',i2,
'are')
710 143
format(1x,
' the cosine of',2i2,
' angle is large',1pd15.5)
711 145
format(t2,
'ang',t11,
'mu',t17,
'phi',t25,
'i sub l',t38,
'i sub r',
712 1 t52,
' u',t64,
' v',t76,
'i',t88,
'p',t97,
' pi*i ',t110,
'prob' /)
714 147
format(1x,20x,1p4d12.4)
715 148
format(1x,f5.2,1x,f6.2,1x,1p4d11.3,1p5d12.4 )
716 149
format(1x,
' sea surface reflectivity for solar'
717 1 ,
' zenith angle = ',0pf8.2,
' is =',1p2d12.3/)
718 151
format(f10.1,2f10.3)
719 155
format(1x,
'fraction of incident flux reflected according to
720 1lambert law (in percent)',0pf7.1/
721 2 1x,
'fraction of incident flux reflected according to fresnel
722 3 law (inpercent)',0pf7.1//)
723 180
format(1x,1p8e14.4/1x,1p8e14.4//)
724 200
format(1x,1p10e12.4)
725 500
format(1x,0pf7.2,0pf8.4,0pf7.1,0p2f7.2,1p9e11.4)
726 515
format(t7,
'sza',t15,
'h. ref1')
727 600
format(1x,2i5,1p4e15.4)
733 subroutine rtang(tha,pha,thcnd,phcnd,thp,dlth,dlph,solz,ntha,nphi,
734 1 nthcnd,nphcnd,nthp,nloop)
736 implicit real*8 (a-h,o-z)
737 real*8 tha(26),pha(47),thp(25),phcnd(46),thcnd(25),solz(25)
741 thcnd(i)=(tha(i+1)+tha(i))/2.0d0
749 pha(2)=pha(1)+dlph/2.0d0
753 phcnd(i)=(pha(i+1)+pha(i))/2.0d0
754 if(pha(i+1).gt.180.0d0)pha(i+1)=180.0d0
755 if(phcnd(i).ge.180.0d0)phcnd(i)=180.0d0
762 subroutine rufint(pi,con,amuo,thcnd,phcnd,opt,pti,
763 1 xi_hgcnt,nthcnd,nphcnd)
766 implicit real * 8 (a-h,o-z)
767 real*8 thcnd(25),phcnd(46),xi_hgcnt(25,46)
768 real * 8 pti(8,25,46)
771 write(7,*)
'welcome to rufint'
779 amu = dcos(thcnd(i) * con)
781 xin = pti(l,i,j) + pti(l+1,i,j)
784 xinsea = xinpi * dexp(-opt/amuo)
785 xintop = xinsea * dexp(-xpt/amu)
786 if (xin .gt. 1.0d-10) poln=sqrt((pti(l,i,j) - pti(l+1,i,j))
787 1 **2 + pti(l+2,i,j)**2 + pti(l+3,i,j)**2 )
788 if (xin .gt. 1.0d-10) pol = poln/xin
789 if (pti(l,i,j) .gt. pti(l+1,i,j) ) pol = -pol
790 write (7,500) thcnd(i),phcnd(j),(pti(m,i,j),m=l,n),xin,pol,
791 1 xinpi,xi_hgcnt(i,jr)*
pi,xintop
799 500
format(1x,f6.2,1x,f6.2,2x,1p4d11.3,1x,1p3d11.3,1x,1p3d11.3)
806 subroutine solidz(thp,php,thsl,phsl,domgan,domega,con)
807 implicit real * 8(a-h,o-z)
808 real*8 thsl(3),phsl(3)
812 sinthp=dsqrt(1.0d0-costhp**2)
813 costh2=dcos(thsl(2) )
815 sn1=(thp+thsl(2) )/2.0d0
817 sintci=dsqrt(1.0d0-costci**2)
818 chi=0.50d0*dacos(costci)
823 sinchi=dsqrt(1.0d0-coschi**2)
824 cosai=(costh2-costhp*costci)/(sinthp*sintci)
827 sinsn=dsqrt(1.0d0-cossn**2)
829 sinsn1=dsqrt(1.0d0-cossn1**2)
830 coss1=cossn*coschi+sinsn*sinchi*cosai
831 coss2=cossn1* coschi+sinsn1*sinchi*cosai
842 st=dtan(ss/2.0d0)*dtan((ss-s1)/2.0d0)*
843 1 dtan((ss-s2)/2.0d0)*dtan((ss-s3)/2.0d0)
844 se=dsqrt(1.0d0/(1.0d0+st) )
845 domgan=4.0d0*dacos(se)
848 r3=dacos(costh2*costh2)
850 sr=dtan(rr/2.0d0)*dtan((rr-r1)/2.0d0)**2 *
851 1 dtan((rr-r3)/2.0d0)
852 re=dsqrt(1.0d0/(1.0d0+sr) )
853 domega=4.0d0*dacos(
re)
857 126
format(1x,1p10d12.4/)
863 subroutine zangl(thp,php,ths,phs,thn,phn,xr,xi,tmio,ei,cost,
866 implicit real*8(a-h),
real*8(o-z)
867 real*8 zmio(4),
ei(4),tmio(4),z(4,4),t(4,4),tzm(4,4)
873 cost = dcos(thn)*dcos(thp) + dsin(thn)*dsin(thp)*dcos(php-phn)
877 sinsq = (1.0d0-cost**2)
879 a = (xr**2-xi**2 -1.0d0 + cost**2)
880 b = (-2.0d0 * xr * xi)
881 r = dsqrt(a**2 + b**2)
883 xp = dsqrt(2.0d0*r + 2.0d0*a)
884 xmm = (2.0d0*r - 2.0d0*a)
885 if(xmm .lt. 0.0d0 .and. xmm .gt. xzx) xmm=-xmm
887 dnmr1 = (sinsq2 + tmr + cost*sinsq*xp)
888 qrmu = (sinsq2 - tmr)/dnmr1
889 qimu = (cost*sinsq*xm)/dnmr1
890 dnmr2 = (cost**2 + r + cost*xp)
891 rrr = (cost**2 - r)/dnmr2
892 rri = (cost*xm)/dnmr2
893 rer = qrmu*rrr - qimu*rri
894 rei = qimu*rrr + qrmu*rri
895 r11 = rer**2 + rei**2
896 r22 = rrr**2 + rri**2
897 r33 = rer*rrr + rei*rri
898 r34 = rri*rer - rei*rrr
903 costot = dcos(2.0d0*thetac)
904 sintot = dsin(2.0d0*thetac)
907 if(thp .le.1.0d-6 .or. ths .le. 1.0d-6)
go to 65
910 if(cons .lt.1.0d-10)
go to 65
911 cosai1 = (dcos(ths) - dcos(thp)*costot)/(dsin(thp)*sintot)
912 cosai2 = (dcos(thp) - dcos(ths)*costot)/(dsin(ths)*sintot)
919 ssqai1 = dsin(ai1)**2
920 csqai1 = dcos(ai1)**2
921 stoai1 = dsin(2.0d0*ai1)
922 ctoai1 = dcos(2.0d0*ai1)
923 ssqai2 = dsin(ai2)**2
924 csqai2 = dcos(ai2)**2
925 stoai2 = dsin(2.0d0*ai2)
926 ctoai2 = dcos(2.0d0*ai2)
935 rl13 =-0.5d0*r11*stoai1
936 rl23 = 0.5d0*r22*stoai1
945 z(1,1)= csqai2*rl11 + ssqai2*rl21 - 0.5d0*stoai2*rl31
946 z(2,1)= ssqai2*rl11 + csqai2*rl21 + 0.5d0*stoai2*rl31
947 z(3,1) = stoai2*rl11- stoai2*rl21+ ctoai2*rl31
949 z(1,2)= csqai2*rl12 + ssqai2*rl22 - 0.5d0*stoai2*rl32
950 z(2,2)= ssqai2*rl12 + csqai2*rl22 + 0.5d0*stoai2*rl32
951 z(3,2) = stoai2*rl12- stoai2*rl22+ ctoai2*rl32
953 z(1,3)= csqai2*rl13 + ssqai2*rl23 - 0.5d0*stoai2*rl33
954 z(2,3)= ssqai2*rl13 + csqai2*rl23 + 0.5d0*stoai2*rl33
955 z(3,3) = stoai2*rl13- stoai2*rl23+ ctoai2*rl33
957 z(1,4)= csqai2*rl14 + ssqai2*rl24 - 0.5d0*stoai2*rl34
958 z(2,4)= ssqai2*rl14 + csqai2*rl24 + 0.5d0*stoai2*rl34
959 z(3,4) = stoai2*rl14- stoai2*rl24+ ctoai2*rl34
966 if(ths .le.1.0d-6 .or. thcnt .le. 1.0d-6)
go to 75
967 cons = dsin(phcnt-phs)
969 if(cons .lt.1.0d-10)
go to 75
970 thtx = dcos(thcnt)*dcos(ths) + dsin(thcnt)*dsin(ths)*
974 costi1 = (dcos(thcnt)-dcos(ths)*thtx)/(dsin(ths)*thty)
975 costi2 = (dcos(ths) - dcos(thcnt)*thtx) / (dsin(thcnt)*thty)
982 stoti1= dsin(2.0d0*ti1)
983 ctoti1= dcos(2.0d0*ti1)
986 stoti2= dsin(2.0d0*ti2)
987 ctoti2= dcos(2.0d0*ti2)
989 t(1,1)= (csqti2*csqti1 +ssqti2*ssqti1 - 0.5d0*stoti2*stoti1)
990 t(2,1)= (ssqti2*csqti1 +csqti2*ssqti1 + 0.5d0*stoti2*stoti1)
991 t(3,1)=stoti2*csqti1 - stoti2*ssqti1 + ctoti2*stoti1
993 t(1,2)= (csqti2*ssqti1 +ssqti2*csqti1 + 0.5d0*stoti2*stoti1)
994 t(2,2)= (ssqti2*ssqti1 +csqti2*csqti1 - 0.5d0*stoti2*stoti1)
995 t(3,2)=stoti2*ssqti1 - stoti2*csqti1 - ctoti2*stoti1
997 t(1,3)= (-0.5d0*csqti2*stoti1+0.5d0*ssqti2*stoti1-
998 1 0.5d0*stoti2*ctoti1)
999 t(2,3)= (-0.5d0*ssqti2*stoti1+0.5d0*csqti2*stoti1+
1000 1 0.5d0*stoti2*ctoti1)
1001 t(3,3)= (-0.5d0*stoti2*stoti1-0.5d0*stoti2*stoti1+
1011 tzm(i,j) = tzm(i,j) + t(i,k)*z(k,j)
1016 tmio(i) = tmio(i) + tzm(i,j)*
ei(j)
1024 subroutine znorml(thnl,phnl,domgan)
1026 implicit real*8(a-h),
real*8(o-z)
1027 real*8 thnl(3,3),phnl(3,3), coside(5),snside(5), cosang(6),
1035 coside(1) = dcos(thnl(1,1))*dcos(thnl(2,1))+dsin(thnl(1,1))*
1036 1 dsin(thnl(2,1))*dcos(phnl(1,1) -phnl(2,1))
1037 coside(2) = dcos(thnl(2,1))*dcos(thnl(2,2))+dsin(thnl(2,1))*
1038 1 dsin(thnl(2,2))*dcos(phnl(2,1) -phnl(2,2))
1039 coside(3) = dcos(thnl(2,2))*dcos(thnl(1,2))+dsin(thnl(2,2))*
1040 1 dsin(thnl(1,2))*dcos(phnl(2,2) -phnl(1,2))
1041 coside(4) = dcos(thnl(1,2))*dcos(thnl(1,1))+dsin(thnl(1,2))*
1042 1 dsin(thnl(1,1))*dcos(phnl(1,2) -phnl(1,1))
1043 coside(5) = dcos(thnl(1,1))*dcos(thnl(2,2))+dsin(thnl(1,1))*
1044 1 dsin(thnl(2,2))*dcos(phnl(1,1) -phnl(2,2))
1046 if(coside(iz) .gt. 1.000000d0)
then
1047 coside(iz)=1.000000d0
1049 if(coside(iz) .lt. -1.000000d0)
then
1050 coside(iz)=-1.000000d0
1052 side(iz) = dacos(coside(iz))
1053 snside(iz)=dsin(side(iz))
1056 36 cosang(k) = 1.0d0
1057 if(side(1).lt.1.0d-10 .or. side(2).lt.1.0d-10) cosang(5)=-1.0d0
1058 if(side(1).lt.1.0d-10 .or. side(2).lt.1.0d-10)
go to 45
1059 cosang(1) = (coside(1) -coside(2)*coside(5))/
1060 1 (snside(2)*snside(5))
1061 cosang(2) = (coside(2) -coside(1)*coside(5))/
1062 1 (snside(1)*snside(5))
1063 cosang(5) = (coside(5) -coside(1)*coside(2))/
1064 1 (snside(1)*snside(2))
1066 if(side(3).lt.1.0d-10 .or. side(4).lt.1.0d-10) cosang(6)=-1.0d0
1067 if(side(3).lt.1.0d-10 .or. side(4).lt.1.0d-10)
go to 55
1068 cosang(3) = (coside(3) -coside(4)*coside(5))/
1069 1 (snside(4)*snside(5))
1070 cosang(4) = (coside(4) -coside(3)*coside(5))/
1071 1 (snside(3)*snside(5))
1072 cosang(6) = (coside(5) -coside(3)*coside(4))/
1073 1 (snside(3)*snside(4))
1077 difabs=dabs(dabs(cosang(iz) ) -1.0d0 )
1078 if(difabs .lt. 1.0d-10 .and. cosang(iz) .gt. 1.0d0)
1080 if(difabs .lt. 1.0d-10 .and. cosang(iz) .lt.aaaaa )
1082 34 angtri(iz)=dacos(cosang(iz))
1084 area1 =(angtri(1)+angtri(2)+angtri(5) -
pi)
1085 area2 =(angtri(3)+angtri(4)+angtri(6) -
pi)
1086 domgan = area1+area2
1087 if(phnl(1,1).lt.1.0d-6)
then
1098 subroutine riwat(wl,xsal,nr,ni)
1100 implicit real*8 (a-h,o-z)
1101 real*8 twl(62),tnr(62),tni(62)
1102 real*8 nr,ni,nrc,nic
1115 s 0.250,0.275,0.300,0.325,0.345,0.375,0.400,0.425,0.445,0.475,
1116 s 0.500,0.525,0.550,0.575,0.600,0.625,0.650,0.675,0.700,0.725,
1117 s 0.750,0.775,0.800,0.825,0.850,0.875,0.900,0.925,0.950,0.975,
1118 s 1.000,1.200,1.400,1.600,1.800,2.000,2.200,2.400,2.600,2.650,
1119 s 2.700,2.750,2.800,2.850,2.900,2.950,3.000,3.050,3.100,3.150,
1120 s 3.200,3.250,3.300,3.350,3.400,3.450,3.500,3.600,3.700,3.800,
1123 s 1.362,1.354,1.349,1.346,1.343,1.341,1.339,1.338,1.337,1.336,
1124 s 1.335,1.334,1.333,1.333,1.332,1.332,1.331,1.331,1.331,1.330,
1125 s 1.330,1.330,1.329,1.329,1.329,1.328,1.328,1.328,1.327,1.327,
1126 s 1.327,1.324,1.321,1.317,1.312,1.306,1.296,1.279,1.242,1.219,
1127 s 1.188,1.157,1.142,1.149,1.201,1.292,1.371,1.426,1.467,1.483,
1128 s 1.478,1.467,1.450,1.432,1.420,1.410,1.400,1.385,1.374,1.364,
1131 s 3.35e-08,2.35e-08,1.60e-08,1.08e-08,6.50e-09,
1132 s 3.50e-09,1.86e-09,1.30e-09,1.02e-09,9.35e-10,
1133 s 1.00e-09,1.32e-09,1.96e-09,3.60e-09,1.09e-08,
1134 s 1.39e-08,1.64e-08,2.23e-08,3.35e-08,9.15e-08,
1135 s 1.56e-07,1.48e-07,1.25e-07,1.82e-07,2.93e-07,
1136 s 3.91e-07,4.86e-07,1.06e-06,2.93e-06,3.48e-06,
1137 s 2.89e-06,9.89e-06,1.38e-04,8.55e-05,1.15e-04,
1138 s 1.10e-03,2.89e-04,9.56e-04,3.17e-03,6.70e-03,
1139 s 1.90e-02,5.90e-02,1.15e-01,1.85e-01,2.68e-01,
1140 s 2.98e-01,2.72e-01,2.40e-01,1.92e-01,1.35e-01,
1141 s 9.24e-02,6.10e-02,3.68e-02,2.61e-02,1.95e-02,
1142 s 1.32e-02,9.40e-03,5.15e-03,3.60e-03,3.40e-03,
1143 s 3.80e-03,4.60e-03/
1145 10
if (wl.lt.twl(i))
goto 20
1154 nr=tnr(i-1)+(wl-twl(i-1))*yr/xwl
1155 ni=tni(i-1)+(wl-twl(i-1))*yi/xwl
1175 nr=nr+nrc*(xsal/34.3)
1176 ni=ni+nic*(xsal/34.3)
1181 subroutine ufunc(pi,xmu,sig,uu)
1182 implicit real*8 (a-h,o-z)
1185 gnu=xmu/(sig*dsqrt(1.0d0-xmu**2))
1187 ff1=dexp(-gnusq)/(dsqrt(
pi)*gnu)
1188 ff2=(1.0d0-
erfz(gnu))
1189 ffnu=0.5d0*(ff1-ff2)
1190 uu=1.0d0/(1.0d0+ffnu)
1199 implicit real*8 (a-h,o-z)
1212 implicit real*8 (a-h,o-z)
1214 if(x.lt.0.d0.or.a.le.0.d0)pause
1216 call gser(gamser,a,x,gln)
1219 call gcf(gammcf,a,x,gln)
1227 subroutine gser(gamser,a,x,gln)
1228 implicit real*8 (a-h,o-z)
1245 if(dabs(del).lt.dabs(sum)*eps)
go to 1
1247 pause
'a too large, itmax too small'
1248 1 gamser=sum*dexp(-x+a*dlog(x)-gln)
1253 subroutine gcf(gammcf,a,x,gln)
1254 implicit real*8 (a-h,o-z)
1276 if(dabs((g-gold)/g).lt.eps)
go to 1
1280 pause
'a too large, itmax too small'
1282 gammcf=dexp(-x+a*dlog(x)-gln)*g
1289 implicit real*8 (a-h,o-z)
1290 real*8 cof(6),stp,half,one,fpf,x,tmp,ser
1292 data cof,stp/76.18009173d0,-86.50532033d0,24.01409822d0,
1293 * -1.231739516d0,.120858003d-2,-.536382d-5,2.50662827465d0/
1294 data half,one,fpf/0.5d0,1.0d0,5.5d0/
1299 tmp=(x+half)*log(tmp)-tmp
1310 subroutine probl_hg(pi,xmup,phirpx,xmux,phirx,sig,alfa,prob,
1313 implicit real*8 (a-h,o-z)
1325 cos2chi=-xmup*xmu-dsqrt((1.0d0-xmup**2)*(1.0d0-xmu**2))*
1328 alfa=(1.0d0+cos2chi)/(xmup-xmu)**2
1329 arg_exp=(1.0d0-2.0d0*alfa)/sig**2
1330 exp_term=dexp(arg_exp)
1331 prob=exp_term/(
pi*sig**2)
1333 chii=dacos(cos2chi)/2.0d0
1341 sinthipsq=sinthip**2
1342 sinthimsq=sinthim**2
1343 costhipsq=1.0d0-sinthipsq
1344 costhimsq=1.0d0-sinthimsq
1345 tanthipsq=sinthipsq/costhipsq
1346 tanthimsq=sinthimsq/costhimsq
1347 if(dabs(chii).lt.1.0d-6)
then
1348 rho_pls=((1.0d0-xn1)/(1.0d0+xn1))**2
1350 rho_pls=0.5d0*(tanthimsq/tanthipsq +
1351 1 sinthimsq/sinthipsq)
1353 xi_hg=(rho_pls*alfa**2*prob)/dabs(xmu)
1357 99
format(
'xmup,phirp,xmu,phir,sig',5f10.4)
1359 100
format(
'cos2chi,alfa,sig,arg_exp,exp_term,prob'/1p6e12.4)
1361 101
format(
'sinthipsq,sinthimsq,costhipsq,costhimsq'/1p4e12.4)
1363 102
format(
'tanthipsq,tanthimsq,rho_pls,xi_hg'/1p4e12.4)
1370 subroutine rufint_new (pi,con,amuo,thcnd,phcnd,opt,pti,
1371 1 xi_hgcnt,nthcnd,nphcnd)
1373 implicit real * 8 (a-h,o-z)
1374 real*8 thcnd(25),phcnd(46),xi_hgcnt(25,46)
1375 real * 8 pti(8,25,46)
1382 amu = dcos(thcnd(i)*con)
1384 xin1=pti(1,i,j)+pti(2,i,j)
1385 xin2=pti(5,i,j)+pti(6,i,j)
1387 xi_hgpi=xi_hgcnt(i,jr)*
pi
1389 xin1sea=xin1pi*dexp(-opt/amuo)
1390 xin1top =xin1sea*dexp(-xpt/amu)
1392 xin2sea=xin2pi*dexp(-opt/amuo)
1393 xin2top =xin2sea*dexp(-xpt/amu)
1394 write (7,500) thcnd(i),phcnd(j),xin1pi,xi_hgpi,
1402 100
format(
' the phi I_ZA I_HG',
1403 1
' Avg_I_ZA Avg_I_ZA_Top')
1404 500
format(1x,f6.2,1x,f6.2,2x,1p4d13.4)