Stellarator-Tools
restart_mod Module Reference

Contains routines for writting the restart file. More...

Functions/Subroutines

integer function restart_read (restart_ext, wout_file, mpolin, ntorin, nfpi
 Reads the restart file. More...
 
subroutine restart_write_free (restart_ext)
 Write the free boundary information. More...
 
subroutine restart_write (restart_ext, wout_file)
 Write the restart file. More...
 
subroutine interpit (aold, anew, ns_old, ns_new, mpol_old, mpol_new, ntor_old, ntor_new, nfp_old, nfp_new, tor_modes_old, tor_modes_new, lhalf)
 Interpolate fourier quantites from the restart file. More...
 
subroutine interpit_1d (aold, anew, ns_old, ns_new, lhalf, parity)
 Interpolate radial quantites from the restart file. More...
 
subroutine restart_normalize (xmn, factor)
 Denormalize a quantity so the value written to the restart file can be summed directly. More...
 
subroutine restart_denormalize (xmn, factor)
 Denormalize a quantity so the value written to the restart file can be summed directly. More...
 

Variables

integer, parameter restart_version = 0
 Version number.
 
integer, parameter restart_lasym = 31
 Bit position for the lasym flag.
 
character(len= *), dimension(1), parameter radial_dim = (/ 'radius' /)
 Radial Dimension names.
 
character(len= *), dimension(3), parameter restart_dims = (/ 'm-mode', 'n-mode', radial_dim(1) /)
 Fourier Dimension names.
 
character(len= *), parameter vn_nsin = 'nrad'
 Name for the restart file number of radial points.
 
character(len= *), parameter vn_mpolin = 'mpol'
 Name for the restart file number of poloidal modes.
 
character(len= *), parameter vn_ntorin = 'ntor'
 Name for the restart file number of toroidal modes.
 
character(len= *), parameter vn_nfpin = 'nfp'
 Name for the restart file number of field periods.
 
character(len= *), parameter vn_wout = 'wout_file'
 Name for the restart file number of wout file modes.
 
character(len= *), parameter vn_flags = 'state_flags'
 Name for the restart file number of state flags modes.
 
character(len= *), parameter vn_tor_modes = 'tor_modes'
 Name for the restart file toroidal modes array.
 
character(len= *), parameter vn_jbsupss = 'JBsupssh_m_n_r_'
 Name for the restart file jbsupss.
 
character(len= *), parameter vn_jbsupuc = 'JBsupuch_m_n_r_'
 Name for the restart file jbsupuc.
 
character(len= *), parameter vn_jbsupvc = 'JBsupvch_m_n_r_'
 Name for the restart file jbsupvc.
 
character(len= *), parameter vn_jbsupsc = 'JBsupsch_m_n_r_'
 Name for the restart file jbsupsc.
 
character(len= *), parameter vn_jbsupus = 'JBsupush_m_n_r_'
 Name for the restart file jbsupus.
 
character(len= *), parameter vn_jbsupvs = 'JBsupvsh_m_n_r_'
 Name for the restart file jbsupus.
 
character(len= *), parameter vn_jpresc = 'jpresch_m_n_r_'
 Name for the restart file jpresc.
 
character(len= *), parameter vn_jpress = 'jpressh_m_n_r_'
 Name for the restart file jpress.
 
character(len= *), parameter vn_rmnc = 'rmnc_m_n_r_'
 Name for the restart file rmnc.
 
character(len= *), parameter vn_rmns = 'rmns_m_n_r_'
 Name for the restart file rmns.
 
character(len= *), parameter vn_zmnc = 'zmnc_m_n_r_'
 Name for the restart file zmnc.
 
character(len= *), parameter vn_zmns = 'zmns_m_n_r_'
 Name for the restart file zmns.
 
character(len= *), parameter vn_chipf = 'chipf(r)'
 Name for the restart file chipf.
 
character(len= *), parameter vn_phipf = 'phipf(r)'
 Name for the restart file phipf.
 
character(len= *), parameter vn_bsupsmns = 'bsupsmnsh_m_n_r_'
 Name for the restart file bsupsmns.
 
character(len= *), parameter vn_bsupsmnc = 'bsupsmnch_m_n_r_'
 Name for the restart file bsupsmnc.
 
character(len= *), parameter vn_bsupumns = 'bsupumnsh_m_n_r_'
 Name for the restart file bsupumns.
 
character(len= *), parameter vn_bsupumnc = 'bsupumnch_m_n_r_'
 Name for the restart file bsupumnc.
 
character(len= *), parameter vn_bsupvmns = 'bsupvmnsh_m_n_r_'
 Name for the restart file bsupvmns.
 
character(len= *), parameter vn_bsupvmnc = 'bsupvmnch_m_n_r_'
 Name for the restart file bsupvmnc.
 
character(len= *), parameter vn_bsubsmns = 'bsubsmnsh_m_n_r_'
 Name for the restart file bsubsmns.
 
character(len= *), parameter vn_bsubsmnc = 'bsubsmnch_m_n_r_'
 Name for the restart file bsubsmnc.
 
character(len= *), parameter vn_bsubumns = 'bsubumnsh_m_n_r_'
 Name for the restart file bsubumns.
 
character(len= *), parameter vn_bsubumnc = 'bsubumnch_m_n_r_'
 Name for the restart file bsubumnc.
 
character(len= *), parameter vn_bsubvmns = 'bsubvmnsh_m_n_r_'
 Name for the restart file bsubvmns.
 
character(len= *), parameter vn_bsubvmnc = 'bsubvmnch_m_n_r_'
 Name for the restart file bsubvmnc.
 
character(len= *), parameter vn_pmns = 'pmnsh_m_n_r_'
 Name for the restart file pmns.
 
character(len= *), parameter vn_pmnc = 'pmnch_m_n_r_'
 Name for the restart file pmnc.
 
character(len= *), parameter vn_jksupsmns = 'jksupsmnsf_m_n_r_'
 Name for the restart file jksupsmns.
 
character(len= *), parameter vn_jksupsmnc = 'jksupsmncf_m_n_r_'
 Name for the restart file jksupsmnc.
 
character(len= *), parameter vn_jksupumns = 'jksupumnsf_m_n_r_'
 Name for the restart file jksupumns.
 
character(len= *), parameter vn_jksupumnc = 'jksupumncf_m_n_r_'
 Name for the restart file jksupumnc.
 
character(len= *), parameter vn_jksupvmns = 'jksupvmnsf_m_n_r_'
 Name for the restart file jksupvmns.
 
character(len= *), parameter vn_jksupvmnc = 'jksupvmncf_m_n_r_'
 Name for the restart file jksupvmnc.
 
character(len= *), parameter vn_fsupsmns = 'fsupsmnsf_m_n_r_'
 Name for the restart file fsupsmns.
 
character(len= *), parameter vn_fsupsmnc = 'fsupsmncf_m_n_r_'
 Name for the restart file fsupsmnc.
 
character(len= *), parameter vn_fsupumns = 'fsupumnsf_m_n_r_'
 Name for the restart file fsupumns.
 
character(len= *), parameter vn_fsupumnc = 'fsupumncf_m_n_r_'
 Name for the restart file fsupumnc.
 
character(len= *), parameter vn_fsupvmns = 'fsupvmnsf_m_n_r_'
 Name for the restart file fsupvmns.
 
character(len= *), parameter vn_fsupvmnc = 'fsupvmncf_m_n_r_'
 Name for the restart file fsupvmnc.
 
character(len= *), parameter vn_fsubsmns = 'fsubsmnsf_m_n_r_'
 Name for the restart file fsubsmns.
 
character(len= *), parameter vn_fsubsmnc = 'fsubsmncf_m_n_r_'
 Name for the restart file fsubsmnc.
 
character(len= *), parameter vn_fsubumns = 'fsubumnsf_m_n_r_'
 Name for the restart file fsubumns.
 
character(len= *), parameter vn_fsubumnc = 'fsubumncf_m_n_r_'
 Name for the restart file fsubumnc.
 
character(len= *), parameter vn_fsubvmns = 'fsubvmnsf_m_n_r_'
 Name for the restart file fsubvmns.
 
character(len= *), parameter vn_fsubvmnc = 'fsubvmncf_m_n_r_'
 Name for the restart file fsubvmnc.
 
character(len= *), parameter vn_asubsmns = 'asubsmnsf_m_n_r_'
 Name for the restart file asubsmns.
 
character(len= *), parameter vn_asubumnc = 'asubumncf_m_n_r_'
 Name for the restart file asubumnc.
 
character(len= *), parameter vn_asubvmnc = 'asubvmncf_m_n_r_'
 Name for the restart file asubumnc.
 
character(len= *), parameter vn_asubsmnc = 'asubumncf_m_n_r_'
 Name for the restart file fsubumns.
 
character(len= *), parameter vn_asubumns = 'asubumnsf_m_n_r_'
 Name for the restart file fsubumnc.
 
character(len= *), parameter vn_asubvmns = 'asubvmnsf_m_n_r_'
 Name for the restart file fsubvmns.
 
character(len= *), parameter vn_lmns = 'lmns_m_n_r_'
 Name for the restart file lmns.
 
character(len= *), parameter vn_lmnc = 'lmnc_m_n_r_'
 Name for the restart file lmnc.
 
character(len= *), parameter vn_p_factor = 'p_factor'
 Name for the restart file p_factor.
 
character(len= *), parameter vn_b_factor = 'b_factor'
 Name for the restart file b_factor.
 
character(len= *), parameter vn_wb = 'wb'
 Name for the restart file wb.
 
character(len= *), parameter vn_wp = 'wp'
 Name for the restart file wb.
 
character(len= *), parameter vn_rmajor = 'rmajor'
 Name for the restart file rmajor.
 
character(len= *), parameter vn_curtor = 'curtor'
 Name for the restart file total toroidal current.
 
character(len= *), parameter vn_p_max = 'p_max'
 Name for the restart file p_max.
 
character(len= *), parameter vn_p_min = 'p_min'
 Name for the restart file p_min.
 
character(len= *), parameter vn_wtotal0 = 'wtotal0'
 Inital stored energy.
 

Detailed Description

Contains routines for writting the restart file.

Function/Subroutine Documentation

◆ interpit()

subroutine restart_mod::interpit ( real (dp), dimension(:,:,:), intent(in)  aold,
real (dp), dimension(:,:,:), intent(out)  anew,
integer, intent(in)  ns_old,
integer, intent(in)  ns_new,
integer, intent(in)  mpol_old,
integer, intent(in)  mpol_new,
integer, intent(in)  ntor_old,
integer, intent(in)  ntor_new,
integer, intent(in)  nfp_old,
integer, intent(in)  nfp_new,
  tor_modes_old,
  tor_modes_new,
logical, intent(in)  lhalf 
)

Interpolate fourier quantites from the restart file.

Restart files can change the number of surfaces and modes.

Parameters
[in]aoldValue from the restart file.
[out]anewNew interpolated value.
[in]ns_oldRadial grid size in the restart file.
[in]ns_newNew radial grid size.
[in]mpol_oldNumber of poloidal modes in the restart file.
[in]mpol_newNew number of poloidal modes.
[in]ntor_oldNumber of totoidal modes in the restart file.
[in]ntor_newNew number of totoidal modes.
[in]nfp_oldNumber of field periods in the restart file.
[in]nfp_newNew number of field periods.
[in]tor_modes_oldToroidal modes in the restart file.
[in]tor_modes_newNew toroidal modes.
[in]lhalfGrid type.

◆ interpit_1d()

subroutine restart_mod::interpit_1d ( real (dp), dimension(:), intent(in)  aold,
real (dp), dimension(:), intent(out)  anew,
integer, intent(in)  ns_old,
integer, intent(in)  ns_new,
logical, intent(in)  lhalf,
integer, intent(in)  parity 
)

Interpolate radial quantites from the restart file.

Restart files can change the number of surfaces.

Parameters
[in]aoldValue from the restart file.
[out]anewNew interpolated value.
[in]ns_oldRadial grid size in the restart file.
[in]ns_newNew radial grid size.

◆ restart_denormalize()

subroutine restart_mod::restart_denormalize ( real (dp), dimension(:,:,:)  xmn,
real (dp)  factor 
)

Denormalize a quantity so the value written to the restart file can be summed directly.

This removes the orthonorm and energy scale factors for a fourier quantity.

Parameters
[in,out]xmnFourier quantity to denormalize.
[in]factorEnergy scale factor.

◆ restart_normalize()

subroutine restart_mod::restart_normalize ( real (dp), dimension(:,:,:)  xmn,
real (dp)  factor 
)

Denormalize a quantity so the value written to the restart file can be summed directly.

This removes the orthonorm and energy scale factors for a fourier quantity.

Parameters
[in,out]xmnFourier quantity to denormalize.
[in]factorEnergy scale factor.

◆ restart_read()

integer function restart_mod::restart_read ( character (len=*), intent(in)  restart_ext,
character (len=*), intent(inout)  wout_file,
integer, intent(in)  mpolin,
integer, intent(in)  ntorin,
  nfpi 
)

Reads the restart file.

Reads the restart information and initalizes SIESTA quantities.

Parameters
[in]restart_extRestart extention.
[in,out]wout_fileName of the wout file.
[in]mpolinNamelist number of polodal modes.
[in]ntorinNamelist number of toroidal modes.
[in]nfpinNamelist number of field periods.
[in]nsinNamelist number of radial grid points.
[in]tor_modesinNamelist torodial modes.
Returns
Preconditioner control flag.

◆ restart_write()

subroutine restart_mod::restart_write ( character (len=*), intent(in)  restart_ext,
character (len=*), intent(in)  wout_file 
)

Write the restart file.

Writes the restart information.

Parameters
[in]restart_extRestart file extension.
[in]wout_fileName of the wout file.

◆ restart_write_free()

subroutine restart_mod::restart_write_free ( character (len=*), intent(in)  restart_ext)

Write the free boundary information.

The way the restart file is created not it's easier to write this to a separate restart file.

FIXME: Marge this into the current restart file. This will involve refactoring the restart so it doesn't overwrite the extire file every time it updates.

Parameters
[in]restart_extRestart file extension.