# how to specify an arbitrary surface for field average in openfoam?

So, I am running this openfoam simulation and I need areaAverage velocity and pressure on a surface,currently the entire plane is being read, I wan't to specify my own in sampleSurfaceDict,

new_plane
{
type            faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled         true;
outputControl   timeStep;
log             true;
valueOutput     true;
source          sampledSurface;
//setFormat raw;
surfaceFormat   vtk;

sampledSurfaceDict
{
type            plane;    // always triangulated
basePoint       (0   -1.5 0);
normalVector    (0 -1 0);
}
operation       areaAverage;
fields
(
p
U
);
}


is there a type circle? or a way to specify radius? in sampledSurfaceDict

sampledSurfaceDict
{
type            plane;    // always triangulated
basePoint       (0   -1.5 0);
normalVector    (0 -1 0);
}


does anyone know about planeEquationDict?

• I think this is best asked in the OpenFOAM forums or mailing lists. – Wolfgang Bangerth Dec 18 '13 at 20:10
• @WolfgangBangerth I tried asking in cfdonline openfoam subforum. is there a openfoam-user mailing list? – fedvasu Dec 18 '13 at 20:12
• I don't know. But I'm sure openfoam.org or openfoam.com know. – Wolfgang Bangerth Dec 18 '13 at 20:47
• @WolfgangBangerth: OpenFOAM essentially sells support; there aren't any forums or mailing lists on their web sites, as far as I can tell, which limits sources of free support to third-party forums and providers, such as CFD Online or OPENFoam Extend. However, like here, sufficiently narrow technical questions regarding OpenFOAM may not be answered for a long time (if at all) on CFD Online because people may not have the expertise, and the documentation is left vague, ostensibly to induce people to pay for support. – Geoff Oxberry Dec 18 '13 at 23:27
• Aw, awesome. I had not realized this. That isn't exactly the spirit of open source... – Wolfgang Bangerth Dec 19 '13 at 13:38

## 1 Answer

As far as I know, there is non such thing. But what you aim for should be fairly straight forward to implement, as long as you happen to have some experience with C++.

1. Locate the circleSet in the OpenFOAM source directory.
2. Make a local copy of it and rename it to something like faceSetSet.
3. Read the name of the faceSet you'd like to sample on.
4. Read the faceSet.
5. In each timestep, loop only over those faces and average the fields you'd like.

This is a very rudimentary and basic algorithm, you'd have to fill in the gaps. If you need more help, let me know.

• OK, it is more than what I expected,let us say I implemented that functionality, how do I link to existing openfoam installation so that my current set-up is undisturbed? (I am basically running a variation on pimpleDyMFoam tut) – fedvasu Dec 19 '13 at 19:35
• Compile the above into a dynamic library, add the following code to your controlDict (change the library name, to fit your freshly compiled library): libs("mylib.so"); That just links your library to the solver during runtime. No need to recompile the solver or change the functionality of it. Does this answer you question? – jhoepken Dec 19 '13 at 22:47
• I will accept after I have done it. – fedvasu Dec 20 '13 at 10:24