Skip to content

Decompose ClosedLoopHeartPulmonary#219

Open
mrp089 wants to merge 21 commits intoSimVascular:masterfrom
mrp089:decompose_ClosedLoopHeartPulmonary_218
Open

Decompose ClosedLoopHeartPulmonary#219
mrp089 wants to merge 21 commits intoSimVascular:masterfrom
mrp089:decompose_ClosedLoopHeartPulmonary_218

Conversation

@mrp089
Copy link
Copy Markdown
Member

@mrp089 mrp089 commented Mar 27, 2026

Current situation

Addresses #218. The monolithic ClosedLoopHeartAndPulmonary block combines four chambers, four valves, and the pulmonary vasculature into a single block with hard-coded internal wiring. This makes it difficult to modify individual components and duplicates physics already available in standalone blocks.

The ClosedLoopHeartAndPulmonary is still present, as removing it will affect more parts of the code, and will be part of a future PR.

Release Notes

  • Add ChamberElastanceInductorExponential block for atrial chambers with exponential passive pressure-volume relation (Sankaran 2012, Menon 2023)
  • Add BloodVesselRC block for flow-through RC windkessel (pulmonary vasculature)
  • Add wrapping cosine and fourier activation functions for atrial and ventricular elastance
  • Add decomposed closed-loop heart test case using individual ChamberElastanceInductor, ValveTanh, BloodVessel, and BloodVesselRC blocks

Documentation

  • ChamberElastanceInductorExponential header documents the exponential P-V governing equations and parameter list
  • BloodVesselRC header documents the flow-through windkessel equations with reference to Sankaran 2012
  • Activation function headers reference Sankaran 2012 and Menon 2023 instead of the monolithic block
  • Decomposed test case includes inline comments mapping each parameter to its monolithic counterpart

Testing

  • New test case closedLoopHeart_singleVessel_decomposed.json added to the pytest suite with stored reference solution
  • Existing chamber_elastance_inductor.json test passes (linear model unchanged)

Code of Conduct & Contributing Guidelines

mrp089 and others added 15 commits March 26, 2026 11:54
Replace ClosedLoopHeartPulmonary references in new files with citations
to the original papers (Sankaran 2012, Menon 2023). Add comparison test
script with plots for aortic pressure/flow, PV loops, valve flows,
dQ/dt, and chamber volumes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add closedLoopHeart_singleVessel_decomposed.json to pytest test suite
with stored reference results. Remove standalone comparison script.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add parameter mapping comments referencing Sankaran 2012 and Menon 2023.
Document correspondence between monolithic and decomposed parameters for
chambers, valves, pulmonary vasculature, and systemic circulation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract the exponential passive P-V relation (for atrial chambers) into
a separate ChamberElastanceInductorExponential class that inherits from
ChamberElastanceInductor. This removes if/else branching on Kxp==0 and
makes the two physical models (linear vs exponential passive P-V)
explicit through the type system.

- ChamberElastanceInductor: linear E(t)*(V-Vrest) model
- ChamberElastanceInductorExponential: adds Kxp, Kxv, Vaso parameters
  for exponential passive pressure (Sankaran 2012, Menon 2023)

Base class provides a protected constructor for derived classes and
virtual get_elastance_values() for the elastance computation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove Emin, Vrd, Vrs, Vrest from ChamberElastanceInductorExponential
since the exponential P-V relation only uses Emax, Kxp, Kxv, Vaso.
Override update_constant to use own parameter indices for Impedance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mrp089 mrp089 requested a review from menon-karthik March 27, 2026 21:47
@mrp089
Copy link
Copy Markdown
Member Author

mrp089 commented Mar 27, 2026

A couple of comparisons of monolithic vs. decomposed test cases. The difference in max. aortic pressure is < 0.1% (1000 time steps and 10 cardiac cycles in both). The tanh valves avoid the flow oscillations of the explicit valves in ClosedLoopHeartPulmonary.
decomp_01_aortic
decomp_02_pv_loops
decomp_03_valve_flows

open_loop_coronary_var_res_bc = 19,
open_loop_coronary_detailed_bc = 20,
blood_vessel_rc = 21,
closed_loop_heart_pulmonary_smooth = 22,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required since there is not going to be a combined block?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used those blocks during debugging and accidentally left them in here. There's now blood_vessel_rc and chamber_elastance_inductor_exponential remaining, since these are the parts of closed_loop_heart_pulmonary that were not available individually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants