Skip to content
Merged
11 changes: 11 additions & 0 deletions .cspell_dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Barnafi
Bartolucci
basix
bcast
bddc
behaviour
bestel
Bestel
Expand Down Expand Up @@ -78,16 +79,20 @@ Jilberto
Karabelas
Kasra
Kluwer
kwonlyargs
Laszlo
LDRB
levelname
libgl
libxrender
linalg
linesearch
linspace
lmbda
Luca
MATIS
Matteo
maxstep
mechanicsproblem
ment
meshtags
Expand All @@ -101,8 +106,11 @@ nabla
ndarray
neohookean
Neumann
newtonls
newtontr
Niederer
Nolte
nullspace
numpy
Oreste
Orovio
Expand Down Expand Up @@ -130,6 +138,7 @@ SELLIER
Severi
Shrier
Silvano
snes
Sorine
Stefano
stica
Expand All @@ -139,11 +148,13 @@ tomek
Tomek
TRAME
transmural
unassembled
ureg
Usyk
varepsilon
Venant
Verlag
vinewtonrsls
Virag
viscoelastic
viscoelasticity
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test_package_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
fail-fast: false
matrix:
container: [
"ghcr.io/fenics/dolfinx/dolfinx:v0.9.0",
"ghcr.io/fenics/dolfinx/dolfinx:stable",
"ghcr.io/fenics/dolfinx/dolfinx:nightly"
]
Expand Down
2 changes: 1 addition & 1 deletion src/pulse/active_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def S(self, C: ufl.core.expr.Expr, dev: bool = False) -> ufl.core.expr.Expr:
Cdev = kinematics.Cdev(C)
else:
Cdev = C
return 2.0 * ufl.diff(self.strain_energy(Cdev), Cdev)
return 2.0 * ufl.diff(self.strain_energy(Cdev), C)

def P(self, F: ufl.core.expr.Expr, dev: bool = False) -> ufl.core.expr.Expr:
"""First Piola-Kirchhoff stress tensor for the active model.
Expand Down
15 changes: 15 additions & 0 deletions src/pulse/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import logging
import operator
from dataclasses import dataclass

from mpi4py import MPI

import dolfinx
import numpy as np
import ufl

logger = logging.getLogger(__name__)


def check_value_greater_than(
Expand Down Expand Up @@ -40,6 +44,17 @@ def check_value_greater_than(
bound,
)

elif isinstance(f, ufl.indexed.Indexed):
try:
func, index = f.ufl_operands
value = func.x.array[int(index[0])]
return op(value, bound)
except Exception:
logger.warning(
"Could not extract value from ufl.indexed.Indexed. Assuming check succeeds.",
)
return True

raise PulseException( # pragma: no cover
f"Invalid type for f: {type(f)}. Expected 'float', "
"'dolfinx.fem.Constant', 'numpy array' or 'dolfinx.fem.Function'",
Expand Down
Loading
Loading