|
[Sponsors] |
How to output values only on cell center or vertex? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 ![]() |
Hi,all:
I want to extract the data on a cutting plane. Grid 128*128, however, the output data contains 32768 points rather than 16384, it's quite inconvenient to find which value corresponding to the specific point listed in the output data. For example(xz plane), if you range the x value from small to large, than you will find 256 x values, however, each x corresponds to 128 z values. The same to z ![]() So I'd like to know how can I output the value only at cell center or vertex. Thanks |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 ![]() |
Anyone can help? Any comment is OK, I'm looking forward for the way to solve it, I have stuck with this for several days
|
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
|
Hi,
Post your samlpleDict as from the post it's not quite clean what sampling mechanism you're using. If it is cuttingPlane, then AFAIK it's usually triangulated, that's why there's a difference between number of points in mesh and in sample output. And if you'd like to have a table with columns |x y value|, it's quite simple to implement utility for this output yourself (though maybe there is already one). |
|
![]() |
![]() |
![]() |
![]() |
#4 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 ![]() |
Quote:
Thank you.This is my sampleDict Code:
setFormat raw; surfaceFormat raw; fields ( UMean U ); surfaces ( constantPlane { type plane; // always triangulated basePoint (0 0.041 0); normalVector (0 1 0); } ); |
||
![]() |
![]() |
![]() |
![]() |
#5 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 ![]() |
Quote:
Code:
nearWalls_interpolated { // Sample cell values off patch. Does not need to be the near-wall // cell, can be arbitrarily far away. type patchInternalField; patches ( "bottomWall" ); interpolate true; // Optional: specify how to obtain sampling points from the patch // face centres (default is 'normal') // // //- Specify distance to offset in normal direction offsetMode normal; distance 0.0407; // // //- Specify single uniform offset // offsetMode uniform; // offset (0 0 0.0001); // // //- Specify offset per patch face // offsetMode nonuniform; // offsets ((0 0 0.0001) (0 0 0.0002)); // Optional: whether to leave as faces (=default) or triangulate // triangulate false; } |
||
![]() |
![]() |
![]() |
![]() |
#6 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 ![]() |
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
|
Hi,
in fact at least in 2.2.2 triangulation of a plane is optional: Code:
Foam::sampledPlane::sampledPlane ( const word& name, const polyMesh& mesh, const dictionary& dict ) : sampledSurface(name, mesh, dict), cuttingPlane(plane(dict.lookup("basePoint"), dict.lookup("normalVector"))), zoneKey_(keyType::null), triangulate_(dict.lookupOrDefault("triangulate", true)), needsUpdate_(true) { ... What are you trying to do with the data? Maybe there's another way of solving your problem. |
|
![]() |
![]() |
![]() |
![]() |
#8 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 ![]() |
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#9 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 ![]() |
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#10 |
Senior Member
|
Hi,
well, yes. Just checked 2.1.1 sources and there: Code:
bool Foam::sampledPlane::update() { ... if (selectedCells.empty()) { reCut(mesh(), true); // always triangulate. Note:Make option? } ... Just for post-processing of your case, you can change that true to false in src/sampling/sampledSurface/sampledPlane/sampledPlane.C and then run wmake in src/sampling folder. After this modification planes won't be triangulated at all (I think I've made this thing once while post-processing results on regular mesh). What do you plan to use for calculation of energy spectrum? If it is external tool (ex. scipy, Matlab), you can interpolate that triangulated data on regular rectangular grid. If it is C++, why not do it using OpenFOAM, where you can iterate over the cells of the mesh getting values inside cells and coordinates of the centers. |
|
![]() |
![]() |
![]() |
![]() |
#11 | |
Senior Member
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14 ![]() |
Quote:
Yes, I do the post-process in Matlab. In order to simplify the process, I need to output only the point or cell center values. Although C++ is a better way, I find it's hard for me to use, for example, in structure mesh, I don't know the cell index and how to get each. If I want to do the average along a homogenous direction, I don't know how to realize this. |
||
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] outputTime in Swak function | immortality | OpenFOAM Community Contributions | 20 | October 6, 2022 13:08 |
Setting cell variable values in a fluid zone using UDF | eromon84 | Fluent UDF and Scheme Programming | 6 | March 28, 2021 12:59 |
setfields for alpha | belkadi | OpenFOAM Programming & Development | 7 | November 25, 2014 12:53 |
[blockMesh] Include list of points | Hikachu | OpenFOAM Meshing & Mesh Conversion | 0 | June 20, 2011 10:03 |
Warning 097- | AB | Siemens | 6 | November 15, 2004 05:41 |