Author Topic: Enhancing checkpoint/restart capabilities [v8.5]  (Read 4327 times)

a118145

  • Guest
Enhancing checkpoint/restart capabilities [v8.5]
« on: April 09, 2021, 01:30:35 AM »
Dear feap forum,

I modified the command SAVE in a way, that the user can now specify checkpoint intervals, i.e. the solution during BATCh is written every X increment. Of course, this can also be achieved by a PARAmeter ch=0, which is counted upwards and an "IF ch-X" condition, where X is the desired interval. The parameter ch is then reset within the condition and SAVE is triggered. I personally find this not very convenient especially in combination with highly automated simulations because more lines and parameters have to be taken care of. Furthermore, the number of the checkpoint file does not correspond to the actual increment but reflects how often SAVE had been called.

Usage:
Code: [Select]
SAVE,,,<chpint>writes results every <chpint> interval using the default name (bc nothing is specified after first comma) and the current increment number (bc nothing is specified after second comma) as naming scheme. The nice thing is, that now, the name of the file actually contains the current increment number (which is convenient) and not just a number which corresponds to how often SAVE had been called (as mentioned in the first paragraph).

Implementation is very easy. In pmacr3.f, you have to modify lines 958ff till the next return as follows:
Code: [Select]
!     Save restart file

      if (nint(ct(2,l)) .lt. 1) then
        ! By default, checkpoint interval is set to 1
        chpint = 1
      else
        chpint = nint(ct(2,l))
      end if
      !write(*,*) MODULO(nstep,chpint)
      if (MODULO(nstep,chpint).eq.0) then
        write(*,*) 'Writing checkpoint'
        call restrt(fint,ndm,ndf,nneq,2)
      end if
Don't forget to declare the integer parameter chpint. I tested it for both, feap and parfeap, and it works seamlessly. However, no guarantee that I might have overseen something.

Warm regards,

a118145

NB: Although the command SAVE seems to support only two parameters (SAVE,<file extension>,<file number>), feap treats every* four character command the same, i.e. there are more numbers stored in ct(:,l) (default value: zero), that can be specified in the command file and subsequently be used as I did above. This is why the required modification is so small.

*to my knowledge. There might be exceptions.

JStorm

  • Sr. Member
  • ****
  • Posts: 250
Re: Enhancing checkpoint/restart capabilities [v8.5]
« Reply #1 on: April 09, 2021, 05:52:30 AM »
Thank you. I like your solution very much and will adopt your modification.
So far I have used a nested loop so far, but your solution simplifies the inputfile.

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: Enhancing checkpoint/restart capabilities [v8.5]
« Reply #2 on: April 09, 2021, 10:54:23 AM »
Thank you for the suggestion.  It will be added to future releases.