How to get branch outflows from svzerodsolver

Provides a system for patient-specific cardiovascular modeling and simulation.
POST REPLY
User avatar
Ricardo Roopnarinesingh
Posts: 15
Joined: Fri Sep 17, 2021 9:56 am

How to get branch outflows from svzerodsolver

Post by Ricardo Roopnarinesingh » Fri Feb 23, 2024 3:16 pm

Hi,

I am trying to find the right syntax to get the average outflow for individual. I can get the inflow using solver.get_single_result_avg("flow:INFLOW:branch0_seg0") but how would I get the outflow average for different branches? I've tried a couple different passes and keep getting a "map::at" error.

Thanks,

Ricardo

User avatar
David Parker
Posts: 1603
Joined: Tue Aug 23, 2005 2:43 pm

Re: How to get branch outflows from svzerodsolver

Post by David Parker » Mon Feb 26, 2024 2:04 pm

Hi Ricardo,

The svZeroDSolver documentation states

Code: Select all

get_single_result_avg()
double Solver::get_single_result_avg	(	const std::string &	dof_name	)	const
Get the result of a single DOF averaged over time.

Parameters
dof_name	Name of the degree-of-freedom
Returns
double Result
It's not clear to me what a dof actually is. There is a section in the JSON input file named y: that has data like what you mentioned so maybe you could try flow:branch0_seg0:OUT.

Cheers,
Dave

User avatar
Ricardo Roopnarinesingh
Posts: 15
Joined: Fri Sep 17, 2021 9:56 am

Re: How to get branch outflows from svzerodsolver

Post by Ricardo Roopnarinesingh » Mon Feb 26, 2024 4:37 pm

I am getting the same map::at error using that syntax. The only flow I can get is the branch0_seg0 flow.

User avatar
Martin Pfaller
Posts: 59
Joined: Tue Oct 01, 2019 10:23 am

Re: How to get branch outflows from svzerodsolver

Post by Martin Pfaller » Mon Feb 26, 2024 10:13 pm

Have a look at the documentation:

https://simvascular.github.io/svZeroDSolver/

You could call solver.get_full_result(), which returns a pandas dataframe from which you can pick the results you'd like. You can see some post-processing in use when looking at the test framework:

https://github.com/SimVascular/svZeroDS ... s/utils.py

User avatar
Ricardo Roopnarinesingh
Posts: 15
Joined: Fri Sep 17, 2021 9:56 am

Re: How to get branch outflows from svzerodsolver

Post by Ricardo Roopnarinesingh » Tue Feb 27, 2024 10:12 am

I get a Segmentation Fault when I try to use the get_full_result() function. Here is the .json file I am using https://drive.google.com/file/d/1Bgy_eR ... sp=sharing. This file does work with the archived version of the 0d solver.

User avatar
Martin Pfaller
Posts: 59
Joined: Tue Oct 01, 2019 10:23 am

Re: How to get branch outflows from svzerodsolver

Post by Martin Pfaller » Tue Feb 27, 2024 6:22 pm

Can you open an issue for the seg fault (uploading the input file on GitHub)? Thank you!

For the outlets, you can use keys like "flow:branch18_seg2:RESISTANCE_10" or "flow:branch17_seg0:RESISTANCE_9". Make sure the branch/segment is connected to the respective outlet.

POST REPLY