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

Detailed Description

Fortran part of Python wrapper for ThinCurr thin-wall eddy current functionality.

Authors
Chris Hansen
Date
March 2024

Functions/Subroutines

subroutine thincurr_apply_lmat (tw_ptr, vals, hodlr_ptr)
 Apply inductance matrix to a ThinCurr field.
subroutine thincurr_bmat (tw_ptr, hodlr_ptr, bmat_ptr, bdr_ptr, cache_file, error_str)
 Compute magnetic field reconstruction operators for a ThinCurr model.
subroutine thincurr_cross_coupling (tw_ptr1, tw_ptr2, mmat, cache_file, error_str)
 Compute the mutual inductance between this and another ThinCurr model.
subroutine thincurr_cross_eval (tw_ptr1, tw_ptr2, nrhs, vec1, vec2, error_str)
 Evaluate inductances on one model due to currents from another model.
subroutine thincurr_curr_regmat (tw_ptr, rmat, error_str)
 Compute the current regularization matrix for a ThinCurr model.
subroutine thincurr_eigenvalues (tw_ptr, direct, neigs, eig_vals, eig_vec, hodlr_ptr, error_str)
 Compute eigenmodes (L/R times and current structures) of a ThinCurr model.
subroutine thincurr_freq_response (tw_ptr, direct, fr_limit, freq, fr_driver, hodlr_ptr, error_str)
 Compute frequence response of a ThinCurr model to given driver voltages.
subroutine thincurr_get_eta (tw_ptr, eta_ptr, error_str)
 Get model surface resistivity values.
subroutine thincurr_get_eta_vol (tw_ptr, eta_ptr, error_str)
 Get model volumetric resistivity values.
subroutine thincurr_get_sensor_name (sensor_ptr, sensor_ind, sensor_name, error_str)
 Get the name of a given sensor.
subroutine thincurr_get_thickness (tw_ptr, thickness_ptr, error_str)
 Return the thickness of the regions as an array of length nreg. If thickness is not set, return -1 for all regions.
subroutine thincurr_lmat (tw_ptr, use_hodlr, lmat_ptr, cache_file, error_str)
 Compute the self-inductance matrix for a ThinCurr model.
subroutine thincurr_mcoil (tw_ptr, mc_ptr, cache_file, error_str)
 Compute the mutual inductance between passive (mesh+Vcoils) and active elements (Icoils).
subroutine thincurr_msensor (tw_ptr, sensor_file, ms_ptr, msc_ptr, nsensors, njumpers, sensor_ptr, cache_file, error_str)
 Compute the mutual inductance between model and sensors.
subroutine thincurr_recon_curr (tw_ptr, vals, curr, format)
 Reconstruct current field on mesh.
subroutine thincurr_recon_field (tw_ptr, pot, coils, field, hodlr_ptr)
 Reconstruct magnetic field on mesh.
subroutine thincurr_reduce_model (tw_ptr, filename, nbasis, basis_vecs, compute_b, sensor_ptr, hodlr_ptr, error_str)
 Needs docs.
subroutine thincurr_rmat (tw_ptr, kr_ptr, lc_ptr, mat_ptr, error_str)
 Compute the resistance matrix for a ThinCurr model.
subroutine thincurr_save_field (tw_ptr, vals, fieldname)
 Save current field from ThinCurr to plot files.
subroutine thincurr_save_scalar (tw_ptr, vals, fieldname)
 Save scalar field to plot files.
subroutine thincurr_scale_va (tw_ptr, vals, div_flag)
 Scale a vertex array by vertex areas (eg. B_n -> flux).
subroutine thincurr_set_eta (tw_ptr, eta_surf_ptr, eta_vol_ptr, thickness_ptr, error_str)
 Set resistivity and thickness values with automatic derivation of missing parameter. Accepts eta_surf alone, or any two of (eta_surf, eta_vol, thickness), and derives the missing value(s). If all three are provided, eta_surf is recomputed from eta_vol and thickness.
subroutine thincurr_setup (mesh_file, np, r_loc, nc, lc_loc, reg_loc, pmap_loc, jumper_start_in, tw_ptr, sizes, error_str, xml_ptr)
 Setup ThinCurr model.
subroutine thincurr_setup_io (tw_ptr, basepath, save_debug, legacy_hdf5, error_str)
 Setup I/O and plotting for ThinCurr model.
subroutine thincurr_time_domain (tw_ptr, direct, dt, nsteps, cg_atol, cg_rtol, timestep_cn, nstatus, nplot, vec_ic, sensor_ptr, ncurr, curr_ptr, nvolt, volt_ptr, volts_full, sensor_vals_ptr, hodlr_ptr, error_str)
 Perform a time-domain simulation.
subroutine thincurr_time_domain_plot (tw_ptr, compute_b, rebuild_sensors, nsteps, nplot, sensor_ptr, sensor_vals_ptr, nsensor, hodlr_ptr, error_str)
 Generate plot files for a time domain simulation that has already been run.

Variables

integer(i4), dimension(:,:), pointer lc_plot
 Needs docs.
real(r8), dimension(:,:), pointer r_plot
 Needs docs.
integer(i4), dimension(:), pointer reg_plot
 Needs docs.

Function/Subroutine Documentation

◆ thincurr_apply_lmat()

subroutine thincurr_apply_lmat ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value vals,
type(c_ptr), intent(in), value hodlr_ptr )

Apply inductance matrix to a ThinCurr field.

Parameters
[in]tw_ptrPointer to ThinCurr object
[in]valsField to apply matrix to (overwritten with result on output)
[in]hodlr_ptrPointer to HODLR object or null

◆ thincurr_bmat()

subroutine thincurr_bmat ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value hodlr_ptr,
type(c_ptr), intent(out) bmat_ptr,
type(c_ptr), intent(out) bdr_ptr,
character(kind=c_char), dimension(oft_path_slen), intent(in) cache_file,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Compute magnetic field reconstruction operators for a ThinCurr model.

Parameters
[in]tw_ptrThinCurr object
[in]hodlr_ptrHODLR operator or null
[out]bmat_ptrMagnetic field reconstruction operator
[out]bdr_ptrMagnetic field reconstruction operator for Icoils
[in]cache_filePath to cache file
[out]error_strError message

◆ thincurr_cross_coupling()

subroutine thincurr_cross_coupling ( type(c_ptr), intent(in), value tw_ptr1,
type(c_ptr), intent(in), value tw_ptr2,
type(c_ptr), intent(in), value mmat,
character(kind=c_char), dimension(oft_path_slen), intent(in) cache_file,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Compute the mutual inductance between this and another ThinCurr model.

Parameters
[in]tw_ptr1ThinCurr object 1 (eg. plasma model)
[in]tw_ptr2ThinCurr object 2 (eg. wall model)
[in]mmatMutual inductance matrix
[in]cache_filePath to cache file
[out]error_strError message

◆ thincurr_cross_eval()

subroutine thincurr_cross_eval ( type(c_ptr), intent(in), value tw_ptr1,
type(c_ptr), intent(in), value tw_ptr2,
integer(kind=c_int), intent(in), value nrhs,
type(c_ptr), intent(in), value vec1,
type(c_ptr), intent(in), value vec2,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Evaluate inductances on one model due to currents from another model.

Parameters
[in]tw_ptr1ThinCurr object 1 (eg. plasma model)
[in]tw_ptr2ThinCurr object 2 (eg. wall model)
[in]nrhsNumber of fields in vec1 and vec2
[in]vec1Currents on model 1
[in]vec2Fluxes on model 2
[out]error_strError message

◆ thincurr_curr_regmat()

subroutine thincurr_curr_regmat ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value rmat,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Compute the current regularization matrix for a ThinCurr model.

Parameters
[in]tw_ptrThinCurr object pointer
[in]rmatPointer to regularization matrix
[out]error_strError message

◆ thincurr_eigenvalues()

subroutine thincurr_eigenvalues ( type(c_ptr), intent(in), value tw_ptr,
logical(kind=c_bool), intent(in), value direct,
integer(kind=c_int), intent(in), value neigs,
type(c_ptr), intent(in), value eig_vals,
type(c_ptr), intent(in), value eig_vec,
type(c_ptr), intent(in), value hodlr_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Compute eigenmodes (L/R times and current structures) of a ThinCurr model.

Parameters
[in]tw_ptrThinCurr object pointer
[in]directUse direct solver?
[in]neigsNumber of eigenmodes to compute
[in]eig_valsPointer to eigenvalue array
[in]eig_vecPointer to eigenvector array
[in]hodlr_ptrPointer to HODLR operator
[out]error_strError message

◆ thincurr_freq_response()

subroutine thincurr_freq_response ( type(c_ptr), intent(in), value tw_ptr,
logical(kind=c_bool), intent(in), value direct,
integer(kind=c_int), intent(in), value fr_limit,
real(kind=c_double), intent(in), value freq,
type(c_ptr), intent(in), value fr_driver,
type(c_ptr), intent(in), value hodlr_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Compute frequence response of a ThinCurr model to given driver voltages.

Parameters
[in]tw_ptrThinCurr object pointer
[in]directUse direct solver?
[in]fr_limitFrequency limit for calculation (0: none, 1: inductive, 2: resistive)
[in]freqFrequency for response calculation [Hz] (unused if fr_limit/=0)
[in]fr_driverPointer to driver voltages (overwritten with result on output)
[in]hodlr_ptrPointer to HODLR operator or null
[out]error_strError message

◆ thincurr_get_eta()

subroutine thincurr_get_eta ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value eta_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Get model surface resistivity values.

Parameters
[in]tw_ptrThinCurr object pointer
[in]eta_ptrPointer to array for return values
[out]error_strError message

◆ thincurr_get_eta_vol()

subroutine thincurr_get_eta_vol ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value eta_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Get model volumetric resistivity values.

Parameters
[in]tw_ptrThinCurr object pointer
[in]eta_ptrPointer to array for return values
[out]error_strError message

◆ thincurr_get_sensor_name()

subroutine thincurr_get_sensor_name ( type(c_ptr), intent(in), value sensor_ptr,
integer(kind=c_int), intent(in), value sensor_ind,
character(kind=c_char), dimension(40), intent(out) sensor_name,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Get the name of a given sensor.

Parameters
[in]sensor_ptrPointer to sensor object
[in]sensor_indIndex of the sensor
[out]sensor_nameName of the sensor
[out]error_strError message

◆ thincurr_get_thickness()

subroutine thincurr_get_thickness ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value thickness_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Return the thickness of the regions as an array of length nreg. If thickness is not set, return -1 for all regions.

◆ thincurr_lmat()

subroutine thincurr_lmat ( type(c_ptr), intent(in), value tw_ptr,
logical(kind=c_bool), intent(in), value use_hodlr,
type(c_ptr), intent(out) lmat_ptr,
character(kind=c_char), dimension(oft_path_slen), intent(in) cache_file,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Compute the self-inductance matrix for a ThinCurr model.

Parameters
[in]tw_ptrThinCurr object
[in]use_hodlrUse HODLR compression?
[out]lmat_ptrPointer to inductance matrix or HODLR operator
[in]cache_filePath to cache file
[out]error_strError message

◆ thincurr_mcoil()

subroutine thincurr_mcoil ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(out) mc_ptr,
character(kind=c_char), dimension(oft_path_slen), intent(in) cache_file,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Compute the mutual inductance between passive (mesh+Vcoils) and active elements (Icoils).

Parameters
[in]tw_ptrThinCurr object
[out]mc_ptrPointer to mutual inductance matrix
[in]cache_filePath to cache file
[out]error_strError message

◆ thincurr_msensor()

subroutine thincurr_msensor ( type(c_ptr), intent(in), value tw_ptr,
character(kind=c_char), dimension(oft_path_slen), intent(in) sensor_file,
type(c_ptr), intent(out) ms_ptr,
type(c_ptr), intent(out) msc_ptr,
integer(kind=c_int), intent(out) nsensors,
integer(kind=c_int), intent(out) njumpers,
type(c_ptr), intent(inout) sensor_ptr,
character(kind=c_char), dimension(oft_path_slen), intent(in) cache_file,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Compute the mutual inductance between model and sensors.

Parameters
[in]tw_ptrThinCurr object
[in]sensor_filePath to sensor file
[out]ms_ptrPointer to mutual inductance matrix between mesh+Vcoils and sensors
[out]msc_ptrPointer to mutual inductance matrix between Icoils and sensors
[out]nsensorsNumber of sensors
[out]njumpersNumber of jumper sets
[in,out]sensor_ptrPointer to sensor object
[in]cache_filePath to cache file
[out]error_strError message

◆ thincurr_recon_curr()

subroutine thincurr_recon_curr ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value vals,
type(c_ptr), intent(in), value curr,
integer(kind=c_int), intent(in), value format )

Reconstruct current field on mesh.

Parameters
[in]tw_ptrPointer to ThinCurr object
[in]valsPointer to field values
[in]currPointer to reconstructed current values
[in]formatFormat for current (1: Cell-centered, 2: Vertex-centered)

◆ thincurr_recon_field()

subroutine thincurr_recon_field ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value pot,
type(c_ptr), intent(in), value coils,
type(c_ptr), intent(in), value field,
type(c_ptr), intent(in), value hodlr_ptr )

Reconstruct magnetic field on mesh.

Parameters
[in]tw_ptrPointer to ThinCurr object
[in]potPointer to current potential values
[in]coilsPointer to Icoil values
[in]fieldPointer to output magnetic field values
[in]hodlr_ptrPointer to HODLR operator or null

◆ thincurr_reduce_model()

subroutine thincurr_reduce_model ( type(c_ptr), intent(in), value tw_ptr,
character(kind=c_char), dimension(oft_path_slen), intent(in) filename,
integer(kind=c_int), intent(in), value nbasis,
type(c_ptr), intent(in), value basis_vecs,
logical(kind=c_bool), intent(in), value compute_b,
type(c_ptr), intent(in), value sensor_ptr,
type(c_ptr), intent(in), value hodlr_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Needs docs.

Parameters
[in]tw_ptrThinCurr model pointer
[in]filenameFilename for the reduced model
[in]nbasisNumber of basis vectors for reduction
[in]basis_vecsPointer to the basis vectors for reduction
[in]compute_bCompute magnetic field?
[in]sensor_ptrPointer to sensor object
[in]hodlr_ptrPointer to HODLR operator object or null
[out]error_strError string

◆ thincurr_rmat()

subroutine thincurr_rmat ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(out) kr_ptr,
type(c_ptr), intent(out) lc_ptr,
type(c_ptr), intent(out) mat_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Compute the resistance matrix for a ThinCurr model.

Parameters
[in]tw_ptrThinCurr object pointer
[out]kr_ptrPointer to array for row pointers of sparse matrix
[out]lc_ptrPointer to array for column indices of sparse matrix
[out]mat_ptrPointer to array for nonzero values of sparse matrix
[out]error_strError message

◆ thincurr_save_field()

subroutine thincurr_save_field ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value vals,
character(kind=c_char), dimension(oft_slen), intent(in) fieldname )

Save current field from ThinCurr to plot files.

Parameters
[in]tw_ptrPointer to ThinCurr object
[in]valsPointer to field values
[in]fieldnameName of the field to save

◆ thincurr_save_scalar()

subroutine thincurr_save_scalar ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value vals,
character(kind=c_char), dimension(oft_slen), intent(in) fieldname )

Save scalar field to plot files.

Parameters
[in]tw_ptrPointer to ThinCurr object
[in]valsData to save
[in]fieldnameName of field in plot files

◆ thincurr_scale_va()

subroutine thincurr_scale_va ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value vals,
logical(c_bool), intent(in), value div_flag )

Scale a vertex array by vertex areas (eg. B_n -> flux).

Parameters
[in]tw_ptrPointer to ThinCurr object
[in]valsData to scale
[in]div_flagDivide by vertex areas?

◆ thincurr_set_eta()

subroutine thincurr_set_eta ( type(c_ptr), intent(in), value tw_ptr,
type(c_ptr), intent(in), value eta_surf_ptr,
type(c_ptr), intent(in), value eta_vol_ptr,
type(c_ptr), intent(in), value thickness_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Set resistivity and thickness values with automatic derivation of missing parameter. Accepts eta_surf alone, or any two of (eta_surf, eta_vol, thickness), and derives the missing value(s). If all three are provided, eta_surf is recomputed from eta_vol and thickness.

Parameters
[in]tw_ptrThinCurr object pointer
[in]eta_surf_ptrSurface resistivity pointer (or NULL)
[in]eta_vol_ptrVolumetric resistivity pointer (or NULL)
[in]thickness_ptrThickness pointer (or NULL)
[out]error_strError string buffer

◆ thincurr_setup()

subroutine thincurr_setup ( character(kind=c_char), dimension(oft_path_slen), intent(in) mesh_file,
integer(c_int), intent(in), value np,
type(c_ptr), intent(in), value r_loc,
integer(c_int), intent(in), value nc,
type(c_ptr), intent(in), value lc_loc,
type(c_ptr), intent(in), value reg_loc,
type(c_ptr), intent(in), value pmap_loc,
integer(c_int), intent(in), value jumper_start_in,
type(c_ptr), intent(out) tw_ptr,
type(c_ptr), intent(in), value sizes,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str,
type(c_ptr), intent(in), value xml_ptr )

Setup ThinCurr model.

Parameters
[in]mesh_fileMesh file name
[in]r_locPointer to point locations array (3,np) (if np>0, otherwise mesh will be loaded from file)
[in]lc_locPointer to cell connectivity array (3,nc) (if np>0, otherwise mesh will be loaded from file)
[in]reg_locPointer to cell region array (nc) (if np>0, otherwise mesh will be loaded from file)
[in]pmap_locPointer to node periodicity mapping
[in]npNumber of nodes
[in]ncNumber of cells
[in]jumper_start_inStarting index of jumpers in nodesets
[in]sizesPointer to storage for output size information
[out]tw_ptrPointer to ThinCurr object
[out]error_strError string
[in]xml_ptrPointer to ThinCurr XML node

◆ thincurr_setup_io()

subroutine thincurr_setup_io ( type(c_ptr), intent(in), value tw_ptr,
character(kind=c_char), dimension(oft_path_slen), intent(in) basepath,
logical(c_bool), intent(in), value save_debug,
logical(c_bool), intent(in), value legacy_hdf5,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Setup I/O and plotting for ThinCurr model.

Parameters
[in]tw_ptrPointer to ThinCurr object
[in]basepathPath to root directory to use for I/O
[in]save_debugSave model debug information?
[in]legacy_hdf5Use legacy HDF5 format?
[out]error_strError string

◆ thincurr_time_domain()

subroutine thincurr_time_domain ( type(c_ptr), intent(in), value tw_ptr,
logical(kind=c_bool), intent(in), value direct,
real(kind=c_double), intent(in), value dt,
integer(kind=c_int), intent(in), value nsteps,
real(kind=c_double), intent(in), value cg_atol,
real(kind=c_double), intent(in), value cg_rtol,
logical(kind=c_bool), intent(in), value timestep_cn,
integer(kind=c_int), intent(in), value nstatus,
integer(kind=c_int), intent(in), value nplot,
type(c_ptr), intent(in), value vec_ic,
type(c_ptr), intent(in), value sensor_ptr,
integer(kind=c_int), intent(in), value ncurr,
type(c_ptr), intent(in), value curr_ptr,
integer(kind=c_int), intent(in), value nvolt,
type(c_ptr), intent(in), value volt_ptr,
logical(kind=c_bool), intent(in), value volts_full,
type(c_ptr), intent(in), value sensor_vals_ptr,
type(c_ptr), intent(in), value hodlr_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Perform a time-domain simulation.

Parameters
[in]tw_ptrThinCurr object pointer
[in]directUse direct solver?
[in]dtTime step [s]
[in]nstepsNumber of time steps
[in]cg_atolCG solver absolute tolerance
[in]cg_rtolCG solver relative tolerance
[in]timestep_cnUse Crank-Nicolson timestep?
[in]nstatusIteration frequency to print status information
[in]nplotIteration frequency to save plot files
[in]vec_icInitial conditions pointer
[in]sensor_ptrSensor object pointer
[in]ncurrNumber of timepoints for Icoil current waveform
[in]curr_ptrIcoil current waveform pointer
[in]nvoltNumber of timepoints for voltage waveform
[in]volt_ptrVoltage waveform pointer
[in]volts_fullVoltage waveform is on full mesh+Vcoils not just Vcoils
[in]sensor_vals_ptrSensor values pointer
[in]hodlr_ptrHODLR operator pointer
[out]error_strError string

◆ thincurr_time_domain_plot()

subroutine thincurr_time_domain_plot ( type(c_ptr), intent(in), value tw_ptr,
logical(kind=c_bool), intent(in), value compute_b,
logical(kind=c_bool), intent(in), value rebuild_sensors,
integer(kind=c_int), intent(in), value nsteps,
integer(kind=c_int), intent(in), value nplot,
type(c_ptr), intent(in), value sensor_ptr,
type(c_ptr), intent(in), value sensor_vals_ptr,
integer(kind=c_int), intent(in), value nsensor,
type(c_ptr), intent(in), value hodlr_ptr,
character(kind=c_char), dimension(oft_error_slen), intent(out) error_str )

Generate plot files for a time domain simulation that has already been run.

Parameters
[in]tw_ptrThinCurr model pointer
[in]compute_bCompute magnetic field?
[in]rebuild_sensorsRebuild sensor objects?
[in]nstepsNumber of time steps
[in]nplotIteration frequency of plot files
[in]sensor_ptrSensor object pointer
[in]sensor_vals_ptrSensor waveform pointer
[in]nsensorNumber of sensors
[in]hodlr_ptrHODLR operator pointer
[out]error_strError string

Variable Documentation

◆ lc_plot

integer(i4), dimension(:,:), pointer lc_plot

Needs docs.

◆ r_plot

real(r8), dimension(:,:), pointer r_plot

Needs docs.

◆ reg_plot

integer(i4), dimension(:), pointer reg_plot

Needs docs.