17 real v1(1),v2(1),v3(1),weight(1)
20 ntotv=lx1*ly1*lz1*nelv
21 normsq1=
glsc3(v1,weight,v1,ntotv)
22 normsq2=
glsc3(v2,weight,v2,ntotv)
24 normsq3=
glsc3(v3,weight,v3,ntotv)
29 opnorm=normsq1+normsq2+normsq3
39 real v1(1) , v2(1), v3(1)
40 real normsq1,normsq2,normsq3,
opnorm
42 ntotv=lx1*ly1*lz1*nelv
43 normsq1=
glsc3(v1,bm1,v1,ntotv)
44 normsq2=
glsc3(v2,bm1,v2,ntotv)
46 normsq3=
glsc3(v3,bm1,v3,ntotv)
63 ntotv = lx1*ly1*lz1*nelv
64 tnorm = sqrt(
glsc3(temp,bm1,temp,ntotv) /voltm1)
74 real v1(1),v2(1),v3(1),temp(1)
75 real normsq1,normsq2,normsq3,normsqt,
dmnorm
76 common/normset/pran, ray, rayc
78 ntotv=lx1*ly1*lz1*nelv
79 normsq1=(rayc)*
glsc3(v1,bm1,v1,ntotv)
80 normsq2=(rayc)*
glsc3(v2,bm1,v2,ntotv)
82 normsq3=(rayc)*
glsc3(v3,bm1,v3,ntotv)
88 normsqt = (pran*ray*ray)*
glsc3(temp,bm1,temp,ntotv)
93 dmnorm=sqrt((normsq1+normsq2+normsq3+normsqt)/volvm1)
105 real v1(1),v2(1),v3(1),temp(1)
107 ltotv=lx1*ly1*lz1*lelv
108 ltott=lx1*ly1*lz1*lelt
110 call cmult(v1,alpha,ltotv)
111 call cmult(v2,alpha,ltotv)
112 if (if3d)
call cmult(v3,alpha,ltotv)
113 if (ifheat)
call cmult(temp,alpha,ltott*ldimt)
124 real v1(*),v2(*),v3(*)
126 ntotv=lx1*ly1*lz1*nelv
128 call cmult(v1,alpha,ntotv)
129 call cmult(v2,alpha,ntotv)
131 if (if3d)
call cmult(v3,alpha,ntotv)
143 $ (vxp(1,jpp),vyp(1,jpp),vzp(1,jpp),tp(1,1,jpp),jpp)
154 real vxq(1),vyq(1),vzq(1),tq(1)
156 common /pertsave/ timestart,tinitial
162 logical if_restart,if_ortho_lyap
163 common/restar/if_restart,if_ortho_lyap
165 character*132 lyprestart
166 common/restflename/lyprestart
171 $
write(6,8) istep,icount,time,twt,(lyap(k,jpp),k=1,3),jpp
172 8
format(i9,i4,2f8.4,1p3e12.4,i3,
'clyap')
179 pertnorm =
dmnorm(vxq,vyq,vzq,tq)
180 pertinvnorm = 1.0/pertnorm
182 lyap(3,jpp) = pertnorm
188 if (jpp.eq.1) icount = icount + 1
191 irescale = param(128)
192 if (icount.eq.irescale)
then
194 lyapsum = lyap(2,jpp)
195 oldpertnorm = lyap(3,jpp)
196 pertnorm=
dmnorm(vxq,vyq,vzq,tq)
198 lyap(1,jpp) = log(pertnorm/oldpertnorm)/(time-timestart)
199 lyapsum = lyapsum + log(pertnorm/oldpertnorm)
200 lyap(2,jpp) = lyapsum
204 write(6 ,1) istep,time,lyap(1,jpp),lyapsum,pertnorm,jpp
205 write(79,2) time,lyap(1,jpp),lyapsum,pertporm,oldpertnorm,jpp
206 1
format(i9,1p4e17.8,i4,
'lyap')
207 2
format(1p5e17.8,i4,
'lyap')
210 if (jpp.eq.1)
open(unit=96,
file=lyprestart)
211 write(96,9) lyapsum,timestart,timeinit,jpp
212 9
format(1p3e19.11,i9)
213 if (jpp.eq.npert)
close(96)
216 pertinvnorm = 1.0/pertnorm
218 lyap(3,jpp) = pertnorm
220 if (jpp.eq.npert)
then
225 if_ortho_lyap = .false.
226 if (param(125).gt.0) if_ortho_lyap = .true.
239 ntotp = lx2*ly2*lz2*nelv
242 $ (vxp(1,jpp),vyp(1,jpp),vzp(1,jpp),tp(1,1,jpp),pertinvnorm)
243 call cmult(prp(1,jpp),pertinvnorm,ntotp)
245 call opscale(exx1p(1,jpp),exy1p(1,jpp),exz1p(1,jpp)
246 $ ,vgradt1p(1,1,jpp),pertinvnorm)
247 call opscale(exx2p(1,jpp),exy2p(1,jpp),exz2p(1,jpp)
248 $ ,vgradt2p(1,1,jpp),pertinvnorm)
250 ltotv = lx1*ly1*lz1*lelv
251 ltotp = lx2*ly2*lz2*lelv
253 call cmult( tlagp(1,1,1,jpp),pertinvnorm,ltotv*(lorder-1)*ldimt)
254 call cmult(vxlagp(1,1,jpp),pertinvnorm,ltotv*(lorder-1))
255 call cmult(vylagp(1,1,jpp),pertinvnorm,ltotv*(lorder-1))
256 call cmult(vzlagp(1,1,jpp),pertinvnorm,ltotv*(lorder-1))
257 call cmult(prlagp(1,1,jpp),pertinvnorm,ltotp*(lorder-2))
259 if (nio.eq.0)
write(6,1) istep,pertnorm,pertinvnorm,jpp,
'PNORM'
260 1
format(i4,1p2e12.4,i4,a5)
261 pertnorm = pertnorm*pertinvnorm
281 real tmp(4),lyapSum,timeStart
282 common/pertsave/timestart,tinitial
283 common/normset/pran,ray,rayc
284 character*1 lyp(4),sch(5)
287 character*7 lypres,lypold
288 CHARACTER*1 SESS1(132),PATH1(132),NAM1(132)
289 equivalence(session,sess1)
290 equivalence(path,path1)
291 equivalence(name,nam1)
292 equivalence(lyp,lyp4)
293 equivalence(sch,sch5)
296 data lypold /
'.lypold'/
297 data lypres /
'.lypsum'/
298 character*132 lypfile,lypfileold,lyprestart,lypsch
299 common/restflename/lyprestart
301 common/restar/if_restart
303 common/debug/ ifdebug
305 ntotv = lx1*ly1*lz1*nelv
306 ntotp = lx2*ly2*lz2*nelv
311 nprex_max = max(0,nbdinp-2)
317 if(param(31).eq.0)
return
321 call opzero(bfxp(1,jpp),bfyp(1,jpp),bfzp(1,jpp))
323 itmp = lx1*ly1*lz1*lelv*(lorder-1)
325 call rzero(vxlagp(1,1,jpp),itmp)
326 call rzero(vylagp(1,1,jpp),itmp)
327 if(if3d)
call rzero(vzlagp(1,1,jpp),itmp)
328 if(ifheat)
call rzero(tlagp(1,1,1,jpp),itmp*ldimt)
330 call opzero(exx1p(1,jpp),exy1p(1,jpp),exz1p(1,jpp))
331 call opzero(exx2p(1,jpp),exy2p(1,jpp),exz2p(1,jpp))
333 pertvnorm = sqrt(rayc)*
opnorm2(vxp(1,jpp),vyp(1,jpp),vzp(1,jpp))
334 perttnorm = sqrt(pran*ray*ray)*
tnorm(tp(1,1,jpp))
335 pertnorm = sqrt(pertvnorm**2+perttnorm**2)
337 if(param(64).ne.1)
then
338 call opzero(vxp(1,jpp),vyp(1,jpp),vzp(1,jpp))
339 call rzero(tp(1,1,jpp),ntotv)
342 call rzero(lyap(1,jpp),3)
344 if(nio.eq.0)
write(6,*)jpp,
'norm of pert IC=',pertnorm
346 pertinvnorm = 1.0/pertnorm
348 if(nio.eq.0)
write(6,*) jpp,
'Rescaled the perturbation'
349 call rzero(lyap(1,jpp),3)
350 lyap(3,jpp) = pertnorm
357 call blank(lypfile,132)
358 call blank(lypfileold,132)
359 call blank(lyprestart,132)
360 call blank(lypsch,132)
365 call chcopy(nam1( 1),path1,lpp)
366 call chcopy(nam1(lpp+1),sess1,ls )
370 call chcopy(nam1(l1),lyp , 4)
371 call chcopy(lypfile ,nam1,ln)
374 call chcopy(nam1(l1),sch , 5)
375 call chcopy(lypsch ,nam1,lns)
378 call chcopy(nam1(l1),lypold , 7)
379 call chcopy(lypfileold ,nam1,ln2)
381 call chcopy(nam1(l1),lypres , 7)
382 call chcopy(lyprestart ,nam1,ln2)
384 if(nid.eq.0.and.jpp.eq.1)
then
385 write(6,*)
'opening file ',lypfile
386 open(unit=79,
file=lypfile,status=
'UNKNOWN')
388 5757
format(1x,
"time",5x,
"lyap",5x,
"lyapsum",5x,
"pertnorm",
391 write(6,*)
'opening file ',lypsch
392 open(unit=146,
file=lypsch)
398 print*,
'opening file ',lypfileold
399 open(unit=86,
file=lypfileold,status=
'OLD')
403 if (jpp.eq.npert)
close(86)
409 lyap(2,jpp) = lyapsum
410 print*,
'nid,lyapsum,timestart=',nid,lyapsum,timestart,jpp
411 if(timestart.gt.time)
then
412 write(6,*) nid,.gt.
' reporting! timestarttime! time=',time
438 call nekasgnp (i,j,k,iel,l)
439 call useric (i,j,k,ielg)
465 $ (vxp(1,jpp),vyp(1,jpp),vzp(1,jpp),prp(1,jpp),tp(1,1,jpp),
476 ntotp = lx2*ly2*lz2*nelv
477 ntotv = lx1*ly1*lz1*nelv
478 ntott = lx1*ly1*lz1*nelt
482 if (if3d)
call add2s2(vzp(1,i),vzp(1,j),
scale,ntotv)
486 call add2s2(vxlagp(1,l,i),vxlagp(1,l,j),
scale,ntotv)
487 call add2s2(vylagp(1,l,i),vylagp(1,l,j),
scale,ntotv)
488 if (if3d)
call add2s2(vzlagp(1,l,i),vzlagp(1,l,j),
scale,ntotv)
489 call add2s2(prlagp(1,l,i),prlagp(1,l,j),
scale,ntotp)
494 if (if3d)
call add2s2(exz1p(1,i),exz1p(1,j),
scale,ntotv)
498 if (if3d)
call add2s2(exz2p(1,i),exz2p(1,j),
scale,ntotv)
503 ntotk = lx1*ly1*lz1*nelfld(k+2)
506 call add2s2(tlagp(1,l,k1,i),tlagp(1,l,k1,j),
scale,ntotk)
508 call add2s2(vgradt1p(1,k1,i),vgradt1p(1,k1,j),
scale,ntotk)
509 call add2s2(vgradt2p(1,k1,i),vgradt2p(1,k1,j),
scale,ntotk)
520 common/normset/pran, ray, rayc
522 ntotv=lx1*ly1*lz1*nelv
523 ntott=lx1*ly1*lz1*nelt
525 s1 = rayc*
glsc3(vxp(1,i),bm1,vxp(1,j),ntotv)
526 s2 = rayc*
glsc3(vyp(1,i),bm1,vyp(1,j),ntotv)
528 if (if3d) s3 = rayc*
glsc3(vzp(1,i),bm1,vzp(1,j),ntotv)
531 if (ifheat) t1=pran*ray*ray*
glsc3(tp(1,1,i),bm1,tp(1,1,j),ntott)
subroutine bcast(buf, len)
subroutine scale(xyzl, nl)
subroutine opzero(ux, uy, uz)
subroutine opnorm(unorm, ux, uy, uz, type3)
function glsc3(a, b, mult, n)
subroutine add2s2(a, b, c1, n)
function ltrunc(string, l)
subroutine cmult(a, const, n)
subroutine chcopy(a, b, n)
function opnorm2(v1, v2, v3)
subroutine pert_ortho_norm1(k)
real function opnormold(v1, v2, v3, weight)
subroutine computelyap1(vxq, vyq, vzq, tq, jpp)
real function dmnorm(v1, v2, v3, temp)
subroutine opscalev(v1, v2, v3, alpha)
subroutine flushbuffer(k)
subroutine rescalepert(pertnorm, pertinvnorm, jpp)
function pert_inner_prod(i, j)
subroutine pert_add2s2(i, j, scale)
subroutine initialize1(jpp)
subroutine opscale(v1, v2, v3, temp, alpha)
subroutine pert_ortho_norm
subroutine outpost2(v1, v2, v3, vp, vt, nfldt, name3)