CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [OpenFOAM] Paraview and VTK (https://www.cfd-online.com/Forums/paraview/61108-paraview-vtk.html)

hemph April 21, 2005 05:19

I do this (in tcl) to get the
 
I do this (in tcl) to get the U-velocity field.
I got a lot of info from the VTK-books, 'VTK User's Guide'
and 'The Visualization Toolkit'.

//Rasmus Hemph

#------------------------------
#READ THE GRID
#------------------------------
vtkUnstructuredGridReader gridreader
append fileName $GRIDPATH $FILEPREFIX "1000.vtk"
gridreader SetFileName $fileName
#------------------------------

#-----------------------------------
#EXTRACT THE U-VECTOR VOLUME FIELD
#-----------------------------------
vtkFieldDataToAttributeDataFilter gfilter
gfilter SetInput [gridreader GetOutput]
gfilter SetInputFieldToPointDataField
gfilter DefaultNormalizeOff
gfilter SetVectorComponent 0 U 0
gfilter SetVectorComponent 1 U 1
gfilter SetVectorComponent 2 U 2
#-----------------------------------

#------------------------------
#OUTLINE OF THE DOMAIN
#----------------------------
#extract the outline of the domain
vtkOutlineFilter outline
outline SetInput [gridreader GetOutput]
#..and create a mapper and actor
vtkPolyDataMapper outlineMapper
outlineMapper SetInput [outline GetOutput]
set center [outlineMapper GetCenter]

...MORE CODE TO GET GRAPHICS...

mattijs April 21, 2005 05:30

Hi Luke, when using the -fi
 
Hi Luke,

when using the -fields option supply the fields
between brackets as in

-fields (gamma U p)

luckyluke April 21, 2005 07:05

Now,foamToVTK has been modifie
 
Now,foamToVTK has been modified to meet my need and a likely right VTK file was got.

I don't know exactly the difference between vtkMesh and fvMesh. The vMesh is defined as follows:
vtkMesh vMesh
(
IOobject
(
meshName,
runTime.timeName(),
runTime,
IOobject::MUST_READ
),
cellSetName
);
I want to know if the point and cell data have been read into vMesh with the above code? If the mesh of my solver keep the same along the time, then whether the code
"polyMesh::readUpdateState meshState = vMesh.readUpdate();......"
in the time loop of my solver
"while (runTime.run()){......}"
should be removed?

Help me.

luckyluke April 21, 2005 07:56

Another question, I want to kn
 
Another question, I want to know if vtkMesh vMesh can be constructed dircetly from fvMesh mesh? Or if we can convert foam data to VTK format without vtkMesh class?

mattijs April 21, 2005 13:56

Yes, when you construct a vtkM
 
Yes, when you construct a vtkMesh with an IOobject with MUST_READ flag it will read the whole mesh. (leave cellSetName an empty string)

It behaves exactly like a normal fvMesh with the difference that it holds the vtk representation (accessible through topo()).

You do not need the readUpdate if your mesh is static.

The vtk representation (vtkTopo) holds the vtk cell types and vertices and does automatic decomposition of polyhedral cells.

Sounds as if you're trying to do something hard. Good luck!

luckyluke April 22, 2005 10:19

Hi, Mattijs, thanks for your h
 
Hi, Mattijs, thanks for your help.
The VTK file achieved has the following lines.
CELL_DATA 12800
FIELD attributes 2
cellID 1 12800 int
gamma 1 12800 float //1 for scalar?

In my Visualization Toolkit, I can only find POINT_DATA instead of CELL_DATA. Which vtk class should be used? vtkUnstructuredGridReader,vtkUnstructuredGrid, or vtkFieldData? Can you tell me how to get the gamma field out in VTK?

Help me.
Thanks.

mattijs April 22, 2005 10:26

No idea. This is what I would
 
No idea. This is what I would do:
1. get a valid case with a gamma field and convert it with foamToVTK with the -ascii option and compare the output.
2. the name of the reader is displayed somewhere on the tab it creates when you read your file.

braennstroem April 25, 2005 02:22

Hi, can anybody tell me wha
 
Hi,

can anybody tell me what advantages paraview has compared to Opendx; and disadvantages. I mean there must be some good reasons, not to support OpenDX anymore!?
Until now, I use OpenDX which is in my eyes pretty powerfull, but I am thinking about leaving OpenDX and just go deeper into paraview.

Greetings!
Fabian

mattijs April 25, 2005 04:19

- paraview runs without any us
 
- paraview runs without any user programming in combination with the foamToVTK converter
- paraFoam requires much less programming than the Open-DX reader (have a look at the complexity of the postFoam network)
- paraview uses much less memory.
- paraview can do distributed data.

There was never too much of a problem with Open-DX itself, it was all the programming nessecary to read and display OpenFOAM data. Paraview is setup to be a CFD postprocessor, OpenDX is an environment to quickly generate one's own postprocessor.

oevermann April 27, 2005 06:21

Hi, I'm having problems using
 
Hi, I'm having problems using paraview 2.0. Since I have an installed version of paraview 2.0 aleady running on my machine, I don't want to compile it again in openfoam. However, when I call
paraFoam icoFoam cavity
on the tutorial example, I get the following error message with paraview crashing

/home/oevermann/OpenFOAM/OpenFOAM-1.1/bin/paraFoam: line 57: 5357 Segmentation fault paraview paraFoam.pvs

Question: how do I get openfoam work neatly with a pre-installed paraview? Which environmental variables and configuration files do I need to set?

Thanks for any help

michael

henry April 27, 2005 06:27

You will have to rebuild the O
 
You will have to rebuild the OpenFOAM ParaView reader module for your pre-installed version of ParaView but the binaries released from KitWare do not include all the necessary build scripts to do this which is why we release ParaView binaries with OpenFOAM which include everything necessary to build the reader module. So the easiest way forward is for you to use the ParaView we release with OpenFOAM or if for some reason you are unable to you will probably have to build from sources.

eugene April 27, 2005 06:33

I have similar problems. I ins
 
I have similar problems. I installed paraview 2.0 to take advantage of the new animation and parallel post-processing capabilities and it is no longer compatible with the reader module.

If you do not want to downgrade to the supported paraview version, I suggest you use the foamToVTK utility to convert your cases to vtk format before post processing. At least that is what I am doing at the moment.

oevermann April 27, 2005 06:36

Henry, thanks for the note! I
 
Henry, thanks for the note! I did built Paraview from source because there is no binary for G5 Mac's running Debian Gnu Linux. So, everything should be OK. How do I rebuild the reader module?

Thanks, michael

henry April 27, 2005 06:46

First change the environment v
 
First change the environment variable for the location and version of ParaView in
.OpenFOAM-1.1/apps/paraview/bashrc or cshrc depending on what shell you are using and source your ~/.bashrc or ~/.cshrc. Then goto OpenFOAM-1.1/applications/utilities/postProcessing/graphics/PVFoamReader
and remove the directories for your platform from PVFoamReader/Make and vtkFoam/Make and type Allwmake and that should build the reader module for you.

luckyluke April 27, 2005 08:09

Hi,all. I want to use the VTK
 
Hi,all. I want to use the VTK lib in this directory "OpenFOAM/linux/paraview-1.8.5/". Whether the VTK contained in paraview has any difference to the original version from the web site of VTK? What is the version of my VTK located in "OpenFOAM/linux/paraview-1.8.5/"?

Under this folder
"\OpenFOAM-1.1\applications\utilities\postProcessing\graphics \PVFoamReader\vtkFo am\Make", I found the option file

EXE_INC = \
-I$(ParaView_INST_DIR)/include/vtk \
-I../PVFoamReader

LIB_LIBS = $(GLIBS).

What is the value of $(GLIBS)? I type "echo $GLIBS", it shows nothing. What should "GLIBS" be replaced by?

Thanks.

oevermann April 27, 2005 13:23

I have rebuild the ParaView re
 
I have rebuild the ParaView reader and paraview 2.0 starts up normally. However, on the console I get the following error message and Paraview crashes when I hit e.g the accept button:

ErrorMessage
# Error or warning: There was a VTK Error in file: /home/oevermann/ftp/paraview-2.0.1/VTK/Filtering/vtkDemandDrivenPipeline.cxx (544)
Algorithm vtkFoamReader(0x117da848) did not create output for port 0 when asked by REQUEST_DATA_OBJECT and does not specify a concrete DATA_TYPE_NAME.
ErrorMessage end
ErrorMessage
# Error or warning: There was a VTK Error in file: /home/oevermann/ftp/paraview-2.0.1/VTK/Filtering/vtkDemandDrivenPipeline.cxx (544)
Algorithm vtkFoamReader(0x117da848) did not create output for port 0 when asked by REQUEST_DATA_OBJECT and does not specify a concrete DATA_TYPE_NAME.
ErrorMessage end
ErrorMessage
# Error or warning: There was a VTK Error in file: /home/oevermann/ftp/paraview-2.0.1/VTK/Filtering/vtkDemandDrivenPipeline.cxx (544)
Algorithm vtkFoamReader(0x117da848) did not create output for port 0 when asked by REQUEST_DATA_OBJECT and does not specify a concrete DATA_TYPE_NAME.
ErrorMessage end
ErrorMessage
# Error or warning: There was a VTK Error in file: /home/oevermann/ftp/paraview-2.0.1/VTK/Filtering/vtkDemandDrivenPipeline.cxx (544)
Algorithm vtkFoamReader(0x117da848) did not create output for port 0 when asked by REQUEST_DATA_OBJECT and does not specify a concrete DATA_TYPE_NAME.
ErrorMessage end

Paraview works fine with other (non openfoam) applications. Any suggestions what's going wrong here?

Thanks again for any help

Michael

henry April 27, 2005 13:35

Sorry I haven't tried the read
 
Sorry I haven't tried the reader module with anything beyond paraview-1.8.5 but we will try paraview-2.0.1 for the next release.

aap May 4, 2005 05:37

Hi! I have run the tutorial c
 
Hi!
I have run the tutorial case simpleFoam/pitzDaily. I have seen the results with paraview. Do you know how to picture the streamlines? And other question, if I want to use simpleFoam for laminar regime, how could I "eliminate" the turbulence?
Thanks
Amalia

hjasak May 4, 2005 05:58

Use the "laminar" turbulence m
 
Use the "laminar" turbulence model.

in constant/turbulenceProperties:

turbulenceModel laminar;

Enjoy,

Hrv

chris May 4, 2005 06:27

Streamlines are documented in
 
Streamlines are documented in the user guide:
http://www.opencfd.co.uk/openfoam/do...36-2000007.1.7

Alternatively, just experiment with the Filters. They are very easy and intuitive to use.


All times are GMT -4. The time now is 07:24.