Skip to content

Commit cd83d8f

Browse files
refactor: use pydantic for the settings module (#1259)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 0e062a3 commit cd83d8f

File tree

18 files changed

+1739
-534
lines changed

18 files changed

+1739
-534
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use pydantic for the settings module

examples/simulator/ep-mechanics-simulator-fullheart.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
# Load default simulation settings.
9999
simulator.settings.load_defaults()
100100

101+
# Use the ReactionEikonal solver for the electrophysiology simulation.
102+
simulator.settings.electrophysiology.analysis.solvertype = "ReactionEikonal"
103+
101104
###############################################################################
102105
# Compute the fiber orientation
103106
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -186,9 +189,6 @@
186189
# A constant pressure is prescribed to the atria.
187190
# No circulation system is coupled with the atria.
188191

189-
# Use the ReactionEikonal solver for the electrophysiology simulation.
190-
simulator.settings.electrophysiology.analysis.solvertype = "ReactionEikonal"
191-
192192
# Start main simulation. The ``auto_post`` option is set to ``False`` to avoid
193193
# automatic postprocessing.
194194
simulator.simulate(auto_post=False)

examples/simulator/ep-simulator-fullheart_rodero.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@
102102
# Load the default settings.
103103
simulator.settings.load_defaults()
104104

105+
simulator.settings.electrophysiology.analysis.solvertype = "ReactionEikonal"
106+
105107
###############################################################################
106108
# Compute fiber orientation
107109
# ~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -145,7 +147,5 @@
145147
# Start the main electrophysiology simulation. This uses the previously computed fiber orientation
146148
# and Purkinje network to set up and run the LS-DYNA model.
147149

148-
149150
# Compute the Eikonal solution. This only computes the activation time.
150-
simulator.settings.electrophysiology.analysis.solvertype = "ReactionEikonal"
151151
simulator.simulate(folder_name="main-ep-ReactionEikonal")

src/ansys/health/heart/models.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,8 +1696,10 @@ def create_stiff_ventricle_base(
16961696
part.fiber = False
16971697
part.active = False
16981698
part.meca_material = stiff_material
1699-
# assign default EP material as for ventricles
1700-
part.ep_material = ep_materials.Active()
1699+
# Assign Active EP material.
1700+
part.ep_material = ep_materials.Active(
1701+
sigma_fiber=0.5, sigma_sheet=0.1, sigma_sheet_normal=0.1, beta=140.0, cm=0.01
1702+
)
17011703

17021704
return part
17031705

src/ansys/health/heart/post/system_model_post.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ def __init__(self, dir: str):
181181
s = SimulationSettings()
182182
s.load(os.path.join(self.dir, "simulation_settings.yml"))
183183
l_ed_pressure = (
184-
s.mechanics.boundary_conditions.end_diastolic_cavity_pressure.left_ventricle.to(
185-
"kilopascal"
186-
).m
184+
s.mechanics.boundary_conditions.end_diastolic_cavity_pressure.get("left_ventricle")
185+
.to("kilopascal")
186+
.m
187187
)
188188
if self.model_type == "BV":
189189
r_ed_pressure = (
190-
s.mechanics.boundary_conditions.end_diastolic_cavity_pressure.right_ventricle.to(
191-
"kilopascal"
192-
).m
190+
s.mechanics.boundary_conditions.end_diastolic_cavity_pressure.get("right_ventricle")
191+
.to("kilopascal")
192+
.m
193193
)
194194

195195
# get EOD volume

0 commit comments

Comments
 (0)