evoxels.problem_definition

Classes

CahnHilliard(vg[, eps, D, mu_hom, A, bc])

CoupledReactionDiffusion(vg[, D_A, D_B, ...])

MultiPhaseAllenCahn(vg[, eps, gab, M, ...])

ODE()

ReactionDiffusion(vg, D[, f, A, bc])

ReactionDiffusionSBM(vg, D[, f, A, bc, ...])

SemiLinearODE()

SmoothedBoundaryODE()

TwoPhaseAllenCahn(vg[, eps, gab, M, force, ...])

class evoxels.problem_definition.CahnHilliard(vg: evoxels.voxelgrid.VoxelGrid, eps: float = 3.0, D: float = 1.0, mu_hom: Callable | None = None, A: float = 0.25, bc: tuple = ('periodic', 'periodic', 'periodic'))
A: float = 0.25
D: float = 1.0
__init__(vg: VoxelGrid, eps: float = 3.0, D: float = 1.0, mu_hom: Callable | None = None, A: float = 0.25, bc: tuple = ('periodic', 'periodic', 'periodic')) None
bc: tuple = ('periodic', 'periodic', 'periodic')
eps: float = 3.0
property fourier_symbol

Symbol of the highest order spatial operator

The symbol of an operator is its representation in the Fourier (spectral) domain. For instance the: - Laplacian operator $

abla^2$ has a symbol $-k^2$,
  • diffusion operator $D

abla^2$ corresponds to $-k^2D$

The symbol is required for pseudo-spectral timesteppers.

mu_hom: Callable | None = None
property order

Spatial order of convergence for numerical right-hand side.

rhs(t, c)

Evaluate \(\partial c / \partial t\) for the CH equation.

Numerical computation of

\[\frac{\partial c}{\partial t} = \nabla \cdot \bigl( M \, \nabla \mu \bigr), \quad \mu = \frac{\delta F}{\delta c} = f'(c) - \kappa \, \nabla^2 c\]

where \(M\) is the (possibly concentration-dependent) mobility, \(\mu\) the chemical potential, and \(\kappa\) the gradient energy coefficient.

Parameters:
  • t (float) – Current time.

  • c (array-like) – Concentration field.

Returns:

Backend array of the same shape as c containing dc/dt.

rhs_analytic(t, c)

Sympy expression of the problem right-hand side.

Parameters:
  • t (float) – Current time.

  • u – Sympy function of current state.

Returns:

Sympy function of problem right-hand side.

vg: VoxelGrid
class evoxels.problem_definition.CoupledReactionDiffusion(vg: evoxels.voxelgrid.VoxelGrid, D_A: float = 1.0, D_B: float = 0.5, feed: float = 0.055, kill: float = 0.117, interaction: Callable | None = None)
D_A: float = 1.0
D_B: float = 0.5
__init__(vg: VoxelGrid, D_A: float = 1.0, D_B: float = 0.5, feed: float = 0.055, kill: float = 0.117, interaction: Callable | None = None) None
feed: float = 0.055
property fourier_symbol

Symbol of the highest order spatial operator

The symbol of an operator is its representation in the Fourier (spectral) domain. For instance the: - Laplacian operator $

abla^2$ has a symbol $-k^2$,
  • diffusion operator $D

abla^2$ corresponds to $-k^2D$

The symbol is required for pseudo-spectral timesteppers.

interaction: Callable | None = None
kill: float = 0.117
property order

Spatial order of convergence for numerical right-hand side.

rhs(t, u)

Two-component reaction-diffusion system

Use batch channels for multiple species: - Species A with concentration c_A = u[0] - Species B with concentration c_B = u[1]

Parameters:
  • t (float) – Current time.

  • u (array-like) – species

Returns:

Backend array of the same shape as u containing du/dt.

rhs_analytic(t, u)

Sympy expression of the problem right-hand side.

Parameters:
  • t (float) – Current time.

  • u – Sympy function of current state.

Returns:

Sympy function of problem right-hand side.

vg: VoxelGrid
class evoxels.problem_definition.MultiPhaseAllenCahn(vg: evoxels.voxelgrid.VoxelGrid, eps: float = 3.0, gab: float = 1.0, M: float = 1.0, force: float = 0.0, curvature: float = 1.0, potential: str = 'well', fast: bool = True, bc: tuple = ('periodic', 'periodic', 'periodic'))
M: float = 1.0
__init__(vg: VoxelGrid, eps: float = 3.0, gab: float = 1.0, M: float = 1.0, force: float = 0.0, curvature: float = 1.0, potential: str = 'well', fast: bool = True, bc: tuple = ('periodic', 'periodic', 'periodic')) None
bc: tuple = ('periodic', 'periodic', 'periodic')
curvature: float = 1.0
eps: float = 3.0
fast: bool = True
force: float = 0.0
property fourier_symbol

Symbol of the highest order spatial operator

The symbol of an operator is its representation in the Fourier (spectral) domain. For instance the: - Laplacian operator $

abla^2$ has a symbol $-k^2$,
  • diffusion operator $D

abla^2$ corresponds to $-k^2D$

The symbol is required for pseudo-spectral timesteppers.

gab: float = 1.0
property order

Spatial order of convergence for numerical right-hand side.

potential: str = 'well'
rhs(t, phis)

Multi-phase Allen-Cahn equation

Microstructural evolution of the phase fractions \(\phi_\alpha\), \(\alpha=1,\ldots,N\), governed by the multiphase-field model. \(M\) denotes the mobility which is the same for all phase-pairs, \(\epsilon\) controls the diffuse interface width, \(\gamma\) denotes the interfacial energy. The laplacian leads to a phase evolution driven by curvature minimization which can be controlled by setting curvature= in range \([0,1]\).

Parameters:
  • t (float) – Current time.

  • phis (array-like) – phase fractions.

Returns:

Backend array of the same shape as \phi containing d\phi/dt.

rhs_analytic(t, phis)

Sympy expression of the problem right-hand side.

Parameters:
  • t (float) – Current time.

  • u – Sympy function of current state.

Returns:

Sympy function of problem right-hand side.

vg: VoxelGrid
class evoxels.problem_definition.ODE
property bc_type

Boundary-condition metadata for the current problem.

initialize_boundary_conditions()
abstract property order: int

Spatial order of convergence for numerical right-hand side.

pad_bc(u)

Function to pad and impose boundary conditions.

Enables applying boundary conditions on u within and outside of the right-hand-side function.

Parameters:

u – field

Returns:

Field padded with boundary values.

abstractmethod rhs(t, u)

Numerical right-hand side of the ODE system.

Parameters:
  • t (float) – Current time.

  • u (array) – Current state.

Returns:

Same type as u containing the time derivative.

abstractmethod rhs_analytic(t, u)

Sympy expression of the problem right-hand side.

Parameters:
  • t (float) – Current time.

  • u – Sympy function of current state.

Returns:

Sympy function of problem right-hand side.

class evoxels.problem_definition.ReactionDiffusion(vg: evoxels.voxelgrid.VoxelGrid, D: float, f: Callable | None = None, A: float = 0.25, bc: tuple = ('periodic', 'periodic', 'periodic'))
A: float = 0.25
D: float
__init__(vg: VoxelGrid, D: float, f: Callable | None = None, A: float = 0.25, bc: tuple = ('periodic', 'periodic', 'periodic')) None
bc: tuple = ('periodic', 'periodic', 'periodic')
f: Callable | None = None
property fourier_symbol

Symbol of the highest order spatial operator

The symbol of an operator is its representation in the Fourier (spectral) domain. For instance the: - Laplacian operator $

abla^2$ has a symbol $-k^2$,
  • diffusion operator $D

abla^2$ corresponds to $-k^2D$

The symbol is required for pseudo-spectral timesteppers.

property order

Spatial order of convergence for numerical right-hand side.

rhs(t, u)

Numerical right-hand side of the ODE system.

Parameters:
  • t (float) – Current time.

  • u (array) – Current state.

Returns:

Same type as u containing the time derivative.

rhs_analytic(t, u)

Sympy expression of the problem right-hand side.

Parameters:
  • t (float) – Current time.

  • u – Sympy function of current state.

Returns:

Sympy function of problem right-hand side.

vg: VoxelGrid
class evoxels.problem_definition.ReactionDiffusionSBM(vg: evoxels.voxelgrid.VoxelGrid, D: float, f: Callable | None = None, A: float = 0.25, bc: tuple = ('periodic', 'periodic', 'periodic'), mask: Any | None = None, bc_flux: Callable | float = 0.0)
__init__(vg: VoxelGrid, D: float, f: Callable | None = None, A: float = 0.25, bc: tuple = ('periodic', 'periodic', 'periodic'), mask: Any | None = None, bc_flux: Callable | float = 0.0) None
bc_flux: Callable | float = 0.0
mask: Any | None = None
rhs(t, u)

Numerical right-hand side of the ODE system.

Parameters:
  • t (float) – Current time.

  • u (array) – Current state.

Returns:

Same type as u containing the time derivative.

rhs_analytic(t, u, mask)

Sympy expression of the problem right-hand side.

Parameters:
  • t (float) – Current time.

  • u – Sympy function of current state.

Returns:

Sympy function of problem right-hand side.

class evoxels.problem_definition.SemiLinearODE
abstract property fourier_symbol

Symbol of the highest order spatial operator

The symbol of an operator is its representation in the Fourier (spectral) domain. For instance the: - Laplacian operator $

abla^2$ has a symbol $-k^2$,
  • diffusion operator $D

abla^2$ corresponds to $-k^2D$

The symbol is required for pseudo-spectral timesteppers.

k_squared()

Helper to choose k^2 for fourier symbol based on BCs.

pad_fft_bc(u)
verify_fft_bc_config()
class evoxels.problem_definition.SmoothedBoundaryODE
abstract property mask: Any | float

A field (same shape as the state) that remains fixed.

class evoxels.problem_definition.TwoPhaseAllenCahn(vg: evoxels.voxelgrid.VoxelGrid, eps: float = 2.0, gab: float = 1.0, M: float = 1.0, force: float = 0.0, curvature: float = 0.01, potential: Callable | None = None, bc: tuple = ('neumann', 'neumann', 'neumann'))
M: float = 1.0
__init__(vg: VoxelGrid, eps: float = 2.0, gab: float = 1.0, M: float = 1.0, force: float = 0.0, curvature: float = 0.01, potential: Callable | None = None, bc: tuple = ('neumann', 'neumann', 'neumann')) None
bc: tuple = ('neumann', 'neumann', 'neumann')
curvature: float = 0.01
eps: float = 2.0
force: float = 0.0
property fourier_symbol

Symbol of the highest order spatial operator

The symbol of an operator is its representation in the Fourier (spectral) domain. For instance the: - Laplacian operator $

abla^2$ has a symbol $-k^2$,
  • diffusion operator $D

abla^2$ corresponds to $-k^2D$

The symbol is required for pseudo-spectral timesteppers.

gab: float = 1.0
property order

Spatial order of convergence for numerical right-hand side.

potential: Callable | None = None
rhs(t, phi)

Two-phase Allen-Cahn equation

Microstructural evolution of the order parameter \phi which can be interpreted as a phase fraction. \(M\) denotes the mobility, \(\epsilon\) controls the diffuse interface width, \(\gamma\) denotes the interfacial energy. The laplacian leads to a phase evolution driven by curvature minimization which can be controlled by setting curvature= in range \([0,1]\).

Parameters:
  • t (float) – Current time.

  • phi (array-like) – order parameter.

Returns:

Backend array of the same shape as \phi containing d\phi/dt.

rhs_analytic(t, phi)

Sympy expression of the problem right-hand side.

Parameters:
  • t (float) – Current time.

  • u – Sympy function of current state.

Returns:

Sympy function of problem right-hand side.

vg: VoxelGrid