V3FIT
|
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 (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, lhalf) |
Interpolate fourier quantites from the restart file. 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. | |
integer, parameter | restart_lrecon = 30 |
Bit position for the lrecon 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_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_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. | |
Contains routines for writting the restart file.
subroutine restart_mod::interpit | ( | real (dp), dimension(0:mpol_old,-ntor_old:ntor_old,ns_ol real (dp), intent(out) :: anew(0:mpol_new,-ntor_new:ntor_new,ns_ne 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 logical, intent(in) :: lhalf ! local variables integer :: real_ntor_min integer :: i_n integer :: i_m real (dp) :: ds integer :: parity integer :: mpol_min integer :: ntor_min ! start of executable code mpol_min = min(mpol_new, mpol_old) real_ntor_min = min(ntor_new*nfp_new, ntor_old*nfp_old) ! if the fourier dimensions of the both arrays are the same just copy them. ! otherwise copy only the matcing modes. if (ns_old .eq. ns_new .and. mpol_old .eq. mpol_new .and. ntor_old .eq. ntor_new .and. nfp_old .eq. nfp_new) then anew = aold else ! only some of the toroidal modes will match if nfp_new and nfp_old are ! different. do i_n = -real_ntor_min, real_ntor_min if (i_n/nfp_new .eq. i_n/nfp_old) then do i_m = 0, mpol_min if (mod(i_m, 2) .eq. 0) then parity = -1 else parity = 1 end if call interpit_1d(aold(i_m, i_n, :), anew(i_m, i_n, :), ns_old, ns_new, lhalf, parity) end do else anew(:, i_n, :) = 0 end if end do end if end subroutine !------------------------------------------------------------------------------- !> @brief interpolate radial quantites from the restart file. !> !> restart files can change the number of surfaces. !> !> @param[in] aold value from the restart file. !> @param[out] anew new interpolated value. !> @param[in] ns_old radial grid size in the restart file. !> @param[in] ns_new new radial grid size. !------------------------------------------------------------------------------- subroutine interpit_1d(aold, anew, ns_old, ns_new, lhalf, parity) use stel_constants, only: one, zero implicit none ! declare arguments real (dp), intent(in) :: aold(ns_old) real (dp), intent(out) :: anew(ns_new) integer, intent(in) :: ns_old integer, intent(in) :: ns_new logical, intent(in) :: lhalf integer, intent(in) :: parity ! local variables real (dp), allocatable, dimension(:) :: temp_y real (dp), allocatable, dimension(:) :: temp_x real (dp), allocatable, dimension(:) :: temp_new real (dp), allocatable, dimension(:) :: temp real (dp) :: ds integer :: i_s ! local parameters real (dp), parameter :: lower_b = -1.e30_dp real (dp), parameter :: upper_b = -1.e30_dp ! start of executable code anew = 0 if (ns_old .eq. ns_new) then anew = aold return end if ! need to radially interpolate. extend the arrays from -ns to ns to get the ! correct behavior at s=0. ds = 1.0/(ns_old - 1) if (lhalf) then allocate(temp_y(2*(ns_old - 1))), intent(in) | aold, |
anew, | |||
ns_old, | |||
ns_new, | |||
mpol_old, | |||
mpol_new, | |||
ntor_old, | |||
ntor_new, | |||
nfp_old, | |||
nfp_new, | |||
lhalf | |||
) |
Interpolate fourier quantites from the restart file.
Restart files can change the number of surfaces and modes.
[in] | aold | Value from the restart file. |
[out] | anew | New interpolated value. |
[in] | ns_old | Radial grid size in the restart file. |
[in] | ns_new | New radial grid size. |
[in] | mpol_old | Number of poloidal modes in the restart file. |
[in] | mpol_new | New number of poloidal modes. |
[in] | ntor_old | Number of totoidal modes in the restart file. |
[in] | ntor_new | New number of totoidal modes. |
[in] | nfp_old | Number of field periods in the restart file. |
[in] | nfp_new | New number of field periods. |
Definition at line 724 of file restart_mod.f90.
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.
[in,out] | xmn | Fourier quantity to denormalize. |
[in] | factor | Energy scale factor. |
Definition at line 784 of file restart_mod.f90.
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.
[in] | restart_ext | Restart extention. |
[in,out] | wout_file | Name of the wout file. |
[in] | mpolin | Namelist number of polodal modes. |
[in] | ntorin | Namelist number of toroidal modes. |
[in] | nsin | Namelist number of radial grid points. |
[in] | nfpin | Namelist number of field periods. |
Definition at line 164 of file restart_mod.f90.
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.
[in] | restart_ext | Restart file extension. |
[in] | wout_file | Name of the wout file. |
Definition at line 363 of file restart_mod.f90.