|
[Sponsors] |
faceZoneAverage function object does not work with field U,p etc. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 13, 2021, 17:52 |
faceZoneAverage function object does not work with field U,p etc.
|
#1 | |
New Member
Join Date: Aug 2021
Posts: 11
Rep Power: 5 |
Since OpenFOAM V8 it should be possible to have the field values processed on a faceZone.
If I add a function file in the system directory in this way e.g. : Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 9 \\/ M anipulation | ------------------------------------------------------------------------------- Description Calculates the average values of fields on a faceZone. \*---------------------------------------------------------------------------*/ type surfaceFieldValue; libs ("libfieldFunctionObjects.so"); writeControl timeStep; writeInterval 1; log yes; writeTotalArea no; writeFields no; regionType faceZone; name my_facezone; operation areaAverage; fields ( U ); // ************************************************************************* // Quote:
Seems there is something I missed? Can anyone give me a hint, what I am doing wrong? Regards Daniel |
||
October 14, 2021, 09:58 |
|
#2 |
Senior Member
|
Hi Daniel,
I once had a similar issue: This is caused by the fact that the field values (U, p, etc.) are stored on the cell center. phi however is stored at the faces as it is the flux through the face. You can use another functionObject first to interpolate the fields to the faces and afterwards you can use the surfaceFieldValue functionObject. Have a look at the online documentation. Hope it helps. Cheers, Tom |
|
October 15, 2021, 19:51 |
|
#3 |
New Member
Join Date: Aug 2021
Posts: 11
Rep Power: 5 |
Thank you Tom!
That worked for the field U in that way: 1. added the function my_surfaceInterpolate to interpolate field U to surface field UInterp 2. defined faceZoneAverage inline with name of faceZone und newly created field UInterp That works for p in the same fashion. Great so far! Code:
functions { my_surfaceInterpolate { type surfaceInterpolate; libs ("libfieldFunctionObjects.so"); fields ((U UInterp)); executeControl timeStep; writeControl writeTime; } #includeFunc faceZoneAverage(name=my_faceZone, UInterp) } Here is what I have done: Code:
#includeFunc mag(U) surfaceInterpolate1 { type surfaceInterpolate; libs ("libfieldFunctionObjects.so"); fields ((mag(U) magUInterp)); executeControl timeStep; writeControl writeTime; } #includeFunc faceZoneAverage(name=my_faceZone, magUInterp) Any ideas? Regards Daniel |
|
October 15, 2021, 20:09 |
Problem solved!
|
#4 |
New Member
Join Date: Aug 2021
Posts: 11
Rep Power: 5 |
My fault,
had something to do with the write control settings. The field was written every 500 time steps. So I got the right values from time step 500 onwards. It works just as Tom stated. Problem solved! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 08:15 |
How to create a function object in OpenFoam that runs properly ? | mkhm | OpenFOAM Programming & Development | 1 | October 20, 2018 17:16 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 02:27 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 21:50 |
Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 07:27 |