The Open FUSION Toolkit 1.0.0-beta6
Modeling tools for plasma and fusion research and engineering
Loading...
Searching...
No Matches
grad_shaf.F90 File Reference
#include "local.h"

Data Types

type  circular_curr
 Interpolation class for uniform source with simple tokamak representation. More...
type  coil_region
 Internal coil region structure. More...
type  cond_region
 Internal wall region structure. More...
interface  flux_cofs_get
 Needs Docs. More...
interface  flux_cofs_set
 Needs Docs. More...
type  flux_func
 Abstract flux function prototype. More...
interface  flux_func_eval
 Needs Docs. More...
interface  flux_func_update
 Needs Docs. More...
type  gs_b_interp
 Interpolate magnetic field for a G-S solution. More...
type  gs_curvature_interp
 Interpolate magnetic field for a G-S solution. More...
type  gs_eq
 Grad-Shafranov equilibrium object. More...
type  gs_j_interp
 Interpolate magnetic field for a G-S solution. More...
type  gs_prof_interp
 Interpolate G-S profiles at a specific point in space. More...
type  gs_region_info
 Information for non-continuous regions. More...
type  gsinv_interp
 Need docs. More...
type  oft_gs_zerob
 Zero scalar Lagrange FE field on all boundary nodes and all nodes outside the plasma. More...

Modules

module  oft_gs
 Grad-Shafranov implementation for TokaMaker.

Functions/Subroutines

subroutine build_dels (mat, self, bc, dt, scale)
 Construct \( \frac{1}{R} \Delta^* \) operator, with or without time-dependence.
subroutine build_mrop (fe_rep, mat, bc)
 Construct mass matrix for a boundary Lagrange scalar representation.
subroutine circ_error (m, n, cofs, err, iflag)
subroutine circle_interp (self, cell, f, gop, val)
 Evaluate uniform source over simple plasma cross-section.
subroutine compute_bcmat (self)
 Compute boundary condition matrix for free-boundary case.
real(r8) function dummy_fpp (self, psi)
subroutine get_limiter ()
subroutine get_olbp (smesh, olbp)
 Generate oriented loop from boundary points.
subroutine gs_analyze_saddles (self, o_point, o_psi, x_point, x_psi)
 Needs Docs.
subroutine gs_b_interp_apply (self, cell, f, gop, val)
 Reconstruct magnetic field from a Grad-Shafranov solution.
subroutine gs_bcrosskappa (self, bcross_kappa)
 Needs docs.
subroutine gs_coil_mutual (self, icoil, b, mutual)
 Compute inductance between coil and given poloidal flux.
subroutine gs_coil_mutual_distributed (self, icoil, b, curr_dist, mutual)
 Compute inductance between a coil with non-uniform current distribution and given poloidal flux.
subroutine gs_coil_source (self, icoil, b)
 Calculates coil current source for given coil.
subroutine gs_coil_source_distributed (self, icoil, b, curr_dist)
 Calculates coil current source for given coil with non-uniform current distribution.
subroutine gs_curvature (self, br, bt, bz, solver_in)
 Needs docs.
subroutine gs_curvature_apply (self, cell, f, gop, val)
 Reconstruct magnetic field from a Grad-Shafranov solution.
subroutine gs_destroy (self)
 Destroy internal storage and nullify references for Grad-Shafranov object.
real(8) function gs_dflux (self)
 Compute diamagentic flux.
character(len=40) function gs_err_reason (ierr)
 Compute Grad-Shafranov solution for current flux definitions.
subroutine gs_find_saddle (self, psi_scale_len, psi_x, pt, stype)
 Needs Docs.
subroutine gs_fit_isoflux (self, psi_full, ierr)
 Compute coil currents to best fit isoflux, flux, and saddle targets at current solution.
subroutine gs_fixed_vflux (self, pts, fluxes)
 Compute required vacuum flux for fixed boundary equilibrium.
subroutine gs_gen_source (self, source_fun, b)
 Compute RHS source from an arbitrary current distribution \( J_{\phi} \).
subroutine gs_get_chi (self)
 Compute toroidal flux potential from Grad-Shafranov solution.
subroutine gs_get_cond_scales (self, vals, skip_fixed)
 Needs Docs.
subroutine gs_get_cond_weights (self, vals, skip_fixed)
 Needs Docs.
subroutine gs_get_qprof (gseq, nr, psi_q, prof, dl, rbounds, zbounds, ravgs)
 Get q profile for equilibrium.
subroutine gs_helicity (self, ener, helic)
 Compute the magnetic energy and helicity of a fixed boundary equilibrium.
subroutine gs_init (self)
 Initialize Grad-Shafranov object by computing operators and allocating storage.
subroutine gs_init_psi (self, ierr, r0, a, kappa, delta, curr_source)
 Initialize \( \psi \).
real(8) function gs_itor (self, psi_vec)
 Compute toroidal current for Grad-Shafranov equilibrium.
subroutine gs_itor_nl (self, itor, centroid)
 Compute toroidal current for Grad-Shafranov equilibrium.
subroutine gs_j_interp_apply (self, cell, f, gop, val)
 Reconstruct magnetic field from a Grad-Shafranov solution.
subroutine gs_j_interp_delete (self)
 Destroy temporary internal storage and nullify references.
subroutine gs_j_interp_setup (self, gs)
 Needs Docs.
subroutine gs_lin_solve (self, adjust_r0, ierr)
 Compute solution to linearized Grad-Shafranov without updating \( \psi \) for RHS.
subroutine gs_load_limiters (self)
 Needs Docs.
subroutine gs_mat_create (fe_rep, new)
 Create G-S matrix with necessary augmentations for free-boundary BC.
subroutine gs_plasma_mutual (self, b, mutual, itor)
 Compute inductance between plasma current and given poloidal flux.
subroutine gs_prof_interp_apply (self, cell, f, gop, val)
 Reconstruct a component of a Grad-Shafranov solution.
subroutine gs_prof_interp_delete (self)
 Destroy temporary internal storage and nullify references.
subroutine gs_prof_interp_setup (self, gs)
 Needs Docs.
subroutine gs_project_b (self, br, bt, bz, solver_in, normalized)
 Needs Docs.
subroutine gs_psi2pt (self, psi_target, pt, pt_con, vec, psi_int)
 Find position of psi along a vector search direction.
subroutine gs_psi2r (self, psi_target, pt, psi_int)
 Find position of psi along a radial chord.
subroutine gs_save_fields (self, pts, npts, filename)
 Compute magnetic fields from Grad-Shafranov equilibrium.
subroutine gs_save_mug (self, filename, legacy)
 Needs Docs.
subroutine gs_save_prof (self, filename, mpsi_sample)
 Needs Docs.
subroutine gs_set_cond_weights (self, vals, skip_fixed)
 Needs Docs.
subroutine gs_setup (self, ml_lag_2d)
 Needs Docs.
subroutine gs_setup_walls (self, skip_load, make_plot)
 Needs Docs.
subroutine gs_solve (self, ierr)
 Compute Grad-Shafranov solution for current flux function definitions and targets.
subroutine gs_source (self, a, b, b2, b3, itor_alam, itor_press, estore)
 Compute plasma component of RHS source for Grad-Shafranov equation.
logical function gs_test_bounds (self, pt)
 Test whether a point is inside the LCFS.
subroutine gs_trace_surf (gseq, psi_in, points, npoints)
 Trace a single specified flux surface.
subroutine gs_update_bounds (self, track_opoint)
 Needs Docs.
subroutine gs_vac_solve (self, psi_sol, rhs_source, ierr)
 Compute Grad-Shafranov solution for vacuum (no plasma).
subroutine gs_vacuum_solve (self, pol_flux, source, ierr)
 Solve for \( \psi \) in vacuum for a given source \( \int \phi^T J_{\phi} dA \).
subroutine gs_wall_source (self, dpsi_dt, b)
 Calculate RHS source for quasi-static solve from previous \( \psi \).
subroutine gsinv_apply (self, cell, f, gop, val)
 Needs Docs.
subroutine gsinv_destroy (self)
 Needs Docs.
subroutine gsinv_setup (self, lag_rep)
 Needs Docs.
real(8) function integrand1 (x)
real(8) function integrand2 (x)
subroutine psi2pt_error (m, n, cofs, err, iflag)
 Needs docs.
subroutine psimax_error (m, n, cofs, err, iflag)
 Needs docs.
subroutine psimax_error_grad (m, n, cofs, err, jac_mat, ldjac_mat, iflag)
 Needs docs.
subroutine set_bcmat (self, mat)
 Add boundary condition terms for free-boundary case to matrix.
subroutine set_noncontinuous
subroutine zerob_apply (self, a)
 Zero a 2D Lagrange scalar field at all nodes outside the plasma or on the global boundary.
subroutine zerob_delete (self)
 Destroy temporary internal storage and nullify references.

Variables

integer(i4cell_active = 0
real(r8), parameter gs_epsilon = 1.d-12
 Epsilon used for radial coordinate.
integer(4), parameter max_xpoints = 20
type(oft_lag_brinterp), pointer psi_eval_active => NULL()
type(oft_lag_bg2interp), pointer psi_g2eval_active => NULL()
type(oft_lag_bginterp), pointer psi_geval_active => NULL()
real(r8psi_target_active = 0.d0
real(r8), dimension(2) pt_con_active = [0.d0,0.d0]
real(r8qp_int_tol = 1.d-12
real(r8), dimension(2) vec_con_active = [0.d0,0.d0]

Function/Subroutine Documentation

◆ circ_error()

subroutine circ_error ( integer(4), intent(in) m,
integer(4), intent(in) n,
real(8), dimension(n), intent(in) cofs,
real(8), dimension(m), intent(out) err,
integer(4), intent(inout) iflag )
private

◆ get_limiter()

subroutine get_limiter
private

◆ integrand1()

real(8) function integrand1 ( real(8), intent(in) x)
private

◆ integrand2()

real(8) function integrand2 ( real(8), intent(in) x)
private

◆ set_noncontinuous()

subroutine set_noncontinuous
private