HeartModel
#
- class ansys.health.heart.models.HeartModel(working_directory: pathlib.Path | str = None)#
Parent class for heart models.
Overview#
Assign conduction paths to the model. |
|
Create a part by element IDs. |
|
Load an input model. |
|
Remesh the input model and fill the volume. |
|
Get a specific part based on a part name. |
|
Dynamically add a part as an attribute to the object. |
|
Remove a part with a specific name from the model. |
|
Get summary information of the model as a dictionary. |
|
Plot the volume mesh of the heart model. |
|
Plot a part in the mesh. |
|
Plot the mesh and fibers as streamlines. |
|
Plot all surfaces in the model. |
|
Plot the mesh and Purkinje network. |
|
Save the model and necessary information to reconstruct. |
|
Load a model from an existing VTU file and part information dictionary. |
|
Update the model and add required features. |
|
Get a nodeset around the apex point. |
|
Use universal coordinates to generate a stiff base region. |
|
Create a part for solids close to the atrial caps. |
List of parts. |
|
List of part names. |
|
List of used part IDs. |
|
List of all defined surfaces. |
|
List of all defined surface names. |
|
List of all defined surface IDs. |
|
List of all cavities in the model. |
|
Dictionary that maps the part name to the part ID. |
|
Dictionary that maps the part ID to the part name. |
|
Dictionary that maps the surface name to the surface ID. |
|
Dictionary that maps the surface ID to the surface name. |
|
l4cv axis. |
|
l2cv axis. |
|
l2cv axis. |
|
List of cap centroids. |
|
List of conduction paths. |
|
Conduction mesh. |
Working directory. |
|
Computational mesh. |
|
Generated fluid mesh. |
|
Electrodes positions for ECG computing. |
Represent self as string. |
Import detail#
from ansys.health.heart.models import HeartModel
Property detail#
- property HeartModel.parts: List[ansys.health.heart.objects.Part]#
List of parts.
- property HeartModel.surfaces: List[ansys.health.heart.objects.SurfaceMesh]#
List of all defined surfaces.
- property HeartModel.cavities: List[ansys.health.heart.objects.Cavity]#
List of all cavities in the model.
- property HeartModel.surface_name_to_surface_id: dict#
Dictionary that maps the surface name to the surface ID.
- property HeartModel.surface_id_to_surface_name: dict#
Dictionary that maps the surface ID to the surface name.
- property HeartModel.cap_centroids#
List of cap centroids.
- property HeartModel.conduction_paths#
List of conduction paths.
- property HeartModel.conduction_mesh#
Conduction mesh.
Attribute detail#
- HeartModel.workdir#
Working directory.
- HeartModel.mesh#
Computational mesh.
- HeartModel.fluid_mesh#
Generated fluid mesh.
- HeartModel.electrodes: List[ansys.health.heart.objects.Point] = []#
Electrodes positions for ECG computing.
Method detail#
- HeartModel.assign_conduction_paths(paths: ansys.health.heart.pre.conduction_path.ConductionPath | list[ansys.health.heart.pre.conduction_path.ConductionPath])#
Assign conduction paths to the model.
- Parameters:
- beams
ConductionBeams
|list
[ConductionBeams
] List of conduction beams.
- beams
Notes
If conduction paths are already defined, they are removed.
- HeartModel.__str__()#
Represent self as string.
- HeartModel.create_part_by_ids(eids: List[int], name: str) None | ansys.health.heart.objects.Part #
Create a part by element IDs.
- HeartModel.load_input(input_vtp: pyvista.PolyData, part_definitions: dict, scalar: str)#
Load an input model.
- HeartModel.mesh_volume(use_wrapper: bool = False, overwrite_existing_mesh: bool = True, global_mesh_size: float = 1.5, path_to_fluent_mesh: str = None, mesh_size_per_part: dict = None, _global_wrap_size: float = 1.5, _wrap_size_per_part: dict = None) ansys.health.heart.objects.Mesh #
Remesh the input model and fill the volume.
- Parameters:
- use_wrapperbool, default:
False
Whether to use the non-manifold mesher.
- overwrite_existing_meshbool, default:
True
Whether to overwrite the existing MSH.H5 mesh.
- global_mesh_size
float
, default: 1.5 Global mesh size for the generated mesh.
- path_to_fluent_mesh
str
, default:None
Path to the generated Fluent MSH.H5 mesh.
- mesh_size_per_part
dict
, default:None
Dictionary specifying the target mesh size for each part.
- _global_wrap_size
float
, default: 1.5 Global size for setting up the size-field for the shrink-wrap algorithm.
- _wrap_size_per_part
dict
, default:None
Per part size for setting up the size-field for the shrink-wrap algorithm.
- use_wrapperbool, default:
Notes
When the input surfaces are non-manifold, the wrapper tries to reconstruct the surface and parts. Inevitably this leads to reconstruction errors. Nevertheless, in many instances, this approach is more robust than meshing from a manifold surface. Moreover, any clear interface between parts is potentially lost.
When the
mesh_size_per_part
attribute is incomplete, remaining part sizes default to the global mesh size. This is an experimental setting. Any wrap sizes given as input arguments are ignored when the wrapper is not used.Examples
>>> from ansys.health.heart.models import HeartModel >>> model = HeartModel() >>> model.load_input(geom, part_definitions, scalar) >>> # mesh the volume with a global size of 1.5 and size of 1 for the left ventricle. >>> model.mesh_volume( ... use_wrapper=True, ... global_mesh_size=1.5, ... path_to_fluent_mesh="simulation-mesh.msh.h5", ... mesh_size_per_part={"Left ventricle": 1}, ... )
- HeartModel.get_part(name: str, by_substring: bool = False) ansys.health.heart.objects.Part | None #
Get a specific part based on a part name.
- HeartModel.plot_mesh(show_edges: bool = True, color_by: str = '_volume-id')#
Plot the volume mesh of the heart model.
- Parameters:
Examples
>>> import ansys.health.heart.models as models >>> model = models.HeartModel.load_model("heart_model.pickle") >>> model.plot_mesh(show_edges=True)
- HeartModel.plot_part(part: ansys.health.heart.objects.Part)#
Plot a part in the mesh.
- Parameters:
- part
Part
Part to highlight in the mesh.
- part
Examples
>>> import ansys.health.heart.models as models >>> model = models.HeartModel.load_model("my_model.pickle") >>> model.part(model.left_ventricle)
- HeartModel.plot_fibers(n_seed_points: int = 1000)#
Plot the mesh and fibers as streamlines.
- Parameters:
Examples
>>> import ansys.health.heart.models as models >>> model = models.HeartModel.load_model("my_model.pickle") >>> model.plot_fibers(n_seed_points=5000)
- HeartModel.plot_surfaces(show_edges: bool = True)#
Plot all surfaces in the model.
Examples
Import modules and load model.
>>> import ansys.health.heart.models as models >>> model = models.HeartModel.load_model("my_model.pickle")
Plot the model.
>>> model.plot(show_edges=True)
- HeartModel.plot_purkinje()#
Plot the mesh and Purkinje network.
- HeartModel.save_model(filename: str)#
Save the model and necessary information to reconstruct.
- Parameters:
- filename
str
Path to the model.
- filename
Notes
The mesh of the heart model is saved as a VTU file. An additional
partinfo.json
file is written to reconstruct the heart model from the VTU file.Examples
>>> model.save_model("my-heart-model.vtu")
- HeartModel.load_model_from_mesh(filename_mesh: str, filename_part_info: str)#
Load a model from an existing VTU file and part information dictionary.
- Parameters:
Examples
>>> from ansys.health.heart.models import FullHeart >>> model: FullHeart = FullHeart() >>> model.load_model_from_mesh("mesh.vtu", "mesh.partinfo.json")
- HeartModel.update()#
Update the model and add required features.
Notes
Synchronize input parts to model parts.
Extract septum elements from the left ventricle.
Assign elements to parts.
Assign surfaces to each part.
Validate parts and surfaces.
Assign cavities to parts.
Update cap types.
Validate cap names.
Extract apical points.
Compute heart axis.
Add placeholder data for fiber and sheet directions.
- HeartModel.get_apex_node_set(part: Literal['left', 'right'] = 'left', option: Literal['endocardium', 'epicardium', 'myocardium'] = 'epicardium', radius: float = 3) numpy.ndarray #
Get a nodeset around the apex point.
- Parameters:
- part
Literal
[“left”, “right”], default: “left” On which part.
- option
Literal
[“endocardium”, “epicardium”, “myocardium”], default: “epicardium” On surface or in mesh.
- radius
float
, default: 3 Search in radius.
- part
- Returns:
np.ndarray
Apex nodeset
- HeartModel.create_stiff_ventricle_base(threshold_left_ventricle: float = 0.9, threshold_right_ventricle: float = 0.95, stiff_material: ansys.health.heart.settings.material.material.MechanicalMaterialModel = Mat295(rho=0.001, iso=ISO(itype=1, beta=2, kappa=10, mu1=0.1, alpha1=2))) None | ansys.health.heart.objects.Part #
Use universal coordinates to generate a stiff base region.
- Parameters:
- threshold_left_ventricle
float
, default: 0.9 If the
uvc_l
value is larger than this threshold in the left ventricle, it is set as stiff material.- threshold_right_ventricle
float
, default: 0.95 If the
uvc_l
value is larger than this threshold in the right ventricle, it is set to a stiff material.- stiff_material
MechanicalMaterialModel
, default:MAT295
(rho=0.001, iso=ISO(itype=1, beta=2, kappa=10, mu1=0.1, alpha1=2) Material to assign.
- threshold_left_ventricle
- Returns:
Part
Part associated with the stiff base region.
- HeartModel.create_atrial_stiff_ring(radius: float = 2) None | ansys.health.heart.objects.Part #
Create a part for solids close to the atrial caps.
- Parameters:
- radius
foat
, default: 2 Influence region.
- radius
- Returns:
Union
[None
,Part
]Part of atrial rings if created.
Notes
Part created is passive and isotropic. The material must be defined.