New QS equilibria
PyAQSC can solve - The full governing equation set for a QS equilibrium. - Or only the magnetic equations for a QS field with no force balance.
Each configuration is managed by a object of the traced class Equilibrium. An example is the return from aqsc.circular_axis(). See background on free parameters for a list of free parameters, their physics definition, dependence, and expansion forms.
This part shows how to create a new QS magnetic field from scratch and iterate to higher orders.
All grid values must be provided at .
Creating new configrations
aqsc.leading_orders_magnetic() creates a QS equilibrium and performs leading order () calculations:
new_equilibrium = aqsc.leading_orders(
nfp,
Rc, Rs, Zc, Zs,
iota_0,
B_theta_20,
B_psi_00,
Y20,
B_alpha_1,
B0, B11c, B22s, B20, B22c,
len_phi,
static_max_freq,
traced_max_freq,
)
Parameters:
nfp : int(static) - The number of field period.Rc, Rs, Zc, Zs : 1d array(traced) - , coefficients of axis shape and w.r.t. cylindrical . The -th component is the -th mode coefficient.iota_0 : float(traced) - The 0th order rotational transform.B_theta_20 : 1d array(traced) - .B_psi_00 : 1d array(traced) - .Y20 : 1d array(traced) - .B_alpha_1 : float(traced) - The 1st order component of flux funtionB0, B11c, B22s, B20, B22c : float(Traced) - Leading components of the magnetic field magnitude .len_phi(static) - The grid numberstatic_max_freq : int(static) - The cut-off frequency for the low-pass filter on the results. Tied to array sizes during spectral solve, and lower value drastically increases solving speeds. Changing will result in recompiling.traced_max_freq(traced) - The cut-off frequency for the low-pass filter on the results. Doesn't impact speed and doesn't require recompiling.
Returns:
- A new Equilibrium.
This function is defined in leading_orders.py.
Iterating to higher orders
To iterate the next two orders, use aqsc.iterate_2_magnetic_only():
new_equilibrium = iterate_2_magnetic_only(
equilibrium,
B_theta_nm1, B_theta_n,
Yn0,
Yn1p_avg,
B_psi_nm20,
B_alpha_nb2,
B_denom_nm1, B_denom_n,
iota_nm2b2,
static_max_freq=(-1,-1),
traced_max_freq=(-1,-1),
n_eval=None,
)
Parameters:
B_theta_nm1 : ChiPhiFunc(traced) - .B_theta_n : ChiPhiFunc(traced) - .Yn0 : 1d array(traced) - .Yn1p_avg : float(traced) - The average pf .B_psi_nm20 : 1d array(traced) - .B_alpha_nb2 : float(traced) - .B_denom_nm1 : ChiPhiFunc(traced) - .B_denom_n : ChiPhiFunc(traced) - .iota_nm2b2 : float(traced) - .static_max_freq : (int, int)(static) - The cut-off frequency for the low-pass filter on the results.traced_max_freq : (scalar, scalar)(traced) - The cut-off frequency for the low-pass filter on the results.n_eval : ChiPhiFunc(static) -n_eval : int(static) - Order to evaluate to. By default evaluates the next two orders, but can also re-evaluate 2 orders from lower . Must be even and no greater than .
Returns
- A new Equilibrium
This function is defined in equilibrium.py.
Loading from pySQC
PyAQSC also supports loading magnetic fields from a qsc.Qsc object in pyQSC. Simply use:
new_equilibrium = import_from_stel(stel, len_phi=1000, nfp_enabled=False)
Where stel is the qsc.Qsc object and len_phi is the desired grid number. qsc.Qsc stores all field periods on its grid. When nfp_enabled is set to True, pyAQSC converts the data to store only one field period. When set to False, all field periods will be stored. This method cannot be JIT compiled.