sampling on cellSet
Hii,
I need to use the "sample" utility to sample field values in a cellSet. Can someone please tell me the entries needed in sampleDict to do this? Thanks |
Quote:
http://www.cfd-online.com/Forums/ope...ampledict.html |
Hii Tushar,
Thanks for your reply. If I understand correctly, the link talks about sampling on a patch, which I can do by writing something like surfaces ( airfoil { type patch; patches (airfoil);; // interpolate false; } ); inside sampleDict. But I need to sample data along a cellSet (not patch) |
Quote:
If suppose you want to plot along a line follow the below shown procedure. Make your sampleDict like the one shown below: interpolationScheme cellPoint; setFormat raw; surfaceFormat raw; sets ( name { type uniform; axis y; start (0 0 0.0005); end (0 0.425 0.0005); nPoints 800; } ); fields (U p); In a similar fashion you can progress for the surface with some changes like surfaces instead of sets, type patch..etc. |
Hii Tushar,
Thanks for your reply. By cellSet I meant the list of cells which we can create based on multiple criteria (See section 5.1 of http://openfoamwiki.net/index.php/TopoSet). |
Quote:
Hi Tarak, Thanks for explaining.. Try looking at the already available topoSetDict with the OF. $tutorial/incompressible/pimpleFoam/TjunctionFan/system/ . May be bad co-ordinates could be sometimes a problem with the effecting running of utility. |
Tarak, Did you find a solution to sample your data on a cellSet/faceSet ? Thanks :) Regards François
|
sampling of cellSet
Hi,
One can first run the topoSetDict and try to make a cellSet. Below is the code to keep in topoSetDict in order to make box typed cellSet. Code:
Code:
foamToVTK -cellSet c0 -latestTime - Ashvin |
Thanks Ashvin for your tip. :)
Indeed it's possible to obtain VTK file from cellSet with foamToVTK but i'm looking for something different: I'll like to obtain a raw file of the sampled cellSet which I can load into python. Is it possible to do it without writing a parser to convert the VTK file to raw data ? Have a nice day Regards Francois |
Hii Francois,
No, I couldn't find a solution. Please let me know if you have one. |
Simple sampling using cellSet
Dear Tarak
Maybe I misunderstood something, but I think what you are trying to do is straight forward: The cellSet you create e.g. with topoSet will be in a file, say, <case>/constant/polyMesh/sets/c0. This contains a list of cell indices, e.g. for all cells having centres within a box defined in your topoSetDict. If the field that you want to sample is a volVectorField (such as the velocity field U) or volScalarField (such as the pressure field p) then the file <case>/<time>/<volFieldName> contains a list with N vectors or scalars, where N is the number of cells in your domain. The n'th value in the list is the field value at the n'th cell. So if your cellSet contains the values (0 4 10) your sampling is simply a matter of picking out elements 0, 4 and 10 in the files <case>/<time>/<volFieldName>. Of course for this to be usefull you also need the cell centres for these cells. This can be calculated with the utility writeCellCentres (type writeCellCentres -help in the terminal). Hope this helped. Johan Ps: If the field you want to sample is a surfaceScalarField or a surfaceVectorField the values in the time directories are the field values on the cell faces. Then I suppose you can do exactly the same using a faceSet. The n'th value in your <case>/<time>/<surfaceField> corresponds to the n'th face in your <case>/constant/polyMesh/faces file (the numbers in this faces file refers to the elements in the constant/polyMesh/points file). Unfortunetaly, I don't think there is any writeFaceCentres utility currently so you would have to calculate the face centres yourself. For this you can extract the points for the faces in your faceSet using writeMeshObject -faceSet <faceSetFileName>. |
Solved: sampling on cellSet
Quote:
OpenFOAM-4.x/src/functionObjects/field/fieldValues/volRegion/volRegion.H and find the sample controlDict at: OpenFOAM-4.x/src/functionObjects/field/fieldValues/controlDict This is very good feature for those who would like to have a time series of sampled data at a particular volume (defined by a cellZone) of the grid in cases where it is not feasible (e.g. huge grid sizes) to store timeseries of the whole grid. This time series later can be used for DMD analysis for example. With a small modification, you can change the time interval that you want the data to be sampled (which can be different than the main time interval), For example you can write: Code:
cellObj1 As mentioned in the header file, the following operations also can be performed on the volume: none | no operation sum | sum sumMag | sum of component magnitudes average | ensemble average weightedAverage | weighted average volAverage | volume weighted average weightedVolAverage | weighted volume average volIntegrate | volume integral min | minimum max | maximum CoV | coefficient of variation: standard deviation/mean Regards, Yousef |
Hi,
Have you tried it? volRegion is class not a function object. This will not work. Cheers, Sebastien |
I am trying to perform the same thing i.e. get the scalar field value for all cells belonging to a set.
Until now, what I am trying to do (combination of topoSet + sampleDict) does not work. If someone has found a solution to this issue, I am interested |
1 Attachment(s)
Quote:
Sorry for the late reply. I just saw the new posts. Regards |
Hi Yousef,
I'm now trying to do the similar work because I need to get a sampled specified volume field for my LES simulation. Although 'volRegion' can be used for the cellZone, I can only get the volume-averaged value for this cellZone rather than the values for each cell in this cellZone. The attached file that you give also shows the same problem. So do you know any other utilities to get the values for each cell in the specified volume? Best regards, Jin |
Quote:
I am now running across the same problem as you. Have you solved this problem? I know that 'volRegion' can be used for cellZone, but I can only get the volume-averaged value rather than the values for each cell in cellZone. Kind regards, Shawn |
Hello,
I have finally found one solution to the above problem. I am working on OpenFOAM 5. 1. Create a "topoSetDict" file into /system that contain: Code:
actions Code:
$ toposet Code:
$ setsToZones 4. Add into "/system/controlDict" Code:
functions - the file volFieldValue.dat into /postProcessiong/volFieldValue1 containing the result of the cellZone volume average. - into your latestTime folder, the file "U_cellZone-user_cellZone" containing the values of U for all the cells included into the cellZone. |
All times are GMT -4. The time now is 14:07. |