Page 1 of 1

How to get branch outflows from svzerodsolver

Posted: Fri Feb 23, 2024 3:16 pm
by riro3277
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

Re: How to get branch outflows from svzerodsolver

Posted: Mon Feb 26, 2024 2:04 pm
by davep
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

Re: How to get branch outflows from svzerodsolver

Posted: Mon Feb 26, 2024 4:37 pm
by riro3277
I am getting the same map::at error using that syntax. The only flow I can get is the branch0_seg0 flow.

Re: How to get branch outflows from svzerodsolver

Posted: Mon Feb 26, 2024 10:13 pm
by pfaller
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

Re: How to get branch outflows from svzerodsolver

Posted: Tue Feb 27, 2024 10:12 am
by riro3277
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.

Re: How to get branch outflows from svzerodsolver

Posted: Tue Feb 27, 2024 6:22 pm
by pfaller
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.