12 parameter(lxx=lx1*lx1)
13 real df(lx1*ly1*lz1,1),sr(lxx*2,1),ss(lxx*2,1),st(lxx*2,1)
15 common /ctmpf/ lr(2*lx1+4),ls(2*lx1+4),lt(2*lx1+4)
16 $ , llr(lelt),lls(lelt),llt(lelt)
17 $ , lmr(lelt),lms(lelt),lmt(lelt)
18 $ , lrr(lelt),lrs(lelt),lrt(lelt)
24 integer lbr,rbr,lbs,rbs,lbt,rbt,e
26 real x(lx1,ly1,lz1,nelv)
27 real y(lx1,ly1,lz1,nelv)
28 real z(lx1,ly1,lz1,nelv)
35 if (param(44).eq.1)
then
43 if (param(44).eq.1)
then
45 $ ,llr(e),lmr(e),lrr(e),zgm2(1,1),lx2,e)
48 $ ,llr(e),lmr(e),lrr(e),e)
51 xsum =
vlsum(wxm2,lx2)
53 yavg =
vlsc2(y(1,i,1,e),wxm2,lx2)/xsum
57 $ ,lls(e),lms(e),lrs(e),zgm2(1,2),axwt,ly2,e)
59 if (param(44).eq.1)
then
61 $ ,lls(e),lms(e),lrs(e),zgm2(1,2),ly2,e)
64 $ ,lls(e),lms(e),lrs(e),e)
68 if (param(44).eq.1)
then
70 $ ,llt(e),lmt(e),lrt(e),zgm2(1,3),lz2,e)
73 $ ,llt(e),lmt(e),lrt(e),e)
90 eps = 1.e-5 * (
vlmax(lr(2),nr-2)
96 diag = lr(i) + ls(j) + lt(k)
110 eps = 1.e-5*(
vlmax(lr(2),nr-2) +
vlmax(ls(2),ns-2))
115 if (diag.gt.eps)
then
133 if (ierrmx.gt.0)
then
134 if (ierr.gt.0)
write(6,*) nid,ierr,
' BC FAIL'
135 call exitti(
'E INVALID BC FOUND in genfast$',ierrmx)
152 parameter(lxx=lx1*lx1)
154 common /ctmpf/ lr(2*lx1+4),ls(2*lx1+4),lt(2*lx1+4)
155 $ , llr(lelt),lls(lelt),llt(lelt)
156 $ , lmr(lelt),lms(lelt),lmt(lelt)
157 $ , lrr(lelt),lrs(lelt),lrt(lelt)
163 integer lbr,rbr,lbs,rbs,lbt,rbt,e
165 real x(lx1,ly1,lz1,nelv)
166 real y(lx1,ly1,lz1,nelv)
167 real z(lx1,ly1,lz1,nelv)
172 if (param(44).eq.1)
then
185 if (wdsize.eq.8) eps = 1.e-14
188 call plane_space2(llr,lls,llt, 0,wxm2,x,y,z,n1,n2,nz0,nzn)
191 call plane_space (lmr,lms,lmt, 1,n1,wxm2,x,y,z,n1,n2,nz0,nzn)
194 call plane_space2(lrr,lrs,lrt,n2,wxm2,x,y,z,n1,n2,nz0,nzn)
203 subroutine plane_space_std(lr,ls,lt,i1,i2,w,x,y,z,nx,nxn,nz0,nzn)
213 real w(1),lr(1),ls(1),lt(1)
214 real x(0:nxn,0:nxn,nz0:nzn,1)
215 real y(0:nxn,0:nxn,nz0:nzn,1)
216 real z(0:nxn,0:nxn,nz0:nzn,1)
236 lr2 = lr2 + ( (x(i2,j,k,ie)-x(i1,j,k,ie))**2
237 $ + (y(i2,j,k,ie)-y(i1,j,k,ie))**2
238 $ + (z(i2,j,k,ie)-z(i1,j,k,ie))**2 )
251 ls2 = ls2 + ( (x(i,j2,k,ie)-x(i,j1,k,ie))**2
252 $ + (y(i,j2,k,ie)-y(i,j1,k,ie))**2
253 $ + (z(i,j2,k,ie)-z(i,j1,k,ie))**2 )
266 lt2 = lt2 + ( (x(i,j,k2,ie)-x(i,j,k1,ie))**2
267 $ + (y(i,j,k2,ie)-y(i,j,k1,ie))**2
268 $ + (z(i,j,k2,ie)-z(i,j,k1,ie))**2 )
281 lr2 = lr2 + ( (x(i2,j,1,ie)-x(i1,j,1,ie))**2
282 $ + (y(i2,j,1,ie)-y(i1,j,1,ie))**2 )
293 ls2 = ls2 + ( (x(i,j2,1,ie)-x(i,j1,1,ie))**2
294 $ + (y(i,j2,1,ie)-y(i,j1,1,ie))**2 )
306 subroutine plane_space(lr,ls,lt,i1,i2,w,x,y,z,nx,nxn,nz0,nzn)
314 real w(1),lr(1),ls(1),lt(1)
315 real x(0:nxn,0:nxn,nz0:nzn,1)
316 real y(0:nxn,0:nxn,nz0:nzn,1)
317 real z(0:nxn,0:nxn,nz0:nzn,1)
342 $ ( (x(i2,j,k,ie)-x(i1,j,k,ie))**2
343 $ + (y(i2,j,k,ie)-y(i1,j,k,ie))**2
344 $ + (z(i2,j,k,ie)-z(i1,j,k,ie))**2 )
349 lr(ie) = 1./sqrt(lr2)
361 $ ( (x(i,j2,k,ie)-x(i,j1,k,ie))**2
362 $ + (y(i,j2,k,ie)-y(i,j1,k,ie))**2
363 $ + (z(i,j2,k,ie)-z(i,j1,k,ie))**2 )
368 ls(ie) = 1./sqrt(ls2)
380 $ ( (x(i,j,k2,ie)-x(i,j,k1,ie))**2
381 $ + (y(i,j,k2,ie)-y(i,j,k1,ie))**2
382 $ + (z(i,j,k2,ie)-z(i,j,k1,ie))**2 )
387 lt(ie) = 1./sqrt(lt2)
398 $ ( (x(i2,j,1,ie)-x(i1,j,1,ie))**2
399 $ + (y(i2,j,1,ie)-y(i1,j,1,ie))**2 )
403 lr(ie) = 1./sqrt(lr2)
413 $ ( (x(i,j2,1,ie)-x(i,j1,1,ie))**2
414 $ + (y(i,j2,1,ie)-y(i,j1,1,ie))**2 )
418 ls(ie) = 1./sqrt(ls2)
425 subroutine plane_space2(lr,ls,lt,i1,w,x,y,z,nx,nxn,nz0,nzn)
434 real w(1),lr(1),ls(1),lt(1)
435 real x(0:nxn,0:nxn,nz0:nzn,1)
436 real y(0:nxn,0:nxn,nz0:nzn,1)
437 real z(0:nxn,0:nxn,nz0:nzn,1)
455 lr2 = lr2 + ( (x(i1,j,k,ie))**2
456 $ + (y(i1,j,k,ie))**2
457 $ + (z(i1,j,k,ie))**2 )
470 ls2 = ls2 + ( (x(i,j1,k,ie))**2
471 $ + (y(i,j1,k,ie))**2
472 $ + (z(i,j1,k,ie))**2 )
485 lt2 = lt2 + ( (x(i,j,k1,ie))**2
486 $ + (y(i,j,k1,ie))**2
487 $ + (z(i,j,k1,ie))**2 )
495 1
format(a6,i5,1p3e12.4)
502 lr2 = lr2 + ( (x(i1,j,1,ie))**2
503 $ + (y(i1,j,1,ie))**2 )
514 ls2 = ls2 + ( (x(i,j1,1,ie))**2
515 $ + (y(i,j1,1,ie))**2 )
527 subroutine set_up_fast_1d_fem(s,lam,n,lbc,rbc,ll,lm,lr,z,nz,e)
528 real s(1),lam(1),ll,lm,lr,z(1)
540 write(6,*)
'ABORT. Error in set_up_fast_1D_fem. Increase m to'
563 real dx(0:1),ll,lm,lr,z(2)
625 scale = lm/(z(nz)-z(1))
627 dx(i+1) = (z(i+1)-z(i))*
scale
636 dx(0) = scalel*(z(2)-z(1))
638 elseif (lbc.eq.1)
then
649 dx(nz+2) = scaler*(z(2)-z(1))
650 elseif (rbc.eq.1)
then
661 real sf(n,n),sft(n,n),atd(1),l(0:1)
665 real atu(m),ad(m),au(m),c(m),bh(m),li(0:m)
668 write(6,*)
'ABORT. Error in gen_eigs_A_fem. Increase m to',n
692 if (ie.gt.0) ad(il) = ad(il) + li(ie)
693 if (ie.lt.n) ad(ir) = ad(ir) + li(ie)
694 if (ie.gt.0) au(il) = - li(ie)
695 if (ie.gt.0) bh(il) = bh(il) + 0.5 * l(ie)
696 if (ie.lt.n) bh(ir) = bh(ir) + 0.5 * l(ie)
700 bhm =
vlmax(bh(2),n-2)/(n-2)
701 ahm =
vlmax(ad(2),n-2)/(n-2)
717 c(i) = sqrt(1.0/bh(i))
723 atd(i) = c(i)*ad(i)*c(i)
730 atu(i) = c(i)*au(i)*c(i+1)
735 call calcz(atd,atu,n,dmax,dmin,sf,ierr)
738 write(6,6) nid,
' czfail:',(l(k),k=0,n)
739 6
format(i5,a8,1p16e10.2)
748 call swap(sft(1,j),atu,n,au)
755 avg =
vlsum(sf(1,j),n)
756 if (avg.lt.0)
call chsign(sf(1,j),n)
765 if (atd(i).lt.eps) atd(i) = 0.0
772 sf(i,j) = sf(i,j)*c(i)
779 alpha =
vlsc3(bh,sf(1,j),sf(1,j),n)
780 alpha = 1.0/sqrt(alpha)
781 call cmult(sf(1,j),alpha,n)
803 integer lbr,rbr,lbs,rbs,lbt,rbt,e,bsym
824 if (cbc(ied,e,ifield).eq.
' ') ibc = 0
825 if (cbc(ied,e,ifield).eq.
'E ') ibc = 0
826 if (cbc(ied,e,ifield).eq.
'msi') ibc = 0
827 if (cbc(ied,e,ifield).eq.
'MSI') ibc = 0
828 if (cbc(ied,e,ifield).eq.
'P ') ibc = 0
829 if (cbc(ied,e,ifield).eq.
'p ') ibc = 0
830 if (cbc(ied,e,ifield).eq.
'O ') ibc = 1
831 if (cbc(ied,e,ifield).eq.
'ON ') ibc = 1
832 if (cbc(ied,e,ifield).eq.
'o ') ibc = 1
833 if (cbc(ied,e,ifield).eq.
'on ') ibc = 1
834 if (cbc(ied,e,ifield).eq.
'MS ') ibc = 1
835 if (cbc(ied,e,ifield).eq.
'ms ') ibc = 1
836 if (cbc(ied,e,ifield).eq.
'MM ') ibc = 1
837 if (cbc(ied,e,ifield).eq.
'mm ') ibc = 1
838 if (cbc(ied,e,ifield).eq.
'mv ') ibc = 2
839 if (cbc(ied,e,ifield).eq.
'mvn') ibc = 2
840 if (cbc(ied,e,ifield).eq.
'v ') ibc = 2
841 if (cbc(ied,e,ifield).eq.
'V ') ibc = 2
842 if (cbc(ied,e,ifield).eq.
'W ') ibc = 2
843 if (cbc(ied,e,ifield).eq.
'SYM') ibc = bsym
844 if (cbc(ied,e,ifield).eq.
'SL ') ibc = 2
845 if (cbc(ied,e,ifield).eq.
'sl ') ibc = 2
846 if (cbc(ied,e,ifield).eq.
'SHL') ibc = 2
847 if (cbc(ied,e,ifield).eq.
'shl') ibc = 2
848 if (cbc(ied,e,ifield).eq.
'A ') ibc = 2
849 if (cbc(ied,e,ifield).eq.
'S ') ibc = 2
850 if (cbc(ied,e,ifield).eq.
's ') ibc = 2
851 if (cbc(ied,e,ifield).eq.
'J ') ibc = 0
852 if (cbc(ied,e,ifield).eq.
'SP ') ibc = 0
856 if (ierr.eq.-1)
write(6,1) ibc,ied,e,ifield,cbc(ied,e,ifield)
857 1
format(2i3,i8,i3,2x,a3,
' get_fast_bc_error')
861 if (ierr.eq.-1)
call exitti(
'Error A get_fast_bc$',e)
871 if (ibc.lt.0) ierr = lglel(e)
884 write(6,6) name3,(x(i),i=1,nn)
895 write(6,*) ie,
' matrix: ',name6,m,n
898 write(6,6) ie,name6,(a(i,j),j=1,n12)
900 6
format(i3,1x,a6,12f9.5)
906 $ (s,lam,n,lbc,rbc,ll,lm,lr,z,y,nz,ie)
907 real s(1),lam(1),ll,lm,lr,z(1),y(1)
919 write(6,*)
'ABORT. Error in set_up_fast_1D_fem. Increase m to'
942 real dx(0:1),ll,lm,lr,z(2),y(1)
1004 scale = lm/(z(nz)-z(1))
1006 dx(i+1) = (z(i+1)-z(i))*
scale
1015 dx(0) = scalel*(z(2)-z(1))
1017 elseif (lbc.eq.1)
then
1028 dx(nz+2) = scaler*(z(2)-z(1))
1029 elseif (rbc.eq.1)
then
1040 real sf(n,n),sft(n,n),atd(1),l(0:1),y(1)
1044 real atu(m),ad(m),au(m),c(m),bh(m),li(0:m)
1047 write(6,*)
'ABORT. Error in gen_eigs_A_fem. Increase m to',n
1071 if (ie.gt.0) ad(il) = ad(il) + li(ie)
1072 if (ie.lt.n) ad(ir) = ad(ir) + li(ie)
1073 if (ie.gt.0) au(il) = - li(ie)
1074 if (ie.gt.0) bh(il) = bh(il) + 0.5 * l(ie)
1075 if (ie.lt.n) bh(ir) = bh(ir) + 0.5 * l(ie)
1079 bhm =
vlmax(bh(2),n-2)/(n-2)
1080 ahm =
vlmax(ad(2),n-2)/(n-2)
1096 c(i) = sqrt(1.0/bh(i))
1102 atd(i) = c(i)*ad(i)*c(i)
1109 atu(i) = c(i)*au(i)*c(i+1)
1114 call calcz(atd,atu,n,dmax,dmin,sf,ierr)
1117 write(6,6) nid,
' czfail2:',(l(k),k=0,n)
1118 6
format(i5,a8,1p16e10.2)
1124 call sort(atd,atu,n)
1127 call swap(sft(1,j),atu,n,au)
1134 avg =
vlsum(sf(1,j),n)
1135 if (avg.lt.0)
call chsign(sf(1,j),n)
1144 if (atd(i).lt.eps) atd(i) = 0.0
1151 sf(i,j) = sf(i,j)*c(i)
1158 alpha =
vlsc3(bh,sf(1,j),sf(1,j),n)
1159 alpha = 1.0/sqrt(alpha)
1160 call cmult(sf(1,j),alpha,n)
1193 call semhat(ah,bh,ch,dh,zh,dph,jph,bgl,zglhat,dgl,jgl,nr,wh)
1200 real bgl(1:n-1),jgl(1:n-1,0:n),dgl(1:n-1,0:n)
1204 jgl(i,j)=bgl(i)*jgl(i,j)
1209 dgl(i,j)=bgl(i)*dgl(i,j)
1215 subroutine semhat(a,b,c,d,z,dgll,jgll,bgl,zgl,dgl,jgl,n,w)
1238 real a(0:n,0:n),b(0:n),c(0:n,0:n),d(0:n,0:n),z(0:n)
1239 real dgll(0:n,1:n-1),jgll(0:n,1:n-1)
1241 real bgl(1:n-1),zgl(1:n-1)
1242 real dgl(1:n-1,0:n),jgl(1:n-1,0:n)
1273 a(i,j) = a(i,j) + d(k,i)*b(k)*d(k,j)
1275 c(i,j) = b(i)*d(i,j)
1279 call zwgl (zgl,bgl,nm)
1314 real x(0:n),c(0:n,0:m)
1335 c(i,k) = c1*(k*c(i-1,k-1)-c5*c(i-1,k))/c2
1337 c(i,0) = -c1*c5*c(i-1,0)/c2
1339 c(j,k) = (c4*c(j,k)-k*c(j,k-1))/c3
1341 c(j,0) = c4*c(j,0)/c3
1353 common /fast1dsem/ g(lr2),w(lr2)
1356 real s(1),lam(1),ll,lm,lr
1359 integer bb0,bb1,eb0,eb1,n,n1
1364 if(lbc.eq.2 .or. lbc.eq.3)
then
1369 if(rbc.eq.2 .or. rbc.eq.3)
then
1390 call set_up_fast_1d_sem_op(s,eb0,eb1,l,r,ll,lm,lr,bh,dgl,0)
1393 call set_up_fast_1d_sem_op(g,bb0,bb1,l,r,ll,lm,lr,bh,jgl,1)
1408 subroutine set_up_fast_1d_sem_op(g,b0,b1,l,r,ll,lm,lr,bh,jgl,jscl)
1433 real g(0:lx1-1,0:lx1-1)
1434 real bh(0:lx1-1),jgl(1:lx2,0:lx1-1)
1440 real bl(0:lx1-1),bm(0:lx1-1),br(0:lx1-1)
1441 real gl,gm,gr,gll,glm,gmm,gmr,grr
1452 elseif (jscl.eq.1)
then
1466 bm(i)=2. /(lm*bh(i))
1470 if(l) bm(0)=bm(0)+0.5*ll*bh(n)
1475 if(r) bm(n)=bm(n)+0.5*lr*bh(0)
1482 bl(i)=2. /(ll*bh(i))
1490 br(i)=2. /(lr*bh(i))
1495 call rzero(g,(n+1)*(n+1))
1499 g(i,j) = g(i,j) + gmm*jgl(i,k)*bm(k)*jgl(j,k)
1506 g(i,0) = glm*jgl(i,0)*bm(0)*jgl(n-1,n)
1515 g(0,0) = g(0,0) + gll*jgl(n-1,i)*bl(i)*jgl(n-1,i)
1523 g(i,n) = gmr*jgl(i,n)*bm(n)*jgl(1,0)
1532 g(n,n) = g(n,n) + grr*jgl(1,i)*br(i)*jgl(1,i)
1546 common /swaplengths/ l(lx1,ly1,lz1,lelv)
1547 common /ctmpf/ lr(2*lx1+4),ls(2*lx1+4),lt(2*lx1+4)
1548 $ , llr(lelt),lls(lelt),llt(lelt)
1549 $ , lmr(lelt),lms(lelt),lmt(lelt)
1550 $ , lrr(lelt),lrs(lelt),lrt(lelt)
1567 call plane_space(lmr,lms,lmt,0,n2,wxm1,xm1,ym1,zm1,nx,n2,nz0,nzn)
1585 llr(e) = l(1,2,2,e)-lmr(e)
1586 lrr(e) = l(n,2,2,e)-lmr(e)
1587 lls(e) = l(2,1,2,e)-lms(e)
1588 lrs(e) = l(2,n,2,e)-lms(e)
1589 llt(e) = l(2,2,1,e)-lmt(e)
1590 lrt(e) = l(2,2,n,e)-lmt(e)
1607 llr(e) = l(1,2,1,e)-lmr(e)
1608 lrr(e) = l(n,2,1,e)-lmr(e)
1609 lls(e) = l(2,1,1,e)-lms(e)
1610 lrs(e) = l(2,n,1,e)-lms(e)
1643 if (
indx1(cbc(ied,e,ifield),
'd',1).gt.0) ibc=2
1645 if (
indx1(cbc(ied,e,ifield),
'n',1).gt.nfc) ibc=1
subroutine calcz(d, e, n, dmax, dmin, z, ierr)
integer function mynode()
subroutine exitti(stringi, idata)
subroutine scale(xyzl, nl)
subroutine dssum(u, nx, ny, nz)
subroutine set_up_fast_1d_sem(s, lam, n, lbc, rbc, ll, lm, lr, ie)
subroutine gen_eigs_a_fem_ax(sf, sft, atd, n, l, y, lbc, rbc)
subroutine mhd_bc_dn(ibc, face, e)
subroutine gen_eigs_a_fem(sf, sft, atd, n, l, lbc, rbc)
subroutine set_up_fast_1d_fem(s, lam, n, lbc, rbc, ll, lm, lr, z, nz, e)
subroutine outv(x, n, name3)
subroutine plane_space(lr, ls, lt, i1, i2, w, x, y, z, nx, nxn, nz0, nzn)
subroutine set_up_1d_geom(dx, lbc, rbc, ll, lm, lr, z, nz)
subroutine row_zero(a, m, n, e)
subroutine set_up_fast_1d_fem_ax(s, lam, n, lbc, rbc, ll, lm, lr, z, y, nz, ie)
subroutine set_up_fast_1d_sem_op(g, b0, b1, l, r, ll, lm, lr, bh, jgl, jscl)
subroutine do_semhat_weight(jgl, dgl, bgl, n)
subroutine set_up_1d_geom_ax(dx, lbc, rbc, ll, lm, lr, z, y, nz)
subroutine semhat(a, b, c, d, z, dgll, jgll, bgl, zgl, dgl, jgl, n, w)
subroutine plane_space2(lr, ls, lt, i1, w, x, y, z, nx, nxn, nz0, nzn)
subroutine gen_fast_spacing(x, y, z)
subroutine load_semhat_weighted
subroutine get_fast_bc(lbr, rbr, lbs, rbs, lbt, rbt, e, bsym, ierr)
subroutine fd_weights_full(xx, x, n, m, c)
subroutine gen_fast(df, sr, ss, st, x, y, z)
subroutine outmat(a, m, n, name6, ie)
subroutine plane_space_std(lr, ls, lt, i1, i2, w, x, y, z, nx, nxn, nz0, nzn)
subroutine generalev(a, b, lam, n, w)
integer function indx1(S1, S2, L2)
subroutine transpose(a, lda, b, ldb)
real function vlmax(vec, n)
real function vlsum(vec, n)
real function vlsc2(x, y, n)
subroutine cmult(a, const, n)
subroutine sort(a, ind, n)
function vlsc3(X, Y, B, N)
subroutine swap(b, ind, n, temp)
subroutine zwgl(Z, W, NP)
subroutine zwgll(Z, W, NP)