|
The Open FUSION Toolkit 1.0.0-beta5
Modeling tools for plasma and fusion research and engineering
|
ThinCurr thin-wall eddy current model class.
Public Member Functions | |
| __init__ (self, debug_level=0, nthreads=2) | |
| Initialize ThinCurr object. | |
| build_reduced_model (self, basis_set, filename='tCurr_reduced.h5', compute_B=False, sensor_obj=c_void_p()) | |
| 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, 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_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=c_void_p()) | |
| 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, direct=False, status_freq=10, plot_freq=10, sensor_obj=c_void_p(), 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. | |
| setup_io (self, basepath=None, save_debug=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=-1) | |
| 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 Member Functions | |
| _update_psin (self) | |
Update input file (oftpyin) with current settings. | |
Protected Attributes | |
| _io_basepath | |
| I/O basepath for plotting/XDMF output. | |
| _psin_dict | |
| Input file settings. | |
| _xml_ptr | |
| Pointer to XML element in Fortran (FoX) | |
| __init__ | ( | self, | |
debug_level = 0, |
|||
nthreads = 2 |
|||
| ) |
Initialize ThinCurr object.
| debug_level | Level of debug printing (0-3) |
|
protected |
Update input file (oftpyin) with current settings.
| build_reduced_model | ( | self, | |
| basis_set, | |||
filename = 'tCurr_reduced.h5', |
|||
compute_B = False, |
|||
sensor_obj = c_void_p() |
|||
| ) |
Build reduced model by projecting full model onto defined basis set of currents.
| basis_set | Basis set for projection (nBasis,:) |
| filename | Filename for saving reduced model |
| compute_B | Compute B-field reconstruction operators for reduced model? |
| sensor_obj | Sensor object to use |
| build_XDMF | ( | self, | |
repeat_static = False, |
|||
pretty = False |
|||
| ) |
Build XDMF plot metadata files for model.
| repeat_static | Repeat static fields (0-th timestep) in all timesteps? |
| pretty | Use pretty printing (indentation) in XDMF files? |
| compute_Bmat | ( | self, | |
cache_file = None |
|||
| ) |
Compute magnetic field reconstruction operators for this model.
| cache_file | Path to cache file to store/load matrix |
(:,:) if HODLR is available else None) (:,:) | 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.
| fdriver | Real/Imaginary driver flux pair (M*I) |
| vdriver | Real/Imaginary driver voltage pair |
| freq | Frequency for response calculation [Hz] (unused if fr_limit!=0) |
| fr_limit | Frequency limit for calculation (0: none, 1: inductive, 2: resistive) |
| direct | Use direct solver? |
| compute_Lmat | ( | self, | |
cache_file = None, |
|||
use_hodlr = False |
|||
| ) |
Compute the self-inductance matrix for this model.
| cache_file | Path to cache file to store/load matrix |
| use_hodlr | Use HODLR compression for the matrix |
(:,:) if use_hodlr=False else reference to HODLR object) | compute_Mcoil | ( | self, | |
cache_file = None |
|||
| ) |
Compute the mutual inductance between passive (mesh+vcoils) and active elements (icoils)
| cache_file | Path to cache file to store/load matrix |
(:,:) | compute_Msensor | ( | self, | |
| sensor_file, | |||
cache_file = None |
|||
| ) |
Compute the mutual inductance between model and sensors.
| sensor_file | Path to file contatining flux loop definitions |
| cache_file | Path to cache file to store/load matrix |
(:,:) (:,:) | compute_Rmat | ( | self, | |
copy_out = False |
|||
| ) |
Compute the resistance matrix for this model.
| copy_out | Copy matrix to python and store in self.Rmat? |
| cross_coupling | ( | self, | |
| model2, | |||
cache_file = None |
|||
| ) |
Compute the mutual inductance between this and another ThinCurr model.
| model2 | The second model for mutual calculation |
| cache_file | Path to cache file to store/load matrix |
(:,:) | cross_eval | ( | self, | |
| model2, | |||
| field | |||
| ) |
Compute the voltage/flux induced on another ThinCurr model from a current structure on this model.
| model2 | The second model for mutual calculation |
| field | One or more current fields |
model2 from field on self (field.shape[0],:) | get_eigs | ( | self, | |
| neigs, | |||
direct = False |
|||
| ) |
Compute eigenmodes of this model.
| neigs | Number of eigenvalues to compute |
| direct | Use direct solver? |
(neigs) (neigs,:) | 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 = c_void_p() |
|||
| ) |
Perform a time-domain simulation.
| nsteps | Number of steps to take |
| compute_B | Compute B-field on grid vertices |
| rebuild_sensors | Recompute sensor signals (overwriting if present) |
| plot_freq | Frequency to load plot files |
| sensor_obj | Sensor object to use |
| reconstruct_Bfield | ( | self, | |
| potential, | |||
coil_currs = None |
|||
| ) |
Reconstruct magnetic field on original grid.
| weights | Reduced model basis weights |
| coil_currs | Coil currents [A] |
(:,3) | reconstruct_current | ( | self, | |
| potential, | |||
centering = 'cell' |
|||
| ) |
Reconstruct current field on mesh.
| potential | Current potential |
| centering | Desired field centering ('cell', 'vertex') |
(:,3) | run_td | ( | self, | |
| dt, | |||
| nsteps, | |||
coil_currs = None, |
|||
coil_volts = None, |
|||
direct = False, |
|||
status_freq = 10, |
|||
plot_freq = 10, |
|||
sensor_obj = c_void_p(), |
|||
lin_tol = 1.E-6, |
|||
timestep_cn = True |
|||
| ) |
Perform a time-domain simulation.
| dt | Time step for simulation |
| nsteps | Number of steps to take |
| coil_currs | Current vs time array for Icoils (:,n_icoils+1) (first column is time) |
| coil_volts | Voltage vs time array for Vcoils (:,n_vcoils+1) (first column is time) |
| direct | Use direct solver? |
| status_freq | Frequency to print status information |
| plot_freq | Frequency to save plot files |
| sensor_obj | Sensor object to use |
| lin_tol | Tolerance for linear solver when direct=False |
| timestep_cn | Use Crank-Nicolson timestep? |
| save_current | ( | self, | |
| potential, | |||
| tag | |||
| ) |
Save current field from ThinCurr to plot files.
| potential | Current potential to save |
| tag | Name of field in plot files |
| save_scalar | ( | self, | |
| field, | |||
| tag | |||
| ) |
Save scalar field to plot files.
| field | Pointwise data to save |
| tag | Name of field in plot files |
| scale_va | ( | self, | |
| data, | |||
div_flag = False |
|||
| ) |
Scale a vertex array by vertex areas (eg.
B_n -> flux)
| data | Data to scale |
| div_flag | Divide by vertex areas instead? |
(:) | setup_io | ( | self, | |
basepath = None, |
|||
save_debug = False |
|||
| ) |
Setup XDMF+HDF5 I/O for 3D visualization.
| basepath | Path to root directory to use for I/O |
| save_debug | Save model debug information? |
| setup_model | ( | self, | |
r = None, |
|||
lc = None, |
|||
reg = None, |
|||
mesh_file = None, |
|||
pmap = None, |
|||
xml_filename = None, |
|||
jumper_start = -1 |
|||
| ) |
Setup ThinCurr model.
| r | Point list (np,3) |
| lc | Cell list (nc,3) |
| reg | Region tag (nc,) |
| mesh_file | File containing model in native mesh format |
| pmap | Point map for periodic grids |
| xml_filename | Path to XML file for model |
|
protected |
I/O basepath for plotting/XDMF output.
|
protected |
Input file settings.
|
protected |
Pointer to XML element in Fortran (FoX)
| 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.