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

Data Types

type  ml_xmhd_vecspace
 Needs docs. More...
type  oft_xmhd_driver
 Forcing object class for xMHD. More...
type  oft_xmhd_errmatrix
 NL metric matrix for xMHD. More...
type  oft_xmhd_massmatrix
 Mass metric matrix for Reduced MHD. More...
type  oft_xmhd_probe
 Probe object class for xMHD. More...
interface  xmhd_driver_apply
 Modify solution vectors to apply forcing. More...
type  xmhd_interp
 Interpolate a xMHD operator fields. More...
type  xmhd_interp_cache
 Interpolate a xMHD operator fields. More...
type  xmhd_loc_values
 Unpack object for local fields evaluated by xmhd_interp. More...
type  xmhd_ops
 xMHD operator container More...
interface  xmhd_probe_apply
 Sample probe signals from solution. More...
type  xmhd_sub_fields
 Object for sub-fields used by oft_xmhd_push and oft_xmhd_pop. More...

Modules

module  xmhd
 Module for modeling extended MHD with a mixed conforming/lagrange basis set.

Macros

#define XMHD_ITCACHE   10
#define XMHD_RST_LEN   5

Functions/Subroutines

subroutine oft_xmhd_create (new, level, cache, native)
 Create new xMHD solution vector.
subroutine oft_xmhd_inject (self, afine, acors)
 Inject a fine level xMHD solution to the next coarsest level.
subroutine oft_xmhd_interp (self, acors, afine)
 Interpolate a coarse level xMHD solution to the next finest level.
subroutine, public oft_xmhd_pop (u, sub_fields)
 Extract subfields from xMHD solution vector.
subroutine, public oft_xmhd_push (sub_fields, u)
 Replace subfields in xMHD solution vector with specified fields.
subroutine oft_xmhd_rst_load (u, filename, path, t, dt, rst_version_out)
 Load xMHD solution state from a restart file.
subroutine oft_xmhd_rst_save (u, t, dt, filename, path)
 Save xMHD solution state to a restart file.
subroutine xmhd_alloc_ops
 Setup and allocate operators used in xMHD advance.
subroutine xmhd_build_ops (fullin)
 Update Jacobian matrix with new fields.
subroutine xmhd_diag (u, diag_vals, ueq)
 Compute diagnostic values from fields.
subroutine xmhd_driver_rst_dummy (self, rst_file)
 Save or load driver info from restart file.
subroutine xmhd_errmatrix_apply (self, a, b)
 Compute the NL metric for solution field.
subroutine xmhd_interp_apply (self, cell, f, gop, val)
 Reconstruct xMHD solution fields.
subroutine xmhd_interp_delete (self)
 Destroy interpolator for xMHD solution fields.
subroutine xmhd_interp_setup (self, mesh)
 Setup interpolator for xMHD solution fields.
subroutine xmhd_interp_unpack (vals, vloc)
 Unpack interpolation fields into xMHD field structure.
subroutine, public xmhd_lin_run (equil_fields, pert_fields, escale)
 Main driver subroutine for extended MHD time advance.
subroutine xmhd_massmatrix_apply (self, a, b)
 Compute the mass matrix for solution field.
subroutine xmhd_mfnk_update (uin)
 Update Jacobian matrices on all levels with new fields.
subroutine, public xmhd_plot (probes)
 Plotting subroutine for xMHD post-processing.
subroutine xmhd_probe_flush (self)
 Flush internal write buffers for probe object.
subroutine xmhd_profile (u)
 Simple subroutine to compute timing of different solve phases.
subroutine xmhd_read_settings (dt, lin_tol, nl_tol, rst_ind, nsteps, rst_freq, nclean, maxextrap, ittarget, nl_update)
 Read settings for extended MHD model from input files.
subroutine, public xmhd_run (initial_fields, driver, probes, profile_only)
 Main driver subroutine for extended MHD time advance.
subroutine xmhd_set_bc
 Set BC flags.
subroutine xmhd_set_level (level)
 Set the current level for xMHD model.
subroutine xmhd_set_ops (uin)
 Update Jacobian matrices on all levels with new solution.
subroutine xmhd_setup_regions ()
 Setup material regions from XML input file.
subroutine xmhd_setup_rep
 Setup composite FE representation and ML environment.
pure real(r8) function xmhd_upwind_weight (v_mag, he, nu)
 Evalute upwinding parameter.

Variables

character(len=2) bbc = 'bc'
 Magnetic field BC ('bc','ic').
real(r8d2_dens = -1.d0
 Particle hyper-diffusivity.
real(r8d_dens = 1.E0_r8
 Particle diffusivity.
real(r8), public den_floor = -1.d0
 Density floor.
real(r8), public den_scale = -1.d0
 Density scale factor.
real(r8dt_scale = 1._r8
 Time step scaling factor.
real(r8eta = 1.E-2_r8
 Resistivity \( \eta / \mu_0 \).
real(r8eta_hyper = -1.d0
 Hyper resistivity.
real(r8), dimension(:), allocatable eta_reg
 Resistivity scale factors.
real(r8eta_temp = -1._r8
 Reference temperature for resistivity.
real(r8), public g_accel = 0.d0
 Gravity (oriented in the -Z direction).
integer(i4j2_ind = -1
 Index of hyper-res aux field.
real(r8), public j2_scale = -1.d0
 Hyper-resistivity aux variable scale factor.
real(r8jac_dt = 1.E-3_r8
 Time step.
real(r8k_boltz = elec_charge
 Boltzmann constant.
real(r8kappa_par = 1.d0
 Parallel thermal conductivity factor.
real(r8kappa_perp = 1.d0
 Perpendicular thermal conductivity factor.
real(r8m_ion = -1.d0
 Ion mass in SI units.
real(r8me_factor = 100.E0_r8
 Artificial electron mass factor.
class(oft_mesh), pointer mesh
type(oft_mf_matrix), target mfmat
 Matrix free operator.
class(multigrid_mesh), pointer mg_mesh
type(oft_matrix_ptr), dimension(:), pointer ml_int => NULL()
 MG interpolation operators.
type(oft_matrix_ptr), dimension(:), pointer ml_j => NULL()
 MG Jacobian operators.
type(oft_ml_fem_comp_type), target ml_xmhd_rep
 ML container for field representation.
real(r8mu_ion = 2.d0
 Ion mass in atomic units.
integer(i4n2_ind = -1
 Index of hyper-diff aux field.
real(r8), public n2_scale = -1.d0
 Hyper-diffusivity aux variable scale factor.
character(len=1) nbc = 'd'
 Density BC ('d','n').
real(r8), dimension(:,:), allocatable neg_flag
real(r8), dimension(:,:), allocatable neg_source
real(r8nu_par = 0.d0
 Fluid (parallel) viscosity (note: dynamic viscosity is nu=nu_par*den_scale/n0).
real(r8nu_perp = 0.d0
 Fluid perpendicular viscosity if anisotropic, as nu_par.
integer(i4), dimension(fem_max_levels) nu_xmhd = 1
 Number of smoother iterations.
class(oft_hcurl_fem), pointer oft_hcurl => NULL()
class(oft_h1_fem), pointer oft_hgrad => NULL()
class(oft_scalar_fem), pointer oft_lagrange => NULL()
type(xmhd_ops), pointer oft_xmhd_ops => NULL()
 Operator container.
type(xmhd_ops), dimension(:), pointer oft_xmhd_ops_ml => NULL()
 MG operator container.
procedure(oft_1d_func), pointer, public res_profile => NULL()
 Resistivity profile.
logical, dimension(:), allocatable solid_cell
 Solid region flag.
character(len=1) tbc = 'd'
 Temperature BC ('d','n').
real(r8te_factor = 1.d0
 Electron temperature factor (single temperature).
integer(i4te_ind = -1
 Index of electron temperature field.
real(r8), public temp_floor = -1.d0
 Temperature floor.
real(r8temp_gamma = 5.d0/3.d0
 Ratio of specific heats.
character(len=4) vbc = 'all'
 Velocity BC ('all','norm','tang').
integer(i4vbc_type = 1
 Velocity BC type.
real(r8), public vel_scale = 1.d3
 Velocity scale factor.
integer(i4visc_itype = 1
 Viscosity type flag (1->kin,2->iso,3->ani).
character(len=3) visc_type = 'kin'
 Viscosity type ('kin','iso','ani').
logical, public xmhd_adv_b = .TRUE.
 Advance magnetic field.
logical xmhd_adv_den = .TRUE.
 Advance density.
logical xmhd_adv_temp = .TRUE.
 Advance temperature.
logical xmhd_advec = .TRUE.
 Include fluid advection.
integer(i4xmhd_blevel = 0
 Highest level on base meshes.
logical, public xmhd_bnorm_force = .TRUE.
 Force B-norm to zero in cleaning.
logical xmhd_brag = .FALSE.
 Braginskii thermal conduction.
logical xmhd_diss_centered = .FALSE.
 Time-center dissipation terms.
real(r8xmhd_eps = 1.d-10
 Epsilon for magnetic field normalization.
logical xmhd_hall = .FALSE.
 Include Hall terms.
real(r8), dimension(:,:), pointer, contiguous xmhd_hcurl_cop => NULL()
real(r8), dimension(:,:), pointer, contiguous xmhd_hcurl_rop => NULL()
real(r8), dimension(:,:), pointer, contiguous xmhd_hgrad_rop => NULL()
logical xmhd_jcb = .TRUE.
 Include JxB force on fluid.
real(r8), dimension(:,:), pointer, contiguous xmhd_lag_gop => NULL()
real(r8), dimension(:), pointer, contiguous xmhd_lag_rop => NULL()
integer(i4xmhd_lev = 1
 Active FE level.
integer(i4xmhd_level = 1
 Active FE level.
integer(i4xmhd_lin_level = 1
 Highest linear element level.
logical xmhd_linear = .FALSE.
 Compute linearized matrix.
integer(i4), dimension(:,:), allocatable xmhd_mat_mask
 Matrix block mask.
logical xmhd_mfnk = .FALSE.
 Use Jacobian free non-linear advance.
integer(i4), public xmhd_minlev = -1
 Lowest MG level.
type(oft_ml_fem_type), pointer, public xmhd_ml_h1 => NULL()
type(oft_ml_fem_type), pointer, public xmhd_ml_h1grad => NULL()
type(oft_ml_fem_type), pointer, public xmhd_ml_hcurl => NULL()
type(oft_ml_fem_comp_type), pointer, public xmhd_ml_hcurl_grad => NULL()
type(oft_ml_fem_type), pointer, public xmhd_ml_lagrange => NULL()
type(ml_xmhd_vecspace), target xmhd_ml_vecspace
type(oft_ml_fem_comp_type), pointer, public xmhd_ml_vlagrange => NULL()
logical xmhd_monitor_div = .FALSE.
 Monitor div error?
integer(i4xmhd_nlevels = 1
 Number of total levels.
integer(i4), dimension(fem_max_levels) xmhd_nparts = 1
 Number of local partitions for preconditioning.
logical xmhd_ohmic = .FALSE.
 Resistive heating.
integer(i4xmhd_opcount = 1
 Number of time steps since preconditioner update.
real(r8xmhd_opdt = 1.d0
 Time step for current preconditioner object.
class(oft_solver), pointer xmhd_pre => NULL()
 Preconditioner object.
type(xml_node), pointer xmhd_pre_node => NULL()
 preconditioner XML node
integer(i4xmhd_prefreq = 30
 Desired update frequency for preconditioner.
type(oft_fem_comp_type), pointer xmhd_rep => NULL()
 Active field representation.
type(xml_node), pointer xmhd_root_node => NULL()
 xMHD XML node
integer(i4), parameter xmhd_rst_version = 3
 Restart file version number.
logical xmhd_rw = .FALSE.
 Resistive wall present.
logical xmhd_skip_update = .FALSE.
 Internal flag for skipping Jac update.
integer(i4), public xmhd_taxis = 3
 Axis for toroidal flux and current.
logical xmhd_therm_equil = .FALSE.
 Include cross-species thermalization.
logical xmhd_two_temp = .FALSE.
 Run 2 Temperature model.
logical xmhd_upwind = .TRUE.
 Use upwinding.
logical xmhd_vbcdir = .FALSE.
 Velocity BC type flag.
logical xmhd_visc_heat = .FALSE.
 Viscous heating.

Macro Definition Documentation

◆ XMHD_ITCACHE

#define XMHD_ITCACHE   10

◆ XMHD_RST_LEN

#define XMHD_RST_LEN   5