API Reference

Contents

API Reference#

kinematics#

fenicsx_pulse.kinematics.DeformationGradient(u: Function) Expr[source]#

Return deformation gradient from displacement.

Parameters:
  • u (dolfinx.fem.Function) – The displacement field

  • isochoric (bool, optional) – If true return the isochoric deformation gradient, by default False

Returns:

The deformation gradient

Return type:

ufl.core.expr.Expr

Notes

Given a displacement field \(\mathbf{u}\), the deformation gradient is given by

\[\mathbf{F} = \mathbf{I} + \nabla \mathbf{u}\]
fenicsx_pulse.kinematics.EngineeringStrain(F: Expr) Expr[source]#

Engineering strain

\[\mathbf{\varepsilon} = \frac{1}{2}\left( \nabla u + (\nabla u)^T \right)\]
Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

Engineering strain

Return type:

ufl.core.expr.Expr

fenicsx_pulse.kinematics.GreenLagrangeStrain(F: Expr) Expr[source]#

Green-Lagrange strain tensor

\[\mathbf{E} = \frac{1}{2}\left( \mathbf{C} - \mathbf{I}\right)\]
Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

Green-Lagrange strain tensor

Return type:

ufl.core.expr.Expr

fenicsx_pulse.kinematics.InversePiolaTransform(A: Expr, F: Expr) Expr[source]#

Push-forward of a rank two-tensor from the reference to the current configuration

Parameters:
  • A (ufl.core.expr.Expr) – The tensor you want to push forward

  • F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The push-forward

Return type:

ufl.core.expr.Expr

Notes

A push-forward is a transformation of a rank-2 tensor from the reference configuration to the current configuration. A common example is the push-forward of the First Piola-Kirchhoff stress tensor to the current configuration which yields the Cauchy stress tensor, i.e

\[\sigma = \frac{1}{J} \mathbf{P} \mathbf{F}^T\]
fenicsx_pulse.kinematics.IsochoricDeformationGradient(F: Expr) Expr[source]#

Return the isochoric deformation gradient

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The isochoric deformation gradient

Return type:

ufl.core.expr.Expr

Notes

We can decompose the the deformation gradient multiplicatively into the volumetric (\(\mathbf{F}_{\mathrm{vol}}\)) and isochoric (\(\mathbf{F}_{\mathrm{iso}}\)) components

\[\mathbf{F} = \mathbf{F}_{\mathrm{iso}} \cdot \mathbf{F}_{\mathrm{vol}}\]

such that \(\mathrm{det}(\mathbf{F}_{\mathrm{iso}}) = 1\). In this case, we can work out that

\[\mathbf{F}_{\mathrm{vol}} = J^{1/3}\mathbf{I}\]

and consequently

\[\mathbf{F}_{\mathrm{vol}} = J^{-1/3}\mathbf{F}\]

with \(J = \mathrm{det}(\mathbf{F})\).

fenicsx_pulse.kinematics.Jacobian(F: Expr) Expr[source]#

Determinant of the deformation gradient

\[J = \mathrm{det}(\mathbf{F})\]
Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The jacobian

Return type:

ufl.core.expr.Expr

fenicsx_pulse.kinematics.LeftCauchyGreen(F: Expr) Expr[source]#

Left Cauchy-Green deformation tensor

\[\mathbf{C} = \mathbf{F}\mathbf{F}^T\]
Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

Left Cauchy-Green deformation tensor

Return type:

ufl.core.expr.Expr

fenicsx_pulse.kinematics.PiolaTransform(A, F: Expr) Expr[source]#

Pull-back of a two-tensor from the current to the reference configuration

Parameters:
  • A (ufl.core.expr.Expr) – The tensor you want to push forward

  • F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The pull-back

Return type:

ufl.core.expr.Expr

Notes

A pull-back is a transformation of a rank-2 tensor from the current configuration to the reference configuration. A common example is the pull-back of the Cauchy stress tensor to the reference configuration which yields the First Piola-Kirchhoff stress tensor, i.e

\[\mathbf{P} = J \sigma \mathbf{F}^{-T}\]
fenicsx_pulse.kinematics.RightCauchyGreen(F: Expr) Expr[source]#

Right Cauchy-Green deformation tensor

\[\mathbf{C} = \mathbf{F}^T\mathbf{F}\]
Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

Right Cauchy-Green deformation tensor

Return type:

ufl.core.expr.Expr

fenicsx_pulse.kinematics.SecondOrderIdentity(F: Expr) Expr[source]#

Return identity with same dimension as input

invariants#

This module defines invariants of the deformation gradient.

The deformation gradient \(\mathbf{F}\) is a tensor field that describes the deformation of a material. The invariants of the deformation gradient are scalar quantities that are invariant under rigid body motion.

The invariants are defined as follows:

  • First principal invariant

    \(I_1 = \text{tr}(\mathbf{C})\)

  • Second principal invariant

    \(I_2 = \left( I_1^2 - \text{tr}(\mathbf{C}\cdot\mathbf{C})\right)\)

  • Third principal invariant

    \(I_3 = \text{det}(\mathbf{C})\)

  • Fourth quasi invariant

    \(I_{4\mathbf{a_0}} = \mathbf{C}\mathbf{a}_0 \cdot \mathbf{a}_0\)

  • Fifth quasi invariant

    \(I_{5\mathbf{a_0}} = \mathbf{C}\mathbf{a}_0 \cdot \mathbf{C}\mathbf{a}_0\)

  • Eight quasi invariant

    \(I_{8\mathbf{a_0}\mathbf{b_0}} = \mathbf{F}\mathbf{a}_0 \cdot \mathbf{F}\mathbf{b}_0\)

where \(\mathbf{C} = \mathbf{F}^T\mathbf{F}\) is the right Cauchy-Green tensor.

fenicsx_pulse.invariants.I1(F: Expr) Expr[source]#

First principal invariant

\[I_1 = \mathrm{tr}(\mathbf{C})\]
Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

First principal invariant

Return type:

ufl.core.expr.Expr

fenicsx_pulse.invariants.I2(F: Expr) Expr[source]#

Second principal invariant

\[I_2 = \left( I_1^2 - \mathrm{tr}(\mathbf{C}\cdot\mathbf{C})\right)\]
Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

Second principal invariant

Return type:

ufl.core.expr.Expr

fenicsx_pulse.invariants.I3(F: Expr) Expr[source]#

Third principal invariant

\[I_3 = \mathrm{det}(\mathbf{C})\]
Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

Third principal invariant

Return type:

ufl.core.expr.Expr

fenicsx_pulse.invariants.I4(F: Expr, a0: Function | Constant) Expr[source]#

Fourth quasi invariant

\[I_{4\mathbf{a_0}} = \mathbf{C}\mathbf{a}_0 \cdot \mathbf{a}_0\]
Parameters:
  • F (ufl.core.expr.Expr) – The deformation gradient

  • a0 (FuncConst) – Some direction

Returns:

Fourth quasi invariant in the direction a0

Return type:

ufl.core.expr.Expr

fenicsx_pulse.invariants.I5(F: Expr, a0: Function | Constant) Expr[source]#

Fifth quasi invariant

\[I_{5\mathbf{a_0}} = \mathbf{C}\mathbf{a}_0 \cdot \mathbf{C}\mathbf{a}_0\]
Parameters:
  • F (ufl.core.expr.Expr) – The deformation gradient

  • a0 (FuncConst) – Some direction

Returns:

Fifth quasi invariant in the direction a0

Return type:

ufl.core.expr.Expr

fenicsx_pulse.invariants.I8(F: Expr, a0: Function | Constant, b0: Function | Constant) Expr[source]#

Eight quasi invariant

\[I_{8\mathbf{a_0}\mathbf{b_0}} = \mathbf{F}\mathbf{a}_0 \cdot \mathbf{F}\mathbf{b}_0\]
Parameters:
  • F (ufl.core.expr.Expr) – The deformation gradient

  • a0 (FuncConst) – Some direction

  • b0 (FuncConst) – Another direction

Returns:

Eight quasi invariant in the direction a0

Return type:

ufl.core.expr.Expr

material_model#

This module defines the material model interface and some common material models.

The material model describes the mechanical behavior of a material. The material model is used to compute the stress tensor given the deformation gradient.

The material model interface defines two methods:

  • sigma(F): The Cauchy stress tensor

  • P(F): The first Piola-Kirchhoff stress tensor

The sigma method computes the Cauchy stress tensor given the deformation gradient. The P method computes the first Piola-Kirchhoff stress tensor given the deformation gradient.

The HyperElasticMaterial class is a base class for hyperelastic material models. Hyperelastic materials are materials that have a strain energy density function that depends only on the deformation gradient. The strain_energy method computes the strain energy density function given the deformation gradient.

class fenicsx_pulse.material_model.HyperElasticMaterial[source]#
P(F: Expr) Expr[source]#

First Piola-Kirchhoff stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The first Piola-Kirchhoff stress tensor

Return type:

ufl.core.expr.Expr

Notes

For a hyperelastic material model with strain energy density function \(\Psi = \Psi(\mathbf{F})\), the first Piola-Kirchhoff stress tensor is given by

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}}\]
sigma(F: Expr) Expr[source]#

Cauchy stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The Cauchy stress tensor

Return type:

ufl.core.expr.Expr

abstract strain_energy(F: Expr) Expr[source]#

Strain energy density function

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The strain energy density

Return type:

ufl.core.expr.Expr

class fenicsx_pulse.material_model.Material[source]#
P(F: Expr) Expr[source]#

First Piola-Kirchhoff stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The first Piola-Kirchhoff stress tensor

Return type:

ufl.core.expr.Expr

abstract sigma(F: Expr) Expr[source]#

Cauchy stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The Cauchy stress tensor

Return type:

ufl.core.expr.Expr

class fenicsx_pulse.material_models.linear_elastic.LinearElastic(E: ~fenicsx_pulse.units.Variable = <factory>, nu: ~fenicsx_pulse.units.Variable = <factory>)[source]#

Linear elastic material

Parameters:
  • E (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Youngs module

  • nu (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Poisson’s ratio

P(F: Expr) Expr#

First Piola-Kirchhoff stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The first Piola-Kirchhoff stress tensor

Return type:

ufl.core.expr.Expr

sigma(F: Expr) Expr[source]#

Cauchy stress for linear elastic material

\[\sigma = \frac{E}{1 + \nu} \left( \varepsilon + \frac{\nu}{1 + \nu} \mathrm{tr}(\varepsilon) \mathbf{I} \right)\]
Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

_description_

Return type:

ufl.core.expr.Expr

class fenicsx_pulse.material_models.holzapfelogden.HolzapfelOgden(f0: ~dolfinx.fem.function.Function | ~dolfinx.fem.function.Constant | None = None, s0: ~dolfinx.fem.function.Function | ~dolfinx.fem.function.Constant | None = None, a: ~fenicsx_pulse.units.Variable = <factory>, b: ~fenicsx_pulse.units.Variable = <factory>, a_f: ~fenicsx_pulse.units.Variable = <factory>, b_f: ~fenicsx_pulse.units.Variable = <factory>, a_s: ~fenicsx_pulse.units.Variable = <factory>, b_s: ~fenicsx_pulse.units.Variable = <factory>, a_fs: ~fenicsx_pulse.units.Variable = <factory>, b_fs: ~fenicsx_pulse.units.Variable = <factory>, use_subplus: bool = True, use_heaviside: bool = True)[source]#

Orthotropic model by Holzapfel and Ogden

Parameters:
  • f0 (dolfinx.fem.Function | dolfinx.fem.Constant | None) – Function representing the direction of the fibers

  • s0 (dolfinx.fem.Function | dolfinx.fem.Constant | None) – Function representing the direction of the sheets

  • a (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 0.0

  • b (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 0.0

  • a_f (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 0.0

  • b_f (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 0.0

  • a_s (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 0.0

  • b_s (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 0.0

  • a_fs (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 0.0

  • b_fs (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 0.0

  • use_subplus (bool) – Use subplus function when computing anisotropic contribution, by default True

  • use_heaviside (bool) – Use heaviside function when computing anisotropic contribution, by default True

Notes

Original model from Holzapfel and Ogden [1]. The strain energy density function is given by

\[\Psi(I_1, I_{4\mathbf{f}_0}, I_{4\mathbf{s}_0}, I_{8\mathbf{f}_0\mathbf{s}_0}) = \frac{a}{2 b} \left( e^{ b (I_1 - 3)} -1 \right) + \frac{a_f}{2 b_f} \mathcal{H}(I_{4\mathbf{f}_0} - 1) \left( e^{ b_f (I_{4\mathbf{f}_0} - 1)_+^2} -1 \right) + \frac{a_s}{2 b_s} \mathcal{H}(I_{4\mathbf{s}_0} - 1) \left( e^{ b_s (I_{4\mathbf{s}_0} - 1)_+^2} -1 \right) + \frac{a_{fs}}{2 b_{fs}} \left( e^{ b_{fs} I_{8 \mathbf{f}_0 \mathbf{s}_0}^2} -1 \right)\]

where

\[(x)_+ = \max\{x,0\}\]

and

\[\begin{split}\mathcal{H}(x) = \begin{cases} 1, & \text{if $x > 0$} \\ 0, & \text{if $x \leq 0$} \end{cases}\end{split}\]

is the Heaviside function.

P(F: Expr) Expr#

First Piola-Kirchhoff stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The first Piola-Kirchhoff stress tensor

Return type:

ufl.core.expr.Expr

Notes

For a hyperelastic material model with strain energy density function \(\Psi = \Psi(\mathbf{F})\), the first Piola-Kirchhoff stress tensor is given by

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}}\]
static orthotropic_parameters() dict[str, Variable][source]#

Material parameters for the Holzapfel Ogden model Taken from Table 1 row 2 in the main paper

static partly_orthotropic_parameters() dict[str, Variable][source]#

Material parameters for the Holzapfel Ogden model Taken from Table 1 row 1 in the main paper

sigma(F: Expr) Expr#

Cauchy stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The Cauchy stress tensor

Return type:

ufl.core.expr.Expr

strain_energy(F: Expr) Expr[source]#

Strain energy density function

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The strain energy density

Return type:

ufl.core.expr.Expr

static transversely_isotropic_parameters() dict[str, Variable][source]#

Material parameters for the Holzapfel Ogden model Taken from Table 1 row 3 in the main paper

class fenicsx_pulse.material_models.guccione.Guccione(f0: ~dolfinx.fem.function.Function | ~dolfinx.fem.function.Constant | None = None, s0: ~dolfinx.fem.function.Function | ~dolfinx.fem.function.Constant | None = None, n0: ~dolfinx.fem.function.Function | ~dolfinx.fem.function.Constant | None = None, C: ~fenicsx_pulse.units.Variable = <factory>, bf: ~fenicsx_pulse.units.Variable = <factory>, bt: ~fenicsx_pulse.units.Variable = <factory>, bfs: ~fenicsx_pulse.units.Variable = <factory>)[source]#

Orthotropic model by Holzapfel and Ogden

Parameters:
  • f0 (dolfinx.fem.Function | dolfinx.fem.Constant | None) – Function representing the direction of the fibers

  • s0 (dolfinx.fem.Function | dolfinx.fem.Constant | None) – Function representing the direction of the sheets

  • n0 (dolfinx.fem.Function | dolfinx.fem.Constant | None) – Function representing the direction of the sheet normal

  • C (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 2.0

  • bf (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 8.0

  • bt (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 2.0

  • bfs (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Material parameter, by default 4.0

Notes

Original model from Guccione [2]. The strain energy density function is given by

\[\Psi = \frac{C}{2} \left( \mathrm{exp}^{Q} - 1 \right)\]

where

\[Q = b_f E_{11}^2 + b_t \left( E_{22}^2 + E_{33}^2 + E_{23}^2 + E_{32}^2 \right) + b_{fs} \left( E_{12}^2 + E_{21}^2 + E_{13}^2 + E_{31}^2 \right)\]
P(F: Expr) Expr#

First Piola-Kirchhoff stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The first Piola-Kirchhoff stress tensor

Return type:

ufl.core.expr.Expr

Notes

For a hyperelastic material model with strain energy density function \(\Psi = \Psi(\mathbf{F})\), the first Piola-Kirchhoff stress tensor is given by

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}}\]
is_isotropic() bool[source]#

Return True if the material is isotropic.

sigma(F: Expr) Expr#

Cauchy stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The Cauchy stress tensor

Return type:

ufl.core.expr.Expr

strain_energy(F: Expr) Expr[source]#

Strain energy density function

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The strain energy density

Return type:

ufl.core.expr.Expr

class fenicsx_pulse.material_models.saint_venant_kirchhoff.SaintVenantKirchhoff(mu: Variable, lmbda: Variable)[source]#

Class for Saint Venant-Kirchhoff material

Let

\[\epsilon = \frac{1}{2} ( \nabla u + \nabla u^T + \nabla u + \nabla u^T )\]

Then

Parameters:
  • mu (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Shear modulus

  • lmbda (float | dolfinx.fem.Function | dolfinx.fem.Constant) – Lame parameter

P(F: Expr) Expr#

First Piola-Kirchhoff stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The first Piola-Kirchhoff stress tensor

Return type:

ufl.core.expr.Expr

Notes

For a hyperelastic material model with strain energy density function \(\Psi = \Psi(\mathbf{F})\), the first Piola-Kirchhoff stress tensor is given by

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}}\]
sigma(F: Expr) Expr#

Cauchy stress tensor

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The Cauchy stress tensor

Return type:

ufl.core.expr.Expr

strain_energy(F: Expr) Expr[source]#

Strain energy density function

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The strain energy density

Return type:

ufl.core.expr.Expr

active_model#

This module defines the ActiveModel class which is an abstract class for active models. Active models are used to incorporate active stress or active strain in the material model.

The ActiveModel class defines two methods:

  • Fe(F): Transforming the deformation gradient to an active deformation gradient

  • strain_energy(F): Active strain energy density function

The Fe method transforms the deformation gradient to an active deformation gradient. For example in the active strain approach we perform a multiplicative decomposition of the deformation gradient into an elastic and an active part, i.e

\[\mathbf{F} = \mathbf{F}_e \mathbf{F}_a\]

In which case the active model can be incorporated by transforming the full deformation gradient into a pure elastic component.

The strain_energy method defines the active strain energy density function. For example in the active stress approach, the active stress is added as an extra stress component

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}} + \mathbf{P}_a\]

where \(\mathbf{P}_a\). Now we can instead rewrite this as a total strain energy by considering the following equation

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}} = \frac{\partial \Psi_p}{\partial \mathbf{F}} + \frac{\partial \Psi_a}{\partial \mathbf{F}}\]

where \(\Psi_p\) is the passive (classical) strain energy density function and \(\Psi_a\) is the corresponding active strain energy density function.

The Passive class is a simple active model with no active component. This model could for example be used if you want to use a pure passive model.

class fenicsx_pulse.active_model.ActiveModel[source]#
abstract Fe(F: Expr) Expr[source]#

Method to transforming the deformation gradient to an an active deformation gradient. For example in the active strain approach we perform a multiplicative decomposition of the deformation gradient into an elastic and an active part, i.e

\[\mathbf{F} = \mathbf{F}_e \mathbf{F}_a\]

In which case the active model can be incorporated by transforming the full deformation gradient into a pure elastic component

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The elastic deformation gradient

Return type:

ufl.core.expr.Expr

abstract strain_energy(F: Expr) Expr[source]#

Active strain energy function. For example in the active stress approach, the active stress is added as an extra stress component

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}} + \mathbf{P}_a\]

where \(\mathbf{P}_a\). Now we can instead rewrite this as a total strain energy by considering the following equation

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}} = \frac{\partial \Psi_p}{\partial \mathbf{F}} + \frac{\partial \Psi_a}{\partial \mathbf{F}}\]

where \(\Psi_p\) is the passive (classical) strain energy density function and \(\Psi_a\) is the corresponding active strain energy density function.

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The active strain energy density function

Return type:

ufl.core.expr.Expr

class fenicsx_pulse.active_model.Passive[source]#

Active model with no active component. This model could for example be used if you want to use a pure passive model.

Fe(F: Expr) Expr[source]#

Method to transforming the deformation gradient to an an active deformation gradient. For example in the active strain approach we perform a multiplicative decomposition of the deformation gradient into an elastic and an active part, i.e

\[\mathbf{F} = \mathbf{F}_e \mathbf{F}_a\]

In which case the active model can be incorporated by transforming the full deformation gradient into a pure elastic component

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The elastic deformation gradient

Return type:

ufl.core.expr.Expr

strain_energy(F: Expr) Expr[source]#

Active strain energy function. For example in the active stress approach, the active stress is added as an extra stress component

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}} + \mathbf{P}_a\]

where \(\mathbf{P}_a\). Now we can instead rewrite this as a total strain energy by considering the following equation

\[\mathbf{P} = \frac{\partial \Psi}{\partial \mathbf{F}} = \frac{\partial \Psi_p}{\partial \mathbf{F}} + \frac{\partial \Psi_a}{\partial \mathbf{F}}\]

where \(\Psi_p\) is the passive (classical) strain energy density function and \(\Psi_a\) is the corresponding active strain energy density function.

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The active strain energy density function

Return type:

ufl.core.expr.Expr

This module contains the active stress model for the cardiac mechanics problem. The active stress model is used to describe the active contraction of the heart. The active stress model is used to compute the active stress given the deformation gradient.

class fenicsx_pulse.active_stress.ActiveStress(f0: ~dolfinx.fem.function.Function | ~dolfinx.fem.function.Constant, activation: ~fenicsx_pulse.units.Variable = <factory>, s0: ~dolfinx.fem.function.Function | ~dolfinx.fem.function.Constant | None = None, n0: ~dolfinx.fem.function.Function | ~dolfinx.fem.function.Constant | None = None, T_ref: ~dolfinx.fem.function.Constant = np.float64(1.0), eta: ~dolfinx.fem.function.Constant = np.float64(0.0), isotropy: ~fenicsx_pulse.active_stress.ActiveStressModels = ActiveStressModels.transversely)[source]#

Active stress model

f0: dolfinx.fem.Function | dolfinx.fem.Constant

The cardiac fiber direction

activation: dolfinx.fem.Function | dolfinx.fem.Constant | None

A function or constant representing the activation. If not provided a constant will be created.

s0: dolfinx.fem.Function | dolfinx.fem.Constant | None

The sheets orientation. Only needed for orthotropic active stress models

n0: dolfinx.fem.Function | dolfinx.fem.Constant | None

The sheet-normal orientation. Only needed for orthotropic active stress models

T_ref: float = 1.0

Reference active stress, by default 1.0

eta: float = 0.0

Amount of transverse active stress, by default 0.0. A value of zero means that all active stress is along the fiber direction. If the value is 1.0 then all active stress will be in the transverse direction.

isotropy: ActiveStressModels

What kind of active stress model to use, by default ‘transversely’

Fe(F: Expr) Expr[source]#

Method to transforming the deformation gradient to an an active deformation gradient. For example in the active strain approach we perform a multiplicative decomposition of the deformation gradient into an elastic and an active part, i.e

\[\mathbf{F} = \mathbf{F}_e \mathbf{F}_a\]

In which case the active model can be incorporated by transforming the full deformation gradient into a pure elastic component

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The elastic deformation gradient

Return type:

ufl.core.expr.Expr

property Ta: Expr#

The active stress

strain_energy(F: Expr) Expr[source]#

Active strain energy density

Parameters:

F (ufl.core.expr.Expr) – The deformation gradient

Returns:

The active strain energy density

Return type:

ufl.core.expr.Expr

Raises:

NotImplementedError – _description_

class fenicsx_pulse.active_stress.ActiveStressModels(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
capitalize()#

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()#

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)#

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int#

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')#

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool#

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)#

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str#

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str#

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()#

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()#

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()#

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()#

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()#

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()#

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()#

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()#

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()#

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()#

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()#

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()#

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)#

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()#

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)#

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()#

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)#

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)#

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)#

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)#

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)#

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)#

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool#

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)#

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()#

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()#

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)#

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()#

Return a copy of the string converted to uppercase.

zfill(width, /)#

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

fenicsx_pulse.active_stress.transversely_active_stress(Ta, C, f0, eta=0.0)[source]#

Return active strain energy when activation is only working along the fibers, with a possible transverse component defined by \(\eta\) with \(\eta = 0\) meaning that all active stress is along the fiber and \(\eta = 1\) meaning that all active stress is in the transverse direction. The active strain energy is given by

\[W = \frac{1}{2} T_a \left( I_{4f} - 1 + \eta ((I_1 - 3) - (I_{4f} - 1)) \right)\]
Parameters:
  • Ta (dolfinx.fem.Function or dolfinx.femConstant) – A scalar function representing the magnitude of the active stress in the reference configuration (first Piola)

  • C (ufl.Form) – The right Cauchy-Green deformation tensor

  • f0 (dolfinx.fem.Function) – A vector function representing the direction of the active stress

  • eta (float) – Amount of active stress in the transverse direction (relative to f0)

compressibility#

This module defines compressibility models for the material models. We define two compressibility models: Incompressible and Compressible.

An incompressible material is a material that does not change its volume under deformation. The volume change is described by the Jacobian \(J = \det(F)\), where \(F\) is the deformation gradient.

The Incompressible model is defined by the strain energy density function \(\Psi = p (J - 1)\), where \(p\) is a function representing the Lagrange multiplier. The Compressible model is defined by the strain energy density function \(\Psi = \kappa (J \ln(J) - J + 1)\), where \(\kappa\) is a material parameter representing the bulk modulus. Higher values of \(\kappa\) correspond to more incompressible material.

class fenicsx_pulse.compressibility.Compressibility[source]#

Base class for compressibility models.

abstract is_compressible() bool[source]#

Returns True if the material model is compressible.

register(*args, **kwargs) None[source]#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

abstract strain_energy(J: Expr) Expr[source]#

Strain energy density function

class fenicsx_pulse.compressibility.Compressible(kappa: ~fenicsx_pulse.units.Variable = <factory>)[source]#

Compressible material model

Strain energy density function is given by

\[\Psi = \kappa (J \ln(J) - J + 1)\]
is_compressible() bool[source]#

Returns True if the material model is compressible.

register(*args, **kwargs) None#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

strain_energy(J: Expr) Expr[source]#

Strain energy density function

class fenicsx_pulse.compressibility.Compressible2(kappa: ~fenicsx_pulse.units.Variable = <factory>)[source]#

Compressible material model

Strain energy density function is given by

\[\Psi = \kappa (J^2 - 1 - 2 \ln(J))\]
is_compressible() bool#

Returns True if the material model is compressible.

register(*args, **kwargs) None#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

strain_energy(J: Expr) Expr[source]#

Strain energy density function

class fenicsx_pulse.compressibility.Incompressible[source]#

Incompressible material model

Strain energy density function is given by

\[\Psi = p (J - 1)\]
is_compressible() bool[source]#

Returns True if the material model is compressible.

register(p: Function) None[source]#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

strain_energy(J: Expr) Expr[source]#

Strain energy density function

viscoelasticity#

class fenicsx_pulse.viscoelasticity.NoneViscoElasticity[source]#
strain_energy(E_dot) Form[source]#

Strain energy density function.

Parameters:

E_dot (ufl.Coefficient) – The strain rate tensor

Returns:

The strain energy density function

Return type:

ufl.Form

class fenicsx_pulse.viscoelasticity.ViscoElasticity[source]#
abstract strain_energy(E_dot) Form[source]#

Strain energy density function.

Parameters:

E_dot (ufl.Coefficient) – The strain rate tensor

Returns:

The strain energy density function

Return type:

ufl.Form

class fenicsx_pulse.viscoelasticity.Viscous(eta: fenicsx_pulse.units.Variable = <factory>)[source]#
strain_energy(E_dot) Form[source]#

Strain energy density function.

Parameters:

E_dot (ufl.Coefficient) – The strain rate tensor

Returns:

The strain energy density function

Return type:

ufl.Form

cardiac_model#

This module defines the cardiac model.

The cardiac model is a combination of a material model, an active model, and a compressibility model.

class fenicsx_pulse.cardiac_model.ActiveModel(*args, **kwargs)[source]#
class fenicsx_pulse.cardiac_model.CardiacModel(material: fenicsx_pulse.cardiac_model.HyperElasticMaterial, active: fenicsx_pulse.cardiac_model.ActiveModel, compressibility: fenicsx_pulse.cardiac_model.Compressibility, viscoelasticity: fenicsx_pulse.cardiac_model.ViscoElasticity = <factory>, decouple_deviatoric_volumetric: bool = False)[source]#
class fenicsx_pulse.cardiac_model.Compressibility(*args, **kwargs)[source]#
register(p: Function | None) None[source]#

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

class fenicsx_pulse.cardiac_model.HyperElasticMaterial(*args, **kwargs)[source]#
class fenicsx_pulse.cardiac_model.ViscoElasticity(*args, **kwargs)[source]#

geometry#

class fenicsx_pulse.geometry.BaseData(centroid, vector, normal)[source]#
centroid: ndarray[Any, dtype[float64]]#

Alias for field number 0

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

normal: ndarray[Any, dtype[float64]]#

Alias for field number 2

vector: ndarray[Any, dtype[float64]]#

Alias for field number 1

class fenicsx_pulse.geometry.CardiacGeometriesObject(*args, **kwargs)[source]#
class fenicsx_pulse.geometry.Geometry(*, mesh: dolfinx.mesh.Mesh, boundaries: Sequence[fenicsx_pulse.geometry.Marker] = (), metadata: dict[str, typing.Any] = <factory>, facet_tags: dolfinx.mesh.MeshTags = <factory>, markers: dict[str, tuple[int, int]] = <factory>)[source]#
class fenicsx_pulse.geometry.HeartGeometry(*, mesh: dolfinx.mesh.Mesh, boundaries: Sequence[fenicsx_pulse.geometry.Marker] = (), metadata: dict[str, typing.Any] = <factory>, facet_tags: dolfinx.mesh.MeshTags = <factory>, markers: dict[str, tuple[int, int]] = <factory>)[source]#
base_center(base: str = 'BASE', u: ~dolfinx.fem.function.Function | None = None, dtype=<class 'numpy.float64'>) ndarray[Any, dtype[float64]][source]#

Return the normal of the base

Parameters:
  • base (str, optional) – Marker for the base, by default “BASE”

  • u (dolfinx.fem.Function | None, optional) – Displacement field, by default None

Returns:

Normal of the base

Return type:

npt.NDArray[np.float64]

base_center_form(base: str = 'BASE', u: Function | None = None) list[Form][source]#

Return the normal of the base

Parameters:
  • base (str, optional) – Marker for the base, by default “BASE”

  • u (dolfinx.fem.Function | None, optional) – Displacement field, by default None

Returns:

Normal of the base

Return type:

npt.NDArray[np.float64]

volume(marker: str, u: Function | None = None) float[source]#

Return the volume of the cavity for a given marker

Parameters:
  • marker (str) – Marker for the surface of the cavity

  • u (dolfinx.fem.Function | None, optional) – Optional displacement field, by default None

Returns:

Volume of the cavity

Return type:

float

Raises:

exceptions.MarkerNotFoundError – If the marker is not found in the geometry

volume_form(u: Function | None = None) Form[source]#

Return the form for the volume of the cavity for a given marker

Parameters:

u (dolfinx.fem.Function | None, optional) – Optional displacement field, by default None

Returns:

The form for the volume of the cavity

Return type:

dolfinx.fem.forms.Form

Raises:

exceptions.MarkerNotFoundError – If the marker is not found in the geometry

class fenicsx_pulse.geometry.Marker(name, marker, dim, locator)[source]#
count(value, /)#

Return number of occurrences of value.

dim: int#

Alias for field number 2

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

locator: Callable[[ndarray[Any, dtype[float64]]], bool]#

Alias for field number 3

marker: int#

Alias for field number 1

name: str#

Alias for field number 0

fenicsx_pulse.geometry.compute_base_data(mesh: Mesh, facet_tags: MeshTags, marker) BaseData[source]#

Compute the centroid, vector and normal of the base

Parameters:
  • mesh (dolfinx.mesh.Mesh) – The mesh

  • facet_tags (dolfinx.mesh.MeshTags) – The facet tags

  • marker (_type_) – Marker for the base

Returns:

NamedTuple containing the centroid, vector and normal of the base

Return type:

BaseData

problem#

class fenicsx_pulse.problem.BaseBC(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Base boundary condition

capitalize()#

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()#

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)#

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int#

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')#

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool#

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)#

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str#

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str#

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()#

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()#

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()#

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()#

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()#

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()#

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()#

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()#

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()#

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()#

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()#

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()#

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)#

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()#

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)#

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()#

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)#

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)#

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)#

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)#

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)#

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)#

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool#

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)#

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()#

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()#

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)#

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()#

Return a copy of the string converted to uppercase.

zfill(width, /)#

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class fenicsx_pulse.problem.Cavity(marker, volume)[source]#
count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

marker: str#

Alias for field number 0

volume: Constant#

Alias for field number 1

class fenicsx_pulse.problem.DynamicProblem(model: ~fenicsx_pulse.cardiac_model.CardiacModel, geometry: ~fenicsx_pulse.problem.Geometry, parameters: dict[str, ~typing.Any] = <factory>, bcs: ~fenicsx_pulse.boundary_conditions.BoundaryConditions = <factory>, cavities: list[~fenicsx_pulse.problem.Cavity] = <factory>)[source]#
a(u: T, u_old: T, v_old: T, a_old: T) T[source]#

Acceleration computed using the generalized \(alpha\)-method

\[a_{i+1} = \frac{u_{i+1} - (u_i + \Delta t v_i + (0.5 - \beta) \Delta t^2 a_i)}{\beta \Delta t^2}\]
Parameters:
  • u (T) – Current displacement

  • u_old (T) – Previous displacement

  • v_old (T) – Previous velocity

  • a_old (T) – Previous acceleration

Returns:

The current acceleration

Return type:

T

solve() bool#

Solve the system

update_fields() None[source]#

Update old values of displacement, velocity and acceleration

v(a: T, v_old: T, a_old: T) T[source]#

Velocity computed using the generalized \(alpha\)-method

\[v_{i+1} = v_i + (1-\gamma) \Delta t a_i + \gamma \Delta t a_{i+1}\]
Parameters:
  • a (T) – Current acceleration

  • v_old (T) – Previous velocity

  • a_old (T) – Previous acceleration

Returns:

The current velocity

Return type:

T

class fenicsx_pulse.problem.Geometry(*args, **kwargs)[source]#

Protocol for geometry objects used in mechanics problems.

class fenicsx_pulse.problem.StaticProblem(model: fenicsx_pulse.cardiac_model.CardiacModel, geometry: fenicsx_pulse.problem.Geometry, parameters: dict[str, typing.Any] = <factory>, bcs: fenicsx_pulse.boundary_conditions.BoundaryConditions = <factory>, cavities: list[fenicsx_pulse.problem.Cavity] = <factory>)[source]#
solve() bool[source]#

Solve the system

fenicsx_pulse.problem.interpolate(x0: T, x1: T, alpha: float)[source]#

Interpolate between \(x_0\) and \(x_1\) to find math:`x_{1-alpha}

Parameters:
  • x0 (T) – First point

  • x1 (T) – Second point

  • alpha (float) – Amount of interpolate

Returns:

math:`x_{1-alpha}

Return type:

T

boundary conditions#

This module defines boundary conditions.

Boundary conditions are used to specify the behavior of the solution on the boundary of the domain. The boundary conditions can be Dirichlet, Neumann, or Robin boundary conditions.

Dirichlet boundary conditions are used to specify the solution on the boundary of the domain. Neumann boundary conditions are used to specify the traction on the boundary of the domain. Robin boundary conditions are used to specify a Robin type boundary condition on the boundary of the domain.

The boundary conditions are collected in a BoundaryConditions object.

class fenicsx_pulse.boundary_conditions.BoundaryConditions(neumann, dirichlet, robin, body_force)[source]#
body_force: Sequence[float | Constant | Function]#

Alias for field number 3

count(value, /)#

Return number of occurrences of value.

dirichlet: Sequence[Callable[[FunctionSpace], Sequence[DirichletBC]]]#

Alias for field number 1

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

neumann: Sequence[NeumannBC]#

Alias for field number 0

robin: Sequence[RobinBC]#

Alias for field number 2

class fenicsx_pulse.boundary_conditions.NeumannBC(traction: fenicsx_pulse.units.Variable, marker: int)[source]#
class fenicsx_pulse.boundary_conditions.RobinBC(value: fenicsx_pulse.units.Variable, marker: int, damping: bool = False)[source]#

units#

class fenicsx_pulse.units.Variable(value: T, unit: pint.registry.Unit | str | None)[source]#

utils#

fenicsx_pulse.utils.evaluate_at_vertex_tag(u: Function, vt: MeshTags, tag: int) ndarray[Any, dtype[int32]][source]#

Given a function u and a vertex tag vt return the values of u at the vertices tagged with tag

Parameters:
  • u (dolfinx.fem.Function) – The function to evaluate

  • vt (dolfinx.mesh.MeshTags) – The vertex tags

  • tag (int) – The tag to evaluate at

Returns:

The values of u at the vertices tagged with tag

Return type:

npt.NDArray[np.int32]

fenicsx_pulse.utils.gather_broadcast_array(comm, local_array)[source]#

Collects local arrays from all processes on the root process and distributes the global array to all processes. Assumes that the local arrays are either the same of empty / None on all processes.

Parameters:
  • comm (MPI.Comm) – The MPI communicator

  • local_array (np.ndarray) – The local array

Returns:

The global array on the root process

Return type:

np.ndarray

fenicsx_pulse.utils.unroll_dofmap(dofs: ndarray[Any, dtype[int32]], bs: int) ndarray[Any, dtype[int32]][source]#

Given a two-dimensional dofmap of size (num_cells, num_dofs_per_cell) Expand the dofmap by its block size such that the resulting array is of size (num_cells, bs*num_dofs_per_cell)

fenicsx_pulse.utils.vertex_to_dofmap(V: FunctionSpace) ndarray[Any, dtype[int32]][source]#

Compute a mapping from vertices to dofs in a function space

Parameters:

V (dolfinx.fem.FunctionSpace) – The function space

Returns:

The mapping from vertices to dofs

Return type:

npt.NDArray[np.int32]