API documentaion#
simcardems.cli module#
simcardems.config module#
- class simcardems.config.Config(outdir: pathlib.Path | str = 'results', outfilename: str = 'results.h5', geometry_path: pathlib.Path | str = '', geometry_schema_path: pathlib.Path | str | NoneType = None, T: float = 1000, dt: float = 0.05, bnd_rigid: bool = False, load_state: bool = False, cell_init_file: pathlib.Path | str = '', show_progress_bar: bool = True, save_freq: int = 1, pre_stretch: dolfin.function.constant.Constant | float | NoneType = None, traction: dolfin.function.constant.Constant | float = None, spring: dolfin.function.constant.Constant | float = None, fix_right_plane: bool = False, loglevel: int = 20, num_refinements: int = 1, set_material: str = '', debug_mode: bool = False, drug_factors_file: pathlib.Path | str = '', popu_factors_file: pathlib.Path | str = '', disease_state: str = 'healthy', dt_mech: float = 1.0, mech_threshold: float = 0.05, mechanics_solve_strategy: Literal['fixed', 'adaptive'] = 'adaptive', ep_ode_scheme: str = 'GRL1', ep_preconditioner: str = 'sor', ep_theta: float = 0.5, linear_mechanics_solver: str = 'mumps', mechanics_use_continuation: bool = False, mechanics_use_custom_newton_solver: bool = False, PCL: float = 1000, coupling_type: Literal['fully_coupled_ORdmm_Land', 'fully_coupled_Tor_Land', 'explicit_ORdmm_Land', 'pureEP_ORdmm_Land'] = 'fully_coupled_ORdmm_Land')[source]#
Bases:
object
- PCL: float = 1000#
- T: float = 1000#
- bnd_rigid: bool = False#
- cell_init_file: Path | str = ''#
- coupling_type: Literal['fully_coupled_ORdmm_Land', 'fully_coupled_Tor_Land', 'explicit_ORdmm_Land', 'pureEP_ORdmm_Land'] = 'fully_coupled_ORdmm_Land'#
- debug_mode: bool = False#
- disease_state: str = 'healthy'#
- drug_factors_file: Path | str = ''#
- dt: float = 0.05#
- dt_mech: float = 1.0#
- ep_ode_scheme: str = 'GRL1'#
- ep_preconditioner: str = 'sor'#
- ep_theta: float = 0.5#
- fix_right_plane: bool = False#
- geometry_path: Path | str = ''#
- geometry_schema_path: Path | str | None = None#
- linear_mechanics_solver: str = 'mumps'#
- load_state: bool = False#
- loglevel: int = 20#
- mech_threshold: float = 0.05#
- mechanics_solve_strategy: Literal['fixed', 'adaptive'] = 'adaptive'#
- mechanics_use_continuation: bool = False#
- mechanics_use_custom_newton_solver: bool = False#
- num_refinements: int = 1#
- outdir: Path | str = 'results'#
- outfilename: str = 'results.h5'#
- popu_factors_file: Path | str = ''#
- pre_stretch: Constant | float | None = None#
- save_freq: int = 1#
- set_material: str = ''#
- show_progress_bar: bool = True#
- spring: Constant | float = None#
- traction: Constant | float = None#
simcardems.datacollector module#
- class simcardems.datacollector.Assigners(*, vs: SplittingSolver | None = None, mech_state: MechanicsProblem | None = None)[source]#
Bases:
object
Helper class to assign subfunctions from EP and Mechanics state
- class simcardems.datacollector.DataCollector(outdir, geo: BaseGeometry, outfilename: str = 'results.h5', reset_state=True)[source]#
Bases:
object
- property function_names: Dict[str, List[str]]#
- property names: Dict[str, List[str]]#
- property results_file#
- property valid_reductions: List[str]#
- class simcardems.datacollector.DataGroups(value)[source]#
Bases:
Enum
An enumeration.
- ep = 'ep'#
- mechanics = 'mechanics'#
- class simcardems.datacollector.DataLoader(h5name: Path | str, empty_ok: bool = False)[source]#
Bases:
object
- property ep_mesh#
- extract_value(group: DataGroups, name: str, t: str | float, reduction: str = 'average')[source]#
- property function_names: Dict[str, List[str]]#
- get(group: DataGroups, name: str, t: str | float) Function [source]#
Retrieve the function from the file
- Parameters:
group (DataGroups) – The group where the function is stored, either ‘ep’ or ‘mechanics’
name (str) – Name of the function
t (Union[str, float]) – Time stamp you want to use. See DataLoader.time_stamps
- Returns:
The function
- Return type:
dolfin.Function
- Raises:
KeyError – If group does not exist in the file
KeyError – If name does not exist in group
KeyError – If ‘t’ provided is not among the time stamps
- property mech_mesh#
- property residual: List[ndarray]#
- property size: int#
simcardems.ep_model module#
- simcardems.ep_model.define_conductivity_tensor(microstructure: Microstructure, chi: float = 140.0, C_m: float = 0.01)[source]#
- simcardems.ep_model.handle_cell_inits(CellModel: Type[CardiacCellModel], cell_inits: Dict[str, float] | None = None, cell_init_file: str = '') Dict[str, float] [source]#
- simcardems.ep_model.handle_cell_params(CellModel: Type[BaseCellModel], cell_params: Dict[str, float] | None = None, disease_state: str = 'healthy', drug_factors_file: str = '', popu_factors_file: str = '')[source]#
- simcardems.ep_model.setup_cell_model(cls, coupling: BaseEMCoupling, cell_params=None, cell_inits=None, cell_init_file=None, drug_factors_file=None, popu_factors_file=None, disease_state='healthy')[source]#
- simcardems.ep_model.setup_model(cellmodel: CardiacCellModel, mesh: Mesh, microstructure: Microstructure, stimulus_domain: StimulusDomain, PCL: int = 1000, chi: float = 140.0, C_m: float = 0.01, duration: float = 2.0, A: float = 50000.0) CardiacModel [source]#
Set-up cardiac model based on benchmark parameters
- Parameters:
cellmodel (cbcbeat.CardiacCellModel) – _description_
mesh (dolfin.Mesh) – _description_
microstructure (pulse.Microstructure) – _description_
PCL (int, optional) – _description_, by default 1000
chi (float, optional) – Surface to volume ratio in mm^{-1}, by default 140.0
C_m (float, optional) – Membrane capacitance in mu F / mm^2, by default 0.01
duration (float, optional) – Stimulation duration in milliseconds, by default 2.0
A (float, optional) – FIXME: Some value in mu A/cm^3, by default 50_000.0
- Returns:
The EP model
- Return type:
cbcbeat.CardiacModel
- simcardems.ep_model.setup_solver(dt, cellmodel: cbcbeat.CardiacCellModel, coupling: BaseEMCoupling, scheme='GRL1', theta=0.5, preconditioner='sor', PCL=1000) cbcbeat.SplittingSolver [source]#
simcardems.geometry module#
- class simcardems.geometry.BaseGeometry(parameters: Dict[str, Any] | None = None, stimulus_domain: StimulusDomain | Callable[[Mesh], StimulusDomain] | None = None, mechanics_mesh: Mesh | None = None, ep_mesh: Mesh | None = None, microstructure: Microstructure | None = None, microstructure_ep: Microstructure | None = None, ffun: MeshFunction | None = None, ffun_ep: MeshFunction | None = None, markers: Dict[str, Tuple[int, int]] | None = None, outdir: Path | str | None = None)[source]#
Bases:
ABC
Abstract geometry base class
- static default_stimulus_domain(mesh: Mesh) StimulusDomain [source]#
- property ds#
Return the surface measure of exterior facets using self.mesh as domain and self.ffun as subdomain_data
- property dx#
Return the volume measure using self.mesh
- property ep_mesh: Mesh#
- property f0: Function#
- property f0_ep: Function#
- property facet_normal: FacetNormal#
- property ffun: MeshFunction#
- property ffun_ep: MeshFunction#
- classmethod from_files(mesh_path: Path | str, ffun_path: Path | str | None = None, marker_path: Path | str | None = None, parameter_path: Path | str | None = None, microstructure_path: Path | str | None = None, **kwargs)[source]#
- property marker_functions#
- property mechanics_mesh: Mesh#
- property mesh: Mesh#
- property microstructure: Microstructure#
- property microstructure_ep: Microstructure#
- property n0: Function#
- property n0_ep: Function#
- property num_refinements: int#
- property outdir: Path | None#
- property s0: Function#
- property s0_ep: Function#
- class simcardems.geometry.StimulusDomain(domain, marker)[source]#
Bases:
NamedTuple
- domain: MeshFunction#
Alias for field number 0
- marker: int#
Alias for field number 1
- simcardems.geometry.load_geometry(mesh_path: Path | str, schema_path: Path | str | None = None, stimulus_domain: StimulusDomain | Callable[[Mesh], StimulusDomain] | None = None) BaseGeometry [source]#
- simcardems.geometry.refine_mesh(mesh: Mesh, num_refinements: int, redistribute: bool = False) Mesh [source]#
- class simcardems.slabgeometry.SlabGeometry(parameters: Dict[str, Any] | None = None, stimulus_domain: StimulusDomain | Callable[[Mesh], StimulusDomain] | None = None, mechanics_mesh: Mesh | None = None, ep_mesh: Mesh | None = None, microstructure: Microstructure | None = None, microstructure_ep: Microstructure | None = None, ffun: MeshFunction | None = None, ffun_ep: MeshFunction | None = None, markers: Dict[str, Tuple[int, int]] | None = None, outdir: Path | str | None = None)[source]#
Bases:
BaseGeometry
- simcardems.slabgeometry.create_slab_facet_function(mesh: Mesh, lx: float, ly: float, lz: float, markers: Dict[str, Tuple[int, int]] | None = None) MeshFunction [source]#
- class simcardems.lvgeometry.LeftVentricularGeometry(parameters: Dict[str, Any] | None = None, stimulus_domain: StimulusDomain | Callable[[Mesh], StimulusDomain] | None = None, mechanics_mesh: Mesh | None = None, ep_mesh: Mesh | None = None, microstructure: Microstructure | None = None, microstructure_ep: Microstructure | None = None, ffun: MeshFunction | None = None, ffun_ep: MeshFunction | None = None, markers: Dict[str, Tuple[int, int]] | None = None, outdir: Path | str | None = None)[source]#
Bases:
BaseGeometry
simcardems.mechanics_model module#
- class simcardems.mechanics_model.ContinuationBasedMechanicsProblem(*args, **kwargs)[source]#
Bases:
MechanicsProblem
- class simcardems.mechanics_model.MechanicsProblem(*args, **kwargs)[source]#
Bases:
ContinuationBasedMechanicsProblem
- property u_subspace_index: int#
- class simcardems.mechanics_model.RigidMotionProblem(*args, **kwargs)[source]#
Bases:
MechanicsProblem
- property u_subspace_index: int#
- simcardems.mechanics_model.create_problem(material: Material, geo: BaseGeometry, bnd_rigid: bool = False, pre_stretch: Constant | float | None = None, traction: Constant | float | None = None, spring: Constant | float | None = None, fix_right_plane: bool = False, linear_solver='mumps', use_custom_newton_solver: bool = False, debug_mode=False) MechanicsProblem [source]#
- simcardems.mechanics_model.resolve_boundary_conditions(geo: BaseGeometry, pre_stretch: Constant | float | None = None, traction: Constant | float | None = None, spring: Constant | float | None = None, fix_right_plane: bool = False) BoundaryConditions [source]#
- simcardems.mechanics_model.setup_solver(coupling: em_model.BaseEMCoupling, ActiveModel, bnd_rigid: bool = False, pre_stretch: Optional[Union[dolfin.Constant, float]] = None, traction: Union[dolfin.Constant, float] = None, spring: Union[dolfin.Constant, float] = None, fix_right_plane: bool = False, debug_mode: bool = False, set_material: str = '', linear_solver='mumps', use_custom_newton_solver: bool = False, state_prev=None)[source]#
Setup mechanics model with dirichlet boundary conditions or rigid motion.
simcardems.newton_solver module#
- class simcardems.newton_solver.MechanicsNewtonSolver(problem: NonlinearProblem, state: Function, update_cb=None, parameters=None)[source]#
Bases:
NewtonSolver
- converged(self: dolfin.cpp.nls.NewtonSolver, arg0: dolfin.cpp.la.GenericVector, arg1: dolfin::NonlinearProblem, arg2: int) bool [source]#
- class simcardems.newton_solver.MechanicsNewtonSolver_ODE(problem: NonlinearProblem, state: Function, update_cb=None, parameters=None)[source]#
Bases:
MechanicsNewtonSolver
simcardems.postprocess module#
- simcardems.postprocess.activation_map(voltage: Iterable[Function], time_stamps: Iterable[float], V: FunctionSpace, threshold: float = 0.0, t0: float = 0.0) Function [source]#
- simcardems.postprocess.ecg(voltage: Iterable[Function], sigma_b: float, point1: tuple[float, float, float], point2: tuple[float, float, float], mesh: Mesh | None = None) list[float] [source]#
- simcardems.postprocess.ecg_recovery(*, v: Function, sigma_b: Constant | float, mesh: Mesh, dx: Measure | None = None, point: ndarray | None = None, r: Function | None = None) float [source]#
- simcardems.postprocess.extract_biomarkers(*, V: ndarray, time: ndarray, Ca: ndarray, Ta: ndarray | None = None, lmbda: ndarray | None = None, inv_lmbda: ndarray | None = None, u: ndarray | None = None) Dict[str, float] [source]#
- simcardems.postprocess.extract_sub_results(results_file: Path | str, output_file: Path | str, t_start: float = 0.0, t_end: float | None = None, names: Dict[str, List[str]] | None = None) DataCollector [source]#
Extract sub results from another results file. This can be useful if you have stored a lot of data in one file and you want to create a smaller file containing only a subset of the data (e.g only the last beat)
- Parameters:
results_file (utils.PathLike) – The input result file
output_file (utils.PathLike) – Path to file where you want to store the sub results
t_start (float, optional) – Time point indicating when the sub results should start, by default 0.0
t_end (float | None, optional) – Time point indicating when the sub results should end, by default None in which case it will choose the last time point
names (Optional[Dict[str, List[str]]], optional) – A dictionary of names for each group indicating which functions to extract for the sub results. If not provided (default) then all functions will be extracted.
- Returns:
A data collector containing the sub results
- Return type:
- Raises:
FileNotFoundError – If the input file does not exist
KeyError – If some of the names provided does not exists in the input file
- simcardems.postprocess.extract_traces(loader: DataLoader, reduction: str = 'average', names: List[Tuple[str, str]] | None = None) Dict[str, ndarray | Dict[str, ndarray]] [source]#
simcardems.save_load_functions module#
- simcardems.save_load_functions.dict_to_h5(data, h5name, h5group, use_attrs: bool = True, comm=None)[source]#
- simcardems.save_load_functions.h5pyfile(h5name, filemode='r', force_serial: bool = False, comm=None)[source]#
- simcardems.save_load_functions.load_initial_conditions_from_h5(path: str | Path, CellModel: Type[CardiacCellModel])[source]#
- simcardems.save_load_functions.load_state(path: str | Path, drug_factors_file: str | Path = '', popu_factors_file: str | Path = '', disease_state='healthy', PCL: float = 1000)[source]#
- simcardems.save_load_functions.mech_heart_to_bnd_cond(mech_heart: MechanicsProblem)[source]#
- simcardems.save_load_functions.save_state(path, config: Config, geo: BaseGeometry, state_params: Dict[str, float] | None = None)[source]#
simcardems.runner module#
- class simcardems.runner.Runner(config: Config | None = None, empty: bool = False)[source]#
Bases:
object
- classmethod from_models(coupling: BaseEMCoupling, config: Config | None = None, reset: bool = True)[source]#
- property outdir: Path#
- solve(T: float = 1000, save_freq: int = 1, show_progress_bar: bool = True, st_progress: ~typing.Any | None = None, default_save_condition: ~typing.Callable[[int, float, float], bool] = <function Runner.<lambda>>)[source]#
- property state_path: Path#
- property t: float#
- property t0: float#
- simcardems.runner.create_progressbar(time_stepper: TimeStepper | None = None, show_progress_bar: bool = True)[source]#
simcardems.utils module#
- class simcardems.utils.Projector(V: FunctionSpace, solver_type: str = 'lu', preconditioner_type: str = 'default')[source]#
Bases:
object
- simcardems.utils.float_to_constant(x: Constant | float) Constant [source]#
Convert float to a dolfin constant. If value is already a constant, do nothing.
- Parameters:
x (Union[dolfin.Constant, float]) – The value to be converted
- Returns:
The same value, wrapped in a constant
- Return type:
dolfin.Constant
simcardems.value_extractor module#
- class simcardems.value_extractor.SlabBoundary(mesh)[source]#
Bases:
Boundary
- property boundaries#
- property center#
- property xmax#
- property xmin#
- property ymax#
- property ymin#
- property zmax#
- property zmin#
- class simcardems.value_extractor.SlabBoundaryNodes(value)[source]#
Bases:
Enum
An enumeration.
- center = 'center'#
- xmax = 'xmax'#
- xmin = 'xmin'#
- ymax = 'ymax'#
- ymin = 'ymin'#
- zmax = 'zmax'#
- zmin = 'zmin'#
- class simcardems.value_extractor.ValueExtractor(geo: BaseGeometry)[source]#
Bases:
object
simcardems.version module#
Models#
simcardems.models.em_model module#
- class simcardems.models.em_model.BaseEMCoupling(geometry: BaseGeometry, t: float = 0.0, **kwargs)[source]#
Bases:
object
- property assigners: datacollector.Assigners#
- property coupling_type#
CustomType
- property dt_mechanics: float#
- static from_state(path: str | Path, drug_factors_file: str | Path = '', popu_factors_file: str | Path = '', disease_state='healthy', PCL: float = 1000)[source]#
- register_datacollector(collector: datacollector.DataCollector) None [source]#
- register_time_stepper(time_stepper: TimeStepper) None [source]#
- property state_params#
- simcardems.models.em_model.setup_EM_model(cls_EMCoupling, cls_CellModel, cls_ActiveModel, geometry: BaseGeometry, config: Config | None = None, cell_params: Dict[str, float] | None = None, cell_inits: Function | None = None, mech_state_init: Function | None = None, state_params: Dict[str, float] | None = None) BaseEMCoupling [source]#
- simcardems.models.em_model.setup_EM_model_from_config(config: Config, geometry: BaseGeometry | None = None, state_params: Dict[str, float] | None = None) BaseEMCoupling [source]#
simcardems.models.fully_coupled_ORdmm_Land#
- simcardems.models.fully_coupled_ORdmm_Land.ActiveModel#
alias of
LandModel
- simcardems.models.fully_coupled_ORdmm_Land.CellModel#
alias of
ORdmmLandFull
- class simcardems.models.fully_coupled_ORdmm_Land.EMCoupling(geometry: BaseGeometry, **state_params)[source]#
Bases:
BaseEMCoupling
- property assigners: datacollector.Assigners#
- property coupling_type#
CustomType
- property dt_mechanics: float#
- property ep_mesh#
- classmethod from_state(path: str | Path, drug_factors_file: str | Path = '', popu_factors_file: str | Path = '', disease_state='healthy', PCL: float = 1000) BaseEMCoupling [source]#
- interpolate(f_mech: Function, f_ep: Function) Function [source]#
Interpolates function from mechanics to ep mesh
- property mech_mesh#
- property mech_state: Function#
- register_datacollector(collector: datacollector.DataCollector) None [source]#
- register_mech_model(solver: mechanics_model.MechanicsProblem)[source]#
- register_time_stepper(time_stepper: TimeStepper) None [source]#
- property vs: Function#
simcardems.models.explicit_ORdmm_Land#
- class simcardems.models.explicit_ORdmm_Land.ActiveModel(coupling: EMCoupling, **kwargs)[source]#
Bases:
ActiveModel
- simcardems.models.explicit_ORdmm_Land.CellModel#
alias of
ORdmmLandExplicit
- class simcardems.models.explicit_ORdmm_Land.EMCoupling(geometry: BaseGeometry, lmbda: Function | None = None, **state_params)[source]#
Bases:
BaseEMCoupling
- property assigners: datacollector.Assigners#
- property coupling_type#
CustomType
- property dLambda_ep#
- property ep_mesh#
- classmethod from_state(path: str | Path, drug_factors_file: str | Path = '', popu_factors_file: str | Path = '', disease_state='healthy', PCL: float = 1000) BaseEMCoupling [source]#
- interpolate(f_mech: Function, f_ep: Function) Function [source]#
Interpolates function from mechanics to ep mesh
- property lmbda_mech#
- property lmbda_mech_func#
- property mech_mesh#
- property mech_state#
- register_datacollector(collector: datacollector.DataCollector) None [source]#
- register_mech_model(solver: mechanics_model.MechanicsProblem)[source]#
- property vs: Function#
simcardems.models.pureEP_ORdmm_Land#
- simcardems.models.pureEP_ORdmm_Land.CellModel#
alias of
ORdmmLandPureEp
- class simcardems.models.pureEP_ORdmm_Land.EMCoupling(geometry: BaseGeometry, t: float = 0.0, **kwargs)[source]#
Bases:
BaseEMCoupling
- property coupling_type#
CustomType
- property ep_mesh#
- classmethod from_state(path: str | Path, drug_factors_file: str | Path = '', popu_factors_file: str | Path = '', disease_state='healthy', PCL: float = 1000) BaseEMCoupling [source]#
- property vs: Function#
Module contents#
- class simcardems.Config(outdir: pathlib.Path | str = 'results', outfilename: str = 'results.h5', geometry_path: pathlib.Path | str = '', geometry_schema_path: pathlib.Path | str | NoneType = None, T: float = 1000, dt: float = 0.05, bnd_rigid: bool = False, load_state: bool = False, cell_init_file: pathlib.Path | str = '', show_progress_bar: bool = True, save_freq: int = 1, pre_stretch: dolfin.function.constant.Constant | float | NoneType = None, traction: dolfin.function.constant.Constant | float = None, spring: dolfin.function.constant.Constant | float = None, fix_right_plane: bool = False, loglevel: int = 20, num_refinements: int = 1, set_material: str = '', debug_mode: bool = False, drug_factors_file: pathlib.Path | str = '', popu_factors_file: pathlib.Path | str = '', disease_state: str = 'healthy', dt_mech: float = 1.0, mech_threshold: float = 0.05, mechanics_solve_strategy: Literal['fixed', 'adaptive'] = 'adaptive', ep_ode_scheme: str = 'GRL1', ep_preconditioner: str = 'sor', ep_theta: float = 0.5, linear_mechanics_solver: str = 'mumps', mechanics_use_continuation: bool = False, mechanics_use_custom_newton_solver: bool = False, PCL: float = 1000, coupling_type: Literal['fully_coupled_ORdmm_Land', 'fully_coupled_Tor_Land', 'explicit_ORdmm_Land', 'pureEP_ORdmm_Land'] = 'fully_coupled_ORdmm_Land')[source]#
Bases:
object
- PCL: float = 1000#
- T: float = 1000#
- bnd_rigid: bool = False#
- cell_init_file: Path | str = ''#
- coupling_type: Literal['fully_coupled_ORdmm_Land', 'fully_coupled_Tor_Land', 'explicit_ORdmm_Land', 'pureEP_ORdmm_Land'] = 'fully_coupled_ORdmm_Land'#
- debug_mode: bool = False#
- disease_state: str = 'healthy'#
- drug_factors_file: Path | str = ''#
- dt: float = 0.05#
- dt_mech: float = 1.0#
- ep_ode_scheme: str = 'GRL1'#
- ep_preconditioner: str = 'sor'#
- ep_theta: float = 0.5#
- fix_right_plane: bool = False#
- geometry_path: Path | str = ''#
- geometry_schema_path: Path | str | None = None#
- linear_mechanics_solver: str = 'mumps'#
- load_state: bool = False#
- loglevel: int = 20#
- mech_threshold: float = 0.05#
- mechanics_solve_strategy: Literal['fixed', 'adaptive'] = 'adaptive'#
- mechanics_use_continuation: bool = False#
- mechanics_use_custom_newton_solver: bool = False#
- num_refinements: int = 1#
- outdir: Path | str = 'results'#
- outfilename: str = 'results.h5'#
- popu_factors_file: Path | str = ''#
- pre_stretch: Constant | float | None = None#
- save_freq: int = 1#
- set_material: str = ''#
- show_progress_bar: bool = True#
- spring: Constant | float = None#
- traction: Constant | float = None#
- class simcardems.DataCollector(outdir, geo: BaseGeometry, outfilename: str = 'results.h5', reset_state=True)[source]#
Bases:
object
- property function_names: Dict[str, List[str]]#
- property names: Dict[str, List[str]]#
- property results_file#
- property valid_reductions: List[str]#
- class simcardems.DataLoader(h5name: Path | str, empty_ok: bool = False)[source]#
Bases:
object
- property ep_mesh#
- extract_value(group: DataGroups, name: str, t: str | float, reduction: str = 'average')[source]#
- property function_names: Dict[str, List[str]]#
- get(group: DataGroups, name: str, t: str | float) Function [source]#
Retrieve the function from the file
- Parameters:
group (DataGroups) – The group where the function is stored, either ‘ep’ or ‘mechanics’
name (str) – Name of the function
t (Union[str, float]) – Time stamp you want to use. See DataLoader.time_stamps
- Returns:
The function
- Return type:
dolfin.Function
- Raises:
KeyError – If group does not exist in the file
KeyError – If name does not exist in group
KeyError – If ‘t’ provided is not among the time stamps
- property mech_mesh#
- property residual: List[ndarray]#
- property size: int#
- class simcardems.MechanicsNewtonSolver(problem: NonlinearProblem, state: Function, update_cb=None, parameters=None)[source]#
Bases:
NewtonSolver
- converged(self: dolfin.cpp.nls.NewtonSolver, arg0: dolfin.cpp.la.GenericVector, arg1: dolfin::NonlinearProblem, arg2: int) bool [source]#
- class simcardems.MechanicsNewtonSolver_ODE(problem: NonlinearProblem, state: Function, update_cb=None, parameters=None)[source]#
Bases:
MechanicsNewtonSolver
- class simcardems.MechanicsProblem(*args, **kwargs)[source]#
Bases:
ContinuationBasedMechanicsProblem
- property u_subspace_index: int#
- class simcardems.RigidMotionProblem(*args, **kwargs)[source]#
Bases:
MechanicsProblem
- property u_subspace_index: int#
- class simcardems.Runner(config: Config | None = None, empty: bool = False)[source]#
Bases:
object
- classmethod from_models(coupling: BaseEMCoupling, config: Config | None = None, reset: bool = True)[source]#
- property outdir: Path#
- solve(T: float = 1000, save_freq: int = 1, show_progress_bar: bool = True, st_progress: ~typing.Any | None = None, default_save_condition: ~typing.Callable[[int, float, float], bool] = <function Runner.<lambda>>)[source]#
- property state_path: Path#
- property t: float#
- property t0: float#
- class simcardems.TimeStepper(*, t0: float, T: float, dt: float, use_ns: bool = True, st_progress: Any | None = None)[source]#
Bases:
object
- property T: float#
- property dt: float#
- static ms2ns(t: float) float [source]#
Convert from milliseconds to nanoseconds
- Parameters:
t (float) – Time in milliseconds
- Returns:
Time in nanoseconds
- Return type:
float
- static ns2ms(t: float) float [source]#
Convert nanoseconds to milliseconds
- Parameters:
t (float) – The time in nanoseconds
- Returns:
Time in milliseconds
- Return type:
float
- property total_steps: int#