|
[Sponsors] |
October 21, 2013, 21: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 17:53. Reason: Added [CODE][/CODE] |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] Extracting ParaView Data into Python Arrays | Jeffzda | ParaView | 30 | November 6, 2023 21:00 |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 11:04 |
CFD by anderson, chp 10.... supersonic flow over flat plate | varunjain89 | Main CFD Forum | 18 | May 11, 2018 07:31 |
Exporting data (cell values, ascii) and obtaining more data than cells! | TfG | FLUENT | 3 | April 3, 2015 00:18 |
FvMatrix coefficients | shrina | OpenFOAM Running, Solving & CFD | 10 | October 3, 2013 14:38 |