SimVascular / svZeroDSolver-Archived

A Python lumped-parameter solver for blood flow and pressure in hemodynamic networks
Other
12 stars 15 forks source link

Incorrect equations in BloodVessel element #51

Closed JonathanPham closed 2 years ago

JonathanPham commented 2 years ago

There is a small bug in the BloodVessel element in blocks.py. The second equation does not account for time derivative of the resistance, R, which may be nonlinear if a non-zero stenosis_coefficient is provided.

I will fix this issue by splitting the second equation into two separate equations. This will circumvent the need to compute a time derivative for R, which may be a complicated process.

mrp089 commented 2 years ago

Looks good @JonathanPham! Thank you for digging into this.

I see that the test cases still pass without requiring any modifications. Is that because our tolerances don't detect the difference in solution? Or is it because our tests are not sensitive to this change? In any case, I think we should modify our test cases so they would have detected this change in results.

JonathanPham commented 2 years ago

Just added a test case to reflect the changes!

mrp089 commented 2 years ago

Awesome work @JonathanPham :anatomical_heart:

That's the way to do it: simple example testing one thing, analytical solution, extremely well documented (what does it test, where do numerical values come from)

JonathanPham commented 2 years ago

I agree! Thanks for the initial advice, @mrp089.