The Open FUSION Toolkit 26.9
An open-source framework for fusion and plasma science and engineering
Loading...
Searching...
No Matches
mugtok_td Module Reference

Data Types

type  oft_mugtok_td
 L2-projected poloidal gradient of F (dF/dR, dF/dZ); helper used by the C wrapper for output. More...
type  oft_mugtok_td_mfop
 Combined MUG and TokaMaker time-advance operator. More...

Functions/Subroutines

subroutine add_f_jac (self, mat)
 Add approximate Jacobian entries corresponding to add_f_terms 1) F resistive-diffusion Jacobian in solid conductor (and vacuum) regions 2) An approximate F0/F0 diagonal = integral over the plasma region of dA/R (no profile effects). 3) The plasma-DOF constraint rows F(ind) - F0.
subroutine add_f_terms (self, a, b, dt)
subroutine apply_rhs_mugtok (self, a, b)
subroutine build_mugtok_td_jacobian (self, mat, a, update_vac)
subroutine build_psi_vac (self, coil_currents)
 Compute vacuum psi from a set of coil currents, for use in MUG.
subroutine, public compute_gradf (self, gradf_r, gradf_z)
 Compute the projected poloidal gradient of F (for poloidal current calculation).
subroutine delete_mfop (self)
subroutine delete_mugtok_td (self)
subroutine mugtok_mfnk_update (a)
subroutine mugtok_rst_save (self, t)
 Save the current solution (fields 1-7 of the augmented vector) to a restart file 'mugtok_NNNNN.rst', indexed by the step counter.
subroutine mugtok_td_plot (self)
 Plot saved restart states to XDMF/HDF5 output Runtime options are set in the main input file using the group mugtok_plot_options. Option group: mugtok_plot_options.
subroutine nlfun_apply (self, a, b)
subroutine setup_mugtok_td (self, equil, dt, lin_tol, nl_tol, mhd_flag, dens_reg, visc_reg, eta_reg, incomp, toroidal_flow)
 Setup combined MUG and TokaMaker simulation object.
subroutine snapshot_f_profile (self)
 Snapshot current FF' profile and f_scale into the sim's f_scale_prev / I_prev, so the next step's RHS pass of add_f_diff uses these previous-step values while the LHS uses whatever is set/computed for the next step.
subroutine step_mugtok_td (self, coil_currents, time, dt, nl_its, lin_its, nretry)
 Take one timestep of the combined MUG and TokaMaker simulation.

Variables

type(oft_mugtok_td), pointer current_sim => NULL()
 Current mug/tokamaker simulation object.
class(oft_scalar_bfem), pointer lag_rep => NULL()
 Pointer to single field FE representation.
class(oft_bmesh), pointer, public mesh => NULL()
 Pointer to FE mesh.

Function/Subroutine Documentation

◆ add_f_jac()

subroutine add_f_jac ( class(oft_mugtok_td), intent(inout) self,
class(oft_matrix), intent(inout), pointer mat )
private

Add approximate Jacobian entries corresponding to add_f_terms 1) F resistive-diffusion Jacobian in solid conductor (and vacuum) regions 2) An approximate F0/F0 diagonal = integral over the plasma region of dA/R (no profile effects). 3) The plasma-DOF constraint rows F(ind) - F0.

Parameters
[in,out]selfsimulation object
[in,out]matMatrix to add entries to

◆ add_f_terms()

subroutine add_f_terms ( class(oft_mugtok_td_mfop), intent(inout) self,
class(oft_vector), intent(inout), target a,
class(oft_vector), intent(inout) b,
real(r8), intent(in) dt )
private
Parameters
[in,out]aSource field
[in,out]bResult
[in]dtTimestep (0 for the RHS)

◆ apply_rhs_mugtok()

subroutine apply_rhs_mugtok ( class(oft_mugtok_td_mfop), intent(inout) self,
class(oft_vector), intent(inout), target a,
class(oft_vector), intent(inout) b )
private
Parameters
[in,out]selfTime-advance operator
[in,out]aSource field
[in,out]bResult of metric function

◆ build_mugtok_td_jacobian()

subroutine build_mugtok_td_jacobian ( class(oft_mugtok_td), intent(inout) self,
class(oft_matrix), intent(inout), pointer mat,
class(oft_vector), intent(inout) a,
logical, intent(in), optional update_vac )
private
Parameters
[in,out]selfSimulation object
[in,out]matJacobian matrix to populate
[in,out]aSolution for computing Jacobian
[in]update_vacWhether to update the vacuum psi operator (default: true)

◆ build_psi_vac()

subroutine build_psi_vac ( class(oft_mugtok_td), intent(inout) self,
real(r8), dimension(:), intent(in) coil_currents )
private

Compute vacuum psi from a set of coil currents, for use in MUG.

Parameters
[in,out]selfSimulation object
[in]coil_currentsCoil currents (size ncoils)

◆ compute_gradf()

subroutine, public compute_gradf ( class(oft_mugtok_td), intent(inout) self,
real(r8), dimension(:), intent(inout) gradf_r,
real(r8), dimension(:), intent(inout) gradf_z )

Compute the projected poloidal gradient of F (for poloidal current calculation).

Parameters
[in,out]gradf_rdF/dR at nodes (length lag_repne)
[in,out]gradf_zdF/dZ at nodes (length lag_repne)

◆ delete_mfop()

subroutine delete_mfop ( class(oft_mugtok_td_mfop), intent(inout) self)
private
Parameters
[in,out]selfTime-advance operator

◆ delete_mugtok_td()

subroutine delete_mugtok_td ( class(oft_mugtok_td), intent(inout) self)
private
Parameters
[in,out]selfNL operator object

◆ mugtok_mfnk_update()

subroutine mugtok_mfnk_update ( class(oft_vector), intent(inout), target a)
private
Parameters
[in,out]aCurrent solution vector

◆ mugtok_rst_save()

subroutine mugtok_rst_save ( class(oft_mugtok_td), intent(inout) self,
real(r8), intent(in) t )
private

Save the current solution (fields 1-7 of the augmented vector) to a restart file 'mugtok_NNNNN.rst', indexed by the step counter.

Parameters
[in]tCurrent solution time

◆ mugtok_td_plot()

subroutine mugtok_td_plot ( class(oft_mugtok_td), intent(inout) self)
private

Plot saved restart states to XDMF/HDF5 output Runtime options are set in the main input file using the group mugtok_plot_options. Option group: mugtok_plot_options.

Option Description Type [dim]
rst_start=0 First restart-file index to read int
rst_end=2000 Last restart-file index to read int

◆ nlfun_apply()

subroutine nlfun_apply ( class(oft_mugtok_td_mfop), intent(inout) self,
class(oft_vector), intent(inout), target a,
class(oft_vector), intent(inout) b )
private
Parameters
[in,out]selfTime-advance operator
[in,out]aSource field
[in,out]bResult of metric function

◆ setup_mugtok_td()

subroutine setup_mugtok_td ( class(oft_mugtok_td), intent(inout), target self,
type(gs_equil), intent(inout), target equil,
real(8), intent(in) dt,
real(8), intent(in) lin_tol,
real(8), intent(in) nl_tol,
logical, dimension(:), intent(in) mhd_flag,
real(8), dimension(:), intent(in) dens_reg,
real(8), dimension(:), intent(in) visc_reg,
real(8), dimension(:,:), intent(in), optional eta_reg,
logical, intent(in), optional incomp,
logical, intent(in), optional toroidal_flow )
private

Setup combined MUG and TokaMaker simulation object.

Parameters
[in,out]selfSimulation object to be setup
[in,out]equilTokamaker equilibrium object
[in]dtDesired timestep [s]
[in]lin_tolLinear solver tolerance
[in]nl_tolNon-linear solver tolerance
[in]mhd_flagTrue for regions where MHD should be used, false for TokaMaker
[in]dens_regDensity [kg/m^3] in each region [unused where mhd_flag is false]
[in]visc_regViscosity [m^2/s] in each region [unused where mhd_flag is false]
[in]eta_regElectrical resistivity [in plane, out of plane], in units of mu0, in each region. Defaults to TokaMaker region resistivites
[in]incompIf true, use incompressible MHD model (false currently not supported)
[in]toroidal_flowAllow toroidal (phi) flow in MHD regions

◆ snapshot_f_profile()

subroutine snapshot_f_profile ( class(oft_mugtok_td), intent(inout) self)
private

Snapshot current FF' profile and f_scale into the sim's f_scale_prev / I_prev, so the next step's RHS pass of add_f_diff uses these previous-step values while the LHS uses whatever is set/computed for the next step.

Parameters
[in,out]selfSimulation object

◆ step_mugtok_td()

subroutine step_mugtok_td ( class(oft_mugtok_td), intent(inout), target self,
real(r8), dimension(:), intent(in) coil_currents,
real(8), intent(inout) time,
real(8), intent(inout) dt,
integer(4), intent(out) nl_its,
integer(4), intent(out) lin_its,
integer(4), intent(out) nretry )
private

Take one timestep of the combined MUG and TokaMaker simulation.

Parameters
[in,out]selfSimulation object
[in]coil_currentsPrescribed I-coil currents for this step (size ncoils)
[in,out]dtCurrent time and desired timestep size [s]
[out]nretryNumber of nonlinear and linear iterations, and number of retries

Variable Documentation

◆ current_sim

type(oft_mugtok_td), pointer current_sim => NULL()

Current mug/tokamaker simulation object.

◆ lag_rep

class(oft_scalar_bfem), pointer lag_rep => NULL()
private

Pointer to single field FE representation.

◆ mesh

class(oft_bmesh), pointer, public mesh => NULL()

Pointer to FE mesh.