Initial Condition and geometry doubts

Provides a system for patient-specific cardiovascular modeling and simulation.
POST REPLY
User avatar
Nishanth Surianarayanan
Posts: 39
Joined: Thu May 30, 2019 6:21 pm

Initial Condition and geometry doubts

Post by Nishanth Surianarayanan » Mon Sep 23, 2019 10:13 pm

Hi Developers,

1. When creating mesh, I see error due to interference of geometry. The software says the coordinates where the error is occurring. But is there any way I can visualize at which point the error is occurring using any software such as Paraview or Meshmixer? I would like to make some modifications to the geometry to correct the error, provided it doesn't alter the geometry drastically.
simvascular doubt6.PNG
simvascular doubt6.PNG (32.67 KiB) Viewed 407 times
2. For inlet flow conditions, we specify the number of Fourier modes and documentation recommends 10 Fourier modes for pulsatile flow. But is there a possibility for the curve fitting to blow up for any specific number of fourier modes? I have tried curve fitting my inlet flow profile on Matlab curve fitting tool and sometimes at the ends, the profile blows up (tends to +/- infinity). Is this also possible in Simvascular since we are not able to see how the curve fitting looks like for a specified fourier mode number? (see attached pictures from Matlab for the problem I am referring)

For 7 fourier modes:
simvascular doubt4.PNG
simvascular doubt4.PNG (89.43 KiB) Viewed 413 times
For 8 fourier modes:
simvascular doubt5.PNG
simvascular doubt5.PNG (92.88 KiB) Viewed 413 times
3. Is it possible for Simvascular developer to show a graph how the curve fitting looks like for a particular number of fourier modes? This can help the user determine sufficient number of modes to use.

4. What is the maximum number of fourier modes that can be used? Is there a limit? I tried using 12 for one of my simulation (wonder if this caused any error)

5. When should we use "Flip normal" option in Prescribed Velocities BC? I don't see any way to see the profile on the software to determine whether to use this option! (I'm not sure if my interpretation of this option is correct)

Thank you for your patience in assisting the users!

Best,
Nishanth

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

Re: Initial Condition and geometry doubts

Post by David Parker » Tue Sep 24, 2019 11:55 am

Hi Nishanth,

I'll answer your first question, someone else will reply to your other questions.

The TetGen error means that there is a vertex imbedded in an edge. These kinds of errors typically occur because the end of a vessel is not fully inside another vessel. Have a look here http://simvascular.github.io/docsModelG ... thPlanning for a discussion of this.

I have used MeshLab is the past to fix certain geometries but I think it is better to create a good model from the start. But if you would like to use MeshLab or MeshMixer to correct the geometry then you will need to first convert the .vtp model file into a .ply file. You can do this using VTK

Code: Select all


#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkXMLPolyDataReader.h>
#include <vtkPLYWriter.h>
#include <vtkXMLPolyDataWriter.h>

int main(int argc, char *argv[])
{
  std::string inputFileName = "demo.vtp";
  std::string outputFileName = "demo.ply";
 
   // Read .vtp file.
  vtkSmartPointer<vtkXMLPolyDataReader> reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
  reader->SetFileName(inputFileName.c_str());
  reader->Update();
 
  // Extract the polydata
  vtkSmartPointer<vtkPolyData> polydata = reader->GetOutput();

  // Write .vtp file.
  vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New();
  writer->SetFileName(outputFileName.c_str());
  writer->SetInputData(polydata);
  writer->Write();
  
 }

Cheers,
Dave

User avatar
Vijay Vedula
Posts: 63
Joined: Mon Feb 09, 2015 1:27 pm

Re: Initial Condition and geometry doubts

Post by Vijay Vedula » Wed Sep 25, 2019 4:38 am

(2) You are right, it is possible that you may get weird curves and oscillations when using Fourier series fit for arbitrary data even though the data is periodic. In SimVascular, Fourier fit is used as in intermediate step before creating a linear interpolation depending on the 'Point Number' value the user provides, and exports the linearly interpolated data into bct.dat/bct.vtp files. It is recommended that the user examines bct.vtp file by loading it in Paraview and checks for any anomalies before running the simulation. This will also help determine whether a flipping of normals on the face is needed (answers your question 5) in case bct.vtp has flow going in the opposite direction.

(3) Interesting idea. Please create an issue/feature request at https://github.com/SimVascular/SimVascular/issues so the developers can keep track of it.

(4) There is no absolute maximum. You may want to provide a value that you think is adequate to capture all the desired features of the raw data. Using a vey high value can create spurious high frequency oscillations and can be an overkill. Using Fourier fit in this application is only intended to create a smooth periodic approximation for the raw data that can be noisy.

(5) answered above.

User avatar
Nishanth Surianarayanan
Posts: 39
Joined: Thu May 30, 2019 6:21 pm

Re: Initial Condition and geometry doubts

Post by Nishanth Surianarayanan » Wed Sep 25, 2019 1:34 pm

Hi Vijay,

Thanks for our reply!

(2) Can you tell me what features can be used in Paraview to see any anomalies and what anomalies can be possible other than finding whether the flow is directed inwards of the model?

(3) I will create one.

(4) Is 12 fourier modes a very high value to create any errors?

Thanks for your support!

Nishanth

User avatar
Vijay Vedula
Posts: 63
Joined: Mon Feb 09, 2015 1:27 pm

Re: Initial Condition and geometry doubts

Post by Vijay Vedula » Wed Sep 25, 2019 3:04 pm

Hi Nishanth,

For (2), one way to examine bct.vtp is to plot glyphs and warp them by the magnitude of the velocity, and then play a movie. You may check for the direction of the vectors - if it is in opposite direction, you could then flip normal direction in SimVascular. You should also see that the velocity magnitudes are within the range you expect them to be. If the velocity diverges for some errors in Fourier fit, you can easily spot them with glyph lengths growing to very large values, etc.

(4) Optimal no. of Fourier modes will depend on the raw data you have. For most data sets, 10 modes would be sufficient but if, for your application, you want to include some high frequency data, you may include higher Fourier modes.

Vijay

User avatar
Weiguang Yang
Posts: 110
Joined: Mon Apr 07, 2008 2:17 pm

Re: Initial Condition and geometry doubts

Post by Weiguang Yang » Wed Sep 25, 2019 3:47 pm

If you already ran the simulation for at least 1 cycle, you can generate the flow and pressure curves for each face (see Postprocessing Calculate Flows in the tutorial). Plot the inflow curve and see if it agrees well with your input waveform.

User avatar
Nishanth Surianarayanan
Posts: 39
Joined: Thu May 30, 2019 6:21 pm

Re: Initial Condition and geometry doubts

Post by Nishanth Surianarayanan » Sun Sep 29, 2019 12:11 pm

Thank you for your suggestions! I will try and let you know if I face any further issues!

POST REPLY