CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > ParaView

Point data Or Cell data

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 21, 2013, 21:48
Default Point data Or Cell data
  #1
Member
 
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 5
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 17:53. Reason: Added [CODE][/CODE]
chenxizh is offline   Reply With Quote

Old   October 26, 2013, 08:20
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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, 19 views)
wyldckat is offline   Reply With Quote

Old   October 27, 2013, 00:07
Default
  #3
Member
 
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 5
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
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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, 15 views)
wyldckat is offline   Reply With Quote

Old   October 28, 2013, 08:44
Default
  #5
Member
 
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 5
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
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to access to field point data zxj160 OpenFOAM Programming & Development 6 May 21, 2015 05:35
exporting data from Fluent in batch mode without exporting entire design point nnvoro FLUENT 5 May 6, 2013 01:51
[ANSYS Meshing] Importing Cylinders by Point Data Input with Radii EphemeralMemory ANSYS Meshing & Geometry 2 May 31, 2012 13:34
Exporting unstructured, face-based, cell data to VTK sbaffini ParaView 4 December 18, 2011 16:06
udf to set vel. = 0 at a grid point or a cell Ralf Schmidt FLUENT 0 September 22, 2006 09:45


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