|
10 | 10 | import numpy as np |
11 | 11 | import math |
12 | 12 | import cardiac_geometries |
13 | | -import fenicsx_pulse |
| 13 | +import pulse |
14 | 14 |
|
15 | 15 | # Next we will create the geometry and save it in the folder called `lv_ellipsoid`. Now we will also generate fibers and use a sixth order quadrature space for the fibers |
16 | 16 |
|
|
43 | 43 | folder=geodir, |
44 | 44 | ) |
45 | 45 |
|
46 | | -# Now, lets convert the geometry to a `fenicsx_pulse.Geometry` object. |
| 46 | +# Now, lets convert the geometry to a `pulse.Geometry` object. |
47 | 47 |
|
48 | | -geometry = fenicsx_pulse.HeartGeometry.from_cardiac_geometries(geo, metadata={"quadrature_degree": 6}) |
| 48 | +geometry = pulse.HeartGeometry.from_cardiac_geometries(geo, metadata={"quadrature_degree": 6}) |
49 | 49 |
|
50 | 50 |
|
51 | | -# The material model used in this benchmark is the {py:class}`Guccione <fenicsx_pulse.material_models.guccione.Guccione>` model. |
| 51 | +# The material model used in this benchmark is the {py:class}`Guccione <pulse.material_models.guccione.Guccione>` model. |
52 | 52 |
|
53 | 53 | material_params = { |
54 | 54 | "C": dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(2.0)), |
55 | 55 | "bf": dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(8.0)), |
56 | 56 | "bt": dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(2.0)), |
57 | 57 | "bfs": dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(4.0)), |
58 | 58 | } |
59 | | -material = fenicsx_pulse.Guccione(f0=geo.f0, s0=geo.s0, n0=geo.n0, **material_params) |
| 59 | +material = pulse.Guccione(f0=geo.f0, s0=geo.s0, n0=geo.n0, **material_params) |
60 | 60 |
|
61 | 61 |
|
62 | 62 | # We use an active stress approach with 60% transverse active stress |
63 | 63 |
|
64 | 64 | Ta = dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(0.0)) |
65 | | -active_model = fenicsx_pulse.ActiveStress(geo.f0, activation=fenicsx_pulse.Variable(Ta, "kPa")) |
| 65 | +active_model = pulse.ActiveStress(geo.f0, activation=pulse.Variable(Ta, "kPa")) |
66 | 66 |
|
67 | 67 | # and the model should be incompressible |
68 | 68 |
|
69 | | -comp_model = fenicsx_pulse.Incompressible() |
| 69 | +comp_model = pulse.Incompressible() |
70 | 70 |
|
71 | 71 |
|
72 | 72 | # and assembles the `CardiacModel` |
73 | 73 |
|
74 | | -model = fenicsx_pulse.CardiacModel( |
| 74 | +model = pulse.CardiacModel( |
75 | 75 | material=material, |
76 | 76 | active=active_model, |
77 | 77 | compressibility=comp_model, |
|
82 | 82 | # We apply a traction in endocardium |
83 | 83 |
|
84 | 84 | traction = dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(0.0)) |
85 | | -neumann = fenicsx_pulse.NeumannBC( |
86 | | - traction=fenicsx_pulse.Variable(traction, "kPa"), |
| 85 | +neumann = pulse.NeumannBC( |
| 86 | + traction=pulse.Variable(traction, "kPa"), |
87 | 87 | marker=geo.markers["ENDO"][0], |
88 | 88 | ) |
89 | 89 |
|
90 | 90 | # and finally combine all the boundary conditions |
91 | 91 |
|
92 | | -bcs = fenicsx_pulse.BoundaryConditions(neumann=(neumann,)) |
| 92 | +bcs = pulse.BoundaryConditions(neumann=(neumann,)) |
93 | 93 |
|
94 | 94 | # and create a Mixed problem |
95 | 95 |
|
96 | | -problem = fenicsx_pulse.StaticProblem( |
97 | | - model=model, geometry=geometry, bcs=bcs, parameters={"base_bc": fenicsx_pulse.BaseBC.fixed}, |
| 96 | +problem = pulse.StaticProblem( |
| 97 | + model=model, geometry=geometry, bcs=bcs, parameters={"base_bc": pulse.BaseBC.fixed}, |
98 | 98 | ) |
99 | 99 |
|
100 | 100 | # Now we can solve the problem |
|
153 | 153 | U = dolfinx.fem.Function(problem.u.function_space) |
154 | 154 | U.interpolate(lambda x: (x[0], x[1], x[2])) |
155 | 155 |
|
156 | | -endo_apex_coord = fenicsx_pulse.utils.evaluate_at_vertex_tag(U, geo.vfun, geo.markers["ENDOPT"][0]) |
157 | | -u_endo_apex = fenicsx_pulse.utils.evaluate_at_vertex_tag(problem.u, geo.vfun, geo.markers["ENDOPT"][0]) |
158 | | -endo_apex_pos = fenicsx_pulse.utils.gather_broadcast_array(geo.mesh.comm, endo_apex_coord + u_endo_apex) |
| 156 | +endo_apex_coord = pulse.utils.evaluate_at_vertex_tag(U, geo.vfun, geo.markers["ENDOPT"][0]) |
| 157 | +u_endo_apex = pulse.utils.evaluate_at_vertex_tag(problem.u, geo.vfun, geo.markers["ENDOPT"][0]) |
| 158 | +endo_apex_pos = pulse.utils.gather_broadcast_array(geo.mesh.comm, endo_apex_coord + u_endo_apex) |
159 | 159 | print(f"\nGet longitudinal position of endocardial apex: {endo_apex_pos[0, 0]:4f} mm") |
160 | 160 |
|
161 | | -epi_apex_coord = fenicsx_pulse.utils.evaluate_at_vertex_tag(U, geo.vfun, geo.markers["EPIPT"][0]) |
162 | | -u_epi_apex = fenicsx_pulse.utils.evaluate_at_vertex_tag(problem.u, geo.vfun, geo.markers["EPIPT"][0]) |
163 | | -epi_apex_pos = fenicsx_pulse.utils.gather_broadcast_array(geo.mesh.comm, epi_apex_coord + u_epi_apex) |
| 161 | +epi_apex_coord = pulse.utils.evaluate_at_vertex_tag(U, geo.vfun, geo.markers["EPIPT"][0]) |
| 162 | +u_epi_apex = pulse.utils.evaluate_at_vertex_tag(problem.u, geo.vfun, geo.markers["EPIPT"][0]) |
| 163 | +epi_apex_pos = pulse.utils.gather_broadcast_array(geo.mesh.comm, epi_apex_coord + u_epi_apex) |
164 | 164 | print(f"\nGet longitudinal position of epicardial apex: {epi_apex_pos[0, 0]:4f} mm") |
0 commit comments