Quick How-To: Sample like in sampleDict during runtime
Hi everyone,
I recently tried to sample various data during runtime. Since I never found a satisfying example on how to do it, here is my (commented) source code that I added at the end of my control dict. The example shows a surface and a line, but can be changed to almost anything that you can use in sampleDict as well. Code:
libs ( I hope I was able to help you with this short code. Let me know if I messed something up, forgot something or if there is a better tutorial (case) somewhere out there =) Henning |
Exactly what I need, thanks!
I've used only line sampling in OF4.0 so far. Small error in the code: there should be semicolon after "sets(...)" inside "pos_1250_300_test1" function. |
does it run in parallel?
|
Yes, it should run in parallel as well
|
Point cloud
Here is one more sampling function. It provides a point cloud where the points are arranged along Cartesian axes. The fields can be interpolated on these points. I found this function somewhere on OpenFOAMWiki.
I used it to generate data files which I can use in order average the flow-fields along a particular coordinate axes. //-----3D array of points along Cartesian axes---------------------- my_point_cloud { functionObjectLibs ("libsampling.so"); type sets; outputControl timeStep; outputInterval 1; setFormat raw; interpolationScheme cellPoint; fields ( U D ); sets ( arrayA1 { type array; axis xyz; coordinateSystem { e1 (1 0 0); e2 (0 1 0); origin (0 0 0); } pointsDensity (2500 200 100); spanBox (3.5 0.1 0.25); } ); } |
All times are GMT -4. The time now is 05:17. |