CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Point data Or Cell data

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2013, 22:48
Default Point data Or Cell data
  #1
Member
 
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 14
chenxizh is on a distinguished road
Hi, I have a problem about the format of data. The problem is as follows: I have a bed as 0~Xmax, 0~Ymax, the size of grid is dx, dy. as in the SIMPLE scheme, the pressure is stored in cell center, so in order to visual the data in paraview, I do the following output
1. first do the loop to output the cell center coordinate, i*dx , i*dy,
2. then I want to output the cell center data of pressure P[i][j],
So the PROBLEM is that should I specific the type of pressure data to be CELL_DATA or POINT_DATA in Paraview?
can any one help me?
Thanks a lot!

The code is as follows,
Code:
// the version
    fprintf(output, "# vtk DataFile Version 2.0\n");

    // the title
    fprintf(output, "Fluid Flied\n");

    // the file format
    fprintf(output, "ASCII\n");

    // the datast structure
    fprintf(output, "DATASET STRUCTURED_GRID\n");

    // the datast dimensions 
    fprintf(output, "DIMENSIONS %d %d %d\n", NX, NY, NZ);  
  // points info
    fprintf(output, "POINTS %d int\n", NX*NY*NZ);  // this is the position
    for (z=0; z<NZ; z++)
    {
        for (y=0; y<NY; y++)
        {
            for (x=0; x<NX; x++e)
            {
                fprintf(output, "%5d%5d%5d\n", x, y, z);
            }
        }
    }
    
    // the dataset attributes
    // point id 
    fprintf(output, "POINT_DATA %d\n", NX*NY*NZ);  // Or This should be CELL_DATA:confused:, the number should be (nx-1)*(ny-1)*(nz-1) and start from 1
    fprintf(output, "SCALARS presuss double %d\n", 1);
    fprintf(output, "LOOKUP_TABLE default\n");

    for (z=0; z<NZ; z++)
    {
        for (y=0; y<NY; y++)
        {
            for (x=0; x<NX; x++)
            {
                fprintf(output, "%lf\n", press[z][y][x]);
            }
        }
    }

Last edited by wyldckat; October 22, 2013 at 18:53. Reason: Added [CODE][/CODE]
chenxizh is offline   Reply With Quote

Old   October 26, 2013, 09:20
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings chenxizh,

Let me check an example on OpenFOAM... here you go, a nice example from the "incompressible/icoFoam/cavityGrade" tutorial is inside the attachment file "cavityGrade_320.vtk.zip".

It provides the following data inside it:
  • List of points of the vertexes of the mesh.
  • List of cells, based on the list of existing vertex points.
  • List of cell types, so that it knows how many vertexes are assigned to each cell.
  • Then comes the cell data ("cellID", "p" and "U") and then point data ("p" and "U").
OpenFOAM's source code for foamToVTK is at: https://github.com/OpenFOAM/OpenFOAM...sion/foamToVTK - the entry point is in the file "foamToVTK.C".

Best regards,
Bruno
Attached Files
File Type: zip cavityGrade_320.vtk.zip (16.9 KB, 49 views)
__________________
wyldckat is offline   Reply With Quote

Old   October 27, 2013, 01:07
Default
  #3
Member
 
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 14
chenxizh is on a distinguished road
Thanks Bruno ,
I think I find out, the openfoam output the type of grid to be unstructure, so it output the cell and its relation between points, it also ouptut both cell and point data about the variables.
In my case, I define my grid to be structured , so either cell or point data is ok ?
Quote:
Originally Posted by wyldckat View Post
Greetings chenxizh,

Let me check an example on OpenFOAM... here you go, a nice example from the "incompressible/icoFoam/cavityGrade" tutorial is inside the attachment file "cavityGrade_320.vtk.zip".

It provides the following data inside it:
  • List of points of the vertexes of the mesh.
  • List of cells, based on the list of existing vertex points.
  • List of cell types, so that it knows how many vertexes are assigned to each cell.
  • Then comes the cell data ("cellID", "p" and "U") and then point data ("p" and "U").
OpenFOAM's source code for foamToVTK is at: https://github.com/OpenFOAM/OpenFOAM...sion/foamToVTK - the entry point is in the file "foamToVTK.C".

Best regards,
Bruno
chenxizh is offline   Reply With Quote

Old   October 27, 2013, 04:26
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
If the mesh is structured, then all that is needed is the box coordinates and the resolution.
As for the data, it should be cell data, since your data is for the center of the cells.

Attached is an example that was generated with the following list of source and filters:
  • Source "Wavelet", with -3 to 3 on all axis.
    • Filter "Elevation", with the default settings. You can change the orientation of the elevation vector, to get a better notion of the order of the cell data.
      • Filter "Point Data to Cell Data", so that the elevation data would be on the center of the cells.
Then I used from the menu the "File -> Save Data" entry to save to VTK the last item on the list.
Attached Files
File Type: zip structured_example.vtk.zip (926 Bytes, 37 views)
vishnu_240 likes this.
__________________
wyldckat is offline   Reply With Quote

Old   October 28, 2013, 08:44
Default
  #5
Member
 
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 14
chenxizh is on a distinguished road
Bruno , Thanks, I get it now.
Quote:
Originally Posted by wyldckat View Post
If the mesh is structured, then all that is needed is the box coordinates and the resolution.
As for the data, it should be cell data, since your data is for the center of the cells.

Attached is an example that was generated with the following list of source and filters:
  • Source "Wavelet", with -3 to 3 on all axis.
    • Filter "Elevation", with the default settings. You can change the orientation of the elevation vector, to get a better notion of the order of the cell data.
      • Filter "Point Data to Cell Data", so that the elevation data would be on the center of the cells.
Then I used from the menu the "File -> Save Data" entry to save to VTK the last item on the list.
chenxizh is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 22:00
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 18 May 11, 2018 08:31
Exporting data (cell values, ascii) and obtaining more data than cells! TfG FLUENT 3 April 3, 2015 01:18
FvMatrix coefficients shrina OpenFOAM Running, Solving & CFD 10 October 3, 2013 15:38


All times are GMT -4. The time now is 10:51.