|
[Sponsors] |
October 21, 2013, 22:48 |
Point data Or Cell data
|
#1 |
Member
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 14 |
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] |
|
October 26, 2013, 09:20 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
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:
Best regards, Bruno
__________________
|
|
October 27, 2013, 01:07 |
|
#3 | |
Member
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 14 |
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:
|
||
October 27, 2013, 04:26 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
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:
__________________
|
|
October 28, 2013, 08:44 |
|
#5 | |
Member
chenxizhong
Join Date: Feb 2012
Posts: 30
Rep Power: 14 |
Bruno , Thanks, I get it now.
Quote:
|
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |