5 use size_m
, only : lx1, lelt
6 use size_m
, only : nx1, nz1, nid, ndim
7 use input, only : ifflow, ifbase, if3d, ifsplit, ifldmhd, ifpert, ifheat
8 use input, only : ifcvode, param, ifmhd, iflomach, npscal
9 use soln, only : vx, vy, vz, pr, t
10 use tstep, only : ifield, istep
16 real(DP),
save :: intv(lx1,lx1)
18 real(DP) :: intt(lx1,lx1)
19 real(DP),
allocatable :: wk1 (:,:,:,:)
20 real(DP) :: wk2 (lx1,lx1,lx1)
21 real(DP) :: tmax(100),omax(103)
24 integer,
save :: icalld = 0
25 real(DP),
save :: old_wght = 0._dp
27 integer :: imax, jmax, ncut, ifldt, mmax, nfldt, ifld, k
28 integer,
external :: iglmax
29 real(DP) :: umax, vmax, wmax, pmax
30 real(DP),
external :: glmax
36 if (icalld == 0 .or. abs(wght-old_wght) > 1.e-8 )
then
39 ncut = int(param(101)+1)
41 elseif (icalld < 0)
then
42 write(*,*)
"Oops: icalld < 0 in qfilter"
45 call
zwgll(zgmv,wgtv,lxv)
46 call
igllm(intuv,intw,zgmv,zgm1,lxv,nx1,lxv,nx1)
47 call
igllm(intdv,intw,zgm1,zgmv,nx1,lxv,nx1,lxv)
49 call
zwgl(zgmp,wgtp,lxp)
50 call
iglm(intup,intw,zgmp,zgm2,lxp,nx2,lxp,nx2)
51 call
iglm(intdp,intw,zgm2,zgmp,nx2,lxp,nx2,lxp)
55 call
mxm(intup,nx2,intdp,lxp,intp,nx2)
56 call
mxm(intuv,nx1,intdv,lxv,intv,nx1)
63 call add2sxy(intp,wght,intup,w0,nx2*nx2)
66 call add2sxy(intv ,wght,intuv,w0,nx1*nx1)
74 if ( ifflow .AND. .NOT. ifmhd ) if_fltv = .true.
75 if ( ifield == 1 .AND. ifmhd ) if_fltv = .true.
78 if ( .NOT. ifbase ) if_fltv = .false.
80 allocate(wk1(lx1,lx1,lx1,lelt))
82 call
filterq(vx,intv,nx1,nz1,wk1,wk2,intt,if3d,umax)
83 call
filterq(vy,intv,nx1,nz1,wk1,wk2,intt,if3d,vmax)
85 call
filterq(vz,intv,nx1,nz1,wk1,wk2,intt,if3d,wmax)
86 if (ifsplit .AND. .NOT. iflomach) &
87 call
filterq(pr,intv,nx1,nz1,wk1,wk2,intt,if3d,pmax)
90 if (ifmhd .AND. ifield == ifldmhd)
then
91 write(*,*)
"Oops: ifmhd"
93 call
filterq(bx,intv,nx1,nz1,wk1,wk2,intt,if3d,umax)
94 call
filterq(by,intv,nx1,nz1,wk1,wk2,intt,if3d,vmax)
96 call
filterq(bz,intv,nx1,nz1,wk1,wk2,intt,if3d,wmax)
101 write(*,*)
"Oops: ifpert"
106 call
filterq(vxp(1,j),intv,nx1,nz1,wk1,wk2,intt,if3d,umax)
107 call
filterq(vyp(1,j),intv,nx1,nz1,wk1,wk2,intt,if3d,vmax)
109 call
filterq(vzp(1,j),intv,nx1,nz1,wk1,wk2,intt,if3d,wmax)
112 if (ifheat .AND. .NOT. ifcvode) &
113 call
filterq(tp(1,j,1),intv,nx1,nz1,wk1,wk2,intt,if3d,wmax)
122 omax(1) = glmax(umax,1)
123 omax(2) = glmax(vmax,1)
124 omax(3) = glmax(wmax,1)
130 if (ifheat .AND. .NOT. ifcvode)
then
133 call
filterq(t(1,1,1,1,ifld),intv &
134 ,nx1,nz1,wk1,wk2,intt,if3d,tmax(ifld))
136 omax(mmax) = glmax(tmax(ifld),1)
142 if (npscal == 0)
then
150 write(6,1) istep,ifield,umax,vmax,wmax
152 write(6,1) istep,ifield,umax,vmax
154 1
format(4x,i7,i3,
' qfilt:',1p3e12.4)
155 if(ifheat .AND. .NOT. ifcvode) &
156 write(6,
'(1p50e12.4)') (tmax(k),k=1,nfldt)
167 subroutine filterq(v,f,nx,nz,w1,w2,ft,if3d,dmax)
169 use size_m
, only : nelt
170 use tstep, only : nelfld, ifield
174 real(DP) :: v(nx*nx*nz,nelt),w1(*),w2(*)
175 real(DP) :: f(nx,nx),ft(nx,nx)
180 integer :: e, nxyz, nel, i, j, k
182 real(DP),
external :: vlamax
195 call
copy(w2,v(1,e),nxyz)
196 call
mxm(f,nx,w2,nx,w1,nx*nx)
200 call
mxm(w1(i),nx,ft,nx,w2(j),nx)
204 call
mxm(w2,nx*nx,ft,nx,w1,nx)
205 w2(1:nxyz) = v(:,e) - w1(1:nxyz)
206 call
copy(v(1,e),w1,nxyz)
207 smax = vlamax(w2,nxyz)
208 dmax = max(dmax,abs(smax))
214 call
copy(w1,v(1,e),nxyz)
215 call
mxm(f ,nx,w1,nx,w2,nx)
216 call
mxm(w2,nx,ft,nx,w1,nx)
218 w2(1:nxyz) = v(:,e) - w1(1:nxyz)
219 call
copy(v(1,e),w1,nxyz)
220 smax = vlamax(w2,nxyz)
221 dmax = max(dmax,abs(smax))
234 real(DP) :: ur(0:n,0:n,0:n),us(0:n,0:n,0:n),ut(0:n,0:n,0:n)
235 real(DP) :: u (0:n,0:n,0:n,*)
236 real(DP) :: D (0:n,0:n),Dt(0:n,0:n)
242 call
mxm(d ,m1,u(0,0,0,e),m1,ur,m2)
244 call
mxm(u(0,0,k,e),m1,dt,m1,us(0,0,k),m1)
246 call
mxm(u(0,0,0,e),m2,dt,m1,ut,m1)
256 subroutine gaujordf(a,m,n,indr,indc,ipiv,ierr,rmult)
260 integer :: m, n, indr(m),indc(n),ipiv(n), ierr
261 real(DP) :: a(m,n),rmult(m)
264 integer :: i, j, k, ir, jc
265 real(DP) :: amx, tmp, piv, work
281 if (ipiv(i) /= 1)
then
283 if (ipiv(j) == 0)
then
284 if (abs(a(i,j)) >= amx)
then
289 elseif (ipiv(j) > 1)
then
296 ipiv(jc) = ipiv(jc) + 1
310 if (abs(a(jc,jc)) < eps)
then
311 write(6 ,*)
'small Gauss Jordan Piv:',jc,a(jc,jc)
312 write(28,*)
'small Gauss Jordan Piv:',jc,a(jc,jc)
320 a(jc,j) = a(jc,j)*piv
335 a(i,j) = a(i,j) - rmult(i)*a(1,j)
359 if (indr(j) /= indc(j))
then
362 a(i,indr(j))=a(i,indc(j))
377 real(DP) :: L(0:n), x
384 l(j) = ( (2*j-1) * x * l(j-1) - (j-1) * l(j-2) ) / j
409 integer :: nx, nid, kut
410 real(DP) :: intv(nx,nx),zpts(nx), wght
412 integer,
parameter :: lm=40
413 integer,
parameter :: lm2=lm*lm
414 real(DP) :: phi(lm2),pht(lm2),diag(lm2),rmult(lm),Lj(lm)
415 integer :: indr(lm),indc(lm),ipiv(lm)
416 integer :: kj, n, j, k, k0, kk, ierr, np1
420 write(6,*)
'ABORT in build_new_filter:',nx,lm
435 pht(kj) = lj(k)-lj(k-2)
439 call
copy(pht,phi,nx*nx)
440 call
gaujordf(pht,nx,nx,indr,indc,ipiv,ierr,rmult)
449 amp = wght*(k-k0)*(k-k0)/(kut*kut)
453 call
mxm(diag,nx,pht,nx,intv,nx)
454 call
mxm(phi ,nx,intv,nx,pht,nx)
455 call
copy(intv,pht,nx*nx)
462 write(6,6)
'filt amp',(pht(k),k=1,nx*nx,np1)
463 write(6,6)
'filt trn',(diag(k),k=1,nx*nx,np1)
464 6
format(a8,16f7.4,6(/,8x,16f7.4))
477 integer,
parameter :: ia=16807,im=2147483647,iq=127773,ir=2836,ntab=32,ndiv=1+(im-1)/ntab
478 real(DP),
parameter :: am=1./im,eps=1.2e-7,rnmx=1.-eps
483 integer :: iv(ntab),iy
485 data iv,iy /ntab*0,0/
487 if (idum <= 0 .OR. iy == 0)
then
491 idum = ia*(idum-k*iq)-ir*k
492 if(idum < 0) idum = idum+im
493 if (j <= ntab) iv(j) = idum
498 idum = ia*(idum-k*iq)-ir*k
499 if(idum < 0) idum = idum+im
503 ran1 = min(am*iy,rnmx)
512 use size_m
, only : nx1, ny1, nz1, nelt
516 real(DP),
external :: ran1
subroutine rand_fld_h1(x)
subroutine ident(a, n)
Construct A = I_n (identity matrix)
subroutine transpose(a, lda, b, ldb)
subroutine gaujordf(a, m, n, indr, indc, ipiv, ierr, rmult)
Gauss-Jordan matrix inversion with full pivoting. Num. Rec. p. 30, 2nd Ed., Fortran a is an m x n mat...
subroutine mxm(a, n1, b, n2, c, n3)
Compute matrix-matrix product C = A*B.
subroutine local_grad3(ur, us, ut, u, N, e, D, Dt)
Output: ur,us,ut Input:u,N,e,D,Dt.
subroutine iglm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2)
subroutine dsavg(u)
Take direct stiffness avg of u.
subroutine filterq(v, f, nx, nz, w1, w2, ft, if3d, dmax)
subroutine q_filter(wght)
filter vx,vy,vz, and p by simple interpolation
subroutine, public zwgll(Z, W, NP)
subroutine legendre_poly(L, x, N)
Evaluate Legendre polynomials of degrees 0-N at point x.
subroutine build_new_filter(intv, zpts, nx, kut, wght, nid)
This routing builds a 1D filter with a transfer function that looks like: ^ d_k | | | 1 |__________ v...
subroutine, public zwgl(Z, W, NP)
Generate NP Gauss Legendre points (Z) and weights (W) associated with Jacobi polynomial P(N)(alpha=0...
subroutine, public igllm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2)
real(dp) function ran1(idum)