From 5c7131288cc4ea49e2e9008f794ccce73b6bbe0c Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Wed, 19 Apr 2023 14:23:56 +0100 Subject: [PATCH] foamPostProcess: New volAverage and volIntegrate packaged function objects These additions mean that the volume-weighted average or volume integral of a field can be conveniently post-processed. This can be done interactively using foamPostProcess: foamPostProcess -func "volAverage(U)" foamPostProcess -func "volIntegrate(rho)" Or at run-time by adding to the functions sub-section of the controlDict: #includeFunc volAverage(U) #includeFunc volIntegrate(rho) --- .../{minMax => volFieldValue}/cellMax | 2 +- .../{minMax => volFieldValue}/cellMax.cfg | 2 +- .../{minMax => volFieldValue}/cellMaxMag | 2 +- .../{minMax => volFieldValue}/cellMaxMag.cfg | 2 +- .../{minMax => volFieldValue}/cellMin | 2 +- .../{minMax => volFieldValue}/cellMin.cfg | 2 +- .../{minMax => volFieldValue}/cellMinMag | 2 +- .../{minMax => volFieldValue}/cellMinMag.cfg | 2 +- .../postProcessing/volFieldValue/volAverage | 17 +++++++++++ .../volFieldValue/volAverage.cfg | 13 +++++++++ .../postProcessing/volFieldValue/volIntegrate | 17 +++++++++++ .../volFieldValue/volIntegrate.cfg | 13 +++++++++ .../volValue.cfg} | 0 .../postProcessing/channel/system/controlDict | 28 +++++++++++-------- 14 files changed, 84 insertions(+), 20 deletions(-) rename etc/caseDicts/postProcessing/{minMax => volFieldValue}/cellMax (90%) rename etc/caseDicts/postProcessing/{minMax => volFieldValue}/cellMax.cfg (88%) rename etc/caseDicts/postProcessing/{minMax => volFieldValue}/cellMaxMag (90%) rename etc/caseDicts/postProcessing/{minMax => volFieldValue}/cellMaxMag.cfg (88%) rename etc/caseDicts/postProcessing/{minMax => volFieldValue}/cellMin (90%) rename etc/caseDicts/postProcessing/{minMax => volFieldValue}/cellMin.cfg (88%) rename etc/caseDicts/postProcessing/{minMax => volFieldValue}/cellMinMag (90%) rename etc/caseDicts/postProcessing/{minMax => volFieldValue}/cellMinMag.cfg (88%) create mode 100644 etc/caseDicts/postProcessing/volFieldValue/volAverage create mode 100644 etc/caseDicts/postProcessing/volFieldValue/volAverage.cfg create mode 100644 etc/caseDicts/postProcessing/volFieldValue/volIntegrate create mode 100644 etc/caseDicts/postProcessing/volFieldValue/volIntegrate.cfg rename etc/caseDicts/postProcessing/{minMax/cellMinMax.cfg => volFieldValue/volValue.cfg} (100%) diff --git a/etc/caseDicts/postProcessing/minMax/cellMax b/etc/caseDicts/postProcessing/volFieldValue/cellMax similarity index 90% rename from etc/caseDicts/postProcessing/minMax/cellMax rename to etc/caseDicts/postProcessing/volFieldValue/cellMax index 6008e699aa..ef4911da74 100644 --- a/etc/caseDicts/postProcessing/minMax/cellMax +++ b/etc/caseDicts/postProcessing/volFieldValue/cellMax @@ -10,7 +10,7 @@ Description \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/minMax/cellMax.cfg" +#includeEtc "caseDicts/postProcessing/volFieldValue/cellMax.cfg" fields (); diff --git a/etc/caseDicts/postProcessing/minMax/cellMax.cfg b/etc/caseDicts/postProcessing/volFieldValue/cellMax.cfg similarity index 88% rename from etc/caseDicts/postProcessing/minMax/cellMax.cfg rename to etc/caseDicts/postProcessing/volFieldValue/cellMax.cfg index 39c118521d..3c025bb9e5 100644 --- a/etc/caseDicts/postProcessing/minMax/cellMax.cfg +++ b/etc/caseDicts/postProcessing/volFieldValue/cellMax.cfg @@ -6,7 +6,7 @@ \\/ M anipulation | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/minMax/cellMinMax.cfg" +#includeEtc "caseDicts/postProcessing/volFieldValue/volValue.cfg" operation max; diff --git a/etc/caseDicts/postProcessing/minMax/cellMaxMag b/etc/caseDicts/postProcessing/volFieldValue/cellMaxMag similarity index 90% rename from etc/caseDicts/postProcessing/minMax/cellMaxMag rename to etc/caseDicts/postProcessing/volFieldValue/cellMaxMag index fcb3d8e3be..9f2dc03c87 100644 --- a/etc/caseDicts/postProcessing/minMax/cellMaxMag +++ b/etc/caseDicts/postProcessing/volFieldValue/cellMaxMag @@ -10,7 +10,7 @@ Description \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/minMax/cellMaxMag.cfg" +#includeEtc "caseDicts/postProcessing/volFieldValue/cellMaxMag.cfg" fields (); diff --git a/etc/caseDicts/postProcessing/minMax/cellMaxMag.cfg b/etc/caseDicts/postProcessing/volFieldValue/cellMaxMag.cfg similarity index 88% rename from etc/caseDicts/postProcessing/minMax/cellMaxMag.cfg rename to etc/caseDicts/postProcessing/volFieldValue/cellMaxMag.cfg index fa41e5492d..3cefb0ede1 100644 --- a/etc/caseDicts/postProcessing/minMax/cellMaxMag.cfg +++ b/etc/caseDicts/postProcessing/volFieldValue/cellMaxMag.cfg @@ -6,7 +6,7 @@ \\/ M anipulation | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/minMax/cellMinMax.cfg" +#includeEtc "caseDicts/postProcessing/volFieldValue/volValue.cfg" operation maxMag; diff --git a/etc/caseDicts/postProcessing/minMax/cellMin b/etc/caseDicts/postProcessing/volFieldValue/cellMin similarity index 90% rename from etc/caseDicts/postProcessing/minMax/cellMin rename to etc/caseDicts/postProcessing/volFieldValue/cellMin index 01c21e3e0b..7487728cb3 100644 --- a/etc/caseDicts/postProcessing/minMax/cellMin +++ b/etc/caseDicts/postProcessing/volFieldValue/cellMin @@ -10,7 +10,7 @@ Description \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/minMax/cellMin.cfg" +#includeEtc "caseDicts/postProcessing/volFieldValue/cellMin.cfg" fields (); diff --git a/etc/caseDicts/postProcessing/minMax/cellMin.cfg b/etc/caseDicts/postProcessing/volFieldValue/cellMin.cfg similarity index 88% rename from etc/caseDicts/postProcessing/minMax/cellMin.cfg rename to etc/caseDicts/postProcessing/volFieldValue/cellMin.cfg index c75b1470f3..b19b66c79d 100644 --- a/etc/caseDicts/postProcessing/minMax/cellMin.cfg +++ b/etc/caseDicts/postProcessing/volFieldValue/cellMin.cfg @@ -6,7 +6,7 @@ \\/ M anipulation | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/minMax/cellMinMax.cfg" +#includeEtc "caseDicts/postProcessing/volFieldValue/volValue.cfg" operation min; diff --git a/etc/caseDicts/postProcessing/minMax/cellMinMag b/etc/caseDicts/postProcessing/volFieldValue/cellMinMag similarity index 90% rename from etc/caseDicts/postProcessing/minMax/cellMinMag rename to etc/caseDicts/postProcessing/volFieldValue/cellMinMag index cc596be1b2..f8c3be3986 100644 --- a/etc/caseDicts/postProcessing/minMax/cellMinMag +++ b/etc/caseDicts/postProcessing/volFieldValue/cellMinMag @@ -10,7 +10,7 @@ Description \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/minMax/cellMinMag.cfg" +#includeEtc "caseDicts/postProcessing/volFieldValue/cellMinMag.cfg" fields (); diff --git a/etc/caseDicts/postProcessing/minMax/cellMinMag.cfg b/etc/caseDicts/postProcessing/volFieldValue/cellMinMag.cfg similarity index 88% rename from etc/caseDicts/postProcessing/minMax/cellMinMag.cfg rename to etc/caseDicts/postProcessing/volFieldValue/cellMinMag.cfg index 1188556168..482b864a45 100644 --- a/etc/caseDicts/postProcessing/minMax/cellMinMag.cfg +++ b/etc/caseDicts/postProcessing/volFieldValue/cellMinMag.cfg @@ -6,7 +6,7 @@ \\/ M anipulation | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/minMax/cellMinMax.cfg" +#includeEtc "caseDicts/postProcessing/volFieldValue/volValue.cfg" operation minMag; diff --git a/etc/caseDicts/postProcessing/volFieldValue/volAverage b/etc/caseDicts/postProcessing/volFieldValue/volAverage new file mode 100644 index 0000000000..d96090abc4 --- /dev/null +++ b/etc/caseDicts/postProcessing/volFieldValue/volAverage @@ -0,0 +1,17 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +------------------------------------------------------------------------------- +Description + Writes out the volume-weighted average of one or more fields. + +\*---------------------------------------------------------------------------*/ + +#includeEtc "caseDicts/postProcessing/volFieldValue/volAverage.cfg" + +fields (); + +// ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/volFieldValue/volAverage.cfg b/etc/caseDicts/postProcessing/volFieldValue/volAverage.cfg new file mode 100644 index 0000000000..cad4d64f93 --- /dev/null +++ b/etc/caseDicts/postProcessing/volFieldValue/volAverage.cfg @@ -0,0 +1,13 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ + +#includeEtc "caseDicts/postProcessing/volFieldValue/volValue.cfg" + +operation volAverage; + +// ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/volFieldValue/volIntegrate b/etc/caseDicts/postProcessing/volFieldValue/volIntegrate new file mode 100644 index 0000000000..72f18955f5 --- /dev/null +++ b/etc/caseDicts/postProcessing/volFieldValue/volIntegrate @@ -0,0 +1,17 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +------------------------------------------------------------------------------- +Description + Writes out the volume integral of one or more fields. + +\*---------------------------------------------------------------------------*/ + +#includeEtc "caseDicts/postProcessing/volFieldValue/volIntegrate.cfg" + +fields (); + +// ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/volFieldValue/volIntegrate.cfg b/etc/caseDicts/postProcessing/volFieldValue/volIntegrate.cfg new file mode 100644 index 0000000000..70fe112b70 --- /dev/null +++ b/etc/caseDicts/postProcessing/volFieldValue/volIntegrate.cfg @@ -0,0 +1,13 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ + +#includeEtc "caseDicts/postProcessing/volFieldValue/volValue.cfg" + +operation volIntegrate; + +// ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/minMax/cellMinMax.cfg b/etc/caseDicts/postProcessing/volFieldValue/volValue.cfg similarity index 100% rename from etc/caseDicts/postProcessing/minMax/cellMinMax.cfg rename to etc/caseDicts/postProcessing/volFieldValue/volValue.cfg diff --git a/test/postProcessing/channel/system/controlDict b/test/postProcessing/channel/system/controlDict index 1b832c7bf9..e6cf2f3403 100644 --- a/test/postProcessing/channel/system/controlDict +++ b/test/postProcessing/channel/system/controlDict @@ -267,17 +267,6 @@ lagrangianFunctions //#includeFunc dsmcFields } -minMaxFunctions -{ - #includeFunc cellMin(epsilon) - - #includeFunc cellMax(k) - - #includeFunc cellMinMag(U, writeLocation=yes) - - #includeFunc cellMaxMag(U, writeLocation=yes) -} - numericalFunctions { #includeFunc residuals(p, U, h, k, epsilon) @@ -410,6 +399,21 @@ surfaceFieldValueFunctions ) } +volFieldValueFunctions +{ + #includeFunc cellMin(epsilon) + + #includeFunc cellMax(k) + + #includeFunc cellMinMag(U, writeLocation=yes) + + #includeFunc cellMaxMag(U, writeLocation=yes) + + #includeFunc volAverage(p) + + #includeFunc volIntegrate(rho) +} + functions { $combustionFunctions; @@ -419,7 +423,6 @@ functions $forcesFunctions; $graphsFunctions; $lagrangianFunctions; - $minMaxFunctions; $numericalFunctions; $pressureFunctions; $probesFunctions; @@ -427,6 +430,7 @@ functions $streamlinesFunctions; $surfaceFunctions; $surfaceFieldValueFunctions; + $volFieldValueFunctions; } // ************************************************************************* //