dynabench.equation
Module for representing partial differential equations.
Functions
|
Expand an expression using methods given as hints. |
|
Converts an arbitrary expression to a type that can be used inside SymPy. |
Classes
|
Advection equation in 2D. |
|
Base class for all equations. |
|
Cahn-Hilliard equation in 2D. |
|
Diffusion equation in 2D. |
|
alias of |
|
FitzHugh–Nagumo model with diffusive coupling given by the following equations: |
|
Base class for applied mathematical functions. |
|
Kuramoto-Sivashinsky equation in 2D. |
|
PDE defined by mathematical expressions |
|
Simple Burgers equation in 2D. |
|
Assumptions: |
|
Wave equation in 2D. |
- class dynabench.equation.AdvectionEquation(c_x: float = 1.0, c_y: float = 1.0, evolution_rate: float = 1.0, **kwargs)[source]
Bases:
BaseEquation
Advection equation in 2D. The equation is given by:
\[\frac{\partial u}{\partial t} = -c_x \frac{\partial u}{\partial x} - c_y \frac{\partial u}{\partial y}\]where c_x and c_y are the speeds of the advection in the x and y directions respectively.
- Parameters:
parameters (dict, default {c_x: 1, c_y: 1}) – Dictionary of parameters for the equations.
- linear_terms
List of linear terms in the equation.
- Type:
List[str]
- nonlinear_terms
List of nonlinear terms in the equation.
- Type:
List[str]
- class dynabench.equation.BaseEquation(equations: List[str] | str = ['dt(u) = 0'], parameters: Dict[str, float] = {}, evolution_rate: float = 1.0, **kwargs)[source]
Bases:
object
Base class for all equations. Represents the equation in the form of a dictionary which can be used with the py-pde library.
- Parameters:
equations (List[str] | str, default ["u_t = 0"]) – List of equations to be represented.
parameters (dict, default {}) – Dictionary of parameters for the equations.
- linear_terms
List of linear terms in the equation.
- Type:
List[str]
- nonlinear_terms
List of nonlinear terms in the equation.
- Type:
List[str]
- property equations
Get the equations of the equation.
- property lhs
Get the left-hand side of the equation.
- property name
Get the name of the equation.
- property num_variables
Get the number of variables in the equation.
- property rhs
Get the right-hand side of the equation.
- simplify_equation(eq: str) str [source]
Simplify the equation.
- Parameters:
eq (str) – The equation to be simplified.
- Returns:
The simplified equation.
- Return type:
str
- property variables
Get the variables of the equation.
- class dynabench.equation.CahnHilliardEquation(D: float = 1.0, gamma: float = 1.0, evolution_rate: float = 1.0, **kwargs)[source]
Bases:
BaseEquation
Cahn-Hilliard equation in 2D. The equation is given by:
\[\frac{\partial u}{\partial t} = D \nabla^2(u^3 - u - \gamma \nabla^2(u))\]where D and gamma are parameters of the equation.
- Parameters:
parameters (dict, default {D: 1, gamma: 1}) – Dictionary of parameters for the equations.
- linear_terms
List of linear terms in the equation.
- Type:
List[str]
- nonlinear_terms
List of nonlinear terms in the equation.
- Type:
List[str]
- class dynabench.equation.DiffusionEquation(D: float = 1.0, evolution_rate: float = 1.0, **kwargs)[source]
Bases:
BaseEquation
Diffusion equation in 2D. The equation is given by:
\[\frac{\partial u}{\partial t} = D \nabla^2 u\]where D is the diffusion coefficient.
- Parameters:
parameters (dict, default {D: 1}) – Dictionary of parameters for the equations.
- linear_terms
List of linear terms in the equation.
- Type:
List[str]
- nonlinear_terms
List of nonlinear terms in the equation.
- Type:
List[str]
- class dynabench.equation.FitzhughNagumoEquation(stimulus: float = 0.5, τ: float = 10, a: float = 0, b: float = 0, evolution_rate: float = 1.0, **kwargs)[source]
Bases:
BaseEquation
FitzHugh–Nagumo model with diffusive coupling given by the following equations:
\[\frac{\partial v}{\partial t} = \nabla^2 v + v - \frac{v^3}{3} - w + stimulus \frac{\partial w}{\partial t} = \frac{v + a - b * w}{\tau}\]where v is the membrane potential and w is the recovery variable, and stimulus, a, b, and tau are parameters of the equation.
- class dynabench.equation.KuramotoSivashinskyEquation(evolution_rate: float = 1.0, **kwargs)[source]
Bases:
BaseEquation
Kuramoto-Sivashinsky equation in 2D. The equation is given by:
\[\frac{\partial u}{\partial t} = -\nabla^2 u - \nabla^4 u - \frac{1}{2}|\nabla u|^2\]- Parameters:
parameters (dict, default {}) – Dictionary of parameters for the equations.
- linear_terms
List of linear terms in the equation.
- Type:
List[str]
- nonlinear_terms
List of nonlinear terms in the equation.
- Type:
List[str]
- class dynabench.equation.SimpleBurgersEquation(nu: float = 1.0, evolution_rate: float = 1.0, **kwargs)[source]
Bases:
BaseEquation
Simple Burgers equation in 2D. The equation is given by:
\[\frac{\partial u}{\partial t} = -u (\frac{\partial u}{\partial x}+\frac{\partial u}{\partial y}) + \nu \nabla^2 u\]where nu is the viscosity of the fluid.
- Parameters:
parameters (dict, default {nu: 1}) – Dictionary of parameters for the equations.
- linear_terms
List of linear terms in the equation.
- Type:
List[str]
- nonlinear_terms
List of nonlinear terms in the equation.
- Type:
List[str]
- class dynabench.equation.WaveEquation(c: float = 1.0, evolution_rate: float = 1.0, **kwargs)[source]
Bases:
BaseEquation
Wave equation in 2D. The equation is given by:
\[\frac{\partial^2 u}{\partial t^2} = c^2 \nabla^2 u\]where c is the speed of the wave.
- Parameters:
parameters (dict, default {c: 1}) – Dictionary of parameters for the equations.
- linear_terms
List of linear terms in the equation.
- Type:
List[str]
- nonlinear_terms
List of nonlinear terms in the equation.
- Type:
List[str]