pde_opt.numerics.equations.allen_cahn

This module contains various Allen-Cahn equation classes.

Classes

AllenCahn2DPeriodic(domain, kappa, mu, R[, ...])

Allen-Cahn equation in 2D with periodic boundary conditions.

AllenCahn2DPeriodicButlerVolmer(domain, ...)

AllenCahn2DPeriodicButlerVolmerConstantCurrent(...)

AllenCahn2DSmoothedBoundary(domain, kappa, ...)

Allen-Cahn equation with smoothed boundary method for arbitrary geometries.

AllenCahn2DSmoothedBoundaryButlerVolmerConstantCurrent(...)

class pde_opt.numerics.equations.allen_cahn.AllenCahn2DPeriodic(domain: Domain, kappa: float, mu: Callable | equinox.Module, R: Callable | equinox.Module, derivs: str = 'fd')[source]

Allen-Cahn equation in 2D with periodic boundary conditions.

The Allen-Cahn equation describes phase transitions and interface dynamics. The equation is:

\[\frac{\partial u}{\partial t} = -R(u) \mu\]

where u is the concentration, R(u) is the reaction term, μ is the chemical potential, and κ is a parameter (the gradient energy coefficient). The chemical potential is given by:

\[\mu = \mu_h(u) - \kappa \nabla^2 u\]
domain: Domain

Domain of the equation

kappa: float

Gradient energy coefficient

mu: Callable | equinox.Module

Function for the chemical potential

R: Callable | equinox.Module

Function for the reaction term

derivs: str = 'fd'

Type of derivative computation

rhs(state, t)[source]

Right hand side of the equation.

rhs_fourier(state, t)[source]
rhs_fd(state, t)[source]
__init__(domain: Domain, kappa: float, mu: Callable | equinox.Module, R: Callable | equinox.Module, derivs: str = 'fd') None
class pde_opt.numerics.equations.allen_cahn.AllenCahn2DSmoothedBoundary(domain: Domain, kappa: float, f: Callable | equinox.Module, mu: Callable | equinox.Module, R: Callable | equinox.Module, theta: Callable | equinox.Module, derivs: str = 'fd')[source]

Allen-Cahn equation with smoothed boundary method for arbitrary geometries.

This class implements the Allen-Cahn equation using the smoothed boundary method, which allows for complex domain geometries through a smooth level-set function ψ.

The equation is:

\[\frac{\partial u}{\partial t} = -R(u) \mu\]

where the chemical potential includes boundary effects:

\[\mu = \mu_h(u) - \frac{\kappa}{\psi} \nabla \cdot (\psi \nabla u) - \sqrt{\kappa} \frac{|\nabla \psi|}{\psi} \sqrt{2f} \cos(\theta)\]
domain: Domain

Domain of the equation

kappa: float

Gradient energy coefficient

f: Callable | equinox.Module

Function for the free energy density

mu: Callable | equinox.Module

Function for the chemical potential

R: Callable | equinox.Module

Function for the reaction term

theta: Callable | equinox.Module

Function for the contact angle

derivs: str = 'fd'

Type of derivative computation

rhs(state, t)[source]

Right hand side of the equation.

rhs_fd(state, t)[source]
__init__(domain: Domain, kappa: float, f: Callable | equinox.Module, mu: Callable | equinox.Module, R: Callable | equinox.Module, theta: Callable | equinox.Module, derivs: str = 'fd') None
class pde_opt.numerics.equations.allen_cahn.AllenCahn2DPeriodicButlerVolmer(domain: pde_opt.numerics.domains.Domain, kappa: float, mu: Callable | equinox.Module, j0: Callable | equinox.Module, alpha: float, derivs: str = 'fd')[source]
domain: Domain

Domain of the equation

kappa: float

Gradient energy coefficient

mu: Callable | equinox.Module

Function for the chemical potential

j0: Callable | equinox.Module

Function for the exchange current

alpha: float

Symmetry factor

derivs: str = 'fd'

Type of derivative computation

rhs(state, t)[source]

Right hand side of the equation.

rhs_fourier(state, t)[source]
rhs_fd(state, t, v)[source]
__init__(domain: Domain, kappa: float, mu: Callable | equinox.Module, j0: Callable | equinox.Module, alpha: float, derivs: str = 'fd') None
class pde_opt.numerics.equations.allen_cahn.AllenCahn2DPeriodicButlerVolmerConstantCurrent(domain: pde_opt.numerics.domains.Domain, kappa: float, mu: Callable | equinox.Module, j0: Callable | equinox.Module, alpha: float, Crate: float, derivs: str = 'fd')[source]
domain: Domain

Domain of the equation

kappa: float

Gradient energy coefficient

mu: Callable | equinox.Module

Function for the chemical potential

__init__(domain: Domain, kappa: float, mu: Callable | equinox.Module, j0: Callable | equinox.Module, alpha: float, Crate: float, derivs: str = 'fd') None
j0: Callable | equinox.Module

Function for the exchange current

alpha: float

Symmetry factor

Crate: float

Current

derivs: str = 'fd'

Type of derivative computation

rhs(state, t)[source]

Right hand side of the equation.

rhs_fourier(state, t)[source]
rhs_fd(state, t)[source]
get_voltage(state)[source]
class pde_opt.numerics.equations.allen_cahn.AllenCahn2DSmoothedBoundaryButlerVolmerConstantCurrent(domain: pde_opt.numerics.domains.Domain, kappa: float, f: Callable | equinox.Module, mu: Callable | equinox.Module, j0: Callable | equinox.Module, alpha: float, Crate: float, derivs: str = 'fd')[source]
__init__(domain: Domain, kappa: float, f: Callable | equinox.Module, mu: Callable | equinox.Module, j0: Callable | equinox.Module, alpha: float, Crate: float, derivs: str = 'fd') None
domain: Domain

Domain of the equation

kappa: float

Gradient energy coefficient

f: Callable | equinox.Module

Function for the free energy density

mu: Callable | equinox.Module

Function for the chemical potential

j0: Callable | equinox.Module

Function for the exchange current

alpha: float

Symmetry factor

Crate: float

Current

derivs: str = 'fd'

Type of derivative computation

rhs(state, t)[source]

Right hand side of the equation.

rhs_fd(state, t)[source]
get_voltage(state)[source]