Skip to content

Commit

Permalink
Fix src/Nd/restrt.f so that frame number is not advanced if output_t0…
Browse files Browse the repository at this point in the history
… is True

In this case it re-writes the last frame from the original calculation
when restarting, and it should reuse that frame number.  For historical
reasons the frame number is called matlabu, stored in amr_module.f90
  • Loading branch information
rjleveque committed Sep 14, 2023
1 parent 177f800 commit 70c3094
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/1d/restrt.f
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ subroutine restrt(nsteps,time,nvar,naux)

logical foundFile
dimension intrtx(maxlv),intrtt(maxlv)
integer matlabu0
c
c :::::::::::::::::::::::::::: RESTRT ::::::::::::::::::::::::::::::::
c read back in the check point files written by subr. check.
Expand Down Expand Up @@ -39,6 +40,8 @@ subroutine restrt(nsteps,time,nvar,naux)
open(rstunit,file=trim(rstfile),status='old',form='unformatted')
rewind rstunit

matlabu0 = matlabu ! value set by amr2, 0 if output_t0, else 1

read(rstunit) lenmax,lendim,isize

c # need to allocate for dynamic memory:
Expand All @@ -58,6 +61,8 @@ subroutine restrt(nsteps,time,nvar,naux)

close(rstunit)

matlabu = matlabu - 1 + matlabu0 ! redo previous frame if output_t0

write(outunit,100) nsteps,time
write(6,100) nsteps,time
100 format(/,' RESTARTING the calculation after ',i5,' steps',
Expand Down
5 changes: 5 additions & 0 deletions src/2d/restrt.f
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ subroutine restrt(nsteps,time,nvar,naux)

logical foundFile
dimension intrtx(maxlv),intrty(maxlv),intrtt(maxlv)
integer matlabu0
c
c :::::::::::::::::::::::::::: RESTRT ::::::::::::::::::::::::::::::::
!> read back in the check point files written by subr. check.
Expand Down Expand Up @@ -39,6 +40,8 @@ subroutine restrt(nsteps,time,nvar,naux)
open(rstunit,file=trim(rstfile),status='old',form='unformatted')
rewind rstunit

matlabu0 = matlabu ! value set by amr2, 0 if output_t0, else 1

!!read(rstunit) lenmax,lendim,isize
!! new version has flexible node size, so need to read current size maxgr
read(rstunit) lenmax,lendim,isize,maxgr
Expand Down Expand Up @@ -66,6 +69,8 @@ subroutine restrt(nsteps,time,nvar,naux)

close(rstunit)

matlabu = matlabu - 1 + matlabu0 ! redo previous frame if output_t0

write(outunit,100) nsteps,time
write(6,100) nsteps,time
100 format(/,' RESTARTING the calculation after ',i5,' steps',
Expand Down
7 changes: 7 additions & 0 deletions src/3d/restrt.f
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ subroutine restrt(nsteps,time,nvar,naux)

logical foundFile
dimension intrtx(maxlv),intrty(maxlv),intrtz(maxlv),intrtt(maxlv)
integer matlabu0

c
c :::::::::::::::::::::::::::: RESTRT ::::::::::::::::::::::::::::::::
c read back in the check point files written by subr. check.
Expand Down Expand Up @@ -39,6 +41,9 @@ subroutine restrt(nsteps,time,nvar,naux)
open(rstunit,file=trim(rstfile),status='old',form='unformatted')
rewind rstunit

matlabu0 = matlabu ! value set in amr3, 0 if output_t0, else 1

!!read(rstunit) lenmax,lendim,isize
!! new version has flexible node size, so need to read current size maxgr
read(rstunit) lenmax,lendim,isize,maxgr

Expand All @@ -60,6 +65,8 @@ subroutine restrt(nsteps,time,nvar,naux)

close(rstunit)

matlabu = matlabu - 1 + matlabu0 ! redo previous frame if output_t0

write(outunit,100) nsteps,time
write(6,100) nsteps,time
100 format(/,' RESTARTING the calculation after ',i5,' steps',
Expand Down

0 comments on commit 70c3094

Please sign in to comment.