|
svZeroDSolver
|
For full svZeroDTuner usage and configuration guidance, see the svZeroDTuner guide on the docs site: https://simvascular.github.io/svZeroDSolver/tuner.html.
This example couples a prescribed venous inflow waveform to a right atrium and right ventricle model using LinearElastanceChamber blocks with piecewise_cosine activation and PiecewiseValve blocks. The right ventricle ejects into a reduced-order pulmonary artery model with:
All inputs and targets in this example are in cgs units:
Two tuning configs are provided:
In practice, Nelder-Mead has produced more stable convergence for this model than differential evolution.
Install the package once from the repository root so the svzerodtuner command is available:
Then run the example from this directory:
Baseline inspection:
This creates baseline_results/ with the full time series, summary CSV, and plots for target selection.
Tuning:
or
svzerodtuner run <config.yaml> is also supported as an alias for optimize.
Target names follow the solver output naming scheme:
Cardiac output is defined as mean flow through PV -> MPA. Flow split is enforced by targeting the mean flows through RPA -> RCR_RPA and LPA -> RCR_LPA.
After running svzerodtuner optimize tuning_nelder_mead.yaml, the output directory optimization_results_right_heart_pa_nm/ contains the following.
Each row reports the target, simulated value, acceptable range, and percent error for one quantity:
| Name | Target | Simulated | Target range | % Error |
|---|---|---|---|---|
| Pulmonary arterial mean flow | 83.3 cm³/s | 84.3 cm³/s | [75.0, 91.7] | 1.2 |
| Pulmonary arterial max pressure | 33 330 dyn/cm² | 36 660 dyn/cm² | [29 997, 36 663] | 10.0 |
| Pulmonary arterial min pressure | 10 670 dyn/cm² | 11 728 dyn/cm² | [9 603, 11 737] | 9.9 |
| Pulmonary arterial mean pressure | 20 000 dyn/cm² | 18 000 dyn/cm² | [18 000, 22 000] | -10.0 |
| RPA mean flow | 45.8 cm³/s | 42.3 cm³/s | [41.2, 50.4] | -7.8 |
| LPA mean flow | 37.5 cm³/s | 38.3 cm³/s | [33.8, 41.3] | 2.0 |
All targets land within their acceptable ranges.
| File | Contents |
|---|---|
| history.csv | Objective value and all parameter values at every function evaluation |
| objective_history.png | Objective vs. iteration — use to confirm convergence |
| parameter_evolution.png | Each parameter value vs. iteration — use to spot parameters hitting bounds |
| timing_info.json | Total wall time and per-evaluation average (789 evals, ~4 min 39 s for this run) |
| File | Contents |
|---|---|
| pressures.png | Pressure waveforms at key junctions over the final cardiac cycle |
| flows.png | Flow waveforms through key vessels |
| volumes.png | Chamber volume waveforms (RA, RV) |
| optimized_results.csv | Full time-series for every output variable |
| optimized_summary.csv | Min / max / mean / std for every output variable |