4. Aneurysm

This tutorial provides a short introduction to VisIt’s features while exploring a finite element blood flow simulation of an aneurysm. The simulation was run using the LifeV finite element solver and made available for this tutorial thanks to Gilles Fourestey and Jean Favre, Swiss National Supercomputing Centre.

4.1. Open the dataset

This tutorial uses the aneurysm dataset.

  1. Download the aneurysm dataset.
  2. Click on the Open icon to bring up the File open window.
  3. Navigate your file system to the folder containing “aneurysm.visit”.
  4. Highlight the file “aneurysm.visit” and then click OK.

4.2. Plotting the mesh topology

First we will examine the finite element mesh used in the blood flow simulation.

4.2.1. Create a Mesh plot

  1. Go to Add->Mesh->Mesh.
  2. Click Draw.
../_images/Aneurysm-MeshPlotAdd.png

Fig. 4.86 Adding a mesh plot.

After this, the mesh plot is rendered in VisIt’s Viewer window. Modify the view by rotating and zooming in the viewer window.

4.2.2. Modify the Mesh plot settings

  1. Double click on the Mesh plot to open the Mesh plot attributes window.
../_images/Aneurysm-MeshAttributes.png

Fig. 4.87 The mesh plot attributes window.

  1. Experiment with settings for:
  • Mesh color
  • Opaque color
  • Opaque mode - When the Mesh plot’s opaque mode is set to automatic, the Mesh plot will be drawn in opaque mode unless it is forced to share the visualization window with other plots, at which point the Mesh plot is drawn in wireframe mode. When the Mesh plot is drawn in wireframe mode, only the edges of each externally visible cell face are drawn, which prevents the Mesh plot from interfering with the appearance of other plots. In addition to having an automatic opaque mode, the Mesh plot can be forced to be drawn in opaque mode or wireframe mode by selecting the On or Off. This is best demonstrated with the Pseudocolor plot of pressure present.
  • Show internal zones

You will need to click Apply to commit the settings to your plot.

../_images/Aneurysm-Mesh.png

Fig. 4.88 The mesh plot of the aneurysm.

4.2.3. Query the mesh properties

VisIt’s Query interface provides several quantitative data summarization operations. We will use the query interface to learn some basic information about the simulation mesh.

  1. Go to Controls->Query to bring up the Query window.
  2. Select NumZones and click Query.
    • This returns the number of elements in the mesh.
  3. Select NumNodes and click Query.
    • This returns the number of vertices in the mesh

Note: The terms “zones”, “elements”, and “cells” are overloaded in scientific visualization, as are the terms “nodes”, “points”, and “vertices”.

4.2.4. Additional exercises

  • What type of finite element was used to construct the mesh?
  • How many elements are used to construct the mesh?
  • How many vertices are used to construct the mesh?
  • On average, how many vertices are shared per element?

4.3. Examining scalar fields

In addition to the mesh topology, this dataset provides two mesh fields:

  • A scalar field “pressure”, associated with the mesh vertices.
  • A vector field “velocity”, associated with the mesh vertices.

VisIt automatically defines an expression that allows us to use the magnitude of the “velocity” vector field as a scalar field on the mesh. The result of the expression is a new field named “velocity_magnitude”.

We will use Pseudocolor plots to examine the “pressure” and “velocity_magnitude” fields.

  1. Go to Add->Pseudocolor->Pressure.
  2. Click Draw.
  3. Double click on the Pseudocolor plot to bring up the Pseudocolor plot attributes window.
  4. Change the color table to Spectral and check the Invert button.
  5. Click Apply.
  6. Click Draw.
  7. Click Play in the Time animation controls above the plot list on the main GUI window.

You will see the pressure field animate on the exterior of the mesh as the simulation evolves.

../_images/Aneurysm-PseudocolorPressure.png

Fig. 4.89 The pseudocolor plot of the pressure.

Experiment with:

  • Setting the Pseudocolor plot limits.
  • Hiding and showing the Mesh plot.

When you are done experimenting, stop animating over time steps using the Stop button.

4.3.1. Query the maximum pressure over time

We can use the “pressure” field to extract the heart beat signal. We want to find the maximum pressure value across the mesh elements at each time step of our dataset. VisIt provides a Query over time mechanism that allows us to extract this data.

First, we need to set our query options to use timestep as the independent variable for our query.

  1. Go to Controls->Query over time options.
  2. Select Timestep.
  3. Click Apply and Dismiss.
../_images/Aneurysm-QueryOverTimeAttributes.png

Fig. 4.90 The QueryOverTime attributes window.

Now we can execute the Max query on all of our time steps and collect the results into a curve.

  1. Click on the Pseudocolor plot to make sure it is active.
  2. Go to Controls->Query to bring up the Query window.
  3. Select Max.
  4. Check Do Time Query.
  5. Click Query.

This will process the simulation output files and create a new window with a curve that contains the maximum pressure value at each time.

../_images/Aneurysm-QueryOverTime.png

Fig. 4.91 The query over time plot.

4.3.2. Additional exercises

  • How many heart beats does this dataset cover?
  • Estimate the number of beats per minute of the simulated heart (each cycle is 0.005 seconds).

4.4. Contours and sub-volumes of high velocity

4.4.1. Examining the velocity magnitude

Next we create a Pseudocolor plot to look at the magnitude of the “velocity” vector field.

  1. Delete all your existing plots by selecting them all and clicking Delete.
  2. Go to Add->Pseudocolor->velocity_magnitude.
  3. Open the Pseudocolor plot attributes window and set the color table options as before.
  4. Click Draw.
../_images/Aneurysm-PseudocolorVelocityMagnitude.png

Fig. 4.92 The pseudocolor plot of the velocity magnitude.

Notice that the velocity at the surface of the mesh is zero. To get a better understanding of the flow inside the mesh, we will use operators to extract regions of high blood flow.

4.4.1.1. Creating a semi-transparent exterior mesh plot

When looking at features inside the mesh, it helps to have a partially transparent view of the whole mesh boundary for reference. We will add a Subset plot to create this view of the mesh boundary.

  1. Uncheck Apply operators to all plots.
../_images/Aneurysm-ApplyOperatorsToAllPlots.png

Fig. 4.93 The apply operators to all plots setting.

  1. Go to Add->Subset->Mesh.
  2. Open the Subset plot attributes window.
  3. Change the color to Light Blue.
  4. Set the Opacity slider to 25%.
  5. Click Apply.
  6. Click Draw.
../_images/Aneurysm-Subset.png

Fig. 4.94 The transparent subset plot.

4.4.1.2. Contours of high velocity

Now we will extract contour surfaces at high velocity values using the Isosurface operator.

  1. Select the Pseudocolor plot in the plot list.
  2. Go to Operators->Slicing->Isosurface.
  3. Open the Isosurface operator attributes window.
  4. Set Select by to Value, and use “10 15 20”.
  5. Click Apply and Dismiss.
  6. Click Draw and press the Play button to animate the plot over time.

You will see the contour surfaces extracted from the “velocity_magnitude” field animate as the simulation evolves.

../_images/Aneurysm-SubsetIsoSurface.png

Fig. 4.95 The transparent subset plot with iso surfaces of velocity magnitude.

4.4.1.3. Sub-volumes of high velocity

As an alternative to contours, we can also extract the sub-volume between two scalar values using the Isovolume operator.

  1. Click Stop to stop the animation.
  2. Remove the Isosurface operator.
  3. Go to Operators->Selection->Isovolume.
  4. Open the Isovolume operator attributes window.
  5. Set the Lower bound to “10” and the Upper Bound to “20”.
  6. Click Apply and Dismiss.
  7. Click Draw and press the Play button to animate the plot over time.
../_images/Aneurysm-SubsetIsoVolume.png

Fig. 4.96 The transparent subset plot with an iso volume of velocity magnitude.

4.5. Visualizing the velocity vector field

This section of the tutorial outlines using glyphs, streamlines, and pathlines to visualize the velocity vector field from the simulation.

4.5.1. Plotting the vector field directly with glyphs

VisIt’s Vector plot renders a vector field at each time step as a collection of arrow glyphs. This allows us to see the direction of the vectors as well as their magnitude. We will create a vector plot to directly view the simulated “velocity” vector field.

  1. Go to Add->Vector->velocity.
  2. Open the Vector plot attributes window.
  3. Go to the Vectors tab.
  4. Set Stride to “5”.
  5. Go to the Color section on the Data tab.
  6. Change the Magnitude to Spectral, and check the Invert option.
  7. Go to the Glyphs tab.
  8. In the Scale section, set the Scale to “0.5”.
  9. In the Style section, set Arrow body to Cylinder.
  10. In the Rendering section, set Geometry Quality to High.
  11. Click Apply and Dismiss.
  12. Click Draw.
  13. Click Play.
../_images/Aneurysm-Vector.png

Fig. 4.97 The vector plot of velocity.

4.5.2. Examining features of the flow field with streamlines

To explore the flow field further we will seed and advect a set of streamlines near the inflow of the artery. Streamlines show the path massless tracer particles would take if advected by a static vector field. To construct Streamlines, the first step is selecting a set of spatial locations that can serve as the initial seed points.

We want to center our seed points around the peak velocity value on a slice near the inflow of the artery. To find this location, we query a sliced pseudocolor plot of the “velocity_magnitude”.

  1. Go to Add->Pseudocolor->velocity_magnitude.
  2. Open the Pseudocolor plot attributes window and set the color table options as before.
  3. Go to Operators->Slicing->Slice.
  4. Open the Slice operator attributes window.
  5. In the Normal section set Orthogonal to Y Axis.
  6. In the Origin section select Point and set the value to “3 3 3”.
  7. In the Up Axis section uncheck Project to 2D.
  8. Click Apply and Dismiss.
  9. Click Draw.
../_images/Aneurysm-PseudocolorSliceVelocityMagnitude.png

Fig. 4.98 The velocity magnitude on a slice.

4.5.2.1. Query to find the maximum velocity on the slice

  1. Click to make sure the Pseudocolor plot of your “velocity_magnitude” slice is active.
  2. Go to Controls->Query.
  3. Select Max.
  4. Select Actual Data.
  5. Click Query.

This will give you the maximum scalar value on the slice and the x,y,z coordinates of the node associated with this value. We will use the x,y,z coordinates of this node to seed a set of streamlines.

../_images/Aneurysm-QueryMaxVelocityMagnitude.png

Fig. 4.99 The result of the velocity magnitude query.

4.5.2.2. Plotting streamlines of velocity

  1. Go to Add->Pseudocolor->operators->IntegralCurve->velocity.
../_images/Aneurysm-CreateStreamlinePlot.png

Fig. 4.100 Creating a streamline plot with the IntegralCurve operator.

  1. Open the IntegralCurve operator attributes window.
  2. Go to the Source tab.
  3. Set the Source type to Circle.
  4. Set the Origin to the value returned from the max query: “3.45115 3 5.54927”, excluding any commas in the input text box.
  5. Set the Normal to the y-axis: “0 1 0”.
  6. Set the Up axis to the z-axis: “0 0 1”.
  7. Set the Radius to “0.12”.
  8. Go to the Sampling section.
  9. Set Sampling along: to Boundary.
  10. Set Samples in Theta: to “12”.
  11. Go to the Advanced tab.
  12. In the Warnings section, uncheck all of the warning checkboxes.
  13. Click Apply and Dismiss.
../_images/Aneurysm-IntegralCurveAttributes.png

Fig. 4.101 The IntegralCurve operator attributes.

  1. Open the Pseudocolor plot attributes window.
  2. Go to the Data tab.
  3. In the Color section set the Color table to Reds.
../_images/Aneurysm-PseudocolorDataAttributes.png

Fig. 4.102 The Pseudocolor attributes for the streamline data.

  1. Go to the Line section on the Geometry tab.
  2. Set Line type to Tubes.
  3. Set Tail to Sphere.
  4. Set Head to Cone.
  5. Set the head and tail Radius to “0.03”.
../_images/Aneurysm-PseudocolorGeometryAttributes.png

Fig. 4.103 The Pseudocolor attributes for the streamline geometry.

  1. Click Apply and Dismiss.
  2. Click Draw.
  3. Use the time slider controls to view a few time steps.
../_images/Aneurysm-Streamlines.png

Fig. 4.104 The streamlines of velocity.

4.5.3. Examining features of the flow field with pathlines

Finally, to explore the time varying behavior of the flow field we will use pathlines. Pathlines show the path massless tracer particles would take if advected by the vector field at each timestep of the simulation.

We will modify our previous IntergralCurve options to create pathlines.

  1. Set the time slider controls to the first timestep.
  2. Open the IntegralCurve attributes window.
  3. Go to the Appearance tab.
  4. In the Streamlines vs Pathlines section select Pathline.
  5. In the Pathlines Options section set How to perform interpolation over time to Mesh is static over time.
../_images/Aneurysm-IntegralCurvePathlineAttributes.png

Fig. 4.105 The IntegralCurve operator pathline attributes.

  1. Click Apply and Dismiss.

This will process all 200 files in the dataset and construct the pathlines that originate at our seed points.

../_images/Aneurysm-Pathlines.png

Fig. 4.106 The pathlines of velocity.

4.6. Publishing to SeedMe.org

4.6.1. Required setup

4.6.2. Sharing automation script

In this section we will render and save pathline trace in 20 steps. Then upload and share the rendered 20 images as a sequence and instuct SeedMe to encode a video from these set of images at 2 frames per second. A sample video can be seen here.

A detailed example with a brief explanation in the comments can be seen here.

  1. Go to Controls->Command.

  2. Find an empty tab.

  3. Paste the following Python snippet into this tab.

    #
    # file: aneurysm_seedme.py
    # info:
    # Example showing how to use SeedMe to publish a pathline animation
    #
    
    ##############################################################################
    # To do : Set the following four variables
    ##############################################################################
    seedme_apikey_path = '/absolute/path/to/seedme.txt'
    my_rendered_image_path = "/absolute/path/for/images/" # does not traverse recursively
    my_content_privacy = "public" # private (default), group, public
    my_share_list = "one@example.com, two@example.com" # comma delimited emails
    
    
    # Set save window attributes including path where the rendered images will be saved
    sa = SaveWindowAttributes()
    sa.outputToCurrentDirectory = 0
    sa.outputDirectory = my_rendered_image_path
    sa.fileName = "pathline"
    sa.family = 1
    sa.format = sa.PNG
    sa.width = 512
    sa.height = 512
    sa.screenCapture = 0
    sa.saveTiled = 0
    sa.quality = 80
    sa.progressive = 0
    sa.binary = 0
    sa.stereo = 0
    sa.compression = sa.PackBits  # None, PackBits, Jpeg, Deflate
    sa.forceMerge = 0
    sa.resConstraint = sa.ScreenProportions  # NoConstraint, EqualWidthHeight, ScreenProportions
    sa.advancedMultiWindowSave = 0
    SetSaveWindowAttributes(sa)
    
    
    # Now save this pathline visualization in 20 frames (images)
    # Animate our pathlines by cropping based on time
    iatts = IntegralCurveAttributes()
    iatts.cropValue = iatts.Time
    iatts.cropEndFlag = 1
    
    nsteps = 20 # Number of steps
    final_time = .995
    for i in range(nsteps+1):
        iatts.cropEnd = final_time * i /nsteps
        SetOperatorOptions(iatts)
        SaveWindow() # will save images at the sa.outputDirectory provided above
    
    
    # ----------------------------------------------------------------------------------#
    # Upload and share content at SeedMe.org
    # Instruct the seedme module to upload 20 images then encode a video from it
    # seedme module ships with VisIt 2.9.x +
    # ----------------------------------------------------------------------------------#
    import seedme
    
    # Set path to the APIKey file
    obj.set_auth_via_file(seedme_apikey_path)
    
    # Create a dictionary for rendered image sequence
    my_seq = {
           "filepath": my_rendered_image_path,
           "title": "Pathline",
           "description": "Pathlines show the path massless tracer particles would take if advected by the vector field at each timestep of the simulation.",
           "fps": 2,
           "encode": True,
          }
    
    # Create seedme object
    obj = seedme.SeedMe()
    
    # Create a new collection using create_collection method
    # composed with title and sequence with public access, shared with two people
    result=obj.create_collection(title="Aneurysm vis",
                                 privacy=my_content_privacy,  # string = One of private(default), group, public
                                 sharing=my_share_list, # string = Comma delimited emails
                                 notify=True, # Boolean = False(default) send email notification to above two emails
                                 sequences=my_seq, # upload sequence
                                 )
    
    # create_collection returns the result as a string in json format
    print result
    
    url = obj.get_url(result)
    # Visit this url on your web browser
    print("\n\nThe url for this collection is: " + url)
    
  4. Click Execute.

To view your shared content login to SeedMe.org then navigate to My collections which should be somewhat similar to the public collections.


To learn more about the SeedMe Python API review the example demo.py.

4.7. Calculating the flux of a velocity field through a surface

To calculate a flux, we will need the original velocity vector, the normal vector of the surface, and VisIt’s Flux Operator. We will calculate the flux through a cross-slice located at Y=3, at the beginning of the artery.

4.7.1. Creating the slice and showing velocity glyphs

First we will directly plot the velocity vectors that exist on the slice through the 3D mesh.

  1. Delete any existing plots.
  2. Go to Add->Vector->velocity.
  3. Open the Vector plot attributes window.
  4. Go to the Vectors tab and set the Fixed number to “40”.
  5. Go to the Glyphs tab.
  6. Set Arrow body to Cylinder.
  7. Set Geometry Quality to High.
../_images/Aneurysm-VectorAttributes.png

Fig. 4.107 The Vector plot attributes.

  1. Click Apply and Dismiss.
  2. Go to Operators->Slicing->Slice.
  3. Open the Slice operator attributes window.
  4. Set Normal to Arbitrary and to “0 1 0”.
  5. Set Origin to Intercept and to “3”.
  6. Uncheck Project to 2D.
  7. Click Make default, Apply and Dismiss.
  8. Click Draw.
../_images/Aneurysm-SliceAttributes.png

Fig. 4.108 The Slice operator attributes.

In order to give some context to the Vector plot of velocity on the slice let’s add a Pseudocolor plot of velocity_magnitude on the same slice and a Mesh plot.

  1. Go to Add->Pseudocolor->velocity_magnitude.
  2. Open the Pseudocolor plot attributes window.
  3. Set Limits to Use Actual Data.
  4. Click Apply and Dismiss.
  5. Go to Operators->Slicing->Slice.
  6. Click Draw.
  7. Go to Add->Mesh->Mesh.
  8. Open the Mesh plot attributes window.
  9. Set Mesh color to Custom and select a medium grey color.
  10. Click Apply and Dismiss.
  11. Click Draw.
  12. Zoom in to explore the plot results.
../_images/Aneurysm-VectorSlice.png

Fig. 4.109 The velocity on the slice.

The Vector plot uses glyphs to draw portions of the instantaneous vector field. The arrows are colored according to the speed at each point (the magnitude of the velocity vector). Next we create an expression to evaluate the vectors normal to the Slice. These normals should all point in the Y direction.

4.7.2. Creating a vector expression and using the DeferExpression operator

We will use VisIt’s pre-defined expression to evaluate the normals on a cell-by-cell basis.

  1. Go to Controls->Expressions.
  2. Click New.
  3. Change the Name to “normals” and the Type to Vector mesh variable.
  4. Go to Insert function->Miscellaneous->cell_surface_normal in the Standard editor tab.
  5. Go to Insert variable->Mesh->Mesh in the Standard editor tab.
../_images/Aneurysm-Expressions.png

Fig. 4.110 The Expressions window.

  1. Click Apply and Dismiss.
  2. Return to the Vector plot and change its variable to “normals”.

You will then get the error message saying: The ‘normals’ expression failed because The Surface normal expression can only be calculated on surfaces. Use the ExternalSurface operator to generate the external surface of this object. You must also use the DeferExpression operator to defer the evaluation of this expression until after the external surface operator. In fact, VisIt cannot use the name Mesh which refers to the original 3D mesh. It needs to defer the evaluation until after the Slice operator is applied. Thus, we need to add the Defer Expression operator.

  1. Go to Operators->Analysis->DeferExpression.
  2. Open the DeferExpression operator attributes window.
  3. Go to Variables->Vector->normals.
../_images/Aneurysm-DeferExpression.png

Fig. 4.111 The DeferExpression window.

  1. Click Apply and Dismiss.
  2. Click Draw.
../_images/Aneurysm-VectorNormals.png

Fig. 4.112 The Vector plot of the normals.

  1. Verify that all your normals point in the up (Y) direction.

4.7.3. Calculating the flux on the slice

We are now ready for the final draw.

  1. Go to Add->Pseudocolor->operators->Flux->Mesh.
  2. Go to Operators->Slicing->Slice.
  3. Open the Slice operator attributes window.
  4. Verify that the default values previously saved are used.
  5. Move the Slice operator above the Flux operator.
  6. Go to Operators->Analysis->DeferExpression.
  7. Move the DeferExpression operator above the Flux operator just below the Slice operator.
  8. Open the Flux operator attributes window.
  9. Set the Flow field to “velocity”.
../_images/Aneurysm-FluxAttributes.png

Fig. 4.113 The Flux operator attributes window.

  1. Click Apply and Dismiss.
  2. Click Draw.
../_images/Aneurysm-VectorFlux.png

Fig. 4.114 The Vector plot of the flux.

Verify that you have a display that is cell-centered, and that will vary with the Time slider

  1. Get the numerical value of the flux by query-ing for the Weighted Variable Sum.
../_images/Aneurysm-QueryWeightedVariableSum.png

Fig. 4.115 The result of the Weighted Variable Sum query.