Exporting to vtp

Provides a system for patient-specific cardiovascular modeling and simulation.
POST REPLY
User avatar
Hadi Wiputra
Posts: 13
Joined: Sat Jul 07, 2018 11:32 pm

Exporting to vtp

Post by Hadi Wiputra » Fri Oct 01, 2021 8:25 am

Hi all,

I've recently ran my first simvascular code in MSI using SvSolver, and it returns the restart files :D.

Right now, i need to download and convert the restart files into .vtp files in simvascular GUI. I wonder if there is a fast way to do it, maybe defining the conversion in the .inp file?

Thank you.

Regards,
Hadi

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

Re: Exporting to vtp

Post by David Parker » Fri Oct 01, 2021 10:39 am

Hello Hadi,

The svSolver software has a program called svpost that is used to convert restart files to vtk files. Running svpost -h gives you its command-line options. I typically run it from a shell script like this

Code: Select all

svpost=/usr/local/sv/svsolver/2019-01-19/bin/svpost
indir=4-procs_case
outdir=export
start=100
stop=500
inc=100

$svpost -all  \
    -indir ${indir}   \
    -outdir ${outdir}  \
    -start ${start}  \
    -stop ${stop}  \
    -incr ${inc}  \
    -vtp all_results  \
    -vtu all_results
svpost does not compute average values at inlets and outlets files though.

Cheers,
Dave

User avatar
Hadi Wiputra
Posts: 13
Joined: Sat Jul 07, 2018 11:32 pm

Re: Exporting to vtp

Post by Hadi Wiputra » Mon Oct 04, 2021 12:01 pm

Hi Dave,

Thank you for the reply, it would definitely speed up the post proc. I saw that there is a similar command in SvFSI solver.inp file:


Save results to VTK format: 1
Name prefix of saved VTK files: result
Increment in saving VTK files: 10
Start saving after time step: 1

I wonder why it is not implemented in svSolver, just curious.

Regards,
Hadi

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

Re: Exporting to vtp

Post by David Parker » Mon Oct 04, 2021 2:38 pm

Hello Hadi,

The svSolver code has been around for a long time, before VTK, so the VTK conversion was added much later.

Cheers,
Dave

User avatar
Mandar Kulkarni
Posts: 16
Joined: Tue Jul 13, 2021 10:38 am

Re: Exporting to vtp

Post by Mandar Kulkarni » Sat Jun 11, 2022 8:27 pm

davep wrote:
Fri Oct 01, 2021 10:39 am

svpost does not compute average values at inlets and outlets files though.
Hello,

I was able to use svpost successfully to create vtp, vtu and restart files.

Is there a separate script to calculate averages?

Thanks,
Mandar

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

Re: Exporting to vtp

Post by David Parker » Mon Jun 13, 2022 1:03 pm

Hi Mandar,

You can create the flow files using the SV GUI, need to move the restart files to your local computer.

I also wrote a C++ program to create these files. See https://github.com/ktbolt/cardiovascula ... flow-files.

Cheers,
Dave

User avatar
Mandar Kulkarni
Posts: 16
Joined: Tue Jul 13, 2021 10:38 am

Re: Exporting to vtp

Post by Mandar Kulkarni » Mon Jun 13, 2022 1:14 pm

Hi Dave,

This is exactly what I was looking for.. I will give it a try and get back to you.

Thanks much!!
Mandar

User avatar
Mandar Kulkarni
Posts: 16
Joined: Tue Jul 13, 2021 10:38 am

Re: Exporting to vtp

Post by Mandar Kulkarni » Mon Jun 13, 2022 3:55 pm

The C++ program works as intended and all_results-flow.txt, all_results-pressure.txt values match exactly with what the SV GUI outputs.

Also, just to report the success of using svpost, here is how I used svpost to output the vtp, vtu and restart files:

Code: Select all

svpost -all -start 0 -stop 100 -incr 50 -ph -laststep -vtu all_results.vtu -vtp all_results.vtp -vtkcombo -indir 16-procs_case -outdir converted-results
and I get the these output files:
restart.100.0 (because I had the options -ph -laststep),
all_results.vtu (because I had the options -vtu all_results.vtu, followed by -vtkcombo)
all_results.vtp (because I had the options -vtp all_results.vtp, followed by -vtkcombo)

On svpost -h, I saw these options

Code: Select all

-nonbinary          : Read/Write files in ASCII format
-vis file_prefix    : Write Vis-format results file
-vismesh filename   : Write Vis-format mesh file
What does the nonbinary option do and what is the Vis-format?

Thanks,
Mandar

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

Re: Exporting to vtp

Post by David Parker » Tue Jun 14, 2022 12:31 pm

Hi Mandar,

It appears that the -nonbinary option can only be used to read results that have been saved as ascii files. It does not seem to be used to write VTP files in ascii as I thought it would, caused svpost to fail.

The -vis flag is used to write results in an ascii format that was used by a now ancient visualization program. For example

Code: Select all

  region "fluid_region"
    time step 1
    time 1.0

    analysis results "pressure"
      number of data 8595
      type "nodal"
      order "scalar"
      length 1
      data
   -2.870094639730830e+00 
    3.259296010619859e+00 
    7.400246868472002e+00 
    1.658926949158073e+01 
.
.
.
    analysis results "velocity"
      number of data 8595
      type "nodal"
      order "vector"
      number of components 3
      components
      "x"
      "y"
      "z"
      end components
      length 3
      data
    0.000000000000000e+00     0.000000000000000e+00     0.000000000000000e+00 
    0.000000000000000e+00     0.000000000000000e+00     0.000000000000000e+00 
    0.000000000000000e+00     0.000000000000000e+00     0.000000000000000e+00 
    0.000000000000000e+00     0.000000000000000e+00     0.000000000000000e+00
    .
    .
    .

Cheers,
Dave

User avatar
Mandar Kulkarni
Posts: 16
Joined: Tue Jul 13, 2021 10:38 am

Re: Exporting to vtp

Post by Mandar Kulkarni » Thu Jun 16, 2022 11:05 am

That explains it, thanks!

Mandar

POST REPLY