Class Solver

Inheritance Relationships

Base Type

Class Documentation

class Solver : public virtual InputVariable

Class providing solver methods for the SCIANTIX simulation framework.

The Solver class contains various numerical methods to solve differential equations and other mathematical problems encountered in the simulation. These solvers are used in conjunction with models within the Simulation class.

Pizzocri D. et al (2018). Journal of Nuclear Materials, 502, 323-330. Zullo G. et al (2022). Nuclear Engineering and Technology, 54, 1195-1205.

Author

D. Pizzocri

Author

T. Barani

Author

G. Zullo

Public Functions

double Integrator(double initial_value, double parameter, double increment)

Integrates the ODE y’ = + S.

Parameters:
  • initial_value – The initial value of the dependent variable.

  • parameter – The source term.

  • increment – The time increment.

Returns:

The updated value after integration.

double LimitedGrowth(double initial_value, std::vector<double> parameter, double increment)

Solves the ODE y’ = k / y + S using a limited growth model.

Parameters:
  • initial_value – The initial value of the dependent variable.

  • parameter – A vector containing the growth rate and source term.

  • increment – The time increment.

Returns:

The updated value after solving the ODE.

double Decay(double initial_condition, double decay_rate, double source_term, double increment)

Solves the ODE y’ = - L y + S using a decay model.

Parameters:
  • initial_condition – The initial value of the dependent variable.

  • decay_rate – The decay rate.

  • source_term – The source.

  • increment – The time increment.

Returns:

The updated value after solving the ODE.

double BinaryInteraction(double initial_condition, double interaction_coefficient, double increment)

Solves the ODE y’ = -k y**2 using a binary interaction model.

Parameters:
  • initial_condition – The initial value of the dependent variable.

  • interaction_coefficient – The interaction coefficient.

  • increment – The time increment.

Returns:

The updated value after solving the ODE.

double SpectralDiffusion(double *initial_condition, std::vector<double> parameter, double increment)

Solves the spatially averaged PDE dy/dt = D div grad y + S - L y using a spectral approach. We apply a spectral approach in space, projecting the equation on the eigenfunctions of the laplacian operator. We use the first order backward Euler solver in time. The number of terms in the expansion, N, is fixed a priori.

Parameters : 0 : N_modes 1 : D 2 : r 3 :production 4 :loss rate

Parameters:
  • initial_condition – The initial conditions for the diffusion modes.

  • parameter – A vector containing the parameters for the diffusion equation.

  • increment – The time increment.

Returns:

The updated value after solving the PDE.

double dotProduct1D(std::vector<double> u, double v[], int n)

Function to compute the dot product between two arrays (v and u) of size n.

Parameters:
  • u – The vector.

  • v – The array.

  • n – The size of the vector and array.

Returns:

The dot product result.

void dotProduct2D(double A[], double v[], int n_rows, const int n_col, double result[])

Computes the dot product of a 2D matrix and a 1D array.

Parameters:
  • A – The matrix.

  • v – The array.

  • n_rows – The number of rows in the matrix.

  • n_col – The number of columns in the matrix.

  • result – The result array.

void SpectralDiffusion2equations(double &gas_1, double &gas_2, double *initial_condition_gas_1, double *initial_condition_gas_2, std::vector<double> parameter, double increment)

Solves two coupled diffusion equations using a spectral approach.

Parameters:
  • gas_1 – The first gas variable.

  • gas_2 – The second gas variable.

  • initial_condition_gas_1 – Initial conditions for the first gas.

  • initial_condition_gas_2 – Initial conditions for the second gas.

  • parameter – A vector containing the parameters for the diffusion equations.

  • increment – The time increment.

void SpectralDiffusion3equations(double &gas_1, double &gas_2, double &gas_3, double *initial_condition_gas_1, double *initial_condition_gas_2, double *initial_condition_gas_3, std::vector<double> parameter, double increment)

Solves three coupled diffusion equations using a spectral approach.

Parameters:
  • gas_1 – The first gas variable.

  • gas_2 – The second gas variable.

  • gas_3 – The third gas variable.

  • initial_condition_gas_1 – Initial conditions for the first gas.

  • initial_condition_gas_2 – Initial conditions for the second gas.

  • initial_condition_gas_3 – Initial conditions for the third gas.

  • parameter – A vector containing the parameters for the diffusion equations.

  • increment – The time increment.

void Laplace2x2(double A[], double b[])

Solves a system of two linear equations using Cramer’s method.

Parameters:
  • A – The coefficient matrix.

  • b – The constant terms vector.

void Laplace3x3(double A[], double b[])

Solves a system of three linear equations according to Cramer’s method.

Parameters:
  • A – The coefficient matrix.

  • b – The constant terms vector.

double det(int N, double A[])

Computes the determinant of a NxN matrix according to Cramer’s method.

Parameters:
  • N – The size of the matrix.

  • A – The matrix.

Returns:

The determinant of the matrix.

void Laplace(int N, double A[], double b[])

Solves a system of linear equations using the Laplace method.

Parameters:
  • N – The size of the matrix.

  • A – The coefficient matrix.

  • b – The constant terms vector.

double QuarticEquation(std::vector<double> parameter)

Solver for the quartic equation ax^4 + bx^3 +cx^2 +dx + e = 0 with the iterative Newton’s method.

Parameters:

parameter – A vector containing the coefficients of the equation. parameter.at(0) initial conditions parameter.at(1) coefficient of x^4 parameter.at(2) coefficient of x^3 parameter.at(3) coefficient of x^2 parameter.at(4) coefficient of x^1 parameter.at(5) coefficient of x^0

Returns:

x1, the solution to the equation.

void modeInitialization(int n_modes, double mode_initial_condition, double *diffusion_modes)

Initializes the diffusion modes.

Parameters:
  • n_modes – The number of diffusion modes.

  • mode_initial_condition – The initial condition for the modes.

  • diffusion_modes – The diffusion modes array.

double NewtonBlackburn(std::vector<double> parameter)

Solver for the non-linear equation (Blackburn’s thermochemical urania model) log(PO2(x)) = 2.0*log(x*(x+2.0)/(1.0-x)) + 108.0*pow(x,2.0) - 32700.0/T + 9.92 with the iterative Newton’s method.

Parameters:

parameter – A vector containing the parameters of the equation.

Returns:

The solution to the equation.

double NewtonLangmuirBasedModel(double initial_value, std::vector<double> parameter, double increment)

Solver for the ODE [y’ = K(1-beta*exp(alpha*y)))].

parameter[0] = K parameter[1] = beta parameter[2] = alpha

Parameters:
  • initial_value – The initial value of the dependent variable.

  • parameter – A vector containing the parameters of the ODE.

  • increment – The time increment.

Returns:

The solution to the ODE.

inline Solver()

Constructor.

inline ~Solver()

Destructor.