Python API Simulations

Provides a system for patient-specific cardiovascular modeling and simulation.
POST REPLY
User avatar
Moses Hamm
Posts: 10
Joined: Sun Dec 04, 2022 10:44 pm

Python API Simulations

Post by Moses Hamm » Tue Dec 06, 2022 8:30 pm

Hi,

I see that fluid simulations can be created using sv.simulation.Fluid(). However, it appears that only velocity and resistance boundary conditions are supported. Is there a way to implement rcr boundary conditions in fluid simulations using the Python API? Or if not, is there a way to manually create the simulation files based on a template?

Thanks!

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

Re: Python API Simulations

Post by David Parker » Fri Dec 09, 2022 3:31 pm

Hello,

The sv.simulation.Fluid() class is only partially implemented, was sort of a test of ideas.

SV creates an .svpre and rcrt.dat files from the values set in the Simulation Tool GUI and stored in a .sjb file in under the SV project Simulations directory. The solver.inp file and other input data needed by svSolver is then created by running the svpre program (installed with the svSolver) with the .svpre file.

The easiest thing to do might be to write a Python script that reads in an .sjb file and writes .svpre and rcrt.dat files.

If you are only changing the rcrt.dat file then you could just create that.

Cheers,
Dave

User avatar
Moses Hamm
Posts: 10
Joined: Sun Dec 04, 2022 10:44 pm

Re: Python API Simulations

Post by Moses Hamm » Fri Dec 16, 2022 7:19 pm

Thanks David! Quick follow up: I plan to use the SV gateway's svPre feature once I create the .svpre file. However, it also requires the mesh-complete file. Is there an example script of how to create that using the Python API?

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

Re: Python API Simulations

Post by David Parker » Mon Dec 19, 2022 12:48 pm

Hello,

There are no API functions to create the mesh-complete files needed for a simulation. You can generate these files using a Python script. Have a look here https://github.com/ktbolt/cardiovascula ... ete/python that does this for an FSI simulation to see how to do it.

Cheers,
Dave

POST REPLY