fenics_model

FenicsModel.

Classes

FenicsModel(*, input_array, pars)

Model using the FEniCS FE library.

FiniteElementObjects(pars)

Class of FEniCS finite element objects.

class nopec.models.fenics_model.FenicsModel(*, input_array, pars)

Model using the FEniCS FE library.

Parameters:
property FE: FiniteElementObjects

Finite element objects.

This property is cached, so that it is not evaluated every time it is called.

input_array: ndarray

Input array. This should be the input function evaluated at each time step.

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

pars: ModelParameters

Model parameters.

state(mu)

Evaluate state variables \(y\) and \(q\).

The state variables are returned in the following \(N \times (K-1)\) matrices:

\[\mathrm{Y} = \left[ \begin{array}{c|c|c} \mathrm{y}^1 & \dots & \mathrm{y}^K \end{array} \right],\]

where \(N\) is the number of spacial degrees of freedom of the FE, \(K\) is the number of time steps, and the array \(\mathrm{y}^k\) is the coordinate array (in the FE basis) of \(y^k\), the approximate solution time \(t_k\).

The approximate solution at \(t_0 = 0\) is not stored.

For the state \(q\) we similarly have

\[\mathrm{Q} = \left[ \begin{array}{c|c|c} \mathrm{q}^1 & \dots & \mathrm{q}^K \end{array} \right].\]
class nopec.models.fenics_model.FiniteElementObjects(pars)

Class of FEniCS finite element objects.

Parameters:

pars (ModelParameters)

Omega: dolfinx.mesh.Mesh

Domain mesh.

V: dolfinx.fem.function.FunctionSpace

Function space of state variable \((y(t),q(t))\).

Vq: dolfinx.fem.function.FunctionSpace

Function space of state variable \(q(t)\)

Vq_to_V_sub_1: ndarray

Array of indices corresponding to space Vq.

Vy: dolfinx.fem.function.FunctionSpace

Function space of state variable \(y(t)\)

Vy_to_V_sub_0: ndarray

Array of indices corresponding to space Vy.

bcs: list[dolfinx.fem.bcs.DirichletBC]

List of Dirichlet boundary conditions.

k1: dolfinx.fem.function.Function

Density function \(\kappa_1\) interpolated on the space Vy.

k2: dolfinx.fem.function.Function

Density function \(\kappa_2\) interpolated on the space Vq.

state_0_array: ndarray

Vector of \((y(0), q(0))\). The coordinates corresponding to the space Vq are not evaluated exactly because the variable \(q(0)\) requires solving a nonlinear problem using \(y(0)\) and the control parameter \(\mu\).

y0_array: ndarray

Vector of \(y_\circ\) in the basis of Vy.