Hot answers tagged

20

If your only worry is file size, then you want binary files. For an illustrative example, lets assume you are writing 1 double precision floating point number to a file. Let's assume that the file system can handle this perfectly and holding the file, headers, and padding are all 0. For a binary file, that number would take the exact size of the number in ...


15

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 ...


15

In practice, you rarely need data in visualization files that's more accurate than, say, 3 valid digits. In that case, ASCII is -- maybe surprisingly -- often more compact than binary form. If you're thinking about archiving, then bzip-ing these ASCII files is likely going to yield the smallest files you can get. That said, Paraview reads VTU format which ...


6

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 ...


5

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 ...


4

I don't know about "in the bash terminal itself", but I use python scripting with Visit. See here or here for some examples. Below I have pasted a simple script I use to make an image of a 2D slice along y = 0.5 of a 3D cube. The script is named "script.py" and "ysolution" refers to a variable name with the .vtk file. # invoke like so: visit -cli -nowin ...


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 ...


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.


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. ...


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

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. ...


1

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


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