Pre-stressing of a left ventricle ellipsoid#
In this demo we will show how to simulate an idealized left ventricular geometry with pre-stressing using the approach described in [BRR24].
from pathlib import Path
from mpi4py import MPI
import dolfinx
import logging
import math
import numpy as np
import pulse.prestress
import pulse
import cardiac_geometries
import cardiac_geometries.geometry
comm = MPI.COMM_WORLD
logging.basicConfig(level=logging.INFO)
dolfinx.log.set_log_level(dolfinx.log.LogLevel.INFO)
geodir = Path("lv_ellipsoid-prestress")
if not geodir.exists():
comm.barrier()
cardiac_geometries.mesh.lv_ellipsoid(
outdir=geodir,
create_fibers=True,
fiber_space="P_2",
r_short_endo=0.025,
r_short_epi=0.035,
r_long_endo=0.09,
r_long_epi=0.097,
psize_ref=0.03,
mu_apex_endo=-math.pi,
mu_base_endo=-math.acos(5 / 17),
mu_apex_epi=-math.pi,
mu_base_epi=-math.acos(5 / 20),
comm=comm,
fiber_angle_epi=-60,
fiber_angle_endo=60,
)
2025-08-26 13:11:25 [debug ] Convert file lv_ellipsoid-prestress/lv_ellipsoid.msh to dolfin
INFO:cardiac_geometries.geometry:Reading geometry from lv_ellipsoid-prestress
Info : Reading 'lv_ellipsoid-prestress/lv_ellipsoid.msh'...
Info : 54 entities
Info : 191 nodes
Info : 990 elements
Info : Done reading 'lv_ellipsoid-prestress/lv_ellipsoid.msh'
[2025-08-26 13:11:25.280] [info] Extract basic topology: 2828->2828
[2025-08-26 13:11:25.280] [info] Build local dual graph
[2025-08-26 13:11:25.280] [info] Build local part of mesh dual graph (mixed)
[2025-08-26 13:11:25.280] [info] GPS pseudo-diameter:(28) 58-440
[2025-08-26 13:11:25.280] [info] Create topology (single cell type)
[2025-08-26 13:11:25.280] [info] Create topology (generalised)
[2025-08-26 13:11:25.280] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.280] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.281] [info] Compute ghost indices
[2025-08-26 13:11:25.281] [info] Computing communication graph edges (using PCX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.281] [info] Finished graph edge discovery using PCX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.281] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.281] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.281] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.281] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.281] [info] Number of neighbourhood source ranks in distribute_to_postoffice: 0
[2025-08-26 13:11:25.281] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.281] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.281] [info] Neighbourhood destination ranks from post office in distribute_data (rank, num dests, num dests/mpi_size): 0, 0, 0
[2025-08-26 13:11:25.281] [info] Checking required entities per dimension
[2025-08-26 13:11:25.281] [info] Cell type: 0 dofmap: 707x4
[2025-08-26 13:11:25.281] [info] Global index computation
[2025-08-26 13:11:25.281] [info] Got 1 index_maps
[2025-08-26 13:11:25.281] [info] Get global indices
[2025-08-26 13:11:25.281] [info] XDMF distribute entity data
[2025-08-26 13:11:25.281] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.281] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.281] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.281] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.281] [info] XDMF build map
[2025-08-26 13:11:25.281] [info] Requesting connectivity (3, 0) - (0, 0)
[2025-08-26 13:11:25.282] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.282] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.282] [info] XDMF distribute entity data
[2025-08-26 13:11:25.282] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.282] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.282] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.282] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.282] [info] XDMF build map
[2025-08-26 13:11:25.282] [info] Computing mesh entities of dimension 2
[2025-08-26 13:11:25.283] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.283] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.283] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:25.283] [info] Computing mesh connectivity 2-3 from transpose.
[2025-08-26 13:11:25.283] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.283] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.283] [info] XDMF distribute entity data
[2025-08-26 13:11:25.283] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.283] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.283] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.283] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.283] [info] XDMF build map
[2025-08-26 13:11:25.283] [info] Computing mesh entities of dimension 1
[2025-08-26 13:11:25.284] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.284] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.284] [info] Requesting connectivity (1, 0) - (3, 0)
[2025-08-26 13:11:25.284] [info] Computing mesh connectivity 1-3 from transpose.
[2025-08-26 13:11:25.284] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.284] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.284] [info] XDMF distribute entity data
[2025-08-26 13:11:25.284] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.284] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.285] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.285] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.285] [info] XDMF build map
[2025-08-26 13:11:25.285] [info] Requesting connectivity (0, 0) - (3, 0)
[2025-08-26 13:11:25.285] [info] Computing mesh connectivity 0-3 from transpose.
[2025-08-26 13:11:25.285] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.285] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.287] [info] Opened HDF5 file with id "72057594037927936"
[2025-08-26 13:11:25.287] [info] Adding mesh to node "/Xdmf/Domain"
[2025-08-26 13:11:25.287] [info] Adding topology data to node /Xdmf/Domain/Grid
[2025-08-26 13:11:25.287] [info] Adding geometry data to node "/Xdmf/Domain/Grid"
[2025-08-26 13:11:25.287] [info] XDMF: add meshtags (Cell tags)
[2025-08-26 13:11:25.287] [info] Adding topology data to node /Xdmf/Domain/Grid
[2025-08-26 13:11:25.288] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:25.288] [info] XDMF: add meshtags (Facet tags)
[2025-08-26 13:11:25.288] [info] Adding topology data to node /Xdmf/Domain/Grid
[2025-08-26 13:11:25.288] [info] Requesting connectivity (1, 0) - (3, 0)
[2025-08-26 13:11:25.288] [info] XDMF: add meshtags (Edge tags)
[2025-08-26 13:11:25.288] [info] Adding topology data to node /Xdmf/Domain/Grid
[2025-08-26 13:11:25.288] [info] Requesting connectivity (0, 0) - (3, 0)
[2025-08-26 13:11:25.288] [info] XDMF: add meshtags (Vertex tags)
[2025-08-26 13:11:25.288] [info] Adding topology data to node /Xdmf/Domain/Grid
[2025-08-26 13:11:25.292] [info] Checking required entities per dimension
[2025-08-26 13:11:25.292] [info] Cell type: 0 dofmap: 707x4
[2025-08-26 13:11:25.292] [info] Global index computation
[2025-08-26 13:11:25.292] [info] Got 1 index_maps
[2025-08-26 13:11:25.292] [info] Get global indices
[2025-08-26 13:11:25.343] [info] Column ghost size increased from 0 to 0
[2025-08-26 13:11:25.347] [info] Checking required entities per dimension
[2025-08-26 13:11:25.347] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:25.347] [info] Global index computation
[2025-08-26 13:11:25.347] [info] Got 2 index_maps
[2025-08-26 13:11:25.347] [info] Get global indices
[2025-08-26 13:11:25.353] [info] Checking required entities per dimension
[2025-08-26 13:11:25.353] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:25.353] [info] Global index computation
[2025-08-26 13:11:25.353] [info] Got 2 index_maps
[2025-08-26 13:11:25.353] [info] Get global indices
[2025-08-26 13:11:25.355] [info] Compute face permutations
[2025-08-26 13:11:25.355] [info] Computing permutations for face type 0
[2025-08-26 13:11:25.355] [info] Compute edge permutations
[2025-08-26 13:11:25.361] [info] Opened HDF5 file with id "72057594037927937"
[2025-08-26 13:11:25.361] [info] Read topology data "Mesh" at /Xdmf/Domain
[2025-08-26 13:11:25.361] [info] HDF5 Read data rate: 841.9485690893528 MB/s
[2025-08-26 13:11:25.361] [info] IO permuting cells
[2025-08-26 13:11:25.361] [info] Read geometry data "Mesh" at /Xdmf/Domain
[2025-08-26 13:11:25.361] [info] HDF5 Read data rate: 531.4166473452353 MB/s
[2025-08-26 13:11:25.362] [info] Using partitioner with 2828 cell data
[2025-08-26 13:11:25.362] [info] Compute partition of cells across ranks
[2025-08-26 13:11:25.362] [info] Building mesh dual graph
[2025-08-26 13:11:25.362] [info] Build local part of mesh dual graph (mixed)
[2025-08-26 13:11:25.362] [info] Build nonlocal part of mesh dual graph
[2025-08-26 13:11:25.362] [info] Graph edges (local: 2590, non-local: 0)
[2025-08-26 13:11:25.362] [info] Compute graph partition using PT-SCOTCH
[2025-08-26 13:11:25.363] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.363] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.363] [info] Extract basic topology: 2828->2828
[2025-08-26 13:11:25.363] [info] Build local dual graph
[2025-08-26 13:11:25.363] [info] Build local part of mesh dual graph (mixed)
[2025-08-26 13:11:25.363] [info] GPS pseudo-diameter:(28) 706-0
[2025-08-26 13:11:25.363] [info] Create topology (single cell type)
[2025-08-26 13:11:25.363] [info] Create topology (generalised)
[2025-08-26 13:11:25.363] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.363] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.363] [info] Compute ghost indices
[2025-08-26 13:11:25.363] [info] Computing communication graph edges (using PCX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.363] [info] Finished graph edge discovery using PCX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.363] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.363] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.363] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.363] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.363] [info] Number of neighbourhood source ranks in distribute_to_postoffice: 0
[2025-08-26 13:11:25.363] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.363] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.363] [info] Neighbourhood destination ranks from post office in distribute_data (rank, num dests, num dests/mpi_size): 0, 0, 0
[2025-08-26 13:11:25.363] [info] Checking required entities per dimension
[2025-08-26 13:11:25.363] [info] Cell type: 0 dofmap: 707x4
[2025-08-26 13:11:25.363] [info] Global index computation
[2025-08-26 13:11:25.363] [info] Got 1 index_maps
[2025-08-26 13:11:25.363] [info] Get global indices
[2025-08-26 13:11:25.364] [info] Requesting connectivity (3, 0) - (3, 0)
[2025-08-26 13:11:25.364] [info] XDMF read meshtags (Cell tags)
[2025-08-26 13:11:25.364] [info] Read topology data "Cell tags" at /Xdmf/Domain
[2025-08-26 13:11:25.364] [info] HDF5 Read data rate: 1619.9341257339254 MB/s
[2025-08-26 13:11:25.364] [info] IO permuting cells
[2025-08-26 13:11:25.364] [info] HDF5 Read data rate: 376.364120308757 MB/s
[2025-08-26 13:11:25.364] [info] IO permuting cells
[2025-08-26 13:11:25.364] [info] XDMF distribute entity data
[2025-08-26 13:11:25.364] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.364] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.364] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.364] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.364] [info] XDMF build map
[2025-08-26 13:11:25.364] [info] XDMF create meshtags
[2025-08-26 13:11:25.364] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.364] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.365] [info] Computing mesh entities of dimension 2
[2025-08-26 13:11:25.365] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.365] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.365] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:25.365] [info] Computing mesh connectivity 2-3 from transpose.
[2025-08-26 13:11:25.365] [info] XDMF read meshtags (Facet tags)
[2025-08-26 13:11:25.365] [info] Read topology data "Facet tags" at /Xdmf/Domain
[2025-08-26 13:11:25.365] [info] HDF5 Read data rate: 561.707149178877 MB/s
[2025-08-26 13:11:25.365] [info] IO permuting cells
[2025-08-26 13:11:25.365] [info] HDF5 Read data rate: 160.5125611195414 MB/s
[2025-08-26 13:11:25.365] [info] IO permuting cells
[2025-08-26 13:11:25.365] [info] XDMF distribute entity data
[2025-08-26 13:11:25.365] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.365] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.365] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.365] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.365] [info] XDMF build map
[2025-08-26 13:11:25.365] [info] XDMF create meshtags
[2025-08-26 13:11:25.365] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.365] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.366] [info] Computing mesh entities of dimension 1
[2025-08-26 13:11:25.366] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.366] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.366] [info] Requesting connectivity (1, 0) - (3, 0)
[2025-08-26 13:11:25.366] [info] Computing mesh connectivity 1-3 from transpose.
[2025-08-26 13:11:25.366] [info] XDMF read meshtags (Edge tags)
[2025-08-26 13:11:25.366] [info] Read topology data "Edge tags" at /Xdmf/Domain
[2025-08-26 13:11:25.366] [info] HDF5 Read data rate: 75.96334327039858 MB/s
[2025-08-26 13:11:25.366] [info] IO permuting cells
[2025-08-26 13:11:25.366] [info] HDF5 Read data rate: 29.29654232669051 MB/s
[2025-08-26 13:11:25.366] [info] IO permuting cells
[2025-08-26 13:11:25.366] [info] XDMF distribute entity data
[2025-08-26 13:11:25.366] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.366] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.366] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.366] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.367] [info] XDMF build map
[2025-08-26 13:11:25.367] [info] XDMF create meshtags
[2025-08-26 13:11:25.367] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.367] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.367] [info] Requesting connectivity (0, 0) - (3, 0)
[2025-08-26 13:11:25.367] [info] Computing mesh connectivity 0-3 from transpose.
[2025-08-26 13:11:25.367] [info] XDMF read meshtags (Vertex tags)
[2025-08-26 13:11:25.367] [info] Read topology data "Vertex tags" at /Xdmf/Domain
[2025-08-26 13:11:25.367] [info] HDF5 Read data rate: 2.1381798743819322 MB/s
[2025-08-26 13:11:25.367] [info] IO permuting cells
[2025-08-26 13:11:25.367] [info] HDF5 Read data rate: 1.5939430165371589 MB/s
[2025-08-26 13:11:25.367] [info] IO permuting cells
[2025-08-26 13:11:25.367] [info] XDMF distribute entity data
[2025-08-26 13:11:25.367] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.367] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.367] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.367] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.367] [info] XDMF build map
[2025-08-26 13:11:25.367] [info] XDMF create meshtags
[2025-08-26 13:11:25.367] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.367] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.369] [info] Checking required entities per dimension
[2025-08-26 13:11:25.369] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:25.369] [info] Global index computation
[2025-08-26 13:11:25.369] [info] Got 2 index_maps
[2025-08-26 13:11:25.369] [info] Get global indices
[2025-08-26 13:11:25.370] [info] Compute face permutations
[2025-08-26 13:11:25.370] [info] Computing permutations for face type 0
[2025-08-26 13:11:25.370] [info] Compute edge permutations
[2025-08-26 13:11:25.375] [info] Checking required entities per dimension
[2025-08-26 13:11:25.375] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:25.375] [info] Global index computation
[2025-08-26 13:11:25.375] [info] Got 2 index_maps
[2025-08-26 13:11:25.375] [info] Get global indices
[2025-08-26 13:11:25.379] [info] Checking required entities per dimension
[2025-08-26 13:11:25.379] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:25.379] [info] Global index computation
[2025-08-26 13:11:25.379] [info] Got 2 index_maps
[2025-08-26 13:11:25.379] [info] Get global indices
geo = cardiac_geometries.geometry.Geometry.from_folder(
comm=comm,
folder=geodir,
)
INFO:cardiac_geometries.geometry:Reading geometry from lv_ellipsoid-prestress
[2025-08-26 13:11:25.388] [info] Opened HDF5 file with id "72057594037927938"
[2025-08-26 13:11:25.388] [info] Read topology data "Mesh" at /Xdmf/Domain
[2025-08-26 13:11:25.388] [info] HDF5 Read data rate: 1157.4154601729165 MB/s
[2025-08-26 13:11:25.388] [info] IO permuting cells
[2025-08-26 13:11:25.388] [info] Read geometry data "Mesh" at /Xdmf/Domain
[2025-08-26 13:11:25.388] [info] HDF5 Read data rate: 465.4752233956134 MB/s
[2025-08-26 13:11:25.389] [info] Using partitioner with 2828 cell data
[2025-08-26 13:11:25.389] [info] Compute partition of cells across ranks
[2025-08-26 13:11:25.389] [info] Building mesh dual graph
[2025-08-26 13:11:25.389] [info] Build local part of mesh dual graph (mixed)
[2025-08-26 13:11:25.389] [info] Build nonlocal part of mesh dual graph
[2025-08-26 13:11:25.389] [info] Graph edges (local: 2590, non-local: 0)
[2025-08-26 13:11:25.389] [info] Compute graph partition using PT-SCOTCH
[2025-08-26 13:11:25.389] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.389] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.389] [info] Extract basic topology: 2828->2828
[2025-08-26 13:11:25.389] [info] Build local dual graph
[2025-08-26 13:11:25.389] [info] Build local part of mesh dual graph (mixed)
[2025-08-26 13:11:25.390] [info] GPS pseudo-diameter:(28) 706-0
[2025-08-26 13:11:25.390] [info] Create topology (single cell type)
[2025-08-26 13:11:25.390] [info] Create topology (generalised)
[2025-08-26 13:11:25.390] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.390] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.390] [info] Compute ghost indices
[2025-08-26 13:11:25.390] [info] Computing communication graph edges (using PCX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.390] [info] Finished graph edge discovery using PCX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.390] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.390] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.390] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.390] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.390] [info] Number of neighbourhood source ranks in distribute_to_postoffice: 0
[2025-08-26 13:11:25.390] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.390] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.390] [info] Neighbourhood destination ranks from post office in distribute_data (rank, num dests, num dests/mpi_size): 0, 0, 0
[2025-08-26 13:11:25.390] [info] Checking required entities per dimension
[2025-08-26 13:11:25.390] [info] Cell type: 0 dofmap: 707x4
[2025-08-26 13:11:25.390] [info] Global index computation
[2025-08-26 13:11:25.390] [info] Got 1 index_maps
[2025-08-26 13:11:25.390] [info] Get global indices
[2025-08-26 13:11:25.391] [info] Requesting connectivity (3, 0) - (3, 0)
[2025-08-26 13:11:25.391] [info] XDMF read meshtags (Cell tags)
[2025-08-26 13:11:25.391] [info] Read topology data "Cell tags" at /Xdmf/Domain
[2025-08-26 13:11:25.391] [info] HDF5 Read data rate: 1758.7064676616915 MB/s
[2025-08-26 13:11:25.391] [info] IO permuting cells
[2025-08-26 13:11:25.391] [info] HDF5 Read data rate: 435.61306223043744 MB/s
[2025-08-26 13:11:25.391] [info] IO permuting cells
[2025-08-26 13:11:25.391] [info] XDMF distribute entity data
[2025-08-26 13:11:25.391] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.391] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.391] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.391] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.391] [info] XDMF build map
[2025-08-26 13:11:25.391] [info] XDMF create meshtags
[2025-08-26 13:11:25.391] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.391] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.391] [info] Computing mesh entities of dimension 2
[2025-08-26 13:11:25.392] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.392] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.392] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:25.392] [info] Computing mesh connectivity 2-3 from transpose.
[2025-08-26 13:11:25.392] [info] XDMF read meshtags (Facet tags)
[2025-08-26 13:11:25.392] [info] Read topology data "Facet tags" at /Xdmf/Domain
[2025-08-26 13:11:25.392] [info] HDF5 Read data rate: 601.3897662665825 MB/s
[2025-08-26 13:11:25.392] [info] IO permuting cells
[2025-08-26 13:11:25.392] [info] HDF5 Read data rate: 174.35897435897436 MB/s
[2025-08-26 13:11:25.392] [info] IO permuting cells
[2025-08-26 13:11:25.392] [info] XDMF distribute entity data
[2025-08-26 13:11:25.392] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.392] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.392] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.392] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.392] [info] XDMF build map
[2025-08-26 13:11:25.392] [info] XDMF create meshtags
[2025-08-26 13:11:25.392] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.392] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.392] [info] Computing mesh entities of dimension 1
[2025-08-26 13:11:25.393] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 0
[2025-08-26 13:11:25.393] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 0
[2025-08-26 13:11:25.393] [info] Requesting connectivity (1, 0) - (3, 0)
[2025-08-26 13:11:25.393] [info] Computing mesh connectivity 1-3 from transpose.
[2025-08-26 13:11:25.393] [info] XDMF read meshtags (Edge tags)
[2025-08-26 13:11:25.393] [info] Read topology data "Edge tags" at /Xdmf/Domain
[2025-08-26 13:11:25.393] [info] HDF5 Read data rate: 81.66172106824926 MB/s
[2025-08-26 13:11:25.393] [info] IO permuting cells
[2025-08-26 13:11:25.393] [info] HDF5 Read data rate: 30.170145588493245 MB/s
[2025-08-26 13:11:25.393] [info] IO permuting cells
[2025-08-26 13:11:25.393] [info] XDMF distribute entity data
[2025-08-26 13:11:25.393] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.393] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.393] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.393] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.393] [info] XDMF build map
[2025-08-26 13:11:25.393] [info] XDMF create meshtags
[2025-08-26 13:11:25.393] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.393] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.393] [info] Requesting connectivity (0, 0) - (3, 0)
[2025-08-26 13:11:25.393] [info] Computing mesh connectivity 0-3 from transpose.
[2025-08-26 13:11:25.393] [info] XDMF read meshtags (Vertex tags)
[2025-08-26 13:11:25.393] [info] Read topology data "Vertex tags" at /Xdmf/Domain
[2025-08-26 13:11:25.394] [info] HDF5 Read data rate: 1.2704462442432904 MB/s
[2025-08-26 13:11:25.394] [info] IO permuting cells
[2025-08-26 13:11:25.394] [info] HDF5 Read data rate: 0.7434944237918216 MB/s
[2025-08-26 13:11:25.394] [info] IO permuting cells
[2025-08-26 13:11:25.394] [info] XDMF distribute entity data
[2025-08-26 13:11:25.394] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.394] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.394] [info] Computing communication graph edges (using NBX algorithm). Number of input edges: 1
[2025-08-26 13:11:25.394] [info] Finished graph edge discovery using NBX algorithm. Number of discovered edges 1
[2025-08-26 13:11:25.394] [info] XDMF build map
[2025-08-26 13:11:25.394] [info] XDMF create meshtags
[2025-08-26 13:11:25.394] [info] Building MeshTags object from tagged entities (defined by vertices).
[2025-08-26 13:11:25.394] [info] Build list of mesh entity indices from the entity vertices.
[2025-08-26 13:11:25.396] [info] Checking required entities per dimension
[2025-08-26 13:11:25.396] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:25.396] [info] Global index computation
[2025-08-26 13:11:25.396] [info] Got 2 index_maps
[2025-08-26 13:11:25.396] [info] Get global indices
[2025-08-26 13:11:25.397] [info] Compute face permutations
[2025-08-26 13:11:25.397] [info] Computing permutations for face type 0
[2025-08-26 13:11:25.397] [info] Compute edge permutations
[2025-08-26 13:11:25.401] [info] Checking required entities per dimension
[2025-08-26 13:11:25.401] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:25.401] [info] Global index computation
[2025-08-26 13:11:25.401] [info] Got 2 index_maps
[2025-08-26 13:11:25.401] [info] Get global indices
[2025-08-26 13:11:25.405] [info] Checking required entities per dimension
[2025-08-26 13:11:25.406] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:25.406] [info] Global index computation
[2025-08-26 13:11:25.406] [info] Got 2 index_maps
[2025-08-26 13:11:25.406] [info] Get global indices
geometry = pulse.HeartGeometry.from_cardiac_geometries(geo, metadata={"quadrature_degree": 6})
target_pressure = 2000.0
pressure = pulse.Variable(dolfinx.fem.Constant(geo.mesh, 0.0), "Pa")
material = pulse.material_models.Usyk(f0=geo.f0, s0=geo.s0, n0=geo.n0)
comp = pulse.compressibility.Compressible3(kappa=pulse.Variable(5e4, "Pa"))
model = pulse.CardiacModel(
material=material, compressibility=comp, active=pulse.active_model.Passive(),
)
alpha_epi = pulse.Variable(
dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(2e5)),
"Pa / m",
)
robin_epi = pulse.RobinBC(value=alpha_epi, marker=geometry.markers["EPI"][0])
alpha_epi_perp = pulse.Variable(
dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(2e5 / 10)),
"Pa / m",
)
robin_epi_perp = pulse.RobinBC(
value=alpha_epi_perp, marker=geometry.markers["EPI"][0], perpendicular=True,
)
neumann = pulse.NeumannBC(traction=pressure, marker=geometry.markers["ENDO"][0])
bcs = pulse.BoundaryConditions(neumann=(neumann,), robin=(robin_epi, robin_epi_perp))
prestress_problem = pulse.prestress.PrestressProblem(
geometry=geometry,
model=model,
bcs=bcs,
parameters={"u_space": "P_2"},
)
[2025-08-26 13:11:25.440] [info] Checking required entities per dimension
[2025-08-26 13:11:25.440] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:25.440] [info] Global index computation
[2025-08-26 13:11:25.440] [info] Got 2 index_maps
[2025-08-26 13:11:25.440] [info] Get global indices
[2025-08-26 13:11:26.597] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:26.597] [info] Requesting connectivity (3, 0) - (2, 0)
[2025-08-26 13:11:26.597] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:26.597] [info] Requesting connectivity (3, 0) - (2, 0)
[2025-08-26 13:11:36.756] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:36.756] [info] Requesting connectivity (3, 0) - (2, 0)
[2025-08-26 13:11:36.756] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:36.756] [info] Requesting connectivity (3, 0) - (2, 0)
[2025-08-26 13:11:36.756] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:36.772] [info] Column ghost size increased from 0 to 0
ramp_steps = 5
for ramp in np.linspace(0.0, 1.0, ramp_steps):
pressure.assign(target_pressure * ramp)
prestress_problem.solve()
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.0 (tol=1e-06), r (rel) = 0.0 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.0624697753647272 (tol=1e-06), r (rel) = 1.0 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 2: r (abs) = 0.0051802895972545135 (tol=1e-06), r (rel) = 0.08292473547422904 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 3: r (abs) = 0.00025071093771217827 (tol=1e-06), r (rel) = 0.004013315819504918 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 4: r (abs) = 1.2573235288968559e-06 (tol=1e-06), r (rel) = 2.012690971843623e-05 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 5: r (abs) = 1.0028895731006566e-10 (tol=1e-06), r (rel) = 1.6053996788772288e-09 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.05458606943601881 (tol=1e-06), r (rel) = 1.0 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 2: r (abs) = 0.00885780767329963 (tol=1e-06), r (rel) = 0.16227231168717882 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 3: r (abs) = 0.0006696870553928739 (tol=1e-06), r (rel) = 0.012268460841970396 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 4: r (abs) = 1.3506977579420906e-05 (tol=1e-06), r (rel) = 0.0002474436741640218 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 5: r (abs) = 9.69727189488877e-09 (tol=1e-06), r (rel) = 1.7765103798607617e-07 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.04377411565251584 (tol=1e-06), r (rel) = 1.0 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 2: r (abs) = 0.006314377527005098 (tol=1e-06), r (rel) = 0.14424911692401465 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 3: r (abs) = 0.0003100549487199316 (tol=1e-06), r (rel) = 0.0070830659648543175 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 4: r (abs) = 1.4813095558066866e-06 (tol=1e-06), r (rel) = 3.383985110208733e-05 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 5: r (abs) = 8.386012464128691e-11 (tol=1e-06), r (rel) = 1.9157468607013923e-09 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.0392838391233011 (tol=1e-06), r (rel) = 1.0 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 2: r (abs) = 0.0037014977910092527 (tol=1e-06), r (rel) = 0.09422444123628741 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 3: r (abs) = 0.0001259272149061357 (tol=1e-06), r (rel) = 0.00320557302230276 (tol=1e-08)
INFO:scifem.solvers:Newton iteration 4: r (abs) = 2.062474671216801e-07 (tol=1e-06), r (rel) = 5.2501861255038335e-06 (tol=1e-08)
with dolfinx.io.VTXWriter(
comm, "prestress_backward.bp", [prestress_problem.u], engine="BP4",
) as vtx:
vtx.write(0.0)
geometry.deform(prestress_problem.u)
[2025-08-26 13:11:40.535] [info] Requesting connectivity (3, 0) - (3, 0)
[2025-08-26 13:11:40.536] [info] Computed bounding box tree with 1413 nodes for 707 entities
forward_problem = pulse.StaticProblem(
model=model,
geometry=geometry,
bcs=bcs,
parameters={"u_space": "P_2"},
)
[2025-08-26 13:11:40.542] [info] Checking required entities per dimension
[2025-08-26 13:11:40.542] [info] Cell type: 0 dofmap: 707x10
[2025-08-26 13:11:40.542] [info] Global index computation
[2025-08-26 13:11:40.542] [info] Got 2 index_maps
[2025-08-26 13:11:40.542] [info] Get global indices
[2025-08-26 13:11:41.590] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:41.590] [info] Requesting connectivity (3, 0) - (2, 0)
[2025-08-26 13:11:41.591] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:41.591] [info] Requesting connectivity (3, 0) - (2, 0)
[2025-08-26 13:11:49.983] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:49.983] [info] Requesting connectivity (3, 0) - (2, 0)
[2025-08-26 13:11:49.983] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:49.983] [info] Requesting connectivity (3, 0) - (2, 0)
[2025-08-26 13:11:49.984] [info] Requesting connectivity (2, 0) - (3, 0)
[2025-08-26 13:11:50.000] [info] Column ghost size increased from 0 to 0
for ramp in np.linspace(0.0, 1.0, ramp_steps):
pressure.assign(target_pressure * ramp)
forward_problem.solve()
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.0 (tol=1e-06), r (rel) = 0.0 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.05526743395072246 (tol=1e-06), r (rel) = 1.0 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 2: r (abs) = 0.004547755828277937 (tol=1e-06), r (rel) = 0.08228635750183022 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 3: r (abs) = 0.0013024910380605259 (tol=1e-06), r (rel) = 0.023567061919716643 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 4: r (abs) = 2.3553106125242135e-05 (tol=1e-06), r (rel) = 0.0004261660880843962 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 5: r (abs) = 1.887598956348176e-07 (tol=1e-06), r (rel) = 3.4153909841936875e-06 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.06041405176309435 (tol=1e-06), r (rel) = 1.0 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 2: r (abs) = 0.009179604823857558 (tol=1e-06), r (rel) = 0.15194486309003333 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 3: r (abs) = 0.001886746239287701 (tol=1e-06), r (rel) = 0.031230254952710753 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 4: r (abs) = 0.00013749964413589782 (tol=1e-06), r (rel) = 0.002275954684765795 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 5: r (abs) = 5.960411313228394e-07 (tol=1e-06), r (rel) = 9.86593538966953e-06 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.0537053877369972 (tol=1e-06), r (rel) = 1.0 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 2: r (abs) = 0.007496400627985141 (tol=1e-06), r (rel) = 0.13958377257596694 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 3: r (abs) = 0.0010676426501441008 (tol=1e-06), r (rel) = 0.019879619068621127 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 4: r (abs) = 1.6773809490067937e-05 (tol=1e-06), r (rel) = 0.00031233010684536213 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 5: r (abs) = 6.0886087418042665e-09 (tol=1e-06), r (rel) = 1.1337053875527415e-07 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 1: r (abs) = 0.04886427811598261 (tol=1e-06), r (rel) = 1.0 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 2: r (abs) = 0.0051453120797837005 (tol=1e-06), r (rel) = 0.1052980270694056 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 3: r (abs) = 0.00044505033503370646 (tol=1e-06), r (rel) = 0.009107887237735302 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 4: r (abs) = 2.5829304922736064e-06 (tol=1e-06), r (rel) = 5.285927863587485e-05 (tol=1e-10)
INFO:scifem.solvers:Newton iteration 5: r (abs) = 1.0278019656875007e-10 (tol=1e-06), r (rel) = 2.1033810491335707e-09 (tol=1e-10)
with dolfinx.io.VTXWriter(comm, "prestress_forward.bp", [forward_problem.u], engine="BP4") as vtx:
vtx.write(0.0)
References#
[BRR24]
NA Barnafi, Francesco Regazzoni, and Davide Riccobelli. Reconstructing relaxed configurations in elastic bodies: mathematical formulations and numerical methods for cardiac modeling. Computer Methods in Applied Mechanics and Engineering, 423:116845, 2024.