ForcingTerms Module
The ForcingTerms module handles external magnetic field perturbation specifications for GPEC.
Overview
The ForcingTerms module provides:
ForcingTermsControl: Configuration parameters for loading forcing dataForcingMode: Data structure representing a single (n, m) forcing modeload_forcing_data!: Function to load forcing data from ASCII or HDF5 files
API Reference
GeneralizedPerturbedEquilibrium.ForcingTerms.ForcingMode — Type
ForcingModeData structure for a single forcing mode.
Fields
n::Int- Toroidal mode numberm::Int- Poloidal mode numberamplitude::ComplexF64- Complex amplitude of the forcing field
GeneralizedPerturbedEquilibrium.ForcingTerms.ForcingTermsControl — Type
ForcingTermsControlUser-facing control parameters from TOML [ForcingTerms] section.
Fields
Forcing Data:
forcing_data_file::String- Path to forcing data file (n, m, complex amplitude)forcing_data_format::String- Format of forcing data: "ascii" or "hdf5" (default: "ascii")
Future: Will include Fortran coil.in parameters for external coil configurations
GeneralizedPerturbedEquilibrium.ForcingTerms.load_forcing_ascii! — Method
load_forcing_ascii!(forcing_modes::Vector{ForcingMode}, filepath::String, verbose::Bool)Load forcing data from ASCII file with columns: n, m, real(amplitude), imag(amplitude)
GeneralizedPerturbedEquilibrium.ForcingTerms.load_forcing_data! — Function
load_forcing_data!(forcing_modes::Vector{ForcingMode}, dir_path::String, forcing_data_file::String, forcing_data_format::String, verbose::Bool=false)Load forcing data from ASCII or HDF5 file.
ASCII format: Three or four columns (n, m, real amplitude, [optional] imag amplitude)
- Column 1: Toroidal mode number (n)
- Column 2: Poloidal mode number (m)
- Column 3: Complex amplitude (real part)
- Column 4: Complex amplitude (imaginary part) [optional, assumes 0 if not present]
Example ASCII file:
1 2 0.5 0.1
1 3 0.3 -0.2
2 4 0.8 0.0HDF5 format:
- Dataset "n": Integer array of toroidal mode numbers
- Dataset "m": Integer array of poloidal mode numbers
- Dataset "amplitude_real": Real parts of amplitudes
- Dataset "amplitude_imag": Imaginary parts of amplitudes
GeneralizedPerturbedEquilibrium.ForcingTerms.load_forcing_hdf5! — Method
load_forcing_hdf5!(forcing_modes::Vector{ForcingMode}, filepath::String, verbose::Bool)Load forcing data from HDF5 file with datasets: n, m, amplitudereal, amplitudeimag