physioblocks 1.1.0__py3-none-any.whl → 1.1.2__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.
- physioblocks/__init__.py +1 -1
- physioblocks/launcher/__main__.py +10 -6
- physioblocks/references/full_configurations/circulation_alone_sim.jsonc +146 -0
- physioblocks/references/full_configurations/spherical_heart_respiration_sim.jsonc +387 -0
- physioblocks/references/full_configurations/spherical_heart_sim.jsonc +343 -0
- physioblocks/simulation/runtime.py +70 -64
- {physioblocks-1.1.0.dist-info → physioblocks-1.1.2.dist-info}/METADATA +2 -1
- {physioblocks-1.1.0.dist-info → physioblocks-1.1.2.dist-info}/RECORD +11 -8
- {physioblocks-1.1.0.dist-info → physioblocks-1.1.2.dist-info}/WHEEL +0 -0
- {physioblocks-1.1.0.dist-info → physioblocks-1.1.2.dist-info}/licenses/licenses/GPL-3.0-only.txt +0 -0
- {physioblocks-1.1.0.dist-info → physioblocks-1.1.2.dist-info}/licenses/licenses/LGPL-3.0-only.txt +0 -0
physioblocks/__init__.py
CHANGED
|
@@ -37,6 +37,7 @@ from pathlib import Path
|
|
|
37
37
|
from typing import Any
|
|
38
38
|
|
|
39
39
|
import pandas as pd
|
|
40
|
+
from rich.logging import RichHandler
|
|
40
41
|
|
|
41
42
|
import physioblocks.utils.exceptions_utils as exception_utils
|
|
42
43
|
from physioblocks.configuration import Configuration, load, unwrap_aliases
|
|
@@ -64,8 +65,9 @@ from physioblocks.simulation import AbstractSimulation, SimulationError
|
|
|
64
65
|
.. note:: When deleting a serie from the launcher folder, or a specific simulation from
|
|
65
66
|
a serie, the launchers logs are updated the next time any simulation is launched.
|
|
66
67
|
"""
|
|
68
|
+
FILE_LOG_FORMATTER = logging.Formatter(logging.BASIC_FORMAT)
|
|
69
|
+
RICH_LOG_FORMATTER = logging.Formatter("%(message)s", "[%X]")
|
|
67
70
|
|
|
68
|
-
SIMULATION_LOG_FORMATER = logging.Formatter(logging.BASIC_FORMAT)
|
|
69
71
|
_root_logger = logging.getLogger()
|
|
70
72
|
_root_logger.setLevel(logging.DEBUG)
|
|
71
73
|
|
|
@@ -90,8 +92,10 @@ def run_simulation(config: Configuration) -> pd.DataFrame:
|
|
|
90
92
|
return pd.DataFrame(results)
|
|
91
93
|
|
|
92
94
|
|
|
93
|
-
def add_log_handler(
|
|
94
|
-
handler.
|
|
95
|
+
def add_log_handler(
|
|
96
|
+
handler: logging.Handler, level: str | int, formatter: logging.Formatter
|
|
97
|
+
) -> None:
|
|
98
|
+
handler.setFormatter(formatter)
|
|
95
99
|
handler.setLevel(level)
|
|
96
100
|
_root_logger.addHandler(handler)
|
|
97
101
|
|
|
@@ -132,7 +136,7 @@ def main(
|
|
|
132
136
|
# configure the simulation log file (always in DEBUG)
|
|
133
137
|
log_file_path = sim_folder / str.join(".", [sim_info.reference, "log"])
|
|
134
138
|
file_handler = logging.FileHandler(log_file_path)
|
|
135
|
-
add_log_handler(file_handler, logging.DEBUG)
|
|
139
|
+
add_log_handler(file_handler, logging.DEBUG, FILE_LOG_FORMATTER)
|
|
136
140
|
|
|
137
141
|
# log the current simulation infos
|
|
138
142
|
_root_logger.info(str(sim_info))
|
|
@@ -260,8 +264,8 @@ if __name__ == "__main__":
|
|
|
260
264
|
|
|
261
265
|
# setup logger when verbose
|
|
262
266
|
if args.verbose is True:
|
|
263
|
-
stdout_handler = logging.StreamHandler(sys.stdout)
|
|
264
|
-
add_log_handler(
|
|
267
|
+
# stdout_handler = logging.StreamHandler(sys.stdout)
|
|
268
|
+
add_log_handler(RichHandler(), args.log_level, RICH_LOG_FORMATTER)
|
|
265
269
|
|
|
266
270
|
# create paths from arguments
|
|
267
271
|
root_folder_path = Path(args.launcher_directory).absolute()
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "forward_simulation",
|
|
3
|
+
"time": {
|
|
4
|
+
"type": "time",
|
|
5
|
+
"step_size": 0.001,
|
|
6
|
+
"min_step": 6.25e-05,
|
|
7
|
+
"start": 0.0,
|
|
8
|
+
"duration": 25.0
|
|
9
|
+
},
|
|
10
|
+
"solver": {
|
|
11
|
+
"type": "linear_solver"
|
|
12
|
+
},
|
|
13
|
+
"net": {
|
|
14
|
+
"type": "net",
|
|
15
|
+
"flux_dof_definitions": {
|
|
16
|
+
"blood_flow": "blood_pressure"
|
|
17
|
+
},
|
|
18
|
+
"nodes": [
|
|
19
|
+
"aorta_proximal",
|
|
20
|
+
"aorta_distal",
|
|
21
|
+
"venous"
|
|
22
|
+
],
|
|
23
|
+
"blocks": {
|
|
24
|
+
"circulation_aorta_proximal": {
|
|
25
|
+
"type": "block_description",
|
|
26
|
+
"model_type": "rc_block",
|
|
27
|
+
"time": "time",
|
|
28
|
+
"flux_type": "blood_flow",
|
|
29
|
+
"resistance": "aorta_proximal.resistance",
|
|
30
|
+
"capacitance": "aorta_proximal.capacitance",
|
|
31
|
+
"nodes": {
|
|
32
|
+
"1": "aorta_distal",
|
|
33
|
+
"2": "aorta_proximal"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"circulation_aorta_distal": {
|
|
37
|
+
"type": "block_description",
|
|
38
|
+
"model_type": "rc_block",
|
|
39
|
+
"time": "time",
|
|
40
|
+
"flux_type": "blood_flow",
|
|
41
|
+
"resistance": "aorta_distal.resistance",
|
|
42
|
+
"capacitance": "aorta_distal.capacitance",
|
|
43
|
+
"nodes": {
|
|
44
|
+
"1": "venous",
|
|
45
|
+
"2": "aorta_distal"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"boundaries_conditions": {
|
|
50
|
+
"aorta_proximal": [
|
|
51
|
+
{
|
|
52
|
+
"type": "condition",
|
|
53
|
+
"condition_type": "blood_flow",
|
|
54
|
+
"condition_id": "aorta_proximal.blood_flow"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"venous": [
|
|
58
|
+
{
|
|
59
|
+
"type": "condition",
|
|
60
|
+
"condition_type": "blood_pressure",
|
|
61
|
+
"condition_id": "venous.blood_pressure"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"variables_magnitudes": {
|
|
67
|
+
"aorta_proximal.blood_pressure": 100000.0,
|
|
68
|
+
"aorta_distal.blood_pressure": 100000.0
|
|
69
|
+
},
|
|
70
|
+
"parameters": {
|
|
71
|
+
"heartbeat_duration": {
|
|
72
|
+
"type": "product",
|
|
73
|
+
"factors": [
|
|
74
|
+
60.0
|
|
75
|
+
],
|
|
76
|
+
"inverses": [
|
|
77
|
+
"heart_rate"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"aorta_proximal.capacitance": 2e-10,
|
|
81
|
+
"aorta_proximal.blood_flow": {
|
|
82
|
+
"type": "rescale_two_phases_function",
|
|
83
|
+
"rescaled_period": "heartbeat_duration",
|
|
84
|
+
"alpha": 0.8,
|
|
85
|
+
"reference_function": [
|
|
86
|
+
[
|
|
87
|
+
0.0,
|
|
88
|
+
"aorta_proximal.blood_flow.min"
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
0.075,
|
|
92
|
+
"aorta_proximal.blood_flow.min"
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
0.134,
|
|
96
|
+
"aorta_proximal.blood_flow.max"
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
0.142,
|
|
100
|
+
"aorta_proximal.blood_flow.max"
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
0.281,
|
|
104
|
+
"aorta_proximal.blood_flow.min"
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
0.9,
|
|
108
|
+
"aorta_proximal.blood_flow.min"
|
|
109
|
+
]
|
|
110
|
+
],
|
|
111
|
+
"phases": [
|
|
112
|
+
0,
|
|
113
|
+
0,
|
|
114
|
+
1,
|
|
115
|
+
1,
|
|
116
|
+
0
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"aorta_distal.capacitance": {
|
|
120
|
+
"type": "product",
|
|
121
|
+
"factors": [
|
|
122
|
+
"aorta_distal.time_constant"
|
|
123
|
+
],
|
|
124
|
+
"inverses": [
|
|
125
|
+
"aorta_distal.resistance"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"heart_rate": 60.0,
|
|
129
|
+
"aorta_proximal.resistance": 7000000.0,
|
|
130
|
+
"aorta_distal.resistance": 110000000.0,
|
|
131
|
+
"aorta_distal.time_constant": 2.0,
|
|
132
|
+
"venous.blood_pressure": 1600.0,
|
|
133
|
+
"aorta_proximal.blood_flow.min": 0.0,
|
|
134
|
+
"aorta_proximal.blood_flow.max": 0.0005
|
|
135
|
+
},
|
|
136
|
+
"variables_initialization": {
|
|
137
|
+
"aorta_proximal.blood_pressure": 10760.0,
|
|
138
|
+
"aorta_distal.blood_pressure": 10760.0
|
|
139
|
+
},
|
|
140
|
+
"output_functions": {
|
|
141
|
+
"aorta_proximal.blood_flow": {
|
|
142
|
+
"type": "watch_quantity",
|
|
143
|
+
"quantity": "aorta_proximal.blood_flow"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "forward_simulation",
|
|
3
|
+
"time": {
|
|
4
|
+
"type": "time",
|
|
5
|
+
"step_size": 0.001,
|
|
6
|
+
"min_step": 6.25e-05,
|
|
7
|
+
"start": 0.0,
|
|
8
|
+
"duration": 25.0
|
|
9
|
+
},
|
|
10
|
+
"solver": {
|
|
11
|
+
"type": "newton_solver",
|
|
12
|
+
"tolerance": 1e-09,
|
|
13
|
+
"iteration_max": 10
|
|
14
|
+
},
|
|
15
|
+
"net": {
|
|
16
|
+
"type": "net",
|
|
17
|
+
"flux_dof_definitions": {
|
|
18
|
+
"blood_flow": "blood_pressure"
|
|
19
|
+
},
|
|
20
|
+
"nodes": [
|
|
21
|
+
"cavity",
|
|
22
|
+
"atrial",
|
|
23
|
+
"aorta_proximal",
|
|
24
|
+
"aorta_distal",
|
|
25
|
+
"venous"
|
|
26
|
+
],
|
|
27
|
+
"blocks": {
|
|
28
|
+
"cavity": {
|
|
29
|
+
"type": "block_description",
|
|
30
|
+
"model_type": "spherical_cavity_block",
|
|
31
|
+
"time": "time",
|
|
32
|
+
"flux_type": "blood_flow",
|
|
33
|
+
"disp": "cavity.dynamics.disp",
|
|
34
|
+
"radius": "heart_radius",
|
|
35
|
+
"thickness": "heart_thickness",
|
|
36
|
+
"submodels": {
|
|
37
|
+
"dynamics": {
|
|
38
|
+
"type": "model_description",
|
|
39
|
+
"model_type": "spherical_dynamics",
|
|
40
|
+
"time": "time",
|
|
41
|
+
"fib_deform": "cavity.rheology.fib_deform",
|
|
42
|
+
"pressure": "cavity.blood_pressure",
|
|
43
|
+
"pressure_external": "pleural.pressure",
|
|
44
|
+
"vel": "cavity.velocity_law.vel",
|
|
45
|
+
"radius": "heart_radius",
|
|
46
|
+
"thickness": "heart_thickness",
|
|
47
|
+
"series_stiffness": "cavity.rheology.series_stiffness"
|
|
48
|
+
},
|
|
49
|
+
"velocity_law": {
|
|
50
|
+
"type": "model_description",
|
|
51
|
+
"model_type": "velocity_law_hht",
|
|
52
|
+
"time": "time",
|
|
53
|
+
"disp": "cavity.dynamics.disp"
|
|
54
|
+
},
|
|
55
|
+
"rheology": {
|
|
56
|
+
"type": "model_description",
|
|
57
|
+
"model_type": "rheology_fiber_additive",
|
|
58
|
+
"time": "time",
|
|
59
|
+
"disp": "cavity.dynamics.disp",
|
|
60
|
+
"active_tension_discr": "cavity.rheology.active_law.active_tension_discr",
|
|
61
|
+
"radius": "heart_radius",
|
|
62
|
+
"submodels": {
|
|
63
|
+
"active_law": {
|
|
64
|
+
"type": "model_description",
|
|
65
|
+
"model_type": "active_law_macro_huxley_two_moments",
|
|
66
|
+
"time": "time",
|
|
67
|
+
"fib_deform": "cavity.rheology.fib_deform",
|
|
68
|
+
"contractility": "heart_contractility"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"nodes": {
|
|
74
|
+
"1": "cavity"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"valve_atrium": {
|
|
78
|
+
"type": "block_description",
|
|
79
|
+
"model_type": "valve_rl_block",
|
|
80
|
+
"time": "time",
|
|
81
|
+
"flux_type": "blood_flow",
|
|
82
|
+
"backward_conductance": "conductance_iso",
|
|
83
|
+
"nodes": {
|
|
84
|
+
"1": "atrial",
|
|
85
|
+
"2": "cavity"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"valve_arterial": {
|
|
89
|
+
"type": "block_description",
|
|
90
|
+
"model_type": "valve_rl_block",
|
|
91
|
+
"time": "time",
|
|
92
|
+
"flux_type": "blood_flow",
|
|
93
|
+
"backward_conductance": "conductance_iso",
|
|
94
|
+
"nodes": {
|
|
95
|
+
"1": "cavity",
|
|
96
|
+
"2": "aorta_proximal"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"capacitance_valve": {
|
|
100
|
+
"type": "block_description",
|
|
101
|
+
"model_type": "c_block",
|
|
102
|
+
"time": "time",
|
|
103
|
+
"flux_type": "blood_flow",
|
|
104
|
+
"nodes": {
|
|
105
|
+
"1": "cavity"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"circulation_aorta_proximal": {
|
|
109
|
+
"type": "block_description",
|
|
110
|
+
"model_type": "rc_block",
|
|
111
|
+
"time": "time",
|
|
112
|
+
"flux_type": "blood_flow",
|
|
113
|
+
"nodes": {
|
|
114
|
+
"1": "aorta_distal",
|
|
115
|
+
"2": "aorta_proximal"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"circulation_aorta_distal": {
|
|
119
|
+
"type": "block_description",
|
|
120
|
+
"model_type": "rc_block",
|
|
121
|
+
"time": "time",
|
|
122
|
+
"flux_type": "blood_flow",
|
|
123
|
+
"nodes": {
|
|
124
|
+
"1": "venous",
|
|
125
|
+
"2": "aorta_distal"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"boundaries_conditions": {
|
|
130
|
+
"atrial": [
|
|
131
|
+
{
|
|
132
|
+
"type": "condition",
|
|
133
|
+
"condition_type": "blood_pressure",
|
|
134
|
+
"condition_id": "atrial.blood_pressure"
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"venous": [
|
|
138
|
+
{
|
|
139
|
+
"type": "condition",
|
|
140
|
+
"condition_type": "blood_pressure",
|
|
141
|
+
"condition_id": "venous.blood_pressure"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"variables_initialization": {
|
|
147
|
+
"valve_atrium.flux": 0.0,
|
|
148
|
+
"valve_arterial.flux": 0.0,
|
|
149
|
+
"cavity.dynamics.disp": 0.0,
|
|
150
|
+
"cavity.velocity_law.vel": 0.0,
|
|
151
|
+
"cavity.velocity_law.accel": 0.0,
|
|
152
|
+
"cavity.rheology.fib_deform": 0.0,
|
|
153
|
+
"cavity.rheology.active_law.active_stiffness": 1.0,
|
|
154
|
+
"cavity.rheology.active_law.active_energy_sqrt": 0.0,
|
|
155
|
+
"cavity.rheology.active_law.active_tension_discr": 0.0,
|
|
156
|
+
"cavity.blood_pressure": "atrial.blood_pressure.max",
|
|
157
|
+
"aorta_proximal.blood_pressure": 10760.0,
|
|
158
|
+
"aorta_distal.blood_pressure": 10760.0
|
|
159
|
+
},
|
|
160
|
+
"variables_magnitudes": {
|
|
161
|
+
"valve_atrium.flux": 0.001,
|
|
162
|
+
"valve_arterial.flux": 0.001,
|
|
163
|
+
"cavity.dynamics.disp": 0.01,
|
|
164
|
+
"cavity.rheology.fib_deform": 0.1,
|
|
165
|
+
"cavity.velocity_law.vel": 0.1,
|
|
166
|
+
"cavity.velocity_law.accel": 1.0,
|
|
167
|
+
"aorta_proximal.blood_pressure": 10000.0,
|
|
168
|
+
"aorta_distal.blood_pressure": 10000.0,
|
|
169
|
+
"cavity.blood_pressure": 10000.0,
|
|
170
|
+
"cavity.rheology.active_law.active_stiffness": 100000.0,
|
|
171
|
+
"cavity.rheology.active_law.active_energy_sqrt": 10.0,
|
|
172
|
+
"cavity.rheology.active_law.active_tension_discr": 10000.0
|
|
173
|
+
},
|
|
174
|
+
"parameters": {
|
|
175
|
+
"heartbeat_duration": {
|
|
176
|
+
"type": "product",
|
|
177
|
+
"factors": [
|
|
178
|
+
60.0
|
|
179
|
+
],
|
|
180
|
+
"inverses": [
|
|
181
|
+
"heart_rate"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"pleural.pressure": {
|
|
185
|
+
"type": "sinus_offset",
|
|
186
|
+
"offset_value": "pleural.pressure.offset",
|
|
187
|
+
"amplitude": "pleural.pressure.amplitude",
|
|
188
|
+
"frequency": "pleural.pressure.frequency",
|
|
189
|
+
"phase_shift": 0.0
|
|
190
|
+
},
|
|
191
|
+
"diastole_scaling_factor": 0.8,
|
|
192
|
+
"cavity.dynamics.vol_mass": 1000.0,
|
|
193
|
+
"cavity.dynamics.damping_coef": 70.0,
|
|
194
|
+
"cavity.velocity_law.scheme_ts_hht": 0.4,
|
|
195
|
+
"cavity.rheology.series_stiffness": 100000000.0,
|
|
196
|
+
"cavity.rheology.damping_parallel": 70.0,
|
|
197
|
+
"cavity.rheology.active_law.starling_abscissas": [
|
|
198
|
+
-0.1668,
|
|
199
|
+
-0.0073,
|
|
200
|
+
0.0534,
|
|
201
|
+
0.0969,
|
|
202
|
+
0.1326,
|
|
203
|
+
0.2016,
|
|
204
|
+
0.4663,
|
|
205
|
+
0.9187,
|
|
206
|
+
1.1762
|
|
207
|
+
],
|
|
208
|
+
"cavity.rheology.active_law.starling_ordinates": [
|
|
209
|
+
0.0,
|
|
210
|
+
0.5614,
|
|
211
|
+
0.7748,
|
|
212
|
+
0.8933,
|
|
213
|
+
0.9618,
|
|
214
|
+
1.0,
|
|
215
|
+
1.0,
|
|
216
|
+
0.1075,
|
|
217
|
+
0.0
|
|
218
|
+
],
|
|
219
|
+
"cavity.rheology.active_law.destruction_rate": 12.0,
|
|
220
|
+
"cavity.rheology.active_law.crossbridge_stiffness": 273000.0,
|
|
221
|
+
"active_law.activation.min": -20.0,
|
|
222
|
+
"active_law.activation.max": 35.0,
|
|
223
|
+
"cavity.rheology.active_law.activation": {
|
|
224
|
+
"type": "rescale_two_phases_function",
|
|
225
|
+
"rescaled_period": "heartbeat_duration",
|
|
226
|
+
"alpha": "diastole_scaling_factor",
|
|
227
|
+
"reference_function": [
|
|
228
|
+
[
|
|
229
|
+
0.0,
|
|
230
|
+
"active_law.activation.min"
|
|
231
|
+
],
|
|
232
|
+
[
|
|
233
|
+
0.027,
|
|
234
|
+
"active_law.activation.min"
|
|
235
|
+
],
|
|
236
|
+
[
|
|
237
|
+
0.037,
|
|
238
|
+
0.0
|
|
239
|
+
],
|
|
240
|
+
[
|
|
241
|
+
0.145,
|
|
242
|
+
"active_law.activation.max"
|
|
243
|
+
],
|
|
244
|
+
[
|
|
245
|
+
0.309,
|
|
246
|
+
"active_law.activation.max"
|
|
247
|
+
],
|
|
248
|
+
[
|
|
249
|
+
0.417,
|
|
250
|
+
0.0
|
|
251
|
+
],
|
|
252
|
+
[
|
|
253
|
+
0.427,
|
|
254
|
+
"active_law.activation.min"
|
|
255
|
+
],
|
|
256
|
+
[
|
|
257
|
+
0.9,
|
|
258
|
+
"active_law.activation.min"
|
|
259
|
+
]
|
|
260
|
+
],
|
|
261
|
+
"phases": [
|
|
262
|
+
0,
|
|
263
|
+
0,
|
|
264
|
+
1,
|
|
265
|
+
1,
|
|
266
|
+
1,
|
|
267
|
+
0,
|
|
268
|
+
0
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
"atrial.blood_pressure": {
|
|
272
|
+
"type": "rescale_two_phases_function",
|
|
273
|
+
"rescaled_period": "heartbeat_duration",
|
|
274
|
+
"alpha": "diastole_scaling_factor",
|
|
275
|
+
"reference_function": [
|
|
276
|
+
[
|
|
277
|
+
0.0,
|
|
278
|
+
"atrial.blood_pressure.max"
|
|
279
|
+
],
|
|
280
|
+
[
|
|
281
|
+
0.02,
|
|
282
|
+
"atrial.blood_pressure.max"
|
|
283
|
+
],
|
|
284
|
+
[
|
|
285
|
+
0.07,
|
|
286
|
+
"atrial.blood_pressure.min"
|
|
287
|
+
],
|
|
288
|
+
[
|
|
289
|
+
0.84,
|
|
290
|
+
"atrial.blood_pressure.min"
|
|
291
|
+
],
|
|
292
|
+
[
|
|
293
|
+
0.9,
|
|
294
|
+
"atrial.blood_pressure.max"
|
|
295
|
+
]
|
|
296
|
+
],
|
|
297
|
+
"phases": [
|
|
298
|
+
1,
|
|
299
|
+
1,
|
|
300
|
+
0,
|
|
301
|
+
1
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
"conductance_iso": 5e-12,
|
|
305
|
+
"valve_atrium.inductance": 1000.0,
|
|
306
|
+
"valve_atrium.conductance": 9e-06,
|
|
307
|
+
"valve_arterial.inductance": 30000.0,
|
|
308
|
+
"valve_arterial.conductance": 1.3e-05,
|
|
309
|
+
"capacitance_valve.capacitance": 5e-12,
|
|
310
|
+
"valve_atrium.scheme_ts_flux": 0.25,
|
|
311
|
+
"valve_arterial.scheme_ts_flux": 0.25,
|
|
312
|
+
"circulation_aorta_proximal.capacitance": 2e-10,
|
|
313
|
+
"circulation_aorta_distal.capacitance": {
|
|
314
|
+
"type": "product",
|
|
315
|
+
"factors": [
|
|
316
|
+
"circulation_aorta_distal.time_constant"
|
|
317
|
+
],
|
|
318
|
+
"inverses": [
|
|
319
|
+
"circulation_aorta_distal.resistance"
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
"pleural.pressure.offset": {
|
|
323
|
+
"type": "product",
|
|
324
|
+
"factors": [
|
|
325
|
+
{
|
|
326
|
+
"type": "sum",
|
|
327
|
+
"add": [
|
|
328
|
+
"pleural.pressure.min",
|
|
329
|
+
"pleural.pressure.max"
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
0.5
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
"pleural.pressure.amplitude": {
|
|
336
|
+
"type": "sum",
|
|
337
|
+
"add": [
|
|
338
|
+
"pleural.pressure.max"
|
|
339
|
+
],
|
|
340
|
+
"subtract": [
|
|
341
|
+
"pleural.pressure.offset"
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
"pleural.pressure.frequency": {
|
|
345
|
+
"type": "product",
|
|
346
|
+
"factors": [
|
|
347
|
+
1.0
|
|
348
|
+
],
|
|
349
|
+
"inverses": [
|
|
350
|
+
"respiration.period"
|
|
351
|
+
]
|
|
352
|
+
},
|
|
353
|
+
"heart_radius": 0.034,
|
|
354
|
+
"heart_thickness": 0.0113,
|
|
355
|
+
"heart_contractility": 90000.0,
|
|
356
|
+
"heart_rate": 60.0,
|
|
357
|
+
"respiration.period": 5.0,
|
|
358
|
+
"venous.blood_pressure": 1600.0,
|
|
359
|
+
"atrial.blood_pressure.min": 450.0,
|
|
360
|
+
"atrial.blood_pressure.max": 900.0,
|
|
361
|
+
"pleural.pressure.min": 0.0,
|
|
362
|
+
"pleural.pressure.max": 300.0,
|
|
363
|
+
"circulation_aorta_proximal.resistance": 7000000.0,
|
|
364
|
+
"circulation_aorta_distal.resistance": 110000000.0,
|
|
365
|
+
"circulation_aorta_distal.time_constant": 2.0,
|
|
366
|
+
"cavity.dynamics.hyperelastic_cst": [
|
|
367
|
+
444.0,
|
|
368
|
+
2.9,
|
|
369
|
+
69.0,
|
|
370
|
+
6.5
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
"output_functions": {
|
|
374
|
+
"atrial.blood_pressure": {
|
|
375
|
+
"type": "watch_quantity",
|
|
376
|
+
"quantity": "atrial.blood_pressure"
|
|
377
|
+
},
|
|
378
|
+
"active_law.activation": {
|
|
379
|
+
"type": "watch_quantity",
|
|
380
|
+
"quantity": "cavity.rheology.active_law.activation"
|
|
381
|
+
},
|
|
382
|
+
"pleural.pressure": {
|
|
383
|
+
"type": "watch_quantity",
|
|
384
|
+
"quantity": "pleural.pressure"
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "forward_simulation",
|
|
3
|
+
"time": {
|
|
4
|
+
"type": "time",
|
|
5
|
+
"step_size": 0.001,
|
|
6
|
+
"min_step": 6.25e-05,
|
|
7
|
+
"start": 0.0,
|
|
8
|
+
"duration": 25.0
|
|
9
|
+
},
|
|
10
|
+
"solver": {
|
|
11
|
+
"type": "newton_solver",
|
|
12
|
+
"tolerance": 1e-09,
|
|
13
|
+
"iteration_max": 10
|
|
14
|
+
},
|
|
15
|
+
"net": {
|
|
16
|
+
"type": "net",
|
|
17
|
+
"flux_dof_definitions": {
|
|
18
|
+
"blood_flow": "blood_pressure"
|
|
19
|
+
},
|
|
20
|
+
"nodes": [
|
|
21
|
+
"cavity",
|
|
22
|
+
"atrial",
|
|
23
|
+
"aorta_proximal",
|
|
24
|
+
"aorta_distal",
|
|
25
|
+
"venous"
|
|
26
|
+
],
|
|
27
|
+
"blocks": {
|
|
28
|
+
"cavity": {
|
|
29
|
+
"type": "block_description",
|
|
30
|
+
"model_type": "spherical_cavity_block",
|
|
31
|
+
"time": "time",
|
|
32
|
+
"flux_type": "blood_flow",
|
|
33
|
+
"disp": "cavity.dynamics.disp",
|
|
34
|
+
"radius": "heart_radius",
|
|
35
|
+
"thickness": "heart_thickness",
|
|
36
|
+
"submodels": {
|
|
37
|
+
"dynamics": {
|
|
38
|
+
"type": "model_description",
|
|
39
|
+
"model_type": "spherical_dynamics",
|
|
40
|
+
"time": "time",
|
|
41
|
+
"fib_deform": "cavity.rheology.fib_deform",
|
|
42
|
+
"pressure": "cavity.blood_pressure",
|
|
43
|
+
"pressure_external": "pleural.pressure",
|
|
44
|
+
"vel": "cavity.velocity_law.vel",
|
|
45
|
+
"radius": "heart_radius",
|
|
46
|
+
"thickness": "heart_thickness",
|
|
47
|
+
"series_stiffness": "cavity.rheology.series_stiffness"
|
|
48
|
+
},
|
|
49
|
+
"velocity_law": {
|
|
50
|
+
"type": "model_description",
|
|
51
|
+
"model_type": "velocity_law_hht",
|
|
52
|
+
"time": "time",
|
|
53
|
+
"disp": "cavity.dynamics.disp"
|
|
54
|
+
},
|
|
55
|
+
"rheology": {
|
|
56
|
+
"type": "model_description",
|
|
57
|
+
"model_type": "rheology_fiber_additive",
|
|
58
|
+
"time": "time",
|
|
59
|
+
"disp": "cavity.dynamics.disp",
|
|
60
|
+
"active_tension_discr": "cavity.rheology.active_law.active_tension_discr",
|
|
61
|
+
"radius": "heart_radius",
|
|
62
|
+
"submodels": {
|
|
63
|
+
"active_law": {
|
|
64
|
+
"type": "model_description",
|
|
65
|
+
"model_type": "active_law_macro_huxley_two_moments",
|
|
66
|
+
"time": "time",
|
|
67
|
+
"fib_deform": "cavity.rheology.fib_deform",
|
|
68
|
+
"contractility": "heart_contractility"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"nodes": {
|
|
74
|
+
"1": "cavity"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"valve_atrium": {
|
|
78
|
+
"type": "block_description",
|
|
79
|
+
"model_type": "valve_rl_block",
|
|
80
|
+
"time": "time",
|
|
81
|
+
"flux_type": "blood_flow",
|
|
82
|
+
"backward_conductance": "conductance_iso",
|
|
83
|
+
"nodes": {
|
|
84
|
+
"1": "atrial",
|
|
85
|
+
"2": "cavity"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"valve_arterial": {
|
|
89
|
+
"type": "block_description",
|
|
90
|
+
"model_type": "valve_rl_block",
|
|
91
|
+
"time": "time",
|
|
92
|
+
"flux_type": "blood_flow",
|
|
93
|
+
"backward_conductance": "conductance_iso",
|
|
94
|
+
"nodes": {
|
|
95
|
+
"1": "cavity",
|
|
96
|
+
"2": "aorta_proximal"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"capacitance_valve": {
|
|
100
|
+
"type": "block_description",
|
|
101
|
+
"model_type": "c_block",
|
|
102
|
+
"time": "time",
|
|
103
|
+
"flux_type": "blood_flow",
|
|
104
|
+
"nodes": {
|
|
105
|
+
"1": "cavity"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"circulation_aorta_proximal": {
|
|
109
|
+
"type": "block_description",
|
|
110
|
+
"model_type": "rc_block",
|
|
111
|
+
"time": "time",
|
|
112
|
+
"flux_type": "blood_flow",
|
|
113
|
+
"nodes": {
|
|
114
|
+
"1": "aorta_distal",
|
|
115
|
+
"2": "aorta_proximal"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"circulation_aorta_distal": {
|
|
119
|
+
"type": "block_description",
|
|
120
|
+
"model_type": "rc_block",
|
|
121
|
+
"time": "time",
|
|
122
|
+
"flux_type": "blood_flow",
|
|
123
|
+
"nodes": {
|
|
124
|
+
"1": "venous",
|
|
125
|
+
"2": "aorta_distal"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"boundaries_conditions": {
|
|
130
|
+
"atrial": [
|
|
131
|
+
{
|
|
132
|
+
"type": "condition",
|
|
133
|
+
"condition_type": "blood_pressure",
|
|
134
|
+
"condition_id": "atrial.blood_pressure"
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
"venous": [
|
|
138
|
+
{
|
|
139
|
+
"type": "condition",
|
|
140
|
+
"condition_type": "blood_pressure",
|
|
141
|
+
"condition_id": "venous.blood_pressure"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"variables_initialization": {
|
|
147
|
+
"valve_atrium.flux": 0.0,
|
|
148
|
+
"valve_arterial.flux": 0.0,
|
|
149
|
+
"cavity.dynamics.disp": 0.0,
|
|
150
|
+
"cavity.velocity_law.vel": 0.0,
|
|
151
|
+
"cavity.velocity_law.accel": 0.0,
|
|
152
|
+
"cavity.rheology.fib_deform": 0.0,
|
|
153
|
+
"cavity.rheology.active_law.active_stiffness": 1.0,
|
|
154
|
+
"cavity.rheology.active_law.active_energy_sqrt": 0.0,
|
|
155
|
+
"cavity.rheology.active_law.active_tension_discr": 0.0,
|
|
156
|
+
"cavity.blood_pressure": "atrial.blood_pressure.max",
|
|
157
|
+
"aorta_proximal.blood_pressure": 10760.0,
|
|
158
|
+
"aorta_distal.blood_pressure": 10760.0
|
|
159
|
+
},
|
|
160
|
+
"variables_magnitudes": {
|
|
161
|
+
"valve_atrium.flux": 0.001,
|
|
162
|
+
"valve_arterial.flux": 0.001,
|
|
163
|
+
"cavity.dynamics.disp": 0.01,
|
|
164
|
+
"cavity.rheology.fib_deform": 0.1,
|
|
165
|
+
"cavity.velocity_law.vel": 0.1,
|
|
166
|
+
"cavity.velocity_law.accel": 1.0,
|
|
167
|
+
"aorta_proximal.blood_pressure": 10000.0,
|
|
168
|
+
"aorta_distal.blood_pressure": 10000.0,
|
|
169
|
+
"cavity.blood_pressure": 10000.0,
|
|
170
|
+
"cavity.rheology.active_law.active_stiffness": 100000.0,
|
|
171
|
+
"cavity.rheology.active_law.active_energy_sqrt": 10.0,
|
|
172
|
+
"cavity.rheology.active_law.active_tension_discr": 10000.0
|
|
173
|
+
},
|
|
174
|
+
"parameters": {
|
|
175
|
+
"heartbeat_duration": {
|
|
176
|
+
"type": "product",
|
|
177
|
+
"factors": [
|
|
178
|
+
60.0
|
|
179
|
+
],
|
|
180
|
+
"inverses": [
|
|
181
|
+
"heart_rate"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"pleural.pressure": 0.0,
|
|
185
|
+
"diastole_scaling_factor": 0.8,
|
|
186
|
+
"cavity.dynamics.vol_mass": 1000.0,
|
|
187
|
+
"cavity.dynamics.damping_coef": 70.0,
|
|
188
|
+
"cavity.velocity_law.scheme_ts_hht": 0.4,
|
|
189
|
+
"cavity.rheology.series_stiffness": 100000000.0,
|
|
190
|
+
"cavity.rheology.damping_parallel": 70.0,
|
|
191
|
+
"cavity.rheology.active_law.starling_abscissas": [
|
|
192
|
+
-0.1668,
|
|
193
|
+
-0.0073,
|
|
194
|
+
0.0534,
|
|
195
|
+
0.0969,
|
|
196
|
+
0.1326,
|
|
197
|
+
0.2016,
|
|
198
|
+
0.4663,
|
|
199
|
+
0.9187,
|
|
200
|
+
1.1762
|
|
201
|
+
],
|
|
202
|
+
"cavity.rheology.active_law.starling_ordinates": [
|
|
203
|
+
0.0,
|
|
204
|
+
0.5614,
|
|
205
|
+
0.7748,
|
|
206
|
+
0.8933,
|
|
207
|
+
0.9618,
|
|
208
|
+
1.0,
|
|
209
|
+
1.0,
|
|
210
|
+
0.1075,
|
|
211
|
+
0.0
|
|
212
|
+
],
|
|
213
|
+
"cavity.rheology.active_law.destruction_rate": 12.0,
|
|
214
|
+
"cavity.rheology.active_law.crossbridge_stiffness": 273000.0,
|
|
215
|
+
"active_law.activation.min": -20.0,
|
|
216
|
+
"active_law.activation.max": 35.0,
|
|
217
|
+
"cavity.rheology.active_law.activation": {
|
|
218
|
+
"type": "rescale_two_phases_function",
|
|
219
|
+
"rescaled_period": "heartbeat_duration",
|
|
220
|
+
"alpha": "diastole_scaling_factor",
|
|
221
|
+
"reference_function": [
|
|
222
|
+
[
|
|
223
|
+
0.0,
|
|
224
|
+
"active_law.activation.min"
|
|
225
|
+
],
|
|
226
|
+
[
|
|
227
|
+
0.027,
|
|
228
|
+
"active_law.activation.min"
|
|
229
|
+
],
|
|
230
|
+
[
|
|
231
|
+
0.037,
|
|
232
|
+
0.0
|
|
233
|
+
],
|
|
234
|
+
[
|
|
235
|
+
0.145,
|
|
236
|
+
"active_law.activation.max"
|
|
237
|
+
],
|
|
238
|
+
[
|
|
239
|
+
0.309,
|
|
240
|
+
"active_law.activation.max"
|
|
241
|
+
],
|
|
242
|
+
[
|
|
243
|
+
0.417,
|
|
244
|
+
0.0
|
|
245
|
+
],
|
|
246
|
+
[
|
|
247
|
+
0.427,
|
|
248
|
+
"active_law.activation.min"
|
|
249
|
+
],
|
|
250
|
+
[
|
|
251
|
+
0.9,
|
|
252
|
+
"active_law.activation.min"
|
|
253
|
+
]
|
|
254
|
+
],
|
|
255
|
+
"phases": [
|
|
256
|
+
0,
|
|
257
|
+
0,
|
|
258
|
+
1,
|
|
259
|
+
1,
|
|
260
|
+
1,
|
|
261
|
+
0,
|
|
262
|
+
0
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
"atrial.blood_pressure": {
|
|
266
|
+
"type": "rescale_two_phases_function",
|
|
267
|
+
"rescaled_period": "heartbeat_duration",
|
|
268
|
+
"alpha": "diastole_scaling_factor",
|
|
269
|
+
"reference_function": [
|
|
270
|
+
[
|
|
271
|
+
0.0,
|
|
272
|
+
"atrial.blood_pressure.max"
|
|
273
|
+
],
|
|
274
|
+
[
|
|
275
|
+
0.02,
|
|
276
|
+
"atrial.blood_pressure.max"
|
|
277
|
+
],
|
|
278
|
+
[
|
|
279
|
+
0.07,
|
|
280
|
+
"atrial.blood_pressure.min"
|
|
281
|
+
],
|
|
282
|
+
[
|
|
283
|
+
0.84,
|
|
284
|
+
"atrial.blood_pressure.min"
|
|
285
|
+
],
|
|
286
|
+
[
|
|
287
|
+
0.9,
|
|
288
|
+
"atrial.blood_pressure.max"
|
|
289
|
+
]
|
|
290
|
+
],
|
|
291
|
+
"phases": [
|
|
292
|
+
1,
|
|
293
|
+
1,
|
|
294
|
+
0,
|
|
295
|
+
1
|
|
296
|
+
]
|
|
297
|
+
},
|
|
298
|
+
"conductance_iso": 5e-12,
|
|
299
|
+
"valve_atrium.inductance": 1000.0,
|
|
300
|
+
"valve_atrium.conductance": 9e-06,
|
|
301
|
+
"valve_arterial.inductance": 30000.0,
|
|
302
|
+
"valve_arterial.conductance": 1.3e-05,
|
|
303
|
+
"capacitance_valve.capacitance": 5e-12,
|
|
304
|
+
"valve_atrium.scheme_ts_flux": 0.25,
|
|
305
|
+
"valve_arterial.scheme_ts_flux": 0.25,
|
|
306
|
+
"circulation_aorta_proximal.capacitance": 2e-10,
|
|
307
|
+
"circulation_aorta_distal.capacitance": {
|
|
308
|
+
"type": "product",
|
|
309
|
+
"factors": [
|
|
310
|
+
"circulation_aorta_distal.time_constant"
|
|
311
|
+
],
|
|
312
|
+
"inverses": [
|
|
313
|
+
"circulation_aorta_distal.resistance"
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
"heart_radius": 0.034,
|
|
317
|
+
"heart_thickness": 0.0113,
|
|
318
|
+
"heart_contractility": 90000.0,
|
|
319
|
+
"heart_rate": 60.0,
|
|
320
|
+
"venous.blood_pressure": 1600.0,
|
|
321
|
+
"atrial.blood_pressure.min": 450.0,
|
|
322
|
+
"atrial.blood_pressure.max": 900.0,
|
|
323
|
+
"circulation_aorta_proximal.resistance": 7000000.0,
|
|
324
|
+
"circulation_aorta_distal.resistance": 110000000.0,
|
|
325
|
+
"circulation_aorta_distal.time_constant": 2.0,
|
|
326
|
+
"cavity.dynamics.hyperelastic_cst": [
|
|
327
|
+
444.0,
|
|
328
|
+
2.9,
|
|
329
|
+
69.0,
|
|
330
|
+
6.5
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
"output_functions": {
|
|
334
|
+
"atrial.blood_pressure": {
|
|
335
|
+
"type": "watch_quantity",
|
|
336
|
+
"quantity": "atrial.blood_pressure"
|
|
337
|
+
},
|
|
338
|
+
"active_law.activation": {
|
|
339
|
+
"type": "watch_quantity",
|
|
340
|
+
"quantity": "cavity.rheology.active_law.activation"
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
@@ -37,6 +37,7 @@ from typing import Any, TypeAlias
|
|
|
37
37
|
|
|
38
38
|
import numpy as np
|
|
39
39
|
from numpy.typing import NDArray
|
|
40
|
+
from rich.progress import Progress
|
|
40
41
|
|
|
41
42
|
from physioblocks.computing.assembling import EqSystem
|
|
42
43
|
from physioblocks.computing.models import ModelComponent
|
|
@@ -359,77 +360,82 @@ class ForwardSimulation(AbstractSimulation):
|
|
|
359
360
|
"""
|
|
360
361
|
# initialize the simulation and save the initial results
|
|
361
362
|
results = self._initialize()
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
363
|
+
progress_step_update = (
|
|
364
|
+
100.0 * self.time_manager.step_size / self.time_manager.duration
|
|
365
|
+
)
|
|
366
|
+
with Progress() as progress:
|
|
367
|
+
try:
|
|
368
|
+
sim_task = progress.add_task("Simulation in progress...")
|
|
369
|
+
while self.time_manager.ended is False:
|
|
370
|
+
next_step = self.time_manager.time.new
|
|
371
|
+
|
|
372
|
+
self._update_time()
|
|
373
|
+
|
|
374
|
+
while (
|
|
375
|
+
np.abs(next_step - self.time_manager.time.current)
|
|
376
|
+
> self.time_manager.min_step
|
|
377
|
+
):
|
|
378
|
+
self.state.reset_state_vector()
|
|
379
|
+
|
|
380
|
+
sol = self.solver.solve(self.state, self.eq_system)
|
|
381
|
+
|
|
382
|
+
if sol.converged is False:
|
|
383
|
+
inter_time = 0.5 * self.time_manager.current_step_size
|
|
384
|
+
if inter_time < self.time_manager.min_step:
|
|
385
|
+
raise ConvergenceError(
|
|
386
|
+
str.format(
|
|
387
|
+
"The solver did not converge at {0}s for "
|
|
388
|
+
"minimal time step {1}",
|
|
389
|
+
self.time_manager.time.current,
|
|
390
|
+
self.time_manager.min_step,
|
|
391
|
+
)
|
|
386
392
|
)
|
|
387
|
-
)
|
|
388
393
|
|
|
389
|
-
|
|
390
|
-
self.time_manager.time.update(
|
|
391
|
-
self.time_manager.time.current
|
|
392
|
-
+ self.time_manager.current_step_size
|
|
393
|
-
)
|
|
394
|
-
else:
|
|
395
|
-
self.state.set_state_vector(sol.x)
|
|
396
|
-
|
|
397
|
-
self.time_manager.update_time()
|
|
398
|
-
if (
|
|
399
|
-
np.abs(next_step - self.time_manager.time.current)
|
|
400
|
-
>= self.time_manager.min_step
|
|
401
|
-
):
|
|
402
|
-
self.time_manager.current_step_size = (
|
|
403
|
-
next_step - self.time_manager.time.current
|
|
404
|
-
)
|
|
405
|
-
self.time_manager.time.update(next_step)
|
|
406
|
-
else:
|
|
407
|
-
self.time_manager.time.initialize(next_step)
|
|
408
|
-
self.time_manager.current_step_size = (
|
|
409
|
-
self.time_manager.step_size
|
|
410
|
-
)
|
|
394
|
+
self.time_manager.current_step_size = inter_time
|
|
411
395
|
self.time_manager.time.update(
|
|
412
396
|
self.time_manager.time.current
|
|
413
397
|
+ self.time_manager.current_step_size
|
|
414
398
|
)
|
|
399
|
+
else:
|
|
400
|
+
self.state.set_state_vector(sol.x)
|
|
401
|
+
|
|
402
|
+
self.time_manager.update_time()
|
|
403
|
+
if (
|
|
404
|
+
np.abs(next_step - self.time_manager.time.current)
|
|
405
|
+
>= self.time_manager.min_step
|
|
406
|
+
):
|
|
407
|
+
self.time_manager.current_step_size = (
|
|
408
|
+
next_step - self.time_manager.time.current
|
|
409
|
+
)
|
|
410
|
+
self.time_manager.time.update(next_step)
|
|
411
|
+
else:
|
|
412
|
+
progress.update(sim_task, advance=progress_step_update)
|
|
413
|
+
self.time_manager.time.initialize(next_step)
|
|
414
|
+
self.time_manager.current_step_size = (
|
|
415
|
+
self.time_manager.step_size
|
|
416
|
+
)
|
|
417
|
+
self.time_manager.time.update(
|
|
418
|
+
self.time_manager.time.current
|
|
419
|
+
+ self.time_manager.current_step_size
|
|
420
|
+
)
|
|
415
421
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
422
|
+
self.state.set_state_vector(sol.x)
|
|
423
|
+
results.append(self._get_current_result())
|
|
424
|
+
except Exception as exception:
|
|
425
|
+
log_exception(
|
|
426
|
+
_logger,
|
|
427
|
+
type(exception),
|
|
428
|
+
exception,
|
|
429
|
+
exception.__traceback__,
|
|
430
|
+
logging.DEBUG,
|
|
431
|
+
)
|
|
432
|
+
raise SimulationError(
|
|
433
|
+
str.format(
|
|
434
|
+
"An error caused the simulation to stop prematurely",
|
|
435
|
+
intermediate_results=results,
|
|
436
|
+
),
|
|
437
|
+
results,
|
|
438
|
+
) from exception
|
|
433
439
|
|
|
434
440
|
self._finalize()
|
|
435
441
|
return results
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: physioblocks
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Dynamic: Author
|
|
5
5
|
Dynamic: Author-email
|
|
6
6
|
Dynamic: License
|
|
@@ -31,6 +31,7 @@ Requires-Dist: pandas
|
|
|
31
31
|
Requires-Dist: plotly
|
|
32
32
|
Requires-Dist: pyarrow
|
|
33
33
|
Requires-Dist: regex
|
|
34
|
+
Requires-Dist: rich
|
|
34
35
|
Requires-Dist: scipy
|
|
35
36
|
Provides-Extra: doc
|
|
36
37
|
Requires-Dist: sphinx; extra == 'doc'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
physioblocks/__init__.py,sha256=
|
|
1
|
+
physioblocks/__init__.py,sha256=Ble2LZgwT5wRSMWSba_Kwp05grtnvY5pPiwxXxmtgcQ,1169
|
|
2
2
|
physioblocks/base/__init__.py,sha256=2h6bk0fe8pwQvJ15Buytg4SZzYOH-Ep7WqoD6pd1eOQ,986
|
|
3
3
|
physioblocks/base/operators.py,sha256=uUfswQZsaMNd2bd7wsaxSGFIYLAr1hQCQ6SQfYawdBc,5689
|
|
4
4
|
physioblocks/base/registers.py,sha256=Cd0hmy1XqojjPQgb_jn4mGeAMTyWWgDkl3qJHCVjCRU,3119
|
|
@@ -25,7 +25,7 @@ physioblocks/description/nets.py,sha256=pKG2uB-4dABc-lvGswkybiho18bOkUwsVJYBdlX7
|
|
|
25
25
|
physioblocks/io/__init__.py,sha256=bOGWA0hAifT9wHxD4kWFQuAXpAx0GzDmGfmcgNDUCGo,990
|
|
26
26
|
physioblocks/io/aliases.py,sha256=d_Gqz0-8SVD6tA9N-T9xYL8SRhaSMmIOjqvOKHBb-Yo,2288
|
|
27
27
|
physioblocks/io/configuration.py,sha256=UY8whA_7KcMwi_gXPIt5h8_gD7TKO2Co5cyf9MHO0yg,3578
|
|
28
|
-
physioblocks/launcher/__main__.py,sha256=
|
|
28
|
+
physioblocks/launcher/__main__.py,sha256=BMErik5JIbCKmjZecQHMUUq5_GQeRQg8zLwYvHFelxk,8968
|
|
29
29
|
physioblocks/launcher/configuration.py,sha256=dqHCR_7PSDInA8NC3NFONqK3PPwSQYpLkZgYSyVU1vs,7959
|
|
30
30
|
physioblocks/launcher/constants.py,sha256=FIBKde1vJrUzMk9dSl4q8f8jqN7bFxYF05EIG2-V0zw,3033
|
|
31
31
|
physioblocks/launcher/files.py,sha256=zvif_8Woh3vEYCb_K3YnFFZYpgMhdlf4c2OSIVW4jC4,4950
|
|
@@ -72,7 +72,7 @@ physioblocks/registers/type_register.py,sha256=JUlrPfP-X_TjIOHewSTkzf7Ck3L0ivVoH
|
|
|
72
72
|
physioblocks/simulation/__init__.py,sha256=wqKVI3OLLVWuQoUcWwKSs5ibdkTP3Da_5DOe36v1up4,1504
|
|
73
73
|
physioblocks/simulation/constants.py,sha256=w9CsB4V7YtvcdW4N1p7Iu6MeV4i-kazcEPAygE7mSx0,1075
|
|
74
74
|
physioblocks/simulation/functions.py,sha256=c6HFwXK8IAzH7gSkz9aMiXLqnWXn_4_9WsX4jrGN9pY,2307
|
|
75
|
-
physioblocks/simulation/runtime.py,sha256=
|
|
75
|
+
physioblocks/simulation/runtime.py,sha256=Moa6S1iR7oPuni8yvO7VwmBsubMcJMpIUeowk1BLaC0,16104
|
|
76
76
|
physioblocks/simulation/saved_quantities.py,sha256=fKWr1wScqxHPhuCE7aDNs8lpm9oWfyLN8NZDus2knPM,4111
|
|
77
77
|
physioblocks/simulation/setup.py,sha256=UmIklaHmfkxi_BIdYKOhorLoC9QT9D4oEXwC-Xfd6v0,18109
|
|
78
78
|
physioblocks/simulation/solvers.py,sha256=xztL-QboEO2mgtws13QE0-wHJ22vjQQzAQahYfxXVBQ,7226
|
|
@@ -86,8 +86,11 @@ physioblocks/utils/math_utils.py,sha256=w5MDs4cP5WiTPHe8WofFuNZZ20WDNLT0XmFGlbis
|
|
|
86
86
|
physioblocks/references/circulation_alone_sim.jsonc,sha256=qv27nzmK7jennhtCJ7wQ_f83mt9_YJSOTABjGCYMcZw,736
|
|
87
87
|
physioblocks/references/spherical_heart_respiration_sim.jsonc,sha256=kKq5xf94r90O1KpkCHk1qwgy6DJ37ePo3-8buEtcu5Y,1397
|
|
88
88
|
physioblocks/references/spherical_heart_sim.jsonc,sha256=kGGBqxY8dnmGKmpMv216kbneyJRGz_3VkcYn1OWavIA,1151
|
|
89
|
-
physioblocks
|
|
90
|
-
physioblocks
|
|
91
|
-
physioblocks
|
|
92
|
-
physioblocks-1.1.
|
|
93
|
-
physioblocks-1.1.
|
|
89
|
+
physioblocks/references/full_configurations/circulation_alone_sim.jsonc,sha256=mHXNMl52Xf_RRc0lcP-udLV8jPp4OFaMPGL_Ov5TEjM,4276
|
|
90
|
+
physioblocks/references/full_configurations/spherical_heart_respiration_sim.jsonc,sha256=su6ExBBx6yZmoTRzBrTSA18QMFDB2f_S_vBGBmYeA1E,12703
|
|
91
|
+
physioblocks/references/full_configurations/spherical_heart_sim.jsonc,sha256=hQYj-TPEJx3DVqkGKYYOiPRfUBGCE6gWPmbcylbaG9g,11420
|
|
92
|
+
physioblocks-1.1.2.dist-info/METADATA,sha256=YNDft9tKDvn1tQL_YlK-ZeEbW-qqYjG82V4rk4SUkEA,4728
|
|
93
|
+
physioblocks-1.1.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
94
|
+
physioblocks-1.1.2.dist-info/licenses/licenses/GPL-3.0-only.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
95
|
+
physioblocks-1.1.2.dist-info/licenses/licenses/LGPL-3.0-only.txt,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
96
|
+
physioblocks-1.1.2.dist-info/RECORD,,
|
|
File without changes
|
{physioblocks-1.1.0.dist-info → physioblocks-1.1.2.dist-info}/licenses/licenses/GPL-3.0-only.txt
RENAMED
|
File without changes
|
{physioblocks-1.1.0.dist-info → physioblocks-1.1.2.dist-info}/licenses/licenses/LGPL-3.0-only.txt
RENAMED
|
File without changes
|