17 use pkind, only: spi,dp
18 use pietc, only: f,t,u0,u1,u2,o2,rtod,dtor,pih,pi2
69 real(dp),
dimension(3),
intent(in ):: xc
70 real(dp),
dimension(2),
intent(out):: xs
72 zp=u1+xc(3); xs=xc(1:2)/zp
84 subroutine xstoxc(xs,xc,xcd)! [xstoxc]
87 real(dp),
dimension(2),
intent(in ):: xs
88 real(dp),
dimension(3),
intent(out):: xc
89 real(dp),
dimension(3,2),
intent(out):: xcd
91 zp=u2/(u1+dot_product(xs,xs)); xc(1:2)=xs*zp; xc(3)=zp
92 xcd=-
outer_product(xc,xs)*zp; xcd(1,1)=xcd(1,1)+zp; xcd(2,2)=xcd(2,2)+zp
109 real(dp),
dimension(2),
intent(in ):: xs
110 real(dp),
dimension(3),
intent(out):: xc
111 real(dp),
dimension(3,2),
intent(out):: xcd
112 real(dp),
dimension(3,2,2),
intent(out):: xcdd
113 real(dp),
dimension(3,2):: zpxcdxs
114 real(dp),
dimension(3) :: zpxc
117 zp=u2/(u1+dot_product(xs,xs)); xc(1:2)=xs*zp; xc(3)=zp
119 zpxc=zp*xc; xc(3)=xc(3)-u1; xcdd=u0
122 xcdd(:,i,i)=xcdd(:,i,i)-zpxc
123 xcdd(:,i,:)=xcdd(:,i,:)-zpxcdxs
124 xcdd(:,:,i)=xcdd(:,:,i)-zpxcdxs
125 xcdd(i,:,i)=xcdd(i,:,i)-zpxc(1:2)
126 xcdd(i,i,:)=xcdd(i,i,:)-zpxc(1:2)
128 do i=1,2; xcd(i,i)=xcd(i,i)+zp;
enddo
140 real(dp),
intent(in ):: k
141 real(dp),
dimension(2),
intent(in ):: xs
142 real(dp),
dimension(2),
intent(out):: xt
143 logical,
intent(out):: ff
145 s=k*(xs(1)*xs(1)+xs(2)*xs(2)); sc=u1-s
146 ff=abs(s)>=u1;
if(ff)
return
158 subroutine xttoxs(k,xt,xs,xsd,ff)! [xttoxs
161 real(dp),
intent(in ):: k
162 real(dp),
dimension(2),
intent(in ):: xt
163 real(dp),
dimension(2),
intent(out):: xs
164 real(dp),
dimension(2,2),
intent(out):: xsd
165 logical,
intent(out):: ff
166 real(dp),
dimension(2):: rspd
167 real(dp) :: s,sp,rsp,rsppi,rsppis
169 s=k*dot_product(xt,xt); sp=u1+s
170 ff=(sp<=u0);
if(ff)
return
177 do i=1,2; xsd(i,i)=xsd(i,i)+rsppi;
enddo
192 subroutine xttoxs1(k,xt,xs,xsd,xsdd,xs1,xsd1,ff)! [xttoxs]
195 real(dp),
intent(in ):: k
196 real(dp),
dimension(2),
intent(in ):: xt
197 real(dp),
dimension(2),
intent(out):: xs ,xs1
198 real(dp),
dimension(2,2),
intent(out):: xsd,xsd1
199 real(dp),
dimension(2,2,2),
intent(out):: xsdd
200 logical,
intent(out):: ff
201 real(dp),
dimension(2,2):: rspdd
202 real(dp),
dimension(2) :: rspd,rspd1,rsppid
203 real(dp) :: s,sp,rsp,rsppi,rsppis,s1,rsp1
205 s1=dot_product(xt,xt); s=k*s1; sp=u1+s
206 ff=(sp<=u0);
if(ff)
return
207 rsp=sqrt(sp); rsp1=o2*s1/rsp
208 rsppi=u1/(u1+rsp); rsppis=rsppi**2
209 xs=xt*rsppi; xs1=-xt*rsp1*rsppis
210 rspd=k*xt/rsp; rspd1=(xt*rsp-k*xt*rsp1)/sp
213 do i=1,2; xsd1(i,i)=xsd1(i,i)-rsp1; enddo; xsd1=xsd1*rsppis
216 do i=1,2; xsd(i,i)=xsd(i,i)+rsppi;
enddo
220 do i=1,2; xsdd(i,:,i)= rsppid;
enddo
221 do i=1,2; xsdd(i,i,:)=xsdd(i,i,:)+rsppid;
enddo
222 do i=1,2; xsdd(:,:,i)=xsdd(:,:,i)+u2*rspdd*rsppid(i);
enddo
223 do i=1,2; rspdd(i,i)=rspdd(i,i)+rsp*rsppi;
enddo
224 do i=1,2; xsdd(i,:,:)=xsdd(i,:,:)-xt(i)*rspdd*rsppi*k/sp;
enddo
236 real(dp),
intent(in ):: a
237 real(dp),
dimension(2),
intent(in ):: xt
238 real(dp),
dimension(2),
intent(out):: xm
239 logical ,
intent(out):: ff
241 do i=1,2; call
zttozm(a,xt(i),xm(i),ff);
if(ff)return;
enddo
253 subroutine xmtoxt(a,xm,xt,xtd,ff)! [xmtoxt]
255 real(dp),
intent(in ):: a
256 real(dp),
dimension(2),
intent(in ):: xm
257 real(dp),
dimension(2),
intent(out):: xt
258 real(dp),
dimension(2,2),
intent(out):: xtd
259 logical,
intent(out):: ff
261 xtd=u0;
do i=1,2; call
zmtozt(a,xm(i),xt(i),xtd(i,i),ff);
if(ff)return;
enddo
275 subroutine xmtoxt1(a,xm,xt,xtd,xt1,xtd1,ff)! [xmtoxt]
277 real(dp),
intent(in ):: a
278 real(dp),
dimension(2),
intent(in ):: xm
279 real(dp),
dimension(2),
intent(out):: xt,xt1
280 real(dp),
dimension(2,2),
intent(out):: xtd,xtd1
281 logical,
intent(out):: ff
286 call
zmtozt1(a,xm(i),xt(i),xtd(i,i),xt1(i),xtd1(i,i),ff)
300 real(dp),
intent(in ):: a,zt
301 real(dp),
intent(out):: zm
302 logical,
intent(out):: ff
305 if (a>u0)then; ra=sqrt( a); razt=ra*zt; zm=atan(razt)/ra
306 elseif(a<u0)then; ra=sqrt(-a); razt=ra*zt; ff=abs(razt)>=u1;
if(ff)
return
322 subroutine zmtozt(a,zm,zt,ztd,ff)! [zmtozt]
324 real(dp),
intent(in ):: a,zm
325 real(dp),
intent(out):: zt,ztd
326 logical,
intent(out):: ff
329 if (a>u0)then; ra=sqrt( a); zt=tan(ra*zm)/ra; ff=abs(ra*zm)>=pih
330 elseif(a<u0)then; ra=sqrt(-a); zt=tanh(ra*zm)/ra
347 subroutine zmtozt1(a,zm,zt,ztd,zt1,ztd1,ff)! [zmtozt]
351 real(dp),
intent(in ):: a,zm
352 real(dp),
intent(out):: zt,ztd,zt1,ztd1
353 logical,
intent(out):: ff
354 real(dp):: ra,rad,razm
356 if (a>u0)then;ra=sqrt( a);razm=ra*zm; zt=tan(razm)/ra; ff=abs(razm)>=pih
358 zt1=(rad*zm/ra)*((-u2*sin(razm*o2)**2-
sinoxm(razm))/cos(razm)+(tan(razm))**2)
359 elseif(a<u0)then;ra=sqrt(-a);razm=ra*zm; zt=tanh(razm)/ra
361 zt1=(rad*zm/ra)*((u2*sinh(razm*o2)**2-
sinhoxm(razm))/cosh(razm)-(tanh(razm))**2)
362 else ;zt=zm; zt1=zm**3*o3
365 ztd1=zt*zt +u2*a*zt*zt1
382 real(dp),
dimension(2),
intent(in ):: ak,xm
383 real(dp),
dimension(3),
intent(out):: xc
384 real(dp),
dimension(3,2),
intent(out):: xcd
385 logical,
intent(out):: ff
401 real(dp),
dimension(2),
intent(in ):: ak,xm
402 real(dp),
dimension(3),
intent(out):: xc
403 real(dp),
dimension(3,2),
intent(out):: xcd
404 real(dp),
dimension(3,2),
intent(out):: xc1
405 real(dp),
dimension(3,2,2),
intent(out):: xcd1
406 logical,
intent(out):: ff
407 real(dp),
dimension(3,2,2):: xcdd
408 real(dp),
dimension(2,2,2):: xsd1,xsdd
409 real(dp),
dimension(2,2) :: xtd,xsd,xs1,xtd1,xsdk,mat22
410 real(dp),
dimension(2) :: xt,xt1,xs,xsk
412 call
xmtoxt1(ak(1),xm,xt,xtd,xt1,xtd1,ff);
if(ff)
return
413 call
xttoxs1(ak(2),xt,xs,xsd,xsdd,xsk,xsdk,ff);
if(ff)
return
414 xs1(:,2)=xsk; xs1(:,1)=matmul(xsd,xt1)
415 mat22=xsdd(:,:,1)*xt1(1)+xsdd(:,:,2)*xt1(2)
416 xsd1(:,:,1)=matmul(xsd,xtd1)+matmul(mat22,xtd)
417 xsd1(:,:,2)=matmul(xsdk,xtd)
419 call
xstoxc(xs,xc,xcd,xcdd)
421 do i=1,3; xcd1(i,:,:)=matmul(transpose(xsd),matmul(xcdd(i,:,:),xs1));
enddo
422 do i=1,2; xcd1(:,:,i)=xcd1(:,:,i)+matmul(xcd,xsd1(:,:,i));
enddo
441 real(dp),
intent(in ):: a,k
442 real(dp),
dimension(2),
intent(in ):: xm
443 real(dp),
dimension(3),
intent(out):: xc
444 real(dp),
dimension(3,2),
intent(out):: xcd
445 logical,
intent(out):: ff
446 real(dp),
dimension(2,2):: xtd,xsd
447 real(dp),
dimension(2) :: xt,xs
448 call
xmtoxt(a,xm,xt,xtd,ff);
if(ff)
return
449 call
xttoxs(k,xt,xs,xsd,ff);
if(ff)
return
467 real(dp),
intent(in ):: a,k
468 real(dp),
dimension(3),
intent(in ):: xc
469 real(dp),
dimension(2),
intent(out):: xm
470 logical,
intent(out):: ff
471 real(dp),
dimension(2):: xs,xt
474 call
xstoxt(k,xs,xt,ff);
if(ff)
return
488 subroutine get_edges(arcx,arcy,edgex,edgey)! [get_edges]
490 real(dp),
intent(in ):: arcx,arcy
491 real(dp),
dimension(3),
intent(out):: edgex,edgey
492 real(dp):: cx,sx,cy,sy,rarcx,rarcy
493 rarcx=arcx*dtor; rarcy=arcy*dtor
494 cx=cos(rarcx); sx=sin(rarcx)
495 cy=cos(rarcy); sy=sin(rarcy)
496 edgex=(/sx,u0,cx/); edgey=(/u0,sy,cy/)
511 subroutine get_qx(j0, v1,v2,v3,v4)! [get_qx]
514 real(dp),
dimension(3,2),
intent(in ):: j0
515 real(dp),
intent(out):: v1,v2,v3,v4
516 real(dp),
dimension(2,2):: el,g
517 g=matmul(transpose(j0),j0)
519 v1=el(1,1)**2+u2*el(1,2)**2+el(2,2)**2
522 v4=(el(1,1)+el(2,2))**2
541 subroutine get_qxd(j0,j0d, v1,v2,v3,v4,v1d,v2d,v3d,v4d)! [get_qx]
544 real(dp),
dimension(3,2),
intent(in ):: j0
545 real(dp),
dimension(3,2,2),
intent(in ):: j0d
546 real(dp),
intent(out):: v1,v2,v3,v4
547 real(dp),
dimension(2),
intent(out):: v1d,v2d,v3d,v4d
548 real(dp),
dimension(2,2,2,2):: deldg
549 real(dp),
dimension(2,2,2) :: eld,gd
550 real(dp),
dimension(2,2) :: el,g
551 integer(spi) :: i,j,k
552 g=matmul(transpose(j0),j0)
554 gd(:,:,i)=matmul(transpose(j0d(:,:,i)),j0)+matmul(transpose(j0),j0d(:,:,i))
556 call
logsym2(g,el,deldg); el=el*o2; deldg=deldg*o2
558 do i=1,2;
do j=1,2;
do k=1,2
559 eld(:,:,k)=eld(:,:,k)+deldg(:,:,i,j)*gd(i,j,k)
560 enddo ;
enddo ;
enddo
561 v1=el(1,1)**2+u2*el(1,2)**2+el(2,2)**2
564 v4=(el(1,1)+el(2,2))**2
565 v1d=u2*(el(1,1)*eld(1,1,:)+u2*el(1,2)*eld(1,2,:)+el(2,2)*eld(2,2,:))
568 v4d=u2*(el(1,1)+el(2,2))*(eld(1,1,:)+eld(2,2,:))
602 subroutine get_meanqd(ngh,lam,xg,wg,ak,ma, q,qdak,qdma, & ! [get_meanq]
605 integer(spi),
intent(in ):: ngh
606 real(dp),
intent(in ):: lam
607 real(dp),
dimension(ngh),
intent(in ):: xg,wg
608 real(dp),
dimension(2) ,
intent(in ):: ak,ma
609 real(dp),
intent(out):: q
610 real(dp),
dimension(2),
intent(out):: qdak,qdma
611 real(dp),
dimension(2),
intent(out):: ga
612 real(dp),
dimension(2,2),
intent(out):: gadak,gadma
613 logical,
intent(out):: ff
614 real(dp),
dimension(3,2,2):: xcd1
615 real(dp),
dimension(3,2) :: xcd,xc1
616 real(dp),
dimension(3) :: xc
617 real(dp),
dimension(2) :: xm, v1dxy,v2dxy,v3dxy,v4dxy, &
618 v1dl,v2dl,v3dl,v4dl, v1d,v2d,v3d,v4d
620 v1xy,v2xy,v3xy,v4xy, v1l,v2l,v3l,v4l, v1,v2,v3,v4
621 integer(spi) :: i,ic,ix,iy
622 v1 =u0; v2 =u0; v3 =u0; v4 =u0
623 v1d=u0; v2d=u0; v3d=u0; v4d=u0
627 v1l =u0; v2l =u0; v3l =u0; v4l =u0
628 v1dl=u0; v2dl=u0; v3dl=u0; v4dl=u0
632 call
xmtoxc_ak(ak,xm,xc,xcd,xc1,xcd1,ff);
if(ff)
return
633 call
get_qx(xcd,xcd1, v1xy,v2xy,v3xy,v4xy, v1dxy,v2dxy,v3dxy,v4dxy)
634 v1l =v1l +wx*v1xy; v2l =v2l +wx*v2xy
635 v3l =v3l +wx*v3xy; v4l =v4l +wx*v4xy
636 v1dl=v1dl+wx*v1dxy;v2dl=v2dl+wx*v2dxy
637 v3dl=v3dl+wx*v3dxy;v4dl=v4dl+wx*v4dxy
639 v1 =v1 +wy*v1l; v2 =v2 +wy*v2l; v3 =v3 +wy*v3l; v4 =v4 +wy*v4l
640 v1d=v1d+wy*v1dl; v2d=v2d+wy*v2dl; v3d=v3d+wy*v3dl; v4d=v4d+wy*v4dl
643 call
get_qofv(lam,v2,v3, v1d,v2d,v3d,v4d, qdak)
649 call
xmtoxc_ak(ak,xm,xc,xcd,xc1,xcd1,ff);
if(ff)
return
650 ga(i)=atan2(xc(i),xc(3))*rtod
651 gadak(i,:)=(xc(3)*xc1(i,:)-xc(i)*xc1(3,:))*rtod
652 gadma(i,i)=(xc(3)*xcd(i,i)-xc(i)*xcd(3,i))*rtod
654 v1l=u0; v2l=u0; v3l=u0; v4l=u0
658 call
xmtoxc_ak(ak,xm,xc,xcd,ff);
if(ff)
return
659 call
get_qx(xcd, v1xy,v2xy,v3xy,v4xy)
660 v1l=v1l+wy*v1xy; v2l=v2l+wy*v2xy; v3l=v3l+wy*v3xy; v4l=v4l+wy*v4xy
662 v1d(i)=(v1l-v1)/ma(i); v2d(i)=(v2l-v2)/ma(i)
663 v3d(i)=(v3l-v3)/ma(i); v4d(i)=(v4l-v4)/ma(i)
665 call
get_qofv(lam,v2,v3, v1d,v2d,v3d,v4d, qdma)
681 subroutine get_meanqs(n,ngh,lam,xg,wg,aks,mas, qs,ff)! [get_meanq]
683 integer(spi),
intent(in ):: n,ngh
684 real(dp),
dimension(ngh),
intent(in ):: xg,wg
685 real(dp),
intent(in ):: lam
686 real(dp),
dimension(2,n),
intent(in ):: aks,mas
687 real(dp),
dimension(n),
intent(out):: qs
688 logical,
intent(out):: ff
689 real(dp),
dimension(n) :: v1s,v2s,v3s,v4s
690 real(dp),
dimension(n) :: v1sl,v2sl,v3sl,v4sl
691 real(dp),
dimension(3,2):: xcd
692 real(dp),
dimension(3) :: xc
693 real(dp),
dimension(2) :: xm,xgs
694 real(dp) :: wx,wy, v1xy,v2xy,v3xy,v4xy
695 integer(spi) :: i,ix,iy
696 v1s=u0; v2s=u0; v3s=u0; v4s=u0
699 v1sl=u0; v2sl=u0; v3sl=u0; v4sl=u0
702 xgs=(/xg(ix),xg(iy)/)
705 call
xmtoxc_ak(aks(:,i),xm,xc,xcd,ff);
if(ff)
return
706 call
get_qx(xcd,v1xy,v2xy,v3xy,v4xy)
707 v1sl(i)=v1sl(i)+wx*v1xy; v2sl(i)=v2sl(i)+wx*v2xy
708 v3sl(i)=v3sl(i)+wx*v3xy; v4sl(i)=v4sl(i)+wx*v4xy
711 v1s=v1s+wy*v1sl; v2s=v2s+wy*v2sl; v3s=v3s+wy*v3sl; v4s=v4s+wy*v4sl
713 call
get_qofv(n,lam,v1s,v2s,v3s,v4s, qs)
728 subroutine get_qofv(lam,v1,v2,v3,v4, q)! [get_qofv]
730 real(dp),
intent(in ):: lam,v1,v2,v3,v4
731 real(dp),
intent(out):: q
734 q=lamc*(v1-(v2**2+v3**2)) +lam*(v4 -(v2+v3)**2)
750 subroutine get_qofvd(lam, v2,v3, v1d,v2d,v3d,v4d, qd)! [get_qofv]
752 real(dp),
intent(in ):: lam,v2,v3
753 real(dp),
dimension(2),
intent(in ):: v1d,v2d,v3d,v4d
754 real(dp),
dimension(2),
intent(out):: qd
757 qd=lamc*(v1d-u2*(v2d*v2+v3d*v3))+lam*(v4d-u2*(v2d+v3d)*(v2+v3))
772 integer(spi),
intent(in ):: n
773 real(dp),
intent(in ):: lam
774 real(dp),
dimension(n),
intent(in ):: v1s,v2s,v3s,v4s
775 real(dp),
dimension(n),
intent(out):: qs
778 qs=lamc*(v1s-(v2s**2+v3s**2)) +lam*(v4s -(v2s+v3s)**2)
792 real(dp),
intent(in ):: asp,tmarcx
793 real(dp),
dimension(2),
intent(out):: ak
810 real(dp),
intent(in ):: asp,arc
811 real(dp),
dimension(2),
intent(out):: ak
812 integer(spi),
parameter :: narc=11,nasp=10
813 real(dp),
parameter :: eps=1.e-7_dp,darc=10._dp+eps,dasp=.1_dp+eps
814 real(dp),
dimension(nasp,0:narc):: adarc,kdarc
815 real(dp) :: sasp,sarc,wx0,wx1,wa0,wa1
816 integer(spi) :: iasp0,iasp1,iarc0,iarc1
826 -.450_dp,-.328_dp,-.185_dp,-.059_dp,0.038_dp,0.107_dp,0.153_dp,0.180_dp,0.195_dp,0.199_dp,&
827 -.452_dp,-.327_dp,-.184_dp,-.058_dp,0.039_dp,0.108_dp,0.154_dp,0.182_dp,0.196_dp,0.200_dp,&
828 -.457_dp,-.327_dp,-.180_dp,-.054_dp,0.043_dp,0.112_dp,0.158_dp,0.186_dp,0.200_dp,0.205_dp,&
829 -.464_dp,-.323_dp,-.173_dp,-.047_dp,0.050_dp,0.118_dp,0.164_dp,0.192_dp,0.208_dp,0.213_dp,&
830 -.465_dp,-.313_dp,-.160_dp,-.035_dp,0.060_dp,0.127_dp,0.173_dp,0.202_dp,0.217_dp,0.224_dp,&
831 -.448_dp,-.288_dp,-.138_dp,-.017_dp,0.074_dp,0.140_dp,0.184_dp,0.213_dp,0.230_dp,0.237_dp,&
832 -.395_dp,-.244_dp,-.104_dp,0.008_dp,0.093_dp,0.156_dp,0.199_dp,0.227_dp,0.244_dp,0.252_dp,&
833 -.301_dp,-.177_dp,-.057_dp,0.042_dp,0.119_dp,0.175_dp,0.215_dp,0.242_dp,0.259_dp,0.269_dp,&
834 -.185_dp,-.094_dp,0.001_dp,0.084_dp,0.150_dp,0.199_dp,0.235_dp,0.260_dp,0.277_dp,0.287_dp,&
835 -.069_dp,-.006_dp,0.066_dp,0.132_dp,0.186_dp,0.227_dp,0.257_dp,0.280_dp,0.296_dp,0.308_dp,&
836 0.038_dp,0.081_dp,0.134_dp,0.185_dp,0.226_dp,0.258_dp,0.283_dp,0.303_dp,0.319_dp,0.333_dp,&
837 0.038_dp,0.081_dp,0.134_dp,0.185_dp,0.226_dp,0.258_dp,0.283_dp,0.303_dp,0.319_dp,0.333_dp/
840 -.947_dp,-.818_dp,-.668_dp,-.535_dp,-.433_dp,-.361_dp,-.313_dp,-.284_dp,-.269_dp,-.264_dp,&
841 -.946_dp,-.816_dp,-.665_dp,-.533_dp,-.431_dp,-.359_dp,-.311_dp,-.282_dp,-.267_dp,-.262_dp,&
842 -.942_dp,-.806_dp,-.655_dp,-.524_dp,-.424_dp,-.353_dp,-.305_dp,-.276_dp,-.261_dp,-.255_dp,&
843 -.932_dp,-.789_dp,-.637_dp,-.509_dp,-.412_dp,-.343_dp,-.296_dp,-.266_dp,-.250_dp,-.244_dp,&
844 -.909_dp,-.759_dp,-.609_dp,-.486_dp,-.394_dp,-.328_dp,-.283_dp,-.254_dp,-.237_dp,-.230_dp,&
845 -.863_dp,-.711_dp,-.569_dp,-.456_dp,-.372_dp,-.310_dp,-.266_dp,-.238_dp,-.220_dp,-.212_dp,&
846 -.779_dp,-.642_dp,-.518_dp,-.419_dp,-.343_dp,-.287_dp,-.247_dp,-.220_dp,-.202_dp,-.192_dp,&
847 -.661_dp,-.556_dp,-.456_dp,-.374_dp,-.310_dp,-.262_dp,-.226_dp,-.200_dp,-.182_dp,-.171_dp,&
848 -.533_dp,-.462_dp,-.388_dp,-.325_dp,-.274_dp,-.234_dp,-.203_dp,-.179_dp,-.161_dp,-.150_dp,&
849 -.418_dp,-.373_dp,-.322_dp,-.275_dp,-.236_dp,-.204_dp,-.178_dp,-.156_dp,-.139_dp,-.127_dp,&
850 -.324_dp,-.296_dp,-.261_dp,-.229_dp,-.200_dp,-.174_dp,-.152_dp,-.133_dp,-.117_dp,-.104_dp,&
851 -.324_dp,-.296_dp,-.261_dp,-.229_dp,-.200_dp,-.174_dp,-.152_dp,-.133_dp,-.117_dp,-.104_dp/
854 iasp0=floor(sasp); wa1=sasp-iasp0
855 iasp1=iasp0+1; wa0=iasp1-sasp
857 iarc0=floor(sarc); wx1=sarc-iarc0
858 iarc1=iarc0+1; wx0=iarc1-sarc
859 if(iasp0<1 .or. iasp1>nasp)stop
'Guessak_geo; Aspect ratio out of range'
860 if(iarc0<0 .or. iarc1>narc)stop
'Guessak_geo; Major semi-arc is out of range'
863 ak=(/wx0*(wa0*adarc(iasp0,iarc0)+wa1*adarc(iasp1,iarc0))+ &
864 wx1*(wa0*adarc(iasp0,iarc1)+wa1*adarc(iasp1,iarc1)), &
865 wx0*(wa0*kdarc(iasp0,iarc0)+wa1*kdarc(iasp1,iarc0))+ &
866 wx1*(wa0*kdarc(iasp0,iarc1)+wa1*kdarc(iasp1,iarc1))/)
902 subroutine bestesg_geo(lam,garcx,garcy, a,k,marcx,marcy,q,ff)! [bestesg_geo]
903 use pietc, only: u5,o5,s18,s36,s54,s72,ms18,ms36,ms54,ms72
907 real(dp),
intent(in ):: lam,garcx,garcy
908 real(dp),
intent(out):: a,k,marcx,marcy,q
909 logical ,
intent(out):: ff
910 integer(spi),
parameter :: nit=200,mit=20,ngh=25
911 real(dp) ,
parameter :: u2o5=u2*o5,&
912 f18=u2o5*s18,f36=u2o5*s36,f54=u2o5*s54,&
913 f72=u2o5*s72,mf18=-f18,mf36=-f36,mf54=-f54,&
914 mf72=-f72,& !<- (Fourier transform coefficients)
915 r=0.001_dp,rr=r*r,dang=pi2*o5,crit=1.e-14_dp
916 real(dp),
dimension(ngh) :: wg,xg
917 real(dp),
dimension(0:4,0:4):: em5
918 real(dp),
dimension(0:4) :: qs
919 real(dp),
dimension(2,0:4) :: aks,mas
920 real(dp),
dimension(2,2) :: basis0,basis,hess,el,gadak,gadma,madga,madak
921 real(dp),
dimension(2) :: ak,dak,dma,vec2,grad,qdak,qdma,ga,ma,gat
922 real(dp) :: s,tgarcx,tgarcy,asp,ang
925 data em5/o5,u2o5, u0,u2o5, u0,&
926 o5, f18, f72,mf54, f36,&
927 o5,mf54, f36, f18,mf72,&
928 o5,mf54,mf36, f18, f72,&
929 o5, f18,mf72,mf54,mf36/
932 data basis0/0.1_dp,u0, 0.3_dp,0.3_dp/
933 ff=lam<u0 .or. lam>=u1
934 if(ff)then; print
'("In bestesg_geo; lam out of range")';return;
endif
935 ff= garcx<=u0 .or. garcy<=u0
937 print
'("In bestesg_geo; a nonpositive domain parameter, garcx or garcy")'
942 if(flip)then; tgarcx=garcy; tgarcy=garcx
943 else ; tgarcx=garcx; tgarcy=garcy
966 call
get_meanq(ngh,lam,xg,wg,ak,ma,q,qdak,qdma,gat,gadak,gadma,ff)
968 madga=gadma; call
inv(madga)
969 madak=-matmul(madga,gadak)
970 qdak=qdak+matmul(qdma,madak)
975 vec2=(/cos(ang),sin(ang)/)*r
976 dak=matmul(basis,vec2)
977 dma=matmul(madak,dak)
981 call
get_meanq(5,ngh,lam,xg,wg,aks,mas, qs,ff)
983 grad=matmul(qdak,basis)/q
996 hess(1,1)=qs(0)+qs(3)
999 hess(2,2)=qs(0)-qs(3)
1003 call
chol2(hess,el,ff)
1005 print
'(" In bestESG_geo, Hessian is not positive; cholesky fails")'
1009 el(1,1)=u1/el(1,1); el(2,2)=u1/el(2,2); el(2,1)=-el(2,1)*el(1,1)*el(2,2)
1012 vec2=-matmul(transpose(el),matmul(el,grad))
1013 dak=matmul(basis,vec2)
1014 gat=gat+matmul(gadak,dak)
1016 dma=-matmul(madga,gat-ga)
1023 if(it<mit)basis=matmul(basis,transpose(el))
1025 s=sqrt(dot_product(dak,dak))
1028 if(it>nit)print
'("WARNING; Relatively inferior convergence in bestesg_geo")'
1031 if(flip)then; marcx=ma(2); marcy=ma(1)
1032 else ; marcx=ma(1); marcy=ma(2)
1072 subroutine bestesg_map(lam,marcx,marcy, a,k,garcx,garcy,q,ff) ![bestesg_map]
1073 use pietc, only: u5,o5,s18,s36,s54,s72,ms18,ms36,ms54,ms72
1076 real(dp),
intent(in ):: lam,marcx,marcy
1077 real(dp),
intent(out):: a,k,garcx,garcy,q
1078 logical ,
intent(out):: ff
1079 integer(spi),
parameter :: nit=25,mit=7,ngh=25
1080 real(dp),
parameter :: u2o5=u2*o5, &
1081 f18=u2o5*s18,f36=u2o5*s36,f54=u2o5*s54, &
1082 f72=u2o5*s72,mf18=-f18,mf36=-f36,mf54=-f54,&
1083 mf72=-f72,& !<- (Fourier)
1084 r=0.001_dp,rr=r*r,dang=pi2*o5,crit=1.e-12_dp
1085 real(dp),
dimension(ngh) :: wg,xg
1086 real(dp),
dimension(0:4,0:4):: em5
1087 real(dp),
dimension(0:4) :: qs
1088 real(dp),
dimension(2,0:4) :: aks,mas
1089 real(dp),
dimension(2,2) :: basis0,basis,hess,el,gadak,gadma
1090 real(dp),
dimension(2) :: ak,dak,vec2,grad,qdak,qdma,ga,ma
1091 real(dp) :: s,tmarcx,tmarcy,asp,ang
1092 integer(spi) :: i,it
1094 data em5/o5,u2o5, u0,u2o5, u0,&
1095 o5, f18, f72,mf54, f36,&
1096 o5,mf54, f36, f18,mf72,&
1097 o5,mf54,mf36, f18, f72,&
1098 o5, f18,mf72,mf54,mf36/
1101 data basis0/0.1_dp,u0, 0.3_dp,0.3_dp/
1102 ff=lam<u0 .or. lam>=u1
1103 if(ff)then; print
'("In bestesg_map; lam out of range")';return;
endif
1104 ff= marcx<=u0 .or. marcy<=u0
1106 print
'("In bestesg_map; a nonpositive domain parameter, marcx or marcy")'
1111 if(flip)then; tmarcx=marcy; tmarcy=marcx
1112 else ; tmarcx=marcx; tmarcy=marcy
1114 ma=(/tmarcx,tmarcy/);
do i=0,4; mas(:,i)=ma;
enddo
1121 call
get_meanq(ngh,lam,xg,wg,ak,ma,q,qdak,qdma,ga,gadak,gadma,ff)
1127 vec2=(/cos(ang),sin(ang)/)*r
1128 aks(:,i)=ak+matmul(basis,vec2)
1130 call
get_meanq(5,ngh,lam,xg,wg,aks,mas, qs,ff)
1132 grad=matmul(qdak,basis)/q
1144 hess(1,1)=qs(0)+qs(3)
1147 hess(2,2)=qs(0)-qs(3)
1151 call
chol2(hess,el,ff)
1153 print
'(" In bestESG_map, hessian is not positive; cholesky fails")'
1157 el(1,1)=u1/el(1,1); el(2,2)=u1/el(2,2); el(2,1)=-el(2,1)*el(1,1)*el(2,2)
1160 vec2=-matmul(transpose(el),matmul(el,grad))
1161 dak=matmul(basis,vec2)
1162 ga=ga+matmul(gadak,dak)
1169 if(it<mit)basis=matmul(basis,transpose(el))
1171 s=sqrt(dot_product(dak,dak))
1174 if(it>nit)print
'("WARNING; Relatively inferior convergence in bestesg_map")'
1177 if(flip)then; garcx=ga(2); garcy=ga(1)
1178 else ; garcx=ga(1); garcy=ga(2)
1219 subroutine hgrid_ak_rr(lx,ly,nx,ny,A,K,plat,plon,pazi, & ! [hgrid_ak_rr]
1220 delx,dely, glat,glon,garea, ff)
1224 integer(spi),
intent(in ):: lx,ly,nx,ny
1225 real(dp),
intent(in ):: a,k,plat,plon,pazi, &
1227 real(dp),
dimension(lx:lx+nx ,ly:ly+ny ),
intent(out):: glat,glon
1228 real(dp),
dimension(lx:lx+nx-1,ly:ly+ny-1),
intent(out):: garea
1229 logical,
intent(out):: ff
1230 real(dp),
dimension(3,3):: prot,azirot
1231 real(dp),
dimension(3,2):: xcd
1232 real(dp),
dimension(3) :: xc
1233 real(dp),
dimension(2) :: xm
1234 real(dp) :: clat,slat,clon,slon,cazi,sazi,&
1235 rlat,drlata,drlatb,drlatc, &
1236 rlon,drlona,drlonb,drlonc
1237 integer(spi) :: ix,iy,mx,my
1238 clat=cos(plat); slat=sin(plat)
1239 clon=cos(plon); slon=sin(plon)
1240 cazi=cos(pazi); sazi=sin(pazi)
1242 azirot(:,1)=(/ cazi, sazi, u0/)
1243 azirot(:,2)=(/-sazi, cazi, u0/)
1244 azirot(:,3)=(/ u0, u0, u1/)
1246 prot(:,1)=(/ -slon, clon, u0/)
1247 prot(:,2)=(/-slat*clon, -slat*slon, clat/)
1248 prot(:,3)=(/ clat*clon, clat*slon, slat/)
1249 prot=matmul(prot,azirot)
1258 xcd=matmul(prot,xcd)
1259 xc =matmul(prot,xc )
1260 call
ctogr(xc,glat(ix,iy),glon(ix,iy))
1268 drlata=glat(ix+1,iy )-rlat
1269 drlatb=glat(ix+1,iy+1)-rlat
1270 drlatc=glat(ix ,iy+1)-rlat
1272 drlona=glon(ix+1,iy )-rlon
1273 drlonb=glon(ix+1,iy+1)-rlon
1274 drlonc=glon(ix ,iy+1)-rlon
1279 garea(ix,iy)=
sarea(rlat, drlata,drlona, drlatb,drlonb) &
1280 -
sarea(rlat, drlatc,drlonc, drlatb,drlonb)
1337 delx,dely, glat,glon,garea,dx,dy,angle_dx,angle_dy, ff)
1341 integer(spi),
intent(in ):: lx,ly,nx,ny
1342 real(dp),
intent(in ):: a,k,plat,plon,pazi, &
1344 real(dp),
dimension(lx:lx+nx ,ly:ly+ny ),
intent(out):: glat,glon
1345 real(dp),
dimension(lx:lx+nx-1,ly:ly+ny-1),
intent(out):: garea
1346 real(dp),
dimension(lx:lx+nx-1,ly:ly+ny ),
intent(out):: dx
1347 real(dp),
dimension(lx:lx+nx ,ly:ly+ny-1),
intent(out):: dy
1348 real(dp),
dimension(lx:lx+nx ,ly:ly+ny ),
intent(out):: angle_dx,angle_dy
1349 logical,
intent(out):: ff
1350 real(dp),
dimension(lx-1:lx+nx+1,ly-1:ly+ny+1):: gat
1351 real(dp),
dimension(lx-1:lx+nx+1,ly :ly+ny ):: dxt
1352 real(dp),
dimension(lx :lx+nx ,ly-1:ly+ny+1):: dyt
1353 real(dp),
dimension(3,3):: prot,azirot
1354 real(dp),
dimension(3,2):: xcd,eano
1355 real(dp),
dimension(2,2):: xcd2
1356 real(dp),
dimension(3) :: xc,east,north
1357 real(dp),
dimension(2) :: xm
1358 real(dp) :: clat,slat,clon,slon,cazi,sazi,delxy
1359 integer(spi) :: ix,iy,mx,my,lxm,lym,mxp,myp
1361 clat=cos(plat); slat=sin(plat)
1362 clon=cos(plon); slon=sin(plon)
1363 cazi=cos(pazi); sazi=sin(pazi)
1365 azirot(:,1)=(/ cazi, sazi, u0/)
1366 azirot(:,2)=(/-sazi, cazi, u0/)
1367 azirot(:,3)=(/ u0, u0, u1/)
1369 prot(:,1)=(/ -slon, clon, u0/)
1370 prot(:,2)=(/-slat*clon, -slat*slon, clat/)
1371 prot(:,3)=(/ clat*clon, clat*slon, slat/)
1372 prot=matmul(prot,azirot)
1384 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
1385 xcd=matmul(prot,xcd)
1386 xc =matmul(prot,xc )
1387 call
ctogr(xc,glat(ix,iy),glon(ix,iy))
1388 east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east))
1390 eano(:,1)=east; eano(:,2)=north
1391 xcd2=matmul(transpose(eano),xcd)
1392 angle_dx(ix,iy)=atan2( xcd2(2,1),xcd2(1,1))
1393 angle_dy(ix,iy)=atan2(-xcd2(1,2),xcd2(2,2))
1394 dxt(ix,iy)=sqrt(dot_product(xcd2(:,1),xcd2(:,1)))*delx
1395 dyt(ix,iy)=sqrt(dot_product(xcd2(:,2),xcd2(:,2)))*dely
1404 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
1405 xcd=matmul(prot,xcd)
1406 xc =matmul(prot,xc )
1407 east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east))
1409 eano(:,1)=east; eano(:,2)=north
1410 xcd2=matmul(transpose(eano),xcd)
1411 dxt(lxm,iy)=sqrt(dot_product(xcd2(:,1),xcd2(:,1)))*delx
1419 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
1420 xcd=matmul(prot,xcd)
1421 xc =matmul(prot,xc )
1422 east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east))
1424 eano(:,1)=east; eano(:,2)=north
1425 xcd2=matmul(transpose(eano),xcd)
1426 dxt(mxp,iy)=sqrt(dot_product(xcd2(:,1),xcd2(:,1)))*delx
1434 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
1435 xcd=matmul(prot,xcd)
1436 xc =matmul(prot,xc )
1437 east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east))
1439 eano(:,1)=east; eano(:,2)=north
1440 xcd2=matmul(transpose(eano),xcd)
1441 dyt(ix,lym)=sqrt(dot_product(xcd2(:,2),xcd2(:,2)))*dely
1449 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
1450 xcd=matmul(prot,xcd)
1451 xc =matmul(prot,xc )
1452 east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east))
1454 eano(:,1)=east; eano(:,2)=north
1455 xcd2=matmul(transpose(eano),xcd)
1456 dyt(ix,myp)=sqrt(dot_product(xcd2(:,2),xcd2(:,2)))*dely
1464 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
1465 xcd=matmul(prot,xcd)
1466 xc =matmul(prot,xc )
1471 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
1472 xcd=matmul(prot,xcd)
1473 xc =matmul(prot,xc )
1479 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
1480 xcd=matmul(prot,xcd)
1481 xc =matmul(prot,xc )
1486 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
1487 xcd=matmul(prot,xcd)
1488 xc =matmul(prot,xc )
1492 dx =(13_dp*(dxt(lx :mx-1,:)+dxt(lx+1:mx ,:)) &
1493 -(dxt(lxm:mx-2,:)+dxt(lx+2:mxp,:)))/24_dp
1494 dy =(13_dp*(dyt(:,ly :my-1)+dyt(:,ly+1:my )) &
1495 -(dyt(:,lym:my-2)+dyt(:,ly+2:myp)))/24_dp
1496 gat(lx:mx-1,:)=(13_dp*(gat(lx :mx-1,:)+gat(lx+1:mx ,:)) &
1497 -(gat(lxm:mx-2,:)+gat(lx+2:mxp,:)))/24_dp
1498 garea =(13_dp*(gat(lx:mx-1,ly :my-1)+gat(lx:mx-1,ly+1:my )) &
1499 -(gat(lx:mx-1,lym:my-2)+gat(lx:mx-1,ly+2:myp)))/24_dp
1539 subroutine hgrid_ak_rc(lx,ly,nx,ny,A,K,plat,plon,pazi, & ! [hgrid_ak_rc]
1540 delx,dely, xc,xcd,garea, ff)
1544 integer(spi),
intent(in ):: lx,ly,nx,ny
1545 real(dp),
intent(in ):: a,k,plat,plon,pazi,delx,dely
1546 real(dp),
dimension(3, lx:lx+nx ,ly:ly+ny ),
intent(out):: xc
1547 real(dp),
dimension(3,2,lx:lx+nx ,ly:ly+ny ),
intent(out):: xcd
1548 real(dp),
dimension( lx:lx+nx-1,ly:ly+ny-1),
intent(out):: garea
1549 logical,
intent(out):: ff
1550 real(dp),
dimension(3,3):: prot,azirot
1551 real(dp),
dimension(2) :: xm
1552 real(dp) :: clat,slat,clon,slon,cazi,sazi, &
1553 rlat,rlata,rlatb,rlatc,drlata,drlatb,drlatc, &
1554 rlon,rlona,rlonb,rlonc,drlona,drlonb,drlonc
1555 integer(spi) :: ix,iy,mx,my
1556 clat=cos(plat); slat=sin(plat)
1557 clon=cos(plon); slon=sin(plon)
1558 cazi=cos(pazi); sazi=sin(pazi)
1560 azirot(:,1)=(/ cazi, sazi, u0/)
1561 azirot(:,2)=(/-sazi, cazi, u0/)
1562 azirot(:,3)=(/ u0, u0, u1/)
1564 prot(:,1)=(/ -slon, clon, u0/)
1565 prot(:,2)=(/-slat*clon, -slat*slon, clat/)
1566 prot(:,3)=(/ clat*clon, clat*slon, slat/)
1567 prot=matmul(prot,azirot)
1574 call
xmtoxc_ak(a,k,xm,xc(:,ix,iy),xcd(:,:,ix,iy),ff)
1576 xcd(:,:,ix,iy)=matmul(prot,xcd(:,:,ix,iy))
1577 xc(:, ix,iy)=matmul(prot,xc(:, ix,iy))
1584 call
ctogr(xc(:,ix ,iy ),rlat ,rlon )
1585 call
ctogr(xc(:,ix+1,iy ),rlata,rlona)
1586 call
ctogr(xc(:,ix+1,iy+1),rlatb,rlonb)
1587 call
ctogr(xc(:,ix ,iy+1),rlatc,rlonc)
1588 drlata=rlata-rlat; drlona=rlona-rlon
1589 drlatb=rlatb-rlat; drlonb=rlonb-rlon
1590 drlatc=rlatc-rlat; drlonc=rlonc-rlon
1596 garea(ix,iy)=
sarea(rlat, drlata,drlona, drlatb,drlonb) &
1597 -
sarea(rlat, drlatc,drlonc, drlatb,drlonb)
1628 subroutine hgrid_ak_dd(lx,ly,nx,ny,a,k,pdlat,pdlon,pdazi, & ! [hgrid_ak_dd]
1629 delx,dely, gdlat,gdlon,garea, ff)
1631 integer(spi),
intent(in ):: lx,ly,nx,ny
1632 real(dp),
intent(in ):: a,k,pdlat,pdlon,&
1634 real(dp),
dimension(lx:lx+nx ,ly:ly+ny ),
intent(out):: gdlat,gdlon
1635 real(dp),
dimension(lx:lx+nx-1,ly:ly+ny-1),
intent(out):: garea
1636 logical,
intent(out):: ff
1637 real(dp):: plat,plon,pazi
1641 call
hgrid_ak_rr(lx,ly,nx,ny,a,k,plat,plon,pazi, &
1642 delx,dely, gdlat,gdlon,garea, ff)
1672 delx,dely, gdlat,gdlon,garea,dx,dy,dangle_dx,dangle_dy, ff)
1674 integer(spi),
intent(in ):: lx,ly,nx,ny
1675 real(dp),
intent(in ):: a,k,pdlat,pdlon,&
1677 real(dp),
dimension(lx:lx+nx ,ly:ly+ny ),
intent(out):: gdlat,gdlon
1678 real(dp),
dimension(lx:lx+nx-1,ly:ly+ny-1),
intent(out):: garea
1679 real(dp),
dimension(lx:lx+nx-1,ly:ly+ny ),
intent(out):: dx
1680 real(dp),
dimension(lx:lx+nx ,ly:ly+ny-1),
intent(out):: dy
1681 real(dp),
dimension(lx:lx+nx ,ly:ly+ny ),
intent(out):: dangle_dx,dangle_dy
1682 logical,
intent(out):: ff
1683 real(dp):: plat,plon,pazi
1688 delx,dely, gdlat,gdlon,garea,dx,dy,dangle_dx,dangle_dy, ff)
1692 dangle_dx=dangle_dx*rtod
1693 dangle_dy=dangle_dy*rtod
1722 subroutine hgrid_ak_dc(lx,ly,nx,ny,a,k,pdlat,pdlon,pdazi, & ! [hgrid_ak_dc]
1723 delx,dely, xc,xcd,garea, ff)
1725 integer(spi),
intent(in ):: lx,ly,nx,ny
1726 real(dp),
intent(in ):: a,k,pdlat,pdlon,pdazi,delx,dely
1727 real(dp),
dimension(3, lx:lx+nx ,ly:ly+ny ),
intent(out):: xc
1728 real(dp),
dimension(3,2,lx:lx+nx ,ly:ly+ny ),
intent(out):: xcd
1729 real(dp),
dimension( lx:lx+nx-1,ly:ly+ny-1),
intent(out):: garea
1730 logical,
intent(out):: ff
1731 real(dp):: plat,plon,pazi
1735 call
hgrid_ak_rc(lx,ly,nx,ny,a,k,plat,plon,pazi, &
1736 delx,dely, xc,xcd,garea, ff)
1764 subroutine hgrid_ak(lx,ly,nx,ny,a,k,plat,plon,pazi, & ! [hgrid_ak]
1765 re,delxre,delyre, glat,glon,garea, ff)
1767 integer(spi),
intent(in ):: lx,ly,nx,ny
1768 real(dp),
intent(in ):: a,k,plat,plon,pazi, &
1770 real(dp),
dimension(lx:lx+nx ,ly:ly+ny ),
intent(out):: glat,glon
1771 real(dp),
dimension(lx:lx+nx-1,ly:ly+ny-1),
intent(out):: garea
1772 logical,
intent(out):: ff
1773 real(dp):: delx,dely,rere
1776 call
hgrid_ak_rr(lx,ly,nx,ny,a,k,plat,plon,pazi, &
1777 delx,dely, glat,glon,garea, ff)
1816 subroutine hgrid_ak_c(lx,ly,nx,ny,a,k,plat,plon,pazi, & ! [hgrid_ak]
1817 re,delxre,delyre, glat,glon,garea,dx,dy,dangle_dx,dangle_dy, ff)
1819 integer(spi),
intent(in ):: lx,ly,nx,ny
1820 real(dp),
intent(in ):: a,k,plat,plon,pazi, &
1822 real(dp),
dimension(lx:lx+nx ,ly:ly+ny ),
intent(out):: glat,glon
1823 real(dp),
dimension(lx:lx+nx-1,ly:ly+ny-1),
intent(out):: garea
1824 real(dp),
dimension(lx:lx+nx-1,ly:ly+ny ),
intent(out):: dx
1825 real(dp),
dimension(lx:lx+nx ,ly:ly+ny-1),
intent(out):: dy
1826 real(dp),
dimension(lx:lx+nx ,ly:ly+ny ),
intent(out):: dangle_dx,dangle_dy
1827 logical,
intent(out):: ff
1828 real(dp):: delx,dely,rere
1832 delx,dely, glat,glon,garea,dx,dy,dangle_dx,dangle_dy, ff)
1838 dangle_dx=dangle_dx*rtod
1839 dangle_dy=dangle_dy*rtod
1853 integer(spi),
intent(IN ):: m
1854 real(dp),
dimension(m),
intent(OUT):: x,w
1855 integer(spi),
parameter:: nit=8
1856 real(dp),
parameter:: eps=3.e-14_dp
1857 integer(spi) :: i,ic,j,jm,it,m2,m4p,m4p3
1858 real(dp) :: z,zzm,p1,p2,p3,pp,z1
1859 m2=m*2; m4p=m*4+1; m4p3=m4p+2
1860 do i=1,m; ic=m4p3-4*i
1861 z=cos(pih*ic/m4p); zzm=z*z-u1
1864 do j=1,m2; jm=j-1; p3=p2; p2=p1; p1=((j+jm)*z*p2-jm*p3)/j;
enddo
1865 pp=m2*(z*p1-p2)/zzm; z1=z; z=z1-p1/pp; zzm=z*z-u1
1866 if(abs(z-z1) <= eps)
exit
1868 x(i)=z; w(i)=-u2/(zzm*pp*pp)
1890 real(dp),
intent(in ):: a,k,plat,plon,pazi,lat,lon
1891 real(dp),
dimension(2),
intent(out):: xm
1892 logical,
intent(out):: ff
1893 real(dp),
dimension(3,3):: prot,azirot
1894 real(dp) :: clat,slat,clon,slon,cazi,sazi
1895 real(dp),
dimension(3) :: xc
1896 clat=cos(plat); slat=sin(plat)
1897 clon=cos(plon); slon=sin(plon)
1898 cazi=cos(pazi); sazi=sin(pazi)
1900 azirot(:,1)=(/ cazi, sazi, u0/)
1901 azirot(:,2)=(/-sazi, cazi, u0/)
1902 azirot(:,3)=(/ u0, u0, u1/)
1904 prot(:,1)=(/ -slon, clon, u0/)
1905 prot(:,2)=(/-slat*clon, -slat*slon, clat/)
1906 prot(:,3)=(/ clat*clon, clat*slon, slat/)
1907 prot=matmul(prot,azirot)
1909 call
grtoc(lat,lon,xc)
1910 xc=matmul(transpose(prot),xc)
1934 real(dp),
intent(in ):: a,k,plat,plon,pazi,delx,dely,lat,lon
1935 real(dp),
dimension(2),
intent(out):: xm
1936 logical,
intent(out):: ff
1937 call
gtoxm_ak_rr_m(a,k,plat,plon,pazi,lat,lon,xm,ff);
if(ff)
return
1938 xm(1)=xm(1)/delx; xm(2)=xm(2)/dely
1956 real(dp),
intent(in ):: a,k,pdlat,pdlon,pdazi,dlat,dlon
1957 real(dp),
dimension(2),
intent(out):: xm
1958 logical,
intent(out):: ff
1959 real(dp):: plat,plon,pazi,lat,lon
1985 real(dp),
intent(in ):: a,k,pdlat,pdlon,pdazi,delx,dely,dlat,dlon
1986 real(dp),
dimension(2),
intent(out):: xm
1987 logical,
intent(out):: ff
1988 real(dp):: plat,plon,pazi,lat,lon
1994 call
gtoxm_ak_rr_g(a,k,plat,plon,pazi,delx,dely,lat,lon,xm,ff)
2017 real(dp),
intent(in ):: a,k,plat,plon,pazi
2018 real(dp),
dimension(2),
intent(in ):: xm
2019 real(dp),
intent(out):: lat,lon
2020 logical,
intent(out):: ff
2021 real(dp),
dimension(3,2):: xcd
2022 real(dp),
dimension(3,3):: prot,azirot
2023 real(dp) :: clat,slat,clon,slon,cazi,sazi
2024 real(dp),
dimension(3) :: xc
2025 clat=cos(plat); slat=sin(plat)
2026 clon=cos(plon); slon=sin(plon)
2027 cazi=cos(pazi); sazi=sin(pazi)
2029 azirot(:,1)=(/ cazi, sazi, u0/)
2030 azirot(:,2)=(/-sazi, cazi, u0/)
2031 azirot(:,3)=(/ u0, u0, u1/)
2033 prot(:,1)=(/ -slon, clon, u0/)
2034 prot(:,2)=(/-slat*clon, -slat*slon, clat/)
2035 prot(:,3)=(/ clat*clon, clat*slon, slat/)
2036 prot=matmul(prot,azirot)
2037 call
xmtoxc_ak(a,k,xm,xc,xcd,ff);
if(ff)
return
2039 call
ctogr(xc,lat,lon)
2064 real(dp),
intent(in ):: a,k,plat,plon,pazi,delx,dely
2065 real(dp),
dimension(2),
intent(in ):: xm
2066 real(dp),
intent(out):: lat,lon
2067 logical,
intent(out):: ff
2068 real(dp),
dimension(2):: xmt
2089 real(dp),
intent(in ):: a,k,pdlat,pdlon,pdazi
2090 real(dp),
dimension(2),
intent(in ):: xm
2091 real(dp),
intent(out):: dlat,dlon
2092 logical,
intent(out):: ff
2093 real(dp):: plat,plon,pazi,lat,lon
2119 real(dp),
intent(in ):: a,k,pdlat,pdlon,pdazi,delx,dely
2120 real(dp),
dimension(2),
intent(in ):: xm
2121 real(dp),
intent(out):: dlat,dlon
2122 logical,
intent(out):: ff
2123 real(dp),
dimension(2):: xmt
2124 real(dp) :: plat,plon,pazi,lat,lon
subroutine xstoxc1(xs, xc, xcd, xcdd)
Standard transformation from polar stereographic map coordinates, xs, to cartesian, xc, assuming the projection axis is polar.
subroutine xmtoxc_vak1(ak, xm, xc, xcd, xc1, xcd1, ff)
Like xmtoxc_vak, _ak, but also return derivatives wrt ak.
subroutine xmtoxc_vak(ak, xm, xc, xcd, ff)
Assuming the vector AK parameterization of the Extended Schmidt-transformed Gnomonic (ESG) mapping wi...
subroutine xmtog_ak_rr_m(A, K, plat, plon, pazi, xm, lat, lon, ff)
Given the ESG map specified by parameters (A,K) and geographical center and orientation, plat,plon,pazi (radians), and a position, in map-space coordinates given by the 2-vector, xm, return the geographical coordinates, lat and lon (radians).
Utility routines for orienting the globe and basic geographical mappings.
subroutine get_meanqd(ngh, lam, xg, wg, ak, ma, q, qdak, qdma, ga, gadak, gadma, ff)
For a parameter vector, ak and a map-space domain-parameter vector, ma, return the lambda-parameteriz...
subroutine xmtog_ak_rr_g(A, K, plat, plon, pazi, delx, dely, xm, lat, lon, ff)
For an ESG map with parameters, (A,K), and geographical orientation, given by plon,plat,pazi (radians), and given a point in grid-space units as the 2-vector, xm, return the geographical coordinates, lat, lon, (radians) of this point.
subroutine zmtozt1(a, zm, zt, ztd, zt1, ztd1, ff)
Like zmtozt, but also, get the derivative with respect to a, zt1 of zt, and ztd1 of ztd...
subroutine get_qsofvs(n, lam, v1s, v2s, v3s, v4s, qs)
General util to convert value.
subroutine gtoxm_ak_dd_g(A, K, pdlat, pdlon, pdazi, delx, dely, dlat, dlon, xm, ff)
Like gtoxm_ak_rr_g, except lat, lon, azimuth, are expressed in degrees.
subroutine hgrid_ak_dd_c(lx, ly, nx, ny, a, k, pdlat, pdlon, pdazi, delx, dely, gdlat, gdlon, garea, dx, dy, dangle_dx, dangle_dy, ff)
Like hgrid_ak_rr_c, except all the angle arguments (but not delx,dely) are in degrees instead of radi...
subroutine gtoxm_ak_rr_m(A, K, plat, plon, pazi, lat, lon, xm, ff)
Given the map specification (angles in radians), the grid spacing (in map-space units) and the sample...
Module for handy vector and matrix operations in Euclidean geometry.
subroutine gtoxm_ak_dd_m(A, K, pdlat, pdlon, pdazi, dlat, dlon, xm, ff)
Like gtoxm_ak_rr_m, except lat, lon, azimuth, are expressed in degrees.
This module is for evaluating several useful real-valued functions that are not always available in F...
Suite of routines to perform the 2-parameter family of Extended Schmidt Gnomonic (ESG) regional grid ...
Standard integer, real, and complex single and double precision kinds.
subroutine xmtog_ak_dd_m(A, K, pdlat, pdlon, pdazi, xm, dlat, dlon, ff)
Like xmtog_ak_rr_m, except lat, lon, azimuth, are expressed in degrees.
subroutine hgrid_ak_c(lx, ly, nx, ny, a, k, plat, plon, pazi, re, delxre, delyre, glat, glon, garea, dx, dy, dangle_dx, dangle_dy, ff)
Like hgrid_ak_rr_c except the argument list includes the earth radius, re, and this is used to expres...
A suite of routines to perform the eigen-decomposition of symmetric 2*2 matrices and to deliver basic...
Some of the commonly used constants (pi etc) mainly for double-precision subroutines.
subroutine get_meanqs(n, ngh, lam, xg, wg, aks, mas, qs, ff)
Like getmeanqd, except for n different values, aks, of ak and n different values, mas of ma...
subroutine gtoxm_ak_rr_g(A, K, plat, plon, pazi, delx, dely, lat, lon, xm, ff)
Given the map specification (angles in radians), the grid spacing (in map-space units) and the sample...
subroutine xmtoxt1(a, xm, xt, xtd, xt1, xtd1, ff)
Like zmtozt1, but for 2-vector xm and xt, and 2*2 diagonal Jacobian xtd Also, the derivatives...
subroutine hgrid_ak_rr_c(lx, ly, nx, ny, a, k, plat, plon, pazi, delx, dely, glat, glon, garea, dx, dy, angle_dx, angle_dy, ff)
Use a and k as the parameters of an extended Schmidt-transformed gnomonic (ESG) mapping centered at (...
subroutine xttoxs1(k, xt, xs, xsd, xsdd, xs1, xsd1, ff)
Like xttoxs, but also, return the derivatives, wrt K, of xs and xsd.
subroutine xmtog_ak_dd_g(A, K, pdlat, pdlon, pdazi, delx, dely, xm, dlat, dlon, ff)
Like xmtog_ak_rr_g, except lat, lon, azimuth, are expressed in degrees.
subroutine get_qofvd(lam, v2, v3, v1d, v2d, v3d, v4d, qd)
Like get_qofv, but for (only) the 2-vector derivatives of Q.
subroutine get_qxd(j0, j0d, v1, v2, v3, v4, v1d, v2d, v3d, v4d)
From a jacobian matrix, j0, and its derivative, j0d, get a sufficient set of v.