Equation Factory#
- class FixedValue(value, components=None)[source]#
Bases:
Equation
Equation to enforce a fixed value. Can be used to enforce Dirichlet Boundary conditions.
Initialization of the
FixedValue
class.
- class FixedGradient(value, components=None, d=None)[source]#
Bases:
Equation
Equation to enforce a fixed gradient for a specific condition.
Initialization of the
FixedGradient
class.- Parameters:
value (float) – The fixed value to be enforced to the gradient.
components (list[str]) – The name of the output variables for which the fixed gradient condition is applied. It should be a subset of the output labels. If
None
, all output variables are considered. Default isNone
.d (list[str]) – The name of the input variables on which the gradient is computed. It should be a subset of the input labels. If
None
, all the input variables are considered. Default isNone
.
- class FixedFlux(value, components=None, d=None)[source]#
Bases:
Equation
Equation to enforce a fixed flux, or divergence, for a specific condition.
Initialization of the
FixedFlux
class.- Parameters:
value (float) – The fixed value to be enforced to the flux.
components (list[str]) – The name of the output variables for which the fixed flux condition is applied. It should be a subset of the output labels. If
None
, all output variables are considered. Default isNone
.d (list[str]) – The name of the input variables on which the flux is computed. It should be a subset of the input labels. If
None
, all the input variables are considered. Default isNone
.
- class FixedLaplacian(value, components=None, d=None)[source]#
Bases:
Equation
Equation to enforce a fixed laplacian for a specific condition.
Initialization of the
FixedLaplacian
class.- Parameters:
value (float) – The fixed value to be enforced to the laplacian.
components (list[str]) – The name of the output variables for which the fixed laplace condition is applied. It should be a subset of the output labels. If
None
, all output variables are considered. Default isNone
.d (list[str]) – The name of the input variables on which the laplacian is computed. It should be a subset of the input labels. If
None
, all the input variables are considered. Default isNone
.
- class Laplace(components=None, d=None)[source]#
Bases:
FixedLaplacian
Equation to enforce a null laplacian for a specific condition. The equation is defined as follows:
\[\delta u = 0\]Initialization of the
Laplace
class.- Parameters:
components (list[str]) – The name of the output variables for which the null laplace condition is applied. It should be a subset of the output labels. If
None
, all output variables are considered. Default isNone
.d (list[str]) – The name of the input variables on which the laplacian is computed. It should be a subset of the input labels. If
None
, all the input variables are considered. Default isNone
.
- class Advection(c)[source]#
Bases:
Equation
Implementation of the N-dimensional advection equation with constant velocity parameter. The equation is defined as follows:
\[\frac{\partial u}{\partial t} + c \cdot \nabla u = 0\]Here, \(c\) is the advection velocity parameter.
Initialization of the
Advection
class.- Parameters:
c (float | int | List[float] | List[int]) – The advection velocity. If a scalar is provided, the same velocity is applied to all spatial dimensions. If a list is provided, it must contain one value per spatial dimension.
- Raises:
ValueError – If
c
is an empty list.
- class AllenCahn(alpha, beta)[source]#
Bases:
Equation
Implementation of the N-dimensional Allen-Cahn equation, defined as follows:
\[\frac{\partial u}{\partial t} - \alpha \Delta u + \beta(u^3 - u) = 0\]Here, \(\alpha\) and \(\beta\) are parameters of the equation.
Initialization of the
AllenCahn
class.
- class DiffusionReaction(alpha, forcing_term)[source]#
Bases:
Equation
Implementation of the N-dimensional Diffusion-Reaction equation, defined as follows:
\[\frac{\partial u}{\partial t} - \alpha \Delta u - f = 0\]Here, \(\alpha\) is a parameter of the equation, while \(f\) is the reaction term.
Initialization of the
DiffusionReaction
class.
- class Helmholtz(k, forcing_term)[source]#
Bases:
Equation
Implementation of the Helmholtz equation, defined as follows:
\[\Delta u + k u - f = 0\]Here, \(k\) is a parameter of the equation, while \(f\) is the forcing term.
Initialization of the
Helmholtz
class.
- class Poisson(forcing_term)[source]#
Bases:
Equation
Implementation of the Poisson equation, defined as follows:
\[\Delta u - f = 0\]Here, \(f\) is the forcing term.
Initialization of the
Poisson
class.- Parameters:
forcing_term (Callable) – The forcing field function, taking as input the points on which evaluation is required.