# Tag Info

16

The easiest way I could find to subtract two fields from different VTK files with the same structured grid is to use a programmable filter in Paraview, which lets you manipulate data using Python scripts. In the programmable filter dialogue box, you can subtract the two arrays and write to output with the code: phi_0 = inputs[0].CellData['Phi'] phi_1 ...

7

If you want to keep your FE code independent of the VTK API, writing a file that VTK can read is the most straightforward way to do that. The file formats are documented here: http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf The legacy format is simpler but the XML format provides access to some of the newer features of VTK. Creating VTK ...

6

Your intuition is right, for example in 3D Orbitals (German Wikipedia) the caption explicitly states that 90% iso-surfaces are used. I have however seen different percentages before where the results look similar. Did you check the Mayavi Example Atomic Orbital? If you remove the phase-coloring and find the additional parameter to contour that sets the ...

3

Unfortunately (unless things have changed very recently) VTK doesn't fully support anything higher than second order cells in terms of mesh visualisation and filtering. Various common workarounds based on upscaling have been attempted, see for example this related question.

3

It is not surprising that VTK can't generate a volume rendering for the poly_vertex cell type since there is no topology associated with that type of cell. The way finite element integration point results is often dealt with is described below: It is common in finite element methods to calculate results (e.g. stresses) at the element integration points. ...

3

In ParaView there is the Append Attributes filter which can be used for this. It requires that the same number of points are in the data set for appending point data properly and the same number of cells are in the data set for appending cell data properly. It will have problems though with arrays of the same name (i.e. Phi in your example). You can copy ...

2

As said above, the VTK legacy format is simple and straightforward and you should be able to write a subroutine to create the output file. However in your case, you are dealing with billions of nodes, resulting in a huge (or several) file. For such amount of data, you must use compressed binary format. I assume you run your code in parallel on a cluster. ...

2

I recently came across a Python tool that claims to convert between all kinds of different mesh formats. I haven't gotten around to trying it yet, but maybe it can help you: https://github.com/nschloe/meshio

2

Here's a simple working example of what I wanted to do, using PyVista. It needs X11 to plot. So, if you are running on a system without X11 (e.g. Ubuntu under WSL2) you might need to install Xvfb. See here for further instructions. This example is based on this PyVista example import numpy as np import pyvista as pv # mesh points vertices = np.array([[0, 0, ...

2

As mentioned by @AloneProgrammer in the comments, you could use ParaView since it is effortless. As added by @WolfgangBangerth, you could also try VisIt that provides a frontend for VTK algorithms. If you need to do it programmatically through Python scripts you could use: VTK itself. The API is not the most intuitive but you could get used to it. It gives ...

1

As suggested in Kindlmann the curvature of a surface is defined by the relationship between positional changes in the neighborhood of a point placed on the surface and the change in the surface normal. Given a level-set $\Phi(\mathbf{x})$, we consider that the value of the level-set is positive inside the object, negative outside. Hence, we define the ...

1

You should have only one CELL_DATA tag in your file. Remove the second one to fix your problem. Some (partial) doc can be found here

1

You can use VTK-m to parse the files and they will automatically show up in a sensible data structure, ready for parallel processing. The learning curve is a bit steep, but the documentation is very legible. Here's a demo which reads a VTK file and uses it for particle advection.

1

Recombine Surface{1} - recombines only the triangles for the surface #1. To allow recombination of all the surfaces, you need either Mesh.RecombineAll=1 or Recombine Surface {:};. Those commands will perform it on all the surfaces. However, I find it a bit strange that you are using Recombine commands for that purpose. They are usually used to create a ...

1

What I want to do can be done by adding cell information to the VTK file, or in ParaView by using Filter->Clip with the "crinkle cut" activated.

1

For volume rendering in ParaView your vtk file should contain a scalar, vector, or tensor data array. Otherwise, it does not show anything to you. You can create a test data array by going to Filters -> Calculator. Then you should see something in your volume rendering.

1

Yes -- in VTK you can output data as lines even if you are in 2d (and in 3d). You can see an example here, as part of the deal.II tutorial program step-51: https://dealii.org/developer/doxygen/deal.II/step_51.html#Results

1

Are you using a program that implements VTK (i.e. ParaView), or are you implementing the RK method yourself? I know that in the ParaView GUI, it's possible to adjust the relative error between the two RK methods, assuming it's some kind of adaptive method like 4/5 Cash-Karp. If you are implementing your own RK method, I would adjust the error or tolerance. ...

1

I don't have a particularly good approach, but I'd copy the 'phi' field from one VTK file into the other and name it 'phiprime' or something. In both Paraview and Visit, you have the option of defining new fields by a formula that uses the values of other fields. You can then define a field "error" as "error=phi-phiprime" in the field editor, and plot this ...

1

The answer to your question is that you can change your Programmable Filter output type to a vtkPolyData and set the Script to: phi0 = inputs[0].PointData['phi'] phi1 = inputs[1].PointData['phi'] dd = abs(phi1-phi0) #note absolute value here ss = sum(dd) points = vtk.vtkPoints() points.InsertPoint(0, [0, 0, 0]) output.SetPoints(points) globalsum = vtk....

1

The way this is done in the deal.II library (http://www.dealii.org; disclaimer: this is a project I am affiliated with) is that we describe an unstructured data set of 3d points and then create cells that happen to be two-dimensional. In other words, just output a set of quadrilaterals that happen to live in a three-dimensional space. To give an example, ...

1

I realized this is a bit older, but I though you might be interested in the VisIt solution: You can do this in VisIt with something called a Connectively Based Cross Mesh Field Expression. That is a mouthful, but is basically machinery to maps fields between databases (in your case VTK files). The "Connectivity based" (conn_cmfe) is used when the topology ...

Only top voted, non community-wiki answers of a minimum length are eligible