KTH framework for Nek5000 toolboxes; testing version  0.0.1

Multistep checkpointing for DNS, MHD and linear simulations. More...

+ Collaboration diagram for Multistep checkpointing:

Files

file  chkptms.f
 Set of multi-file checkpoint routines for DNS, MHD and perturbation simulations.
 

Functions

subroutine chkpts_register ()
 Register multi step checkpointing module. More...
 
subroutine chkpts_init
 Initialise multi-file checkpoint routines. More...
 
logical function chkpts_is_initialised ()
 Check if module was initialised. More...
 
subroutine chkpts_write ()
 Write full file restart set. More...
 
subroutine chkpts_read ()
 Read full file restart set. More...
 
subroutine chkptms_dt_get
 Get old simulation time steps and pressure mesh marker. More...
 
subroutine chkptms_set_name (fname, fnum, nset, ifile)
 Generate set of restart file names in snapshot. More...
 
subroutine chkpt_fname (fname, prefix, nset, ifile, ierr)
 Generate single restart file name. More...
 
subroutine chkptms_restart_write (fname, fnum, ifcoord)
 Write checkpoint snapshot. More...
 
subroutine chkptms_restart_read (fname, fnum)
 Read checkpoint snapshot. More...
 
subroutine chkptms_mfo (fname, chktype, ipert)
 Write field to the file. More...
 
subroutine chkptms_mfi (fname, chktype, ipert)
 Read field to the file. More...
 
subroutine chkptms_map_gll (xf, yf, nxr, nzr, nel)
 Interpolate input on velocity mesh. More...
 
subroutine chkptms_map_gl (xf, yf, nxr, nzr, nel)
 Interpolate pressure input. More...
 
subroutine chkptms_axis_interp_ic ()
 Map loaded variables from velocity to axisymmetric mesh. More...
 

Detailed Description

Multistep checkpointing for DNS, MHD and linear simulations.

In the case of multistep restart one needs data from NBDINP timestep, where NBDINP is time integration order. I adapt full_restart and full_restart_save subroutines for DNS, MHD and perturbation simulations. There are three possible sets of restart files generated by this module:

  1. 'rsX...' storing DNS data,
  2. 'rbX...' storing MHD data,
  3. 'rpX...' storing perturbation data,

where X is equal to 2*NBDINP and gives a max number of restart files. Only NBDINP files is requiered for restart and there are two file sets to avoid overwritting. Checkpoints are saved in double precission in binary ###.f format.

The possible combinations of files are:

  1. 'rsX...' alone for DNS mode,
  2. 'rsX...' and 'rbX...' for MHD mode,
  3. 'rsX...' and 'rpX...' for perturbation mode.

In the perturbation mode only the first perturbation is written to the checkpoint file. To save disc space the mesh data is written only to the 'rsX...' file. For not moving boundaries (IFMVBD=FALSE) only the first 'rsX...' file in the set contains mehs data. In the similar way in the perturbation mode with fixed base flow (IFBASE=FALSE) only single 'rsX...' file is generated.

Notice for multistep checkpointing runtime parameter chkpFnumber gives the fiel set number, so it can be equal 1 or 2 only.

Module interface:
Global interface list:
Interface provided to checkpoint:
  1. chkpts_register
  2. chkpts_init
  3. chkpts_read
  4. chkpts_write
Module parameters:
Global parameter dependency:
Parameters required by multistep module:
  1. CHKPTD:
    • chpt_step - checkpiont dump frequency (number of time steps)
    • chpt_ifrst - if restart
    • chpt_fnum - restart set number
  2. Nek5000 PARAM array
    • PARAM(27) - if negative number of files is equal NBDINP otherwise chkptms_snmax

Function Documentation

◆ chkpt_fname()

subroutine chkpt_fname ( character*132  fname,
character*3  prefix,
integer  nset,
integer  ifile,
integer  ierr 
)

Generate single restart file name.

Parameters
[out]fnamerestart file name
[in]prefixprefix
[in]nsetset number
[in]ifilesnupshot numer
[out]ierrerror mark

Definition at line 461 of file chkptms.f.

References io_mfo_fname(), and mntr_error().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkptms_axis_interp_ic()

subroutine chkptms_axis_interp_ic

Map loaded variables from velocity to axisymmetric mesh.

Note
This is version of axis_interp_ic taking into account fact pressure does not have to be written on velocity mesh.
Remarks
This routine uses global scratch space CTMP0.

Definition at line 1342 of file chkptms.f.

References copy(), invmt(), and mxm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkptms_dt_get()

subroutine chkptms_dt_get

Get old simulation time steps and pressure mesh marker.

Todo:
Different files could have different chkptms_if_pmesh, so it is not the best place to read it

Definition at line 300 of file chkptms.f.

References addfid(), bcast(), blank(), byte_close, byte_open, byte_read, chkpt_fname(), io_init(), and mntr_check_abort().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkptms_map_gl()

subroutine chkptms_map_gl ( real, dimension(lx2,ly2,lz2,nel)  xf,
real, dimension(nxr,nxr,nzr,nel)  yf,
integer  nxr,
integer  nzr,
integer  nel 
)

Interpolate pressure input.

This is version of mapab modified to work with pressure mesh. It iterpolates fields defined on GL points. Like the orginal routine I assume NXR=NYR=NZR, or NXR=NYR, NZR=1

Parameters
[out]xfoutput field on pressure mesh
[in]yfinput field on pressure mesh
[in]nxr,nzrarray sizes
[in]nelelement number
Remarks
This routine uses global scratch space CTMP0, CTMPABM2

Definition at line 1278 of file chkptms.f.

References copy(), iglm(), mxm(), and zwgl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkptms_map_gll()

subroutine chkptms_map_gll ( real, dimension(lx1,ly1,lz1,nel)  xf,
real, dimension(nxr,nxr,nzr,nel)  yf,
integer  nxr,
integer  nzr,
integer  nel 
)

Interpolate input on velocity mesh.

This is version of mapab with corrected array sizes. It iterpolates fields defined on GLL points. Like the orginal routine I assume NXR=NYR=NZR, or NXR=NYR, NZR=1

Parameters
[out]xfoutput field on velocity mesh
[in]yfinput field on velocity mesh
[in]nxr,nzrarray sizes
[in]nelelement number
Remarks
This routine uses global scratch space CTMP0, CTMPABM1

Definition at line 1209 of file chkptms.f.

References copy(), igllm(), mxm(), and zwgll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkptms_mfi()

subroutine chkptms_mfi ( character*132  fname,
integer  chktype,
integer  ipert 
)

Read field to the file.

This routine is based on mfi but supports perturbation as well. It is optimised for chekpoint reading.

Parameters
[in]fnamefile name
[in]chktypedata type to read (DNS, MHD, preturbation)
[in]ipertindex of perturbation field
Remarks
This routine uses global scratch space SCRUZ.

Definition at line 834 of file chkptms.f.

References chkptms_axis_interp_ic(), chkptms_map_gl(), chkptms_map_gll(), copy(), io_mbyte_close(), io_mfis(), io_mfiv(), map12(), map21t(), mfi_prepare(), mntr_check_abort(), mntr_log(), mntr_logi(), and mntr_logr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkptms_mfo()

subroutine chkptms_mfo ( character*132  fname,
integer  chktype,
integer  ipert 
)

Write field to the file.

This routine is based on mfo_outfld but does not assume any file numbering. It is optimised for chekpoint writing.

Parameters
[in]fnamefile name
[in]chktypedata type to write (DNS, MHD, perturbation)
[in]ipertindex of perturbation field
Note
Only one set of data (DNS, MHD or perturbation) can be saved in single file
Remarks
This routine uses global scratch space SCRCG.

Definition at line 669 of file chkptms.f.

References copy(), io_mbyte_close(), io_mbyte_open(), io_mfos(), io_mfov(), mfo_write_hdr(), mntr_check_abort(), mntr_log(), mntr_logi(), mntr_logr(), and rzero().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkptms_restart_read()

subroutine chkptms_restart_read ( character*132, dimension(chkptms_fmax)  fname,
integer  fnum 
)

Read checkpoint snapshot.

Parameters
[out]fnamerestart file name
[in]fnumnumber of files in snapshot

Definition at line 603 of file chkptms.f.

References chkptms_mfi(), mntr_abort(), and sioflag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkptms_restart_write()

subroutine chkptms_restart_write ( character*132, dimension(chkptms_fmax)  fname,
integer  fnum,
logical  ifcoord 
)

Write checkpoint snapshot.

Parameters
[out]fnamerestart file name
[in]fnumnumber of files in snapshot
[in]ifcoorddo we save coordinates

Definition at line 511 of file chkptms.f.

References chkptms_mfo(), and mntr_abort().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkptms_set_name()

subroutine chkptms_set_name ( character*132, dimension(chkptms_fmax)  fname,
integer  fnum,
integer  nset,
integer  ifile 
)

Generate set of restart file names in snapshot.

Parameters
[out]fnamerestart file names
[out]fnumnumber of files in snapshot
[in]nsetset number
[in]ifilesnupshot numer

Definition at line 383 of file chkptms.f.

References chkpt_fname(), and mntr_check_abort().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chkpts_init()

subroutine chkpts_init

Initialise multi-file checkpoint routines.

Note
This interface is defined in chkpt_main

Definition at line 56 of file chkptms.f.

References mntr_abort(), and mntr_warn().

+ Here is the call graph for this function:

◆ chkpts_is_initialised()

logical function chkpts_is_initialised

Check if module was initialised.

Returns
chkpts_is_initialised

Definition at line 94 of file chkptms.f.

References chkpts_is_initialised().

+ Here is the call graph for this function:

◆ chkpts_read()

subroutine chkpts_read

Read full file restart set.

Note
This interface is defined in chkpt_main
This is version of full_restart routine.

Definition at line 209 of file chkptms.f.

References chcopy(), chkptms_dt_get(), chkptms_restart_read(), chkptms_set_name(), io_init(), mntr_tmr_add(), and mntr_warn().

+ Here is the call graph for this function:

◆ chkpts_register()

subroutine chkpts_register

Register multi step checkpointing module.

Definition at line 8 of file chkptms.f.

References mntr_abort(), mntr_mod_is_name_reg(), mntr_mod_reg(), mntr_set_step_delay(), mntr_tmr_is_name_reg(), mntr_tmr_reg(), and mntr_warn().

+ Here is the call graph for this function:

◆ chkpts_write()

subroutine chkpts_write

Write full file restart set.

Note
This interface is defined in chkpt_main.
This is version of full_restart_save routine.

Definition at line 109 of file chkptms.f.

References chcopy(), chkptms_restart_write(), chkptms_set_name(), io_init(), mntr_log(), and mntr_tmr_add().

+ Here is the call graph for this function: