The Open FUSION Toolkit 1.0.0-8905cc5
Modeling tools for plasma and fusion research and engineering
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
ThinCurr Class Reference

Detailed Description

ThinCurr thin-wall E-M model class.

Public Member Functions

 __init__ (self, OFT_env)
 Initialize ThinCurr object.
 
 build_reduced_model (self, basis_set, filename='tCurr_reduced.h5', compute_B=False, sensor_obj=None)
 Build reduced model by projecting full model onto defined basis set of currents.
 
 build_XDMF (self, repeat_static=False, pretty=False)
 Build XDMF plot metadata files for model.
 
 compute_Bmat (self, cache_file=None)
 Compute magnetic field reconstruction operators for this model.
 
 compute_freq_response (self, fdriver=None, vdriver=None, freq=0.0, fr_limit=0, direct=False)
 Compute frequence response of the current model to given driver voltages.
 
 compute_Lmat (self, cache_file=None, use_hodlr=False)
 Compute the self-inductance matrix for this model.
 
 compute_Mcoil (self, cache_file=None)
 Compute the mutual inductance between passive (mesh+vcoils) and active elements (icoils)
 
 compute_Msensor (self, sensor_file=None, cache_file=None)
 Compute the mutual inductance between model and sensors.
 
 compute_Rmat (self, copy_out=False)
 Compute the resistance matrix for this model.
 
 cross_coupling (self, model2, cache_file=None)
 Compute the mutual inductance between this and another ThinCurr model.
 
 cross_eval (self, model2, field)
 Compute the voltage/flux induced on another ThinCurr model from a current structure on this model.
 
 get_eigs (self, neigs, direct=False)
 Compute eigenmodes of this model.
 
 get_eta_values (self)
 Get resistivity values for model.
 
 get_regmat (self)
 Compute the current regularization matrix for this model.
 
 plot_td (self, nsteps, compute_B=False, rebuild_sensors=False, plot_freq=10, sensor_obj=None, sensor_values=None)
 Perform a time-domain simulation.
 
 reconstruct_Bfield (self, potential, coil_currs=None)
 Reconstruct magnetic field on original grid.
 
 reconstruct_current (self, potential, centering='cell')
 Reconstruct current field on mesh.
 
 run_td (self, dt, nsteps, coil_currs=None, coil_volts=None, full_volts=None, direct=False, status_freq=10, plot_freq=10, sensor_obj=None, sensor_values=None, lin_tol=1.E-6, timestep_cn=True)
 Perform a time-domain simulation.
 
 save_current (self, potential, tag)
 Save current field from ThinCurr to plot files.
 
 save_scalar (self, field, tag)
 Save scalar field to plot files.
 
 scale_va (self, data, div_flag=False)
 Scale a vertex array by vertex areas (eg.
 
 set_eta_values (self, eta_values=None)
 Set resistivity values for model (overrides those in XML if specified)
 
 setup_io (self, basepath=None, save_debug=False, legacy_hdf5=False)
 Setup XDMF+HDF5 I/O for 3D visualization.
 
 setup_model (self, r=None, lc=None, reg=None, mesh_file=None, pmap=None, xml_filename=None, jumper_start=0)
 Setup ThinCurr model.
 

Public Attributes

 lc
 Mesh triangles [nc,3].
 
 Lmat
 Model inductance matrix (dense)
 
 Lmat_hodlr
 Model inductance matrix (HODLR)
 
 n_icoils
 Number of V-coil elements in the thin-wall model.
 
 n_vcoils
 Number of V-coil elements in the thin-wall model.
 
 nc
 Number of cells in mesh.
 
 ne
 Number of edges in mesh.
 
 nelems
 Total number of active DOFs in the thin-wall model.
 
 nholes
 Number of hole elements in the thin-wall model.
 
 np
 Number of points in mesh.
 
 np_active
 Number of vertices that are active in the thin-wall model.
 
 nregs
 Number of regions in mesh.
 
 r
 Mesh vertices [np,3] (last column should be all zeros)
 
 reg
 Mesh regions [nc].
 
 Rmat
 Model resistance matrix.
 
 tw_obj
 Thin-wall model object.
 

Protected Attributes

 _io_basepath
 I/O basepath for plotting/XDMF output.
 
 _oft_env
 
 _xml_ptr
 Pointer to XML element in Fortran (FoX)
 

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
  OFT_env 
)

Initialize ThinCurr object.

Parameters
OFT_envOFT runtime environment object (See OFT_env)

Member Function Documentation

◆ build_reduced_model()

build_reduced_model (   self,
  basis_set,
  filename = 'tCurr_reduced.h5',
  compute_B = False,
  sensor_obj = None 
)

Build reduced model by projecting full model onto defined basis set of currents.

Parameters
basis_setBasis set for projection (nBasis,:)
filenameFilename for saving reduced model
compute_BCompute B-field reconstruction operators for reduced model?
sensor_objSensor object to use
Returns
Reduced model (see ThinCurr_reduced)

◆ build_XDMF()

build_XDMF (   self,
  repeat_static = False,
  pretty = False 
)

Build XDMF plot metadata files for model.

Parameters
repeat_staticRepeat static fields (0-th timestep) in all timesteps?
prettyUse pretty printing (indentation) in XDMF files?

◆ compute_Bmat()

compute_Bmat (   self,
  cache_file = None 
)

Compute magnetic field reconstruction operators for this model.

Parameters
cache_filePath to cache file to store/load matrix
Returns
Element B-field reconstruction matrix ((:,:) if HODLR is available else None)
Icoil B-field reconstruction matrix (:,:)

◆ compute_freq_response()

compute_freq_response (   self,
  fdriver = None,
  vdriver = None,
  freq = 0.0,
  fr_limit = 0,
  direct = False 
)

Compute frequence response of the current model to given driver voltages.

Parameters
fdriverReal/Imaginary driver flux pair (M*I)
vdriverReal/Imaginary driver voltage pair
freqFrequency for response calculation [Hz] (unused if fr_limit!=0)
fr_limitFrequency limit for calculation (0: none, 1: inductive, 2: resistive)
directUse direct solver?
Returns
Real/Imaginary eddy current response

◆ compute_Lmat()

compute_Lmat (   self,
  cache_file = None,
  use_hodlr = False 
)

Compute the self-inductance matrix for this model.

Parameters
cache_filePath to cache file to store/load matrix
use_hodlrUse HODLR compression for the matrix
Returns
Self-inductance matrix ((:,:) if use_hodlr=False else reference to HODLR object)

◆ compute_Mcoil()

compute_Mcoil (   self,
  cache_file = None 
)

Compute the mutual inductance between passive (mesh+vcoils) and active elements (icoils)

Parameters
cache_filePath to cache file to store/load matrix
Returns
Mutual inductance matrix (:,:)

◆ compute_Msensor()

compute_Msensor (   self,
  sensor_file = None,
  cache_file = None 
)

Compute the mutual inductance between model and sensors.

Parameters
sensor_filePath to file contatining flux loop definitions
cache_filePath to cache file to store/load matrix
Returns
Mutual inductance matrix between model and sensors (:,:)
Mutual inductance matrix between icoils and sensors (:,:)
Internal ThinCurr sensor object

◆ compute_Rmat()

compute_Rmat (   self,
  copy_out = False 
)

Compute the resistance matrix for this model.

Parameters
copy_outCopy matrix to python and store in self.Rmat?

◆ cross_coupling()

cross_coupling (   self,
  model2,
  cache_file = None 
)

Compute the mutual inductance between this and another ThinCurr model.

Parameters
model2The second model for mutual calculation
cache_filePath to cache file to store/load matrix
Returns
Mutual inductance matrix (:,:)

◆ cross_eval()

cross_eval (   self,
  model2,
  field 
)

Compute the voltage/flux induced on another ThinCurr model from a current structure on this model.

Parameters
model2The second model for mutual calculation
fieldOne or more current fields
Returns
Flux on model2 from field on self (field.shape[0],:)

◆ get_eigs()

get_eigs (   self,
  neigs,
  direct = False 
)

Compute eigenmodes of this model.

Parameters
neigsNumber of eigenvalues to compute
directUse direct solver?
Returns
Eigenvalues (neigs)
Eigenvectors (neigs,:)

◆ get_eta_values()

get_eta_values (   self)

Get resistivity values for model.

Returns
eta_values Resistivity values for model [nregs]

◆ get_regmat()

get_regmat (   self)

Compute the current regularization matrix for this model.

Returns
Regularization matrix (:,:)

◆ plot_td()

plot_td (   self,
  nsteps,
  compute_B = False,
  rebuild_sensors = False,
  plot_freq = 10,
  sensor_obj = None,
  sensor_values = None 
)

Perform a time-domain simulation.

Parameters
nstepsNumber of steps to take
compute_BCompute B-field on grid vertices
rebuild_sensorsRecompute sensor signals (overwriting if present)
plot_freqFrequency to load plot files
sensor_objSensor object to use

◆ reconstruct_Bfield()

reconstruct_Bfield (   self,
  potential,
  coil_currs = None 
)

Reconstruct magnetic field on original grid.

Parameters
weightsReduced model basis weights
coil_currsCoil currents [A]
Returns
Magnetic field on original grid (:,3)

◆ reconstruct_current()

reconstruct_current (   self,
  potential,
  centering = 'cell' 
)

Reconstruct current field on mesh.

Parameters
potentialCurrent potential
centeringDesired field centering ('cell', 'vertex')
Returns
Current field on selected centering (:,3)

◆ run_td()

run_td (   self,
  dt,
  nsteps,
  coil_currs = None,
  coil_volts = None,
  full_volts = None,
  direct = False,
  status_freq = 10,
  plot_freq = 10,
  sensor_obj = None,
  sensor_values = None,
  lin_tol = 1.E-6,
  timestep_cn = True 
)

Perform a time-domain simulation.

Parameters
dtTime step for simulation
nstepsNumber of steps to take
coil_currsCurrent vs time array for Icoils (:,n_icoils+1) (first column is time)
coil_voltsVoltage vs time array for Vcoils (:,n_vcoils+1) (first column is time)
full_voltsVoltage vs time array for Vcoils (:,nelems+1) (first column is time)
directUse direct solver?
status_freqFrequency to print status information
plot_freqFrequency to save plot files
sensor_objSensor object to use
lin_tolTolerance for linear solver when direct=False
timestep_cnUse Crank-Nicolson timestep?

◆ save_current()

save_current (   self,
  potential,
  tag 
)

Save current field from ThinCurr to plot files.

Parameters
potentialCurrent potential to save
tagName of field in plot files

◆ save_scalar()

save_scalar (   self,
  field,
  tag 
)

Save scalar field to plot files.

Parameters
fieldPointwise data to save
tagName of field in plot files

◆ scale_va()

scale_va (   self,
  data,
  div_flag = False 
)

Scale a vertex array by vertex areas (eg.

B_n -> flux)

Parameters
dataData to scale
div_flagDivide by vertex areas instead?
Returns
Scaled data (:)

◆ set_eta_values()

set_eta_values (   self,
  eta_values = None 
)

Set resistivity values for model (overrides those in XML if specified)

Parameters
eta_valuesNew resistivity values for model [nregs]

◆ setup_io()

setup_io (   self,
  basepath = None,
  save_debug = False,
  legacy_hdf5 = False 
)

Setup XDMF+HDF5 I/O for 3D visualization.

Parameters
basepathPath to root directory to use for I/O
save_debugSave model debug information?
legacy_hdf5Use legacy HDF5 format (required for VisIt)

◆ setup_model()

setup_model (   self,
  r = None,
  lc = None,
  reg = None,
  mesh_file = None,
  pmap = None,
  xml_filename = None,
  jumper_start = 0 
)

Setup ThinCurr model.

Parameters
rPoint list (np,3)
lcCell list (nc,3)
regRegion tag (nc,)
mesh_fileFile containing model in native mesh format
pmapPoint map for periodic grids
xml_filenamePath to XML file for model
jumper_startIndex of first jumper nodeset in meshfile (positive values Fortran style, negative values Python style)

Member Data Documentation

◆ _io_basepath

_io_basepath
protected

I/O basepath for plotting/XDMF output.

◆ _oft_env

_oft_env
protected

◆ _xml_ptr

_xml_ptr
protected

Pointer to XML element in Fortran (FoX)

◆ lc

lc

Mesh triangles [nc,3].

◆ Lmat

Lmat

Model inductance matrix (dense)

◆ Lmat_hodlr

Lmat_hodlr

Model inductance matrix (HODLR)

◆ n_icoils

n_icoils

Number of V-coil elements in the thin-wall model.

◆ n_vcoils

n_vcoils

Number of V-coil elements in the thin-wall model.

◆ nc

nc

Number of cells in mesh.

◆ ne

ne

Number of edges in mesh.

◆ nelems

nelems

Total number of active DOFs in the thin-wall model.

◆ nholes

nholes

Number of hole elements in the thin-wall model.

◆ np

np

Number of points in mesh.

◆ np_active

np_active

Number of vertices that are active in the thin-wall model.

◆ nregs

nregs

Number of regions in mesh.

◆ r

r

Mesh vertices [np,3] (last column should be all zeros)

◆ reg

reg

Mesh regions [nc].

◆ Rmat

Rmat

Model resistance matrix.

◆ tw_obj

tw_obj

Thin-wall model object.


The documentation for this class was generated from the following file: