23 $
'module ['//trim(chkptms_name)//
'] already registered')
32 $
'Parent ['//trim(chpt_name)//
'] module not registered')
37 $
'Multi-file checkpointing')
42 $
'CHP_READ',
'Checkpointing reading time',.true.)
45 $
'CHP_WRITE',
'Checkpointing writing time',.true.)
67 if (chkptms_ifinit)
then
69 $
'module ['//trim(chkptms_name)//
'] already initiaised.')
74 if (param(27).lt.0)
then
75 chkptms_nsnap = nbdinp
77 chkptms_nsnap = chkptms_snmax
83 $
'only single perturbation supported')
86 chkptms_ifinit = .true.
120 integer il, ifile, fnum
122 character*132 fname(chkptms_fmax)
127 character*200 lstring
142 if (chpt_stepc.gt.0.and.chpt_stepc.le.chkptms_nsnap)
then
147 ifile = chkptms_nsnap - chpt_stepc +1
148 if (ifile.eq.1)
call mntr_log(chkptms_id,lp_inf,
149 $
'Writing checkpoint snapshot')
160 elseif (ifile.eq.1)
then
162 if (ifpert.and.(.not.ifbase))
then
163 if (icalldl.eq.0.and.(.not.chpt_ifrst))
then
167 call chcopy (fname(1),fname(fnum),132)
176 if (ifpert.and.(.not.ifbase))
then
177 call chcopy (fname(1),fname(fnum),132)
188 if (ifile.eq.chkptms_nsnap)
then
189 write(str,
'(I2)') chpt_set_o+1
190 lstring =
'Written checkpoint snapshot number: '//trim(str)
191 call mntr_log(chkptms_id,lp_prd,lstring)
195 ltim = dnekclock() - ltim
220 integer ifile, fnum, fnuml, il
221 real dtratio, epsl, ltim
222 parameter(epsl = 0.0001)
224 character*132 fname(chkptms_fmax),fnamel(chkptms_fmax)
225 character*200 lstring
239 if (chpt_ifrst.and.icalld.eq.0)
then
244 if (chpt_ifrst.and.(istep.lt.chkptms_nsnap))
then
258 if (ifpert.and.(.not.ifbase))
then
262 call chcopy (fname(1),fnamel(1),132)
265 call chcopy (fname(1),fname(fnum),132)
273 if(ifile.gt.1.and.chkptms_dtstep(ifile).gt.0.0)
then
274 dtratio = abs(dt-chkptms_dtstep(ifile))
275 $ /chkptms_dtstep(ifile)
276 if (dtratio.gt.epsl)
then
277 write(lstring,*)
'Time step inconsistent, new=',
278 $ dt,
', old=',chkptms_dtstep(ifile)
285 ltim = dnekclock() - ltim
313 real timerl(chkptms_snmax), p0thr
314 character*132 fname, header
319 if (ifpert.and.(.not.ifbase))
then
329 do ifile=1,chkptms_nsnap
330 call chkpt_fname(fname, prefix, chpt_set_i, ifile, ierr)
332 $
'dt get; file name error')
335 if (nid.eq.pid00)
then
339 fname = trim(fname)//char(0)
343 call blank (header,iheadersize)
344 call byte_read (header,iheadersize/4,ierr)
350 $
'dt get; error reading header')
352 call bcast(header,iheadersize)
354 if (index(header,
'#std').eq.1)
then
355 read(header,*,iostat=ierr) dummy
356 $ , wdsizr,nxr,nyr,nzr,nelr,nelgr,timer,istpr
359 $ , p0thr, chkptms_if_pmesh
364 $
'dt get; error extracting timer')
366 timerl(ifile) = timer
370 do ifile=2,chkptms_nsnap
371 chkptms_dtstep(ifile) = timerl(ifile) - timerl(ifile-1)
392 character*132 fname(chkptms_fmax)
393 integer fnum, nset, ifile
408 call chkpt_fname(fname(1), prefix, nset, ifile, ierr)
410 $
'chkptms_set_name; DNS file name error')
414 call chkpt_fname(fname(2), prefix, nset, ifile, ierr)
416 $
'chkptms_set_name; MHD file name error')
430 call chkpt_fname(fname(1), prefix, nset, ifilel, ierr)
432 $
'chkptms_set_name; base flow file name error')
436 call chkpt_fname(fname(2), prefix, nset, ifile, ierr)
438 $
'chkptms_set_name; perturbation file name error')
445 call chkpt_fname(fname(1), prefix, nset, ifile, ierr)
447 $
'chkptms_set_name; DNS file name error')
472 integer nset, ifile, ierr
483 parameter(kst=
'0123456789abcdefx')
487 prefixl(1:2) = prefix(1:2)
488 itmp=min(17,chpt_nset*chkptms_nsnap) + 1
489 prefixl(3:3)=kst(itmp:itmp)
492 bname = trim(adjustl(session))
496 call mntr_error(chkptms_id,
'chkpt_fname; file name error')
500 write(str,
'(i5.5)') chkptms_nsnap*nset+ifile
501 fname = trim(fnamel)//trim(str)
521 character*132 fname(chkptms_fmax)
531 logical lif_full_pres, lifxyo, lifpo, lifvo, lifto,
537 lif_full_pres = if_full_pres
538 if_full_pres = .true.
547 lifpsco(il)= ifpsco(il)
578 $
'chkptms_restart_write; too meny files for DNS')
587 if_full_pres = lif_full_pres
593 ifpsco(il) = lifpsco(il)
613 character*132 fname(chkptms_fmax)
617 integer ndumps, ipert, il
625 call sioflag(ndumps,fnamel,fname(1))
630 call sioflag(ndumps,fnamel,fname(2))
637 call sioflag(ndumps,fnamel,fname(1))
644 call sioflag(ndumps,fnamel,fname(fnum))
649 $
'chkptms_restart_read; too meny files for DNS')
652 call sioflag(ndumps,fnamel,fname(1))
684 integer chktype, ipert
687 integer ierr, il, itmp
690 real dnbyte, tiostart, tio
693 real dnekclock_sync, glsum
695 real pm1(lx1,ly1,lz1,lelv)
699 tiostart=dnekclock_sync()
709 $
'chkptms_mfo; file not opened')
715 offs = iheadersize + 4 + isize*nelgt
721 call io_mfov(offs,xm1,ym1,zm1,nx1,ny1,nz1,nelt,nelgt,ndim)
722 ioflds = ioflds + ndim
727 if (chktype.eq.1)
then
728 call io_mfov(offs,vx,vy,vz,nx1,ny1,nz1,nelt,nelgt,ndim)
729 elseif(chktype.eq.2)
then
730 call io_mfov(offs,bx,by,bz,nx1,ny1,nz1,nelt,nelgt,ndim)
731 elseif(chktype.eq.3)
then
732 call io_mfov(offs,vxp(1,ipert),vyp(1,ipert),
733 $ vzp(1,ipert),nx1,ny1,nz1,nelt,nelgt,ndim)
735 ioflds = ioflds + ndim
740 if (chktype.eq.1)
then
743 itmp = nx1*ny1*nz1*lelv
744 call io_mfos(offs,pr,nx2,ny2,nz2,nelt,nelgt,ndim)
746 itmp = nx1*ny1*nz1*lelv
750 call copy(pm1(1,1,1,il),pr(1,1,1,il),itmp)
752 call io_mfos(offs,pm1,nx1,ny1,nz1,nelt,nelgt,ndim)
754 elseif(chktype.eq.2)
then
756 itmp = nx1*ny1*nz1*lelv
760 call copy(pm1(1,1,1,il),pm(1,1,1,il),itmp)
762 call io_mfos(offs,pm1,nx1,ny1,nz1,nelt,nelgt,ndim)
763 elseif(chktype.eq.3)
then
765 itmp = nx1*ny1*nz1*lelv
769 call copy(pm1(1,1,1,il),prp(1+itmp*(il-1),ipert),itmp)
771 call io_mfos(offs,pm1,nx1,ny1,nz1,nelt,nelgt,ndim)
776 if (chktype.ne.2)
then
778 if (chktype.eq.1)
then
779 call io_mfos(offs,t,nx1,ny1,nz1,nelt,nelgt,ndim)
780 elseif(chktype.eq.3)
then
781 call io_mfos(offs,tp(1,1,ipert),
782 $ nx1,ny1,nz1,nelt,nelgt,ndim)
789 if (chktype.eq.1)
then
790 call io_mfos(offs,t(1,1,1,1,il+1),
791 $ nx1,ny1,nz1,nelt,nelgt,ndim)
792 elseif(chktype.eq.3)
then
793 call io_mfos(offs,tp(1,il+1,ipert),
794 $ nx1,ny1,nz1,nelt,nelgt,ndim)
800 dnbyte = 1.*ioflds*nelt*wdsizo*nx1*ny1*nz1
807 $
'chkptms_mfo; file not closed')
810 tio = dnekclock_sync()-tiostart
813 dnbyte = glsum(dnbyte,1)
814 dnbyte = dnbyte + iheadersize + 4. + isize*nelgt
815 dnbyte = dnbyte/1024/1024
817 call mntr_log(chkptms_id,lp_prd,
'Checkpoint written:')
818 call mntr_logr(chkptms_id,lp_vrb,
'file size (MB) = ',dnbyte)
819 call mntr_logr(chkptms_id,lp_vrb,
'avg data-throughput (MB/s) = ',
821 call mntr_logi(chkptms_id,lp_vrb,
'io-nodes = ',nfileo)
849 integer chktype, ipert
852 integer ierr, il, jl, kl
853 integer itmp1, itmp2, itmp3
855 integer*8 offs0,offs,nbyte
856 real dnbyte, tiostart, tio
861 parameter(lwkv = lx1*ly1*lz1*lelt)
862 real wkv1(lwkv),wkv2(lwkv),wkv3(lwkv)
863 common /scruz/ wkv1,wkv2,wkv3
866 real dnekclock_sync, glsum
869 tiostart=dnekclock_sync()
877 offs = iheadersize + 4 + isize*nelgr
886 if ((nxr.eq.lx1).and.(nyr.eq.ly1).and.(nzr.eq.lz1))
then
887 call io_mfiv(offs,xm1,ym1,zm1,lx1,ly1,lz1,lelt,ifskip)
890 call io_mfiv(offs,wkv1,wkv2,wkv3,nxr,nyr,nzr,lelt,ifskip)
892 ioflds = ioflds + ldim
898 if ((nxr.eq.lx1).and.(nyr.eq.ly1).and.(nzr.eq.lz1))
then
901 if (chktype.eq.1)
then
902 call io_mfiv(offs,vx,vy,vz,lx1,ly1,lz1,lelv,ifskip)
903 elseif(chktype.eq.2)
then
904 call io_mfiv(offs,bx,by,bz,lx1,ly1,lz1,lelv,ifskip)
905 elseif(chktype.eq.3)
then
906 call io_mfiv(offs,vxp(1,ipert),vyp(1,ipert),vzp(1,ipert)
907 $ ,lx1,ly1,lz1,lelv,ifskip)
912 call io_mfiv(offs,wkv1,wkv2,wkv3,nxr,nyr,nzr,lelt,ifskip)
916 if (chktype.eq.1)
then
920 elseif(chktype.eq.2)
then
924 elseif(chktype.eq.3)
then
932 ioflds = ioflds + ndim
939 if (chkptms_if_pmesh)
then
942 call io_mfis(offs,wkv1,nxr,nyr,nzr,lelt,ifskip)
945 if ((nxr.eq.lx1).and.(nyr.eq.ly1).and.(nzr.eq.lz1))
then
948 if (chktype.eq.1)
then
953 call map21t (pr(1,1,1,il),wkv1(jl),il)
962 if(chktype.eq.1)
then
964 call copy(pr(1,1,1,il),wkv1(jl),itmp2)
967 elseif(chktype.eq.2)
then
969 call copy(pm(1,1,1,il),wkv1(jl),itmp2)
972 elseif(chktype.eq.3)
then
975 call copy(prp(kl,ipert),wkv1(jl),itmp2)
986 itmp2 = (nxr-2)*(nyr-2)*itmp3
990 call copy(wkv2(kl),wkv1(jl),itmp2)
996 if (chktype.eq.1)
then
1004 call map21t (pr(1,1,1,il),wkv1(jl),il)
1010 if (chktype.eq.1)
then
1012 elseif(chktype.eq.2)
then
1014 elseif(chktype.eq.3)
then
1024 if ((nxr.eq.lx1).and.(nyr.eq.ly1).and.(nzr.eq.lz1))
then
1028 if (chktype.eq.1)
then
1029 call io_mfis(offs,pr,lx1,ly1,lz1,lelv,ifskip)
1033 call io_mfis(offs,wkv1,nxr,nyr,nzr,lelt,ifskip)
1040 if (chktype.eq.1)
then
1042 call map12 (pr(1,1,1,il),wkv1(jl),il)
1045 elseif(chktype.eq.2)
then
1047 call map12 (pm(1,1,1,il),wkv1(jl),il)
1050 elseif(chktype.eq.3)
then
1053 call map12 (prp(kl,ipert),wkv1(jl),il)
1064 call io_mfis(offs,wkv1,nxr,nyr,nzr,lelt,ifskip)
1078 if (chktype.eq.1)
then
1080 call map12 (pr(1,1,1,il),wkv2(jl),il)
1083 elseif(chktype.eq.2)
then
1085 call map12 (pm(1,1,1,il),wkv2(jl),il)
1088 elseif(chktype.eq.3)
then
1091 call map12 (prp(kl,ipert),wkv2(jl),il)
1104 if (chktype.ne.2)
then
1106 ifskip = .not.ifgett
1107 if ((nxr.eq.lx1).and.(nyr.eq.ly1).and.(nzr.eq.lz1))
then
1110 if (chktype.eq.1)
then
1111 call io_mfis(offs,t,lx1,ly1,lz1,lelt,ifskip)
1112 elseif(chktype.eq.3)
then
1113 call io_mfis(offs,tp(1,1,ipert),lx1,ly1,lz1,lelt,
1119 call io_mfis(offs,wkv1,nxr,nyr,nzr,lelt,ifskip)
1123 if (chktype.eq.1)
then
1125 elseif(chktype.eq.3)
then
1135 if (ifgtpsr(il))
then
1136 ifskip = .not.ifgtps(il)
1137 if ((nxr.eq.lx1).and.(nyr.eq.ly1).and.(nzr.eq.lz1))
then
1140 if (chktype.eq.1)
then
1141 call io_mfis(offs,t(1,1,1,1,il+1),lx1,ly1,lz1,
1143 elseif(chktype.eq.3)
then
1144 call io_mfis(offs,tp(1,il+1,ipert),lx1,ly1,lz1,
1150 call io_mfis(offs,wkv1,nxr,nyr,nzr,lelt,ifskip)
1153 if (ifgtps(il))
then
1154 if (chktype.eq.1)
then
1157 elseif(chktype.eq.3)
then
1168 if (ifgtim) time = timer
1173 $
'chkptms_mfi; file not closed')
1176 tio = dnekclock_sync()-tiostart
1177 if (tio.le.0) tio=1.
1179 if(nid.eq.pid0r)
then
1180 dnbyte = 1.*ioflds*nelr*wdsizr*nxr*nyr*nzr
1185 dnbyte = glsum(dnbyte,1)
1186 dnbyte = dnbyte + iheadersize + 4. + isize*nelgt
1187 dnbyte = dnbyte/1024/1024
1189 call mntr_log(chkptms_id,lp_prd,
'Checkpoint read:')
1190 call mntr_logr(chkptms_id,lp_vrb,
'avg data-throughput (MB/s) = ',
1192 call mntr_logi(chkptms_id,lp_vrb,
'io-nodes = ',nfileo)
1218 integer nxr, nzr, nel
1219 real xf(lx1,ly1,lz1,nel), yf(nxr,nxr,nzr,nel)
1223 integer ie, iz, izoff
1231 integer lxr, lyr, lzr, lxyzr
1232 parameter(lxr=lx1+6)
1233 parameter(lyr=ly1+6)
1234 parameter(lzr=lz1+6)
1235 parameter(lxyzr=lxr*lyr*lzr)
1236 real txa(lxyzr),txb(lx1,ly1,lzr),zgmr(lxr),wgtr(lxr)
1237 common /ctmp0/ txa, txb, zgmr, wgtr
1240 real ires(lxr*lxr) ,itres(lxr*lxr)
1241 common /ctmpabm1/ ires, itres
1246 if (nxr.ne.nold)
then
1248 call zwgll(zgmr,wgtr,nxr)
1249 call igllm(ires,itres,zgmr,zgm1,nxr,lx1,nxr,lx1)
1253 call mxm (ires,lx1,yf(1,1,1,ie),nxr,txa,nyzr)
1255 izoff = 1 + (iz-1)*lx1*nxr
1256 call mxm (txa(izoff),lx1,itres,nxr,txb(1,1,iz),ly1)
1259 call mxm (txb,nxy2,itres,nzr,xf(1,1,1,ie),lz1)
1261 call copy(xf(1,1,1,ie),txb,nxy2)
1287 integer nxr, nzr, nel
1288 real xf(lx2,ly2,lz2,nel), yf(nxr,nxr,nzr,nel)
1292 integer ie, iz, izoff
1300 integer lxr, lyr, lzr, lxyzr
1301 parameter(lxr=lx2+6)
1302 parameter(lyr=ly2+6)
1303 parameter(lzr=lz2+6)
1304 parameter(lxyzr=lxr*lyr*lzr)
1305 real txa(lxyzr),txb(lx2,ly2,lzr),zgmr(lxr),wgtr(lxr)
1306 common /ctmp0/ txa, txb, zgmr, wgtr
1309 real ires(lxr,lxr) ,itres(lxr,lxr)
1310 common /ctmpabm2/ ires, itres
1315 if (nxr.ne.nold)
then
1317 call zwgl (zgmr,wgtr,nxr)
1318 call iglm (ires,itres,zgmr,zgm2,nxr,lx2,nxr,lx2)
1322 call mxm (ires,lx2,yf(1,1,1,ie),nxr,txa,nyzr)
1324 izoff = 1 + (iz-1)*lx2*nxr
1325 call mxm (txa(izoff),lx2,itres,nxr,txb(1,1,iz),ly2)
1328 call mxm (txb,nxy2,itres,nzr,xf(1,1,1,ie),lz2)
1330 call copy(xf(1,1,1,ie),txb,nxy2)
1354 real axism1 (lx1,ly1), axism2 (lx2,ly2), ialj2 (ly2,ly2),
1355 $ iatlj2(ly2,ly2), tmp(ly2,ly2)
1356 common /ctmp0/ axism1, axism2, ialj2, iatlj2, tmp
1359 integer el, ips, is1
1361 if (.not.ifaxis)
return
1366 call invmt(iatjl2,iatlj2,tmp,ly2)
1369 if (ifrzer(el))
then
1371 call mxm(xm1(1,1,1,el),nx1,iatlj1,ny1,axism1,ny1)
1372 call copy(xm1(1,1,1,el),axism1,nx1*ny1)
1373 call mxm(ym1(1,1,1,el),nx1,iatlj1,ny1,axism1,ny1)
1374 call copy(ym1(1,1,1,el),axism1,nx1*ny1)
1377 call mxm(vx(1,1,1,el),nx1,iatlj1,ny1,axism1,ny1)
1378 call copy(vx(1,1,1,el),axism1,nx1*ny1)
1379 call mxm(vy(1,1,1,el),nx1,iatlj1,ny1,axism1,ny1)
1380 call copy(vy(1,1,1,el),axism1,nx1*ny1)
1383 call mxm(vz(1,1,1,el),nx1,iatlj1,ny1,axism1,ny1)
1384 call copy(vz(1,1,1,el),axism1,nx1*ny1)
1388 call mxm(pr(1,1,1,el),nx1,iatlj1,ny1,axism1,ny1)
1389 call copy(pr(1,1,1,el),axism1,nx1*ny1)
1391 call mxm(pr(1,1,1,el),nx2,iatlj2,ny2,axism2,ny2)
1392 call copy(pr(1,1,1,el),axism2,nx2*ny2)
1396 call mxm(t(1,1,1,el,1),nx1,iatlj1,ny1,axism1,ny1)
1397 call copy(t(1,1,1,el,1),axism1,nx1*ny1)
1401 if (ifgtps(ips))
then
1402 call mxm(t(1,1,1,el,is1),nx1,iatlj1,ny1,axism1,ny1)
1403 call copy(t(1,1,1,el,is1),axism1,nx1*ny1)
subroutine invmt(A, B, AA, N)
subroutine map21t(y, x, iel)
subroutine map12(y, x, iel)
subroutine bcast(buf, len)
subroutine chkpts_init
Dummy replacement for checkpoint initialisation.
subroutine chkpts_read
Dummy replacement for checkpoint reader.
logical function chkpts_is_initialised()
Dummy replacement for check of module initialisation.
subroutine chkpts_register
Dummy replacement for checkpoint registration.
subroutine chkpts_write
Dummy replacement for checkpoint writer.
subroutine chkptms_map_gll(xf, yf, nxr, nzr, nel)
Interpolate input on velocity mesh.
subroutine chkptms_mfi(fname, chktype, ipert)
Read field to the file.
subroutine chkptms_restart_read(fname, fnum)
Read checkpoint snapshot.
subroutine chkptms_mfo(fname, chktype, ipert)
Write field to the file.
subroutine chkptms_restart_write(fname, fnum, ifcoord)
Write checkpoint snapshot.
subroutine chkptms_axis_interp_ic()
Map loaded variables from velocity to axisymmetric mesh.
subroutine chkptms_map_gl(xf, yf, nxr, nzr, nel)
Interpolate pressure input.
subroutine chkptms_dt_get
Get old simulation time steps and pressure mesh marker.
subroutine chkptms_set_name(fname, fnum, nset, ifile)
Generate set of restart file names in snapshot.
subroutine chkpt_fname(fname, prefix, nset, ifile, ierr)
Generate single restart file name.
subroutine mntr_logi(mid, priority, logs, ivar)
Write log message adding single integer.
subroutine mntr_tmr_is_name_reg(mid, mname)
Check if timer name is registered and return its id.
subroutine mntr_logr(mid, priority, logs, rvar)
Write log message adding single real.
subroutine mntr_warn(mid, logs)
Write warning message.
subroutine mntr_tmr_add(mid, icount, time)
Check if timer id is registered. This operation is performed locally.
subroutine mntr_mod_is_name_reg(mid, mname)
Check if module name is registered and return its id.
subroutine mntr_abort(mid, logs)
Abort simulation.
subroutine mntr_log(mid, priority, logs)
Write log message.
subroutine mntr_error(mid, logs)
Write error message.
subroutine mntr_mod_reg(mid, pmid, mname, mdscr)
Register new module.
subroutine mntr_tmr_reg(mid, pmid, modid, mname, mdscr, ifsum)
Register new timer.
subroutine mntr_check_abort(mid, ierr, logs)
Abort simulation.
subroutine mntr_set_step_delay(dstep)
Set number of steps necessary to write proper checkpointing.
subroutine addfid(fname, fid)
subroutine sioflag(ndumps, fname, rsopts)
subroutine mfi_prepare(hname)
subroutine chcopy(a, b, n)
subroutine mxm(a, n1, b, n2, c, n3)
subroutine zwgl(Z, W, NP)
subroutine zwgll(Z, W, NP)
subroutine iglm(I12, IT12, Z1, Z2, lz1, lz2, ND1, ND2)
subroutine igllm(I12, IT12, Z1, Z2, lz1, lz2, ND1, ND2)