Automating Batch Simulations
- Daniel Emerson
- Posts: 12
- Joined: Fri Jul 17, 2020 4:33 pm
Automating Batch Simulations
Hi, I am trying to run batch simulations to create a data set. I am able to call the svSolver from terminal/command line, but I have to manually set up the simulations before and manually convert the data after the fact. Is there some way I can automate these processes?
Re: Automating Batch Simulations
Hi, Daniel and Developers
Could you share the steps to batch mesh generation and cfd computations?
I also have a lot of STL format files, and want to run CFD batch process.
Thank you so much!
Gang
Could you share the steps to batch mesh generation and cfd computations?
I also have a lot of STL format files, and want to run CFD batch process.
Thank you so much!
Gang
- Daniel Emerson
- Posts: 12
- Joined: Fri Jul 17, 2020 4:33 pm
Re: Automating Batch Simulations
Gang,
I am just using one model with a fixed mesh, so I cant speak much to automating the meshing process. I am looking to randomize the input parameters to create a data set.
That said, you might find the following paper out of the Marsden Lab interesting: Accelerating cardiovascular model building with convolutional neural networks. Link: https://doi.org/10.1007/s11517-019-02029-3
The paper talks about using a CNN to automate the segmentation process. The user still has to manually specify path lines, but the CNN takes care of making 2D and 3D geometries.
Best,
Dan
I am just using one model with a fixed mesh, so I cant speak much to automating the meshing process. I am looking to randomize the input parameters to create a data set.
That said, you might find the following paper out of the Marsden Lab interesting: Accelerating cardiovascular model building with convolutional neural networks. Link: https://doi.org/10.1007/s11517-019-02029-3
The paper talks about using a CNN to automate the segmentation process. The user still has to manually specify path lines, but the CNN takes care of making 2D and 3D geometries.
Best,
Dan
- David Parker
- Posts: 1719
- Joined: Tue Aug 23, 2005 2:43 pm
Re: Automating Batch Simulations
Hi Dan,
I am planning on adding a Simulation module to the new SV Python API (see http://simvascular.github.io/docsPythonInterface.html) that will be useful for automating simulations. That should be added in a few weeks.
Until the Simulation module is done you will need to kind of hack things together by generating the .svpre and solver.inp files needed to setup a simulation using some sort of script; I would use Python for this. Once you have generated an .svpre file you can use the svpre program installed with svsolver to generate geombc and restart files.
Cheers,
Dave
I am planning on adding a Simulation module to the new SV Python API (see http://simvascular.github.io/docsPythonInterface.html) that will be useful for automating simulations. That should be added in a few weeks.
Until the Simulation module is done you will need to kind of hack things together by generating the .svpre and solver.inp files needed to setup a simulation using some sort of script; I would use Python for this. Once you have generated an .svpre file you can use the svpre program installed with svsolver to generate geombc and restart files.
Cheers,
Dave
- Daniel Emerson
- Posts: 12
- Joined: Fri Jul 17, 2020 4:33 pm
Re: Automating Batch Simulations
Thanks for the reply Dave!
I was looking into generating the solver.inp and sim.svpre files. It looks like the only input to the svPre is the sim.svpre file, and the outputs are (bct.dat, geombc.dat.1, restart.0.1, numstart.dat)? I am assuming I would then generate the solver.inp file and copy over the files describing the mesh (my mesh is constant across all simulations).
How would I call the svPre executable from terminal? This is the only part I couldnt surmise from the documentation. Do I set my directory to the .svpre file and then call the executable?
I guess I have a lot of the same questions for the post solver. Does the svPost executable perform the same function as the "convert results" button in the simulation GUI? And again, how would I call from terminal? Point the directory where the restart files are contained and then call the svPost exectuable?
Best,
Dan
I was looking into generating the solver.inp and sim.svpre files. It looks like the only input to the svPre is the sim.svpre file, and the outputs are (bct.dat, geombc.dat.1, restart.0.1, numstart.dat)? I am assuming I would then generate the solver.inp file and copy over the files describing the mesh (my mesh is constant across all simulations).
How would I call the svPre executable from terminal? This is the only part I couldnt surmise from the documentation. Do I set my directory to the .svpre file and then call the executable?
I guess I have a lot of the same questions for the post solver. Does the svPost executable perform the same function as the "convert results" button in the simulation GUI? And again, how would I call from terminal? Point the directory where the restart files are contained and then call the svPost exectuable?
Best,
Dan
- David Parker
- Posts: 1719
- Joined: Tue Aug 23, 2005 2:43 pm
Re: Automating Batch Simulations
Hi Dan,
You are correct! The svpre executable creates the initial input files for the solver. The solver.inp is used to actually run the solver, you will need to create that too.
The svpre executable is in the same directory as svsolver. On Mac and Ubuntu this is something like /usr/local/sv/svsolver/2019-01-19/bin. svpre is run from the command like this in the Simulations/sim directory
The svpost executable is also in /usr/local/sv/svsolver/2019-01-19/bin, it has a bunch of options, but to mimic what is going on in the SV GUI I use a shell script like this
Note that the outdir directory must already exist.
svpost -h prints a list of options.
svpost does not create any of the .txt files (e.g. all_results-averages-from_cm-to-mmHg-L_per_min.txt), that is done in SV. If you need those files then I can figure out how to get them.
Cheers,
Dave
You are correct! The svpre executable creates the initial input files for the solver. The solver.inp is used to actually run the solver, you will need to create that too.
The svpre executable is in the same directory as svsolver. On Mac and Ubuntu this is something like /usr/local/sv/svsolver/2019-01-19/bin. svpre is run from the command like this in the Simulations/sim directory
Code: Select all
/usr/local/sv/svsolver/2019-01-19/bin/svpre sim.svpre
Code: Select all
svpost=/usr/local/sv/svsolver/2019-01-19/bin/svpost
indir=288-procs_case
outdir=export
start=100
stop=2000
inc=100
$svpost -all \
-indir ${indir} \
-outdir ${outdir} \
-start ${start} \
-stop ${stop} \
-incr ${inc} \
-vtp all_results \
-vtu all_results
svpost -h prints a list of options.
svpost does not create any of the .txt files (e.g. all_results-averages-from_cm-to-mmHg-L_per_min.txt), that is done in SV. If you need those files then I can figure out how to get them.
Cheers,
Dave
- Daniel Emerson
- Posts: 12
- Joined: Fri Jul 17, 2020 4:33 pm
Re: Automating Batch Simulations
Hi Dave,
Perfect, this is exactly what I have been looking for!! Coincidentally the only parameters I am really interested in are the average pressure and flows from the all_results-averages-from_cm-to-mmHg-L_per_min.txt file. Any help on generating these numbers would be much appreciated.
Thanks!
Dan
Perfect, this is exactly what I have been looking for!! Coincidentally the only parameters I am really interested in are the average pressure and flows from the all_results-averages-from_cm-to-mmHg-L_per_min.txt file. Any help on generating these numbers would be much appreciated.
Thanks!
Dan
- David Parker
- Posts: 1719
- Joined: Tue Aug 23, 2005 2:43 pm
Re: Automating Batch Simulations
Hi Dan,
I'll write a Python script to calculate average pressure and flows, think this would be useful for other users too.
Cheers,
Dave
I'll write a Python script to calculate average pressure and flows, think this would be useful for other users too.
Cheers,
Dave
- Daniel Emerson
- Posts: 12
- Joined: Fri Jul 17, 2020 4:33 pm
Re: Automating Batch Simulations
Dave,
That would be great. Thank you!
Best,
Dan
That would be great. Thank you!
Best,
Dan
- Shannen Kizilski
- Posts: 17
- Joined: Thu Dec 08, 2016 3:39 pm
Re: Automating Batch Simulations
I have another quick question about using svpost: How do you achieve the "As Single File" option to create only one VTP and one VTU for all of the selected steps in the simulation?
I tried using -vtkcombo based on its description, but that instead created one VTU for each step. If I'm running hundreds of steps, I don't want to create hundreds of files; plus I need the TAWSS and OSI values to be calculated.
Thank you!
- Shannen
I tried using -vtkcombo based on its description, but that instead created one VTU for each step. If I'm running hundreds of steps, I don't want to create hundreds of files; plus I need the TAWSS and OSI values to be calculated.
Thank you!
- Shannen