How to interpolate array data using gauss points (quadrature)

I need to interpolate a result (stress) using gauss points.
I understand that I should use Quadrature Scheme.

I’ve created a quadrature definition:

vtkNew gauss_points_triangle;
gauss_points_triangle->Initialize(VTK_TRIANGLE, 3, 3, Ngauss3, Wi);

where 3 is the number of nodes, 3 the number of quadrature points, Ngauss is an array with the shape functions of each gauss points (dimension=9), Wi is the quadrature weights (dimension 3).

Afterwards I create an offset:
vtkDataArray* offsets = layer->GetOffsetsArray();

Afterwards I create my array with stress results (my unstructured grid contains 2 triangles):

vtkNew Stress_si;
Stress_si->SetName(“Stress Si”);

Afterwards I connect the quadrature scheme with Stress array:

auto* key = vtkQuadratureSchemeDefinition::DICTIONARY();
Stress_si->GetInformation()->Set(vtkQuadratureSchemeDefinition::QUADRATURE_OFFSET_ARRAY_NAME(), offsets->GetName());
Afterwards I add stress array into unstructured grid.

I think that the vtu file is correct:
example_vtk.vtu (2.4 KB)

However when I open this file in paraview I do not know how can I show my stresses interpolated.

I’ve found three filters in paraview:

  • Generate quadrature scheme dictionary: it appears the following error message:
    “Filter data has not been configured correctly. Aborting”.

  • Generate quadrature points: I can show my quadrature points:

  • InterpolatetoQuadraturePoints: it appears the same error message than using Generate quadrature scheme dictionary.

I do not how can I use these filters or another way to show stresses interpolating to gauss points.

The Interpolate to Quadrature Points filter interpolates the data at the points onto the gauss points of each element. Therefore, first load the mesh data that has scalar or vector values at nodes into ParaView. Here, note that you do not need to prepare the definition of the gauss points in advance. This is because the gauss points of your triangles are the same as the ones provided by the VTK library by default (see link below), so just run the Generate Quadrature Scheme Dictionary filter and the gauss points will be set.

Next, apply the Interpolate to Quadrature Points filter to interpolate the nodal data onto the gauss points. (The interpolated values will be saved as Field data, and you can check these values by specifying the Field as Attibute in SpreadSheet View.)

Finally, use the Generate Quadrature Points filter to generate real gauss points, and you will see the interpolated coloring in the Render View.

The following is an example of using the above three filters.
quadrature_sample.pvsm (642.5 KB)

1 Like

First of all, I would like to express my gratitude for your answer.

My problem is that I have values at cells, specifically in the gauss points, for example stresses. I cannot to interpolate these values to nodes because I could have different values in nodes. I would like to write my values in gauss points in a vtk file and then open this file in paraview and see these values interpolated in all element surface.

For instance, the following image shows the stress result written at gauss points and these stresses are interpolated over the surface.


Thank you very much for your help

Does it make sense to use Point Dataset Interpolator only for gauss points in your case? (Or do you not have values (e.g. ‘stress’ property) for these gauss points?)

I have values for the gauss points and I need how can I write these values in gauss points in a vtk file and then open it using paraview

For example:

For a stress value I have:

GaussPoints “Triangles” ElemType Triangle
Number Of Gauss Points: 3
Natural Coordinates: Internal

Result “Shells//Stresses//Top//SI” “Static” 1 Scalar OnGaussPoints “Triangles”
Unit “Pa”
1 1385.88453
2 1385.88453
End Values

I need to write this information in a vtk file and then open this file using paraview

In order to interpolate the values at gauss points onto the surface, I think we need to interpolate them onto the nodes first. Unfortunately, the ParaView and VTK libraries do not include such a feature (although it is not difficult to implement). To achieve the desired visualization, you may need to use other methods that do not embed the gauss points in the vtu file.

1 Like

When you extrapolate stresses to nodes you can have several values for each node depending on the cells around it.

Moreover I do not understand which is the usefulness of quadrature scheme. When you have values in nodes, then paraview interpolate this values on the surface of the cells.

For example, in the following image the displacement (displacement is a value calculated in the nodes) is shown:


In the following link it is possible to access a document where the quadrature scheme is explained:

At the end of this document it is possible to see an example of vtu file with the quadrature scheme:

My vtk file has this scheme but I do not if I am giving the values of cells correctly.

Thank you for your attention