physioblocks 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. physioblocks/__init__.py +37 -0
  2. physioblocks/base/__init__.py +27 -0
  3. physioblocks/base/operators.py +176 -0
  4. physioblocks/base/registers.py +108 -0
  5. physioblocks/computing/__init__.py +47 -0
  6. physioblocks/computing/assembling.py +291 -0
  7. physioblocks/computing/models.py +811 -0
  8. physioblocks/computing/quantities.py +354 -0
  9. physioblocks/configuration/__init__.py +38 -0
  10. physioblocks/configuration/aliases.py +203 -0
  11. physioblocks/configuration/base.py +123 -0
  12. physioblocks/configuration/computing/__init__.py +27 -0
  13. physioblocks/configuration/computing/quantities.py +56 -0
  14. physioblocks/configuration/constants.py +121 -0
  15. physioblocks/configuration/description/__init__.py +33 -0
  16. physioblocks/configuration/description/blocks.py +239 -0
  17. physioblocks/configuration/description/nets.py +155 -0
  18. physioblocks/configuration/functions.py +695 -0
  19. physioblocks/configuration/simulation/__init__.py +32 -0
  20. physioblocks/configuration/simulation/simulations.py +280 -0
  21. physioblocks/description/__init__.py +34 -0
  22. physioblocks/description/blocks.py +418 -0
  23. physioblocks/description/flux.py +157 -0
  24. physioblocks/description/nets.py +746 -0
  25. physioblocks/io/__init__.py +29 -0
  26. physioblocks/io/aliases.py +73 -0
  27. physioblocks/io/configuration.py +125 -0
  28. physioblocks/launcher/__main__.py +285 -0
  29. physioblocks/launcher/configuration.py +231 -0
  30. physioblocks/launcher/configure/__main__.py +99 -0
  31. physioblocks/launcher/constants.py +105 -0
  32. physioblocks/launcher/files.py +150 -0
  33. physioblocks/launcher/series.py +165 -0
  34. physioblocks/library/__init__.py +27 -0
  35. physioblocks/library/aliases/blocks/c_block.json +5 -0
  36. physioblocks/library/aliases/blocks/rc_block.json +5 -0
  37. physioblocks/library/aliases/blocks/rcr_block.json +5 -0
  38. physioblocks/library/aliases/blocks/spherical_cavity_block.json +5 -0
  39. physioblocks/library/aliases/blocks/valve_rl_block.json +5 -0
  40. physioblocks/library/aliases/flux/heart_flux_dof_couples.jsonc +4 -0
  41. physioblocks/library/aliases/model_components/active_law_macro_huxley_two_moments.json +5 -0
  42. physioblocks/library/aliases/model_components/rheology_fiber_additive.json +5 -0
  43. physioblocks/library/aliases/model_components/spherical_dynamics.json +5 -0
  44. physioblocks/library/aliases/model_components/velocity_law_hht.json +5 -0
  45. physioblocks/library/aliases/nets/circulation_alone_net.json +31 -0
  46. physioblocks/library/aliases/nets/spherical_heart_net.json +93 -0
  47. physioblocks/library/aliases/simulations/circulation_alone_forward_simulation.jsonc +55 -0
  48. physioblocks/library/aliases/simulations/default_forward_simulation.jsonc +7 -0
  49. physioblocks/library/aliases/simulations/default_time.jsonc +8 -0
  50. physioblocks/library/aliases/simulations/newton_method_solver.json +5 -0
  51. physioblocks/library/aliases/simulations/spherical_heart_forward_simulation.jsonc +157 -0
  52. physioblocks/library/aliases/simulations/spherical_heart_with_respiration_forward_simulation.jsonc +45 -0
  53. physioblocks/library/blocks/__init__.py +27 -0
  54. physioblocks/library/blocks/capacitances.py +516 -0
  55. physioblocks/library/blocks/cavity.py +192 -0
  56. physioblocks/library/blocks/valves.py +281 -0
  57. physioblocks/library/functions/__init__.py +27 -0
  58. physioblocks/library/functions/base_operations.py +129 -0
  59. physioblocks/library/functions/first_order.py +113 -0
  60. physioblocks/library/functions/piecewise.py +271 -0
  61. physioblocks/library/functions/trigonometric.py +78 -0
  62. physioblocks/library/functions/watchers.py +113 -0
  63. physioblocks/library/model_components/__init__.py +27 -0
  64. physioblocks/library/model_components/active_law.py +345 -0
  65. physioblocks/library/model_components/dynamics.py +986 -0
  66. physioblocks/library/model_components/rheology.py +160 -0
  67. physioblocks/library/model_components/velocity_law.py +169 -0
  68. physioblocks/references/circulation_alone_sim.jsonc +24 -0
  69. physioblocks/references/spherical_heart_respiration_sim.jsonc +33 -0
  70. physioblocks/references/spherical_heart_sim.jsonc +29 -0
  71. physioblocks/registers/__init__.py +32 -0
  72. physioblocks/registers/load_function_register.py +93 -0
  73. physioblocks/registers/save_function_register.py +106 -0
  74. physioblocks/registers/type_register.py +97 -0
  75. physioblocks/simulation/__init__.py +48 -0
  76. physioblocks/simulation/constants.py +30 -0
  77. physioblocks/simulation/functions.py +71 -0
  78. physioblocks/simulation/runtime.py +484 -0
  79. physioblocks/simulation/saved_quantities.py +129 -0
  80. physioblocks/simulation/setup.py +576 -0
  81. physioblocks/simulation/solvers.py +235 -0
  82. physioblocks/simulation/state.py +340 -0
  83. physioblocks/simulation/time_manager.py +354 -0
  84. physioblocks/utils/__init__.py +27 -0
  85. physioblocks/utils/dynamic_import_utils.py +150 -0
  86. physioblocks/utils/exceptions_utils.py +115 -0
  87. physioblocks/utils/gradient_test_utils.py +337 -0
  88. physioblocks/utils/math_utils.py +109 -0
  89. physioblocks-1.0.0.dist-info/METADATA +127 -0
  90. physioblocks-1.0.0.dist-info/RECORD +93 -0
  91. physioblocks-1.0.0.dist-info/WHEEL +4 -0
  92. physioblocks-1.0.0.dist-info/licenses/licenses/GPL-3.0-only.txt +674 -0
  93. physioblocks-1.0.0.dist-info/licenses/licenses/LGPL-3.0-only.txt +165 -0
@@ -0,0 +1,165 @@
1
+ # SPDX-FileCopyrightText: Copyright INRIA
2
+ #
3
+ # SPDX-License-Identifier: LGPL-3.0-only
4
+ #
5
+ # Copyright INRIA
6
+ #
7
+ # This file is part of PhysioBlocks, a library mostly developed by the
8
+ # [Ananke project-team](https://team.inria.fr/ananke) at INRIA.
9
+ #
10
+ # Authors:
11
+ # - Colin Drieu
12
+ # - Dominique Chapelle
13
+ # - François Kimmig
14
+ # - Philippe Moireau
15
+ #
16
+ # PhysioBlocks is free software: you can redistribute it and/or modify it under the
17
+ # terms of the GNU Lesser General Public License as published by the Free Software
18
+ # Foundation, version 3 of the License.
19
+ #
20
+ # PhysioBlocks is distributed in the hope that it will be useful, but WITHOUT ANY
21
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
22
+ # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
23
+ #
24
+ # You should have received a copy of the GNU Lesser General Public License along with
25
+ # PhysioBlocks. If not, see <https://www.gnu.org/licenses/>.
26
+
27
+ """
28
+ Defines function to handles series and simulation results
29
+ """
30
+
31
+ import socket
32
+ from dataclasses import dataclass
33
+ from datetime import datetime
34
+ from importlib.metadata import version
35
+ from pathlib import Path
36
+
37
+ import pandas as pd
38
+
39
+ import physioblocks
40
+ from physioblocks.launcher.constants import (
41
+ LAUNCHER_DATE_TIME_FORMAT,
42
+ LAUNCHER_HOSTNAME_SEPARATOR,
43
+ LAUNCHER_LOG_COLUMNS,
44
+ LAUNCHER_LOG_FILE_SEPARATOR,
45
+ LAUNCHER_REFERENCE_SEPARATOR,
46
+ )
47
+
48
+
49
+ @dataclass
50
+ class SimulationInfo:
51
+ machine_name: str
52
+ "the mane of the machine running the simulation"
53
+ date_time: str
54
+ "the time stamp of the simulation run"
55
+ series: str
56
+ "the simulation serie"
57
+ number: str
58
+ "the simulation number"
59
+ version: str
60
+ "the PhysioBlocks version used"
61
+ message: str = ""
62
+ "a note associated with the simulation"
63
+
64
+ @property
65
+ def reference(self) -> str:
66
+ return str.join(
67
+ LAUNCHER_REFERENCE_SEPARATOR, [self.machine_name, self.series, self.number]
68
+ )
69
+
70
+ @property
71
+ def data_frame(self) -> pd.DataFrame:
72
+ return pd.DataFrame(
73
+ [
74
+ [
75
+ self.date_time,
76
+ self.machine_name,
77
+ self.reference,
78
+ self.version,
79
+ self.message,
80
+ ]
81
+ ],
82
+ columns=LAUNCHER_LOG_COLUMNS,
83
+ )
84
+
85
+ def __str__(self) -> str:
86
+ return str.join(
87
+ LAUNCHER_LOG_FILE_SEPARATOR,
88
+ (
89
+ self.date_time,
90
+ self.machine_name,
91
+ self.reference,
92
+ self.version,
93
+ self.message,
94
+ ),
95
+ )
96
+
97
+
98
+ def is_valid_reference_name(reference: str) -> bool:
99
+ dir_name_split = reference.split(LAUNCHER_REFERENCE_SEPARATOR)
100
+ return len(dir_name_split) >= 3 and str.isdigit(dir_name_split[-1])
101
+
102
+
103
+ def is_valid_reference_dir_name(dir_name: str, series_name: str) -> bool:
104
+ dir_name_split = dir_name.split(LAUNCHER_REFERENCE_SEPARATOR)
105
+ dir_series_name = LAUNCHER_REFERENCE_SEPARATOR.join(dir_name_split[1:-1])
106
+ return is_valid_reference_name(dir_name) and dir_series_name == series_name
107
+
108
+
109
+ def parse_reference_number(reference: str) -> tuple[str, str, int]:
110
+ split_ref = reference.split(LAUNCHER_REFERENCE_SEPARATOR)
111
+
112
+ if is_valid_reference_name(reference) is False:
113
+ raise ValueError(
114
+ str.format(
115
+ "{0} is not a valid simulation reference name.",
116
+ reference,
117
+ )
118
+ )
119
+
120
+ number = split_ref[-1]
121
+ serie = split_ref[-2]
122
+ machine = str.join(LAUNCHER_REFERENCE_SEPARATOR, split_ref[0:-2])
123
+
124
+ return machine, serie, int(number)
125
+
126
+
127
+ def reference_follows(tested_reference: str, base_reference: str) -> bool:
128
+ # Return true if the base reference comes after (or is the same as)
129
+ # the tested reference
130
+ parsed_tested = parse_reference_number(tested_reference)
131
+ parsed_base = parse_reference_number(base_reference)
132
+ return parsed_tested[1] == parsed_base[1] and parsed_tested[2] >= parsed_base[2]
133
+
134
+
135
+ def get_reference_number(serie_path: Path) -> str:
136
+ serie_name = serie_path.name
137
+ if serie_path.exists() is False:
138
+ raise FileNotFoundError(str.format("No series directory at {0}", serie_path))
139
+ numbers = [
140
+ int(d.name.split(LAUNCHER_REFERENCE_SEPARATOR)[-1])
141
+ for d in serie_path.iterdir()
142
+ if is_valid_reference_dir_name(d.name, serie_name) is True
143
+ ]
144
+ if len(numbers) > 0:
145
+ return str(max(numbers) + 1)
146
+
147
+ return str(1)
148
+
149
+
150
+ def get_simulation_info(serie_path: Path, message: str) -> SimulationInfo:
151
+ number = get_reference_number(serie_path)
152
+
153
+ # get the machine name
154
+ host_name = socket.gethostname()
155
+ machine_name = host_name.split(LAUNCHER_HOSTNAME_SEPARATOR, 2)[0]
156
+
157
+ # get the current time stamp
158
+ time_stamp = datetime.now().strftime(LAUNCHER_DATE_TIME_FORMAT)
159
+
160
+ # get the PhysioBlocks version
161
+ lib_version = version(physioblocks.__name__)
162
+
163
+ return SimulationInfo(
164
+ machine_name, time_stamp, serie_path.name, number, lib_version, message
165
+ )
@@ -0,0 +1,27 @@
1
+ # SPDX-FileCopyrightText: Copyright INRIA
2
+ #
3
+ # SPDX-License-Identifier: LGPL-3.0-only
4
+ #
5
+ # Copyright INRIA
6
+ #
7
+ # This file is part of PhysioBlocks, a library mostly developed by the
8
+ # [Ananke project-team](https://team.inria.fr/ananke) at INRIA.
9
+ #
10
+ # Authors:
11
+ # - Colin Drieu
12
+ # - Dominique Chapelle
13
+ # - François Kimmig
14
+ # - Philippe Moireau
15
+ #
16
+ # PhysioBlocks is free software: you can redistribute it and/or modify it under the
17
+ # terms of the GNU Lesser General Public License as published by the Free Software
18
+ # Foundation, version 3 of the License.
19
+ #
20
+ # PhysioBlocks is distributed in the hope that it will be useful, but WITHOUT ANY
21
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
22
+ # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
23
+ #
24
+ # You should have received a copy of the GNU Lesser General Public License along with
25
+ # PhysioBlocks. If not, see <https://www.gnu.org/licenses/>.
26
+
27
+ """Define objects (blocks, function, etc) usable in PhysioBlocks configurations"""
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "block_description",
3
+ "model_type": "c_block",
4
+ "time": "time"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "block_description",
3
+ "model_type": "rc_block",
4
+ "time": "time"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "block_description",
3
+ "model_type": "rcr_block",
4
+ "time": "time"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "block_description",
3
+ "model_type": "spherical_cavity_block",
4
+ "time": "time"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "block_description",
3
+ "model_type": "valve_rl_block",
4
+ "time": "time"
5
+ }
@@ -0,0 +1,4 @@
1
+ // Define available flux - dof types couples
2
+ {
3
+ "blood_flow": "blood_pressure"
4
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "model_description",
3
+ "model_type": "active_law_macro_huxley_two_moments",
4
+ "time": "time"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "model_description",
3
+ "model_type": "rheology_fiber_additive",
4
+ "time": "time"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "model_description",
3
+ "model_type": "spherical_dynamics",
4
+ "time": "time"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "model_description",
3
+ "model_type": "velocity_law_hht",
4
+ "time": "time"
5
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "type": "net",
3
+ "flux_dof_definitions": {"type": "heart_flux_dof_couples"},
4
+ "nodes": [
5
+ "aorta_proximal",
6
+ "aorta_distal",
7
+ "venous"
8
+ ],
9
+ "blocks": {
10
+ "circulation_aorta_proximal": {
11
+ "type": "rc_block",
12
+ "flux_type": "blood_flow",
13
+ "resistance": "aorta_proximal.resistance",
14
+ "capacitance": "aorta_proximal.capacitance",
15
+ "nodes": {
16
+ "1": "aorta_distal",
17
+ "2": "aorta_proximal"
18
+ }
19
+ },
20
+ "circulation_aorta_distal": {
21
+ "type": "rc_block",
22
+ "flux_type": "blood_flow",
23
+ "resistance": "aorta_distal.resistance",
24
+ "capacitance": "aorta_distal.capacitance",
25
+ "nodes": {
26
+ "1": "venous",
27
+ "2": "aorta_distal"
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,93 @@
1
+ {
2
+ "type": "net",
3
+ "flux_dof_definitions": {"type": "heart_flux_dof_couples"},
4
+ "nodes": [
5
+ "cavity",
6
+ "atrial",
7
+ "aorta_proximal",
8
+ "aorta_distal",
9
+ "venous"
10
+ ],
11
+ "blocks": {
12
+ "cavity": {
13
+ "type": "spherical_cavity_block",
14
+ "flux_type": "blood_flow",
15
+ "disp": "cavity.dynamics.disp",
16
+ "radius": "heart_radius",
17
+ "thickness": "heart_thickness",
18
+ "submodels": {
19
+ "dynamics": {
20
+ "type": "spherical_dynamics",
21
+ "fib_deform": "cavity.rheology.fib_deform",
22
+ "pressure": "cavity.blood_pressure",
23
+ "pressure_external": "pleural.pressure",
24
+ "vel": "cavity.velocity_law.vel",
25
+ "radius": "heart_radius",
26
+ "thickness": "heart_thickness",
27
+ "series_stiffness": "cavity.rheology.series_stiffness"
28
+ },
29
+ "velocity_law": {
30
+ "type": "velocity_law_hht",
31
+ "disp": "cavity.dynamics.disp"
32
+ },
33
+ "rheology": {
34
+ "type": "rheology_fiber_additive",
35
+ "disp": "cavity.dynamics.disp",
36
+ "active_tension_discr": "cavity.rheology.active_law.active_tension_discr",
37
+ "radius": "heart_radius",
38
+ "submodels": {
39
+ "active_law": {
40
+ "type": "active_law_macro_huxley_two_moments",
41
+ "fib_deform": "cavity.rheology.fib_deform",
42
+ "contractility": "heart_contractility"
43
+ }
44
+ }
45
+ }
46
+ },
47
+ "nodes": {
48
+ "1": "cavity"
49
+ }
50
+ },
51
+ "valve_atrium": {
52
+ "type": "valve_rl_block",
53
+ "flux_type": "blood_flow",
54
+ "backward_conductance": "conductance_iso",
55
+ "nodes": {
56
+ "1": "atrial",
57
+ "2": "cavity"
58
+ }
59
+ },
60
+ "valve_arterial": {
61
+ "type": "valve_rl_block",
62
+ "flux_type": "blood_flow",
63
+ "backward_conductance": "conductance_iso",
64
+ "nodes": {
65
+ "1": "cavity",
66
+ "2": "aorta_proximal"
67
+ }
68
+ },
69
+ "capacitance_valve": {
70
+ "type": "c_block",
71
+ "flux_type": "blood_flow",
72
+ "nodes": {
73
+ "1": "cavity"
74
+ }
75
+ },
76
+ "circulation_aorta_proximal": {
77
+ "type": "rc_block",
78
+ "flux_type": "blood_flow",
79
+ "nodes": {
80
+ "1": "aorta_distal",
81
+ "2": "aorta_proximal"
82
+ }
83
+ },
84
+ "circulation_aorta_distal": {
85
+ "type": "rc_block",
86
+ "flux_type": "blood_flow",
87
+ "nodes": {
88
+ "1": "venous",
89
+ "2": "aorta_distal"
90
+ }
91
+ }
92
+ }
93
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "type": "default_forward_simulation",
3
+ "net": {
4
+ "type": "circulation_alone_net",
5
+ "boundaries_conditions": {
6
+ "aorta_proximal": [
7
+ {
8
+ "type": "condition",
9
+ "condition_type": "blood_flow",
10
+ "condition_id": "aorta_proximal.blood_flow"
11
+ }
12
+ ],
13
+ "venous": [
14
+ {
15
+ "type": "condition",
16
+ "condition_type": "blood_pressure",
17
+ "condition_id": "venous.blood_pressure"
18
+ }
19
+ ]
20
+ }
21
+ },
22
+ "variables_magnitudes": {
23
+ "aorta_proximal.blood_pressure":1e5,
24
+ "aorta_distal.blood_pressure":1e5
25
+ },
26
+ "parameters": {
27
+ "heartbeat_duration": {"type": "product", "factors": [60.0] , "inverses": ["heart_rate"]},
28
+ "aorta_proximal.capacitance": 2.0e-10,
29
+ "aorta_proximal.blood_flow": {
30
+ "type": "rescale_two_phases_function",
31
+ "rescaled_period": "heartbeat_duration",
32
+ "alpha": 0.8,
33
+ "reference_function": [
34
+ [0.0, "aorta_proximal.blood_flow.min"],
35
+ [0.075, "aorta_proximal.blood_flow.min"],
36
+ [0.134, "aorta_proximal.blood_flow.max"],
37
+ [0.142, "aorta_proximal.blood_flow.max"],
38
+ [0.281, "aorta_proximal.blood_flow.min"],
39
+ [0.9, "aorta_proximal.blood_flow.min"]
40
+ ],
41
+ "phases": [0, 0, 1, 1, 0]
42
+
43
+ },
44
+ // initialize the distal capacitance from the distal time constant and resistance (Cc = tc / Rc)
45
+ // Required parameters initialization is: "aorta_distal.time_constant"
46
+ "aorta_distal.capacitance": {
47
+ "type": "product",
48
+ "factors": ["aorta_distal.time_constant"],
49
+ "inverses": ["aorta_distal.resistance"]
50
+ }
51
+ },
52
+ "solver": {
53
+ "iteration_max": 2 // This problem is linear
54
+ }
55
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "forward_simulation",
3
+ "time": {"type": "default_time"},
4
+ "solver": {
5
+ "type": "newton_method_solver"
6
+ }
7
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "type": "time",
3
+ // The parameter "start" and "end" must be provided
4
+ // "start":,
5
+ // "duration": ,
6
+ "step_size": 0.001,
7
+ "min_step": 6.25e-5
8
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "newton_solver",
3
+ "tolerance": 1e-9,
4
+ "iteration_max": 10
5
+ }
@@ -0,0 +1,157 @@
1
+ {
2
+ "type": "default_forward_simulation",
3
+ "net": {
4
+ "type": "spherical_heart_net",
5
+ "boundaries_conditions": {
6
+ "atrial": [
7
+ {
8
+ "type": "condition",
9
+ "condition_type": "blood_pressure",
10
+ "condition_id": "atrial.blood_pressure"
11
+ }
12
+ ],
13
+ "venous": [
14
+ {
15
+ "type": "condition",
16
+ "condition_type": "blood_pressure",
17
+ "condition_id": "venous.blood_pressure"
18
+ }
19
+ ]
20
+ }
21
+ },
22
+ "variables_initialization": {
23
+ "valve_atrium.flux": 0.0,
24
+ "valve_arterial.flux": 0.0,
25
+ "cavity.dynamics.disp": 0.0,
26
+ "cavity.velocity_law.vel": 0.0,
27
+ "cavity.velocity_law.accel": 0.0,
28
+ "cavity.rheology.fib_deform": 0.0,
29
+ "cavity.rheology.active_law.active_stiffness": 1.0,
30
+ "cavity.rheology.active_law.active_energy_sqrt": 0.0,
31
+ "cavity.rheology.active_law.active_tension_discr": 0.0
32
+ },
33
+ "variables_magnitudes": {
34
+ "valve_atrium.flux": 1.0e-3,
35
+ "valve_arterial.flux": 1.0e-3,
36
+ "cavity.dynamics.disp": 0.01,
37
+ "cavity.rheology.fib_deform": 0.1,
38
+ "cavity.velocity_law.vel": 0.1,
39
+ "cavity.velocity_law.accel": 1.0,
40
+ "aorta_proximal.blood_pressure": 1.0e4,
41
+ "aorta_distal.blood_pressure": 1.0e4,
42
+ "cavity.blood_pressure": 1.0e4,
43
+ "cavity.rheology.active_law.active_stiffness": 1.0e5,
44
+ "cavity.rheology.active_law.active_energy_sqrt": 10.0,
45
+ "cavity.rheology.active_law.active_tension_discr": 1.0e4
46
+ },
47
+ "parameters": {
48
+
49
+ // "Inverse the heart_rate to get the heartbeat period in seconds"
50
+ // Required parameters initialization is:
51
+ // heart_rate in beat / min
52
+ "heartbeat_duration": {"type": "product", "factors": [60.0] , "inverses": ["heart_rate"]},
53
+ "pleural.pressure": 0.0,
54
+ "diastole_scaling_factor": 0.80,
55
+
56
+ // dynamics section
57
+ "cavity.dynamics.vol_mass": 1000.0,
58
+ "cavity.dynamics.damping_coef": 70.0,
59
+
60
+ // velocity law section
61
+ "cavity.velocity_law.scheme_ts_hht": 0.4,
62
+
63
+ // rheology section
64
+ "cavity.rheology.series_stiffness": 100000000.0,
65
+ "cavity.rheology.damping_parallel": 70.0,
66
+
67
+ // active law section
68
+ "cavity.rheology.active_law.starling_abscissas": [
69
+ -0.1668,
70
+ -0.0073,
71
+ 0.0534,
72
+ 0.0969,
73
+ 0.1326,
74
+ 0.2016,
75
+ 0.4663,
76
+ 0.9187,
77
+ 1.1762
78
+ ],
79
+ "cavity.rheology.active_law.starling_ordinates": [
80
+ 0.0,
81
+ 0.5614,
82
+ 0.7748,
83
+ 0.8933,
84
+ 0.9618,
85
+ 1.0,
86
+ 1.0,
87
+ 0.1075,
88
+ 0.0
89
+ ],
90
+ "cavity.rheology.active_law.destruction_rate": 12.0,
91
+ "cavity.rheology.active_law.crossbridge_stiffness": 273000.0,
92
+
93
+ // Parametrize the active law activation
94
+ // Required parameters initialization are:
95
+ // heartbeat_duration
96
+ // active_law.activation.min
97
+ // active_law.activation.max
98
+ "active_law.activation.min": -20.0,
99
+ "active_law.activation.max": 35.0,
100
+ "cavity.rheology.active_law.activation": {
101
+ "type": "rescale_two_phases_function",
102
+ "rescaled_period": "heartbeat_duration",
103
+ "alpha": "diastole_scaling_factor",
104
+ "reference_function": [
105
+ [0.0, "active_law.activation.min"],
106
+ [0.027, "active_law.activation.min"],
107
+ [0.037, 0.0],
108
+ [0.145, "active_law.activation.max"],
109
+ [0.309, "active_law.activation.max"],
110
+ [0.417, 0.0],
111
+ [0.427, "active_law.activation.min"],
112
+ [0.9, "active_law.activation.min"]
113
+ ],
114
+ "phases": [0, 0, 1, 1, 1, 0, 0]
115
+ },
116
+
117
+ // Section to parametrize the atrial blood pressure
118
+ // Required parameters initialization are:
119
+ // heartbeat_duration
120
+ // atrial.blood_pressure.min
121
+ // atrial.blood_pressure.max
122
+ "atrial.blood_pressure": {
123
+ "type": "rescale_two_phases_function",
124
+ "rescaled_period": "heartbeat_duration",
125
+ "alpha": "diastole_scaling_factor",
126
+ "reference_function": [
127
+ [0.0, "atrial.blood_pressure.max"],
128
+ [0.02, "atrial.blood_pressure.max"],
129
+ [0.07, "atrial.blood_pressure.min"],
130
+ [0.84, "atrial.blood_pressure.min"],
131
+ [0.9, "atrial.blood_pressure.max"]
132
+ ],
133
+ "phases": [1, 1, 0, 1]
134
+ },
135
+
136
+ // valves section
137
+ "conductance_iso": 5e-12,
138
+ "valve_atrium.inductance": 1.0e3,
139
+ "valve_atrium.conductance": 9e-06,
140
+ "valve_arterial.inductance": 3.0e4,
141
+ "valve_arterial.conductance": 1.3e-05,
142
+ "capacitance_valve.capacitance": 5e-12,
143
+ "valve_atrium.scheme_ts_flux": 0.25,
144
+ "valve_arterial.scheme_ts_flux": 0.25,
145
+
146
+ // circulation section
147
+ "circulation_aorta_proximal.capacitance": 2.0e-10,
148
+
149
+ // initialize the distal capacitance from the distal time constant and resistance (Cc = tc / Rc)
150
+ // Required parameters initialization is: "circulation_aorta_distal.time_constant"
151
+ "circulation_aorta_distal.capacitance": {
152
+ "type": "product",
153
+ "factors": ["circulation_aorta_distal.time_constant"],
154
+ "inverses": ["circulation_aorta_distal.resistance"]
155
+ }
156
+ }
157
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ // Define a varying pleural pressure from a respiratory period
3
+ // on top of a default spherical heart forward simulation
4
+ // The required parameter in parent configuration are:
5
+ // pleural.pressure.min
6
+ // pleural.pressure.max
7
+ // respiration.period
8
+ "type": "spherical_heart_forward_simulation",
9
+ "parameters":{
10
+ // pleural.pressure.offset = (pleural.pressure.min + pleural.pressure.max) / 2
11
+ "pleural.pressure.offset": {
12
+ "type": "product",
13
+ "factors": [
14
+ {
15
+ "type": "sum",
16
+ "add" : ["pleural.pressure.min", "pleural.pressure.max"]
17
+ },
18
+ 0.5
19
+ ]
20
+ },
21
+ // pleural.pressure.amplitude = pleural.pressure.max - pleural.pressure.offset
22
+ "pleural.pressure.amplitude": {
23
+ "type": "sum",
24
+ "add": [
25
+ "pleural.pressure.max"
26
+ ],
27
+ "subtract": [
28
+ "pleural.pressure.offset"
29
+ ]
30
+ },
31
+ // pleural.pressure.frequency = 1 / "respiration.period"
32
+ "pleural.pressure.frequency": {
33
+ "type": "product",
34
+ "factors": [1.0],
35
+ "inverses": ["respiration.period"]
36
+ },
37
+ "pleural.pressure": {
38
+ "type": "sinus_offset",
39
+ "offset_value": "pleural.pressure.offset",
40
+ "amplitude": "pleural.pressure.amplitude",
41
+ "frequency": "pleural.pressure.frequency",
42
+ "phase_shift": 0.0
43
+ }
44
+ }
45
+ }