FusionKernel

Struct FusionKernel 

Source
pub struct FusionKernel { /* private fields */ }
Expand description

The Grad-Shafranov equilibrium solver.

Implementations§

Source§

impl FusionKernel

Source

pub fn new(config: ReactorConfig) -> Self

Create a new kernel from configuration.

Source

pub fn from_file(path: &str) -> FusionResult<Self>

Create a new kernel from a JSON config file.

Source

pub fn solve_equilibrium(&mut self) -> FusionResult<EquilibriumResult>

Main equilibrium solver. Port of solve_equilibrium().

Algorithm:

  1. Compute vacuum field from coils
  2. Seed Gaussian current distribution
  3. Initial Jacobi solve
  4. Picard iteration loop: a. Find O-point (axis) and X-point b. Update nonlinear source term c. Jacobi elliptic solve d. Apply vacuum boundary conditions e. Relax: Ψ = (1-α)Ψ_old + α Ψ_new f. Check convergence
Source

pub fn psi(&self) -> &Array2<f64>

Read-only access to flux.

Source

pub fn j_phi(&self) -> &Array2<f64>

Read-only access to current density.

Source

pub fn state(&self) -> &PlasmaState

Read-only access to the plasma state.

Source

pub fn grid(&self) -> &Grid2D

Read-only access to the grid.

Source

pub fn set_solver_method(&mut self, method: SolverMethod)

Set the inner linear solver method.

Source

pub fn solver_method(&self) -> SolverMethod

Get the current inner linear solver method.

Source

pub fn config(&self) -> &ReactorConfig

Read-only access to the configuration.

Source

pub fn set_external_profiles( &mut self, params_p: ProfileParams, params_ff: ProfileParams, )

Enable externally specified mTanh profiles for source update.

Source

pub fn clear_external_profiles(&mut self)

Disable external profile mode and revert to default nonlinear source update.

Source

pub fn set_particle_current_feedback( &mut self, particle_j_phi: Array2<f64>, coupling: f64, ) -> FusionResult<()>

Inject a static particle-current map blended into fluid J_phi each Picard step.

Source

pub fn clear_particle_current_feedback(&mut self)

Disable particle-current feedback for subsequent solves.

Source

pub fn set_particle_feedback_from_population( &mut self, particles: &[ChargedParticle], coupling: f64, runaway_threshold_mev: f64, ) -> FusionResult<ParticlePopulationSummary>

Build particle feedback map from macro-particle population and enable coupling.

Source

pub fn solve_equilibrium_with_profiles( &mut self, params_p: ProfileParams, params_ff: ProfileParams, ) -> FusionResult<EquilibriumResult>

Convenience wrapper to solve with temporary external profile parameters.

Source

pub fn sample_psi_at(&self, r: f64, z: f64) -> FusionResult<f64>

Sample solved flux at nearest grid point to (R, Z).

Source

pub fn sample_psi_at_probes( &self, probes: &[(f64, f64)], ) -> FusionResult<Vec<f64>>

Sample solved flux at multiple probe coordinates.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.