Skip to content

Commit 174d8d4

Browse files
committed
Fix citations in prestressing and add option to update fibers during fixed point iteration
1 parent 3916daf commit 174d8d4

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

.cspell_dict.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ caplog
2121
cardiomyocytes
2222
cellname
2323
Chiara
24+
CMAME
2425
cntl
2526
cofac
2627
cofnorm

demo/geometries/ukb_mesh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ def dirichlet_bc(V: dolfinx.fem.FunctionSpace):
252252

253253
vtx = dolfinx.io.VTXWriter(geometry.mesh.comm, outdir / "displacement.bp", [problem.u], engine="BP4")
254254
vtx.write(0.0)
255-
256-
pressures = [0.5, 1.0, 1.5] # kPa
255+
pressures = [0.5, 1.0, 1.5] # kPa
257256
for i, plv in enumerate(pressures, start=1):
258257
print(f"Solving for pressure: {plv} kPa")
259258
traction_lv.assign(plv)
@@ -262,6 +261,7 @@ def dirichlet_bc(V: dolfinx.fem.FunctionSpace):
262261
vtx.write(float(i))
263262

264263
# Visualize Passive Inflation
264+
265265
try:
266266
import pyvista
267267
except ImportError:

demo/prestress/README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ where $\mathbf{x} \in \Omega_t$. The deformation gradient $\mathbf{F}$ is comput
2929

3030
* **Class:** `pulse.unloading.PrestressProblem`
3131
* **Demo:** [Pre-stressing a Bi-Ventricular Geometry](prestress_biv.py)
32-
* **Reference:** The method is described in {cite}`barnafi2024reconstructing`.
32+
* **Reference:** Barnafi et al., *Reconstructing relaxed configurations in elastic bodies: Mathematical formulations and numerical methods for cardiac modeling*, CMAME (2024).
3333

3434
## Method 2: Fixed-Point Iteration (Backward Displacement)
3535

@@ -46,7 +46,7 @@ This method is intuitive as it reuses the standard forward solver, but it may re
4646

4747
* **Class:** `pulse.unloading.FixedPointUnloader`
4848
* **Demo:** [Pre-stressing with Fixed-Point Iteration](prestress_fixedpoint_unloader.py)
49-
* **Reference:** The method is described in {cite}`SELLIER20111461`
49+
* **Reference:** Sellier, M. *An iterative method for the inverse elasto-static problem.* Journal of Fluids and Structures 27.8 (2011).
5050

5151
## Summary of Differences
5252

@@ -57,8 +57,3 @@ This method is intuitive as it reuses the standard forward solver, but it may re
5757
| **Computational Cost** | Generally lower (one system solve) | Higher (multiple forward solves) |
5858
| **Implementation** | Requires specific inverse forms | Wraps standard forward solver |
5959
| **Pulse Class** | `PrestressProblem` | `FixedPointUnloader` |
60-
61-
62-
# References
63-
```{bibliography}
64-
:filter: docname in docnames

demo/prestress/prestress_fixedpoint_unloader.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
cardiac_geometries.mesh.lv_ellipsoid(
6666
outdir=geodir,
6767
create_fibers=True,
68-
fiber_space="P_2",
68+
fiber_space="Quadrature_6",
6969
r_short_endo=0.025,
7070
r_short_epi=0.035,
7171
r_long_endo=0.09,
@@ -98,6 +98,7 @@
9898
# * **Neumann**: Endocardial pressure (Target = 2000 Pa).
9999
# * **Robin**: Epicardial and Basal springs to mimic tissue support.
100100

101+
101102
def setup_problem(geometry, f0, s0, n0, target_pressure=2000.0):
102103

103104
material = pulse.material_models.Usyk(f0=f0, s0=s0, n0=n0)
@@ -129,7 +130,9 @@ def setup_problem(geometry, f0, s0, n0, target_pressure=2000.0):
129130
bcs = pulse.BoundaryConditions(neumann=(neumann,), robin=(robin_epi, robin_base))
130131
return model, bcs, pressure, target_pressure
131132

133+
132134
# Initialize model with fibers from the target geometry
135+
133136
model, bcs, pressure, target_pressure = setup_problem(geometry, geo.f0, geo.s0, geo.n0)
134137

135138
# Define the loading target for the unloader

src/pulse/unloading.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def default_parameters(self) -> dict[str, typing.Any]:
125125
"max_iter": 10,
126126
"tol": 1e-4,
127127
"ramp_steps": 20,
128+
"update_model_fields": True,
128129
}
129130

130131
def unload(self) -> dolfinx.fem.Function:
@@ -136,6 +137,7 @@ def unload(self) -> dolfinx.fem.Function:
136137

137138
max_iter = self.unload_parameters["max_iter"]
138139
tol = self.unload_parameters["tol"]
140+
update_model_fields = self.unload_parameters["update_model_fields"]
139141
comm = self.geometry.mesh.comm
140142

141143
for i in range(max_iter):
@@ -197,9 +199,11 @@ def unload(self) -> dolfinx.fem.Function:
197199
# This effectively moves the reference configuration 'backwards' by the displacement
198200
# required to reach the target from the current guess.
199201
self.geometry.mesh.geometry.x[:] = self._target_coords - u_at_nodes
202+
200203
# Deforming the fields seems to cause issues with convergence, so we skip it for now.
201-
u.x.array[:] *= -1.0
202-
self._update_model_fields(u)
204+
if update_model_fields:
205+
u.x.array[:] *= -1.0
206+
self._update_model_fields(u)
203207

204208
else:
205209
logger.warning("FixedPointUnloader reached maximum iterations without converging.")

0 commit comments

Comments
 (0)