DOC: elaborate the usage of function objects

ENH: update libs of etc/caseDicts/postProcess items
  ENH: ensure destructor=default
  ENH: ensure constness
  ENH: ensure no 'copy construct' and 'no copy assignment' exist
  TUT: add examples of function objects with full set
       of settings into a TUT if unavailable
  TUT: update pisoFoam/RAS/cavity tutorial in terms of usage
This commit is contained in:
Kutalmis Bercin
2020-03-13 18:49:58 +00:00
committed by Andrew Heather
parent b549116588
commit a5c6516e23
264 changed files with 7120 additions and 2830 deletions

View File

@ -6,14 +6,16 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Description Description
Calculates and writes the second largest eigenvalue of the sum of the Computes the min/max/average arbitrary mesh interface (AMI) weights, and
square of the symmetrical and anti-symmetrical parts of the velocity optionally reports to a text file or writes VTK surfaces of the sum of
gradient tensor. the weights and mask fields for arbitrarily coupled mesh interface (ACMI)
patches.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type AMIWeights; type AMIWeights;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
writeFields yes; writeFields yes;
writeControl writeTime; writeControl writeTime;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type CourantNo; type CourantNo;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field phi; field phi;

View File

@ -6,14 +6,14 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Description Description
Calculates and writes the second largest eigenvalue of the sum of the Calculates Lamb vector, i.e. the cross product of vorticity and velocity.
square of the symmetrical and anti-symmetrical parts of the velocity Calculation of the divergence of the Lamb vector can be performed by using
gradient tensor. \c div function object on this \c LambVector function object.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type lambVector; type LambVector;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field U; field U;

View File

@ -13,7 +13,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type Lambda2; type Lambda2;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field U; field U;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type MachNo; type MachNo;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field U; field U;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type PecletNo; type PecletNo;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field phi; field phi;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type Q; type Q;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field U; field U;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type turbulenceFields; type turbulenceFields;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field R; field R;

View File

@ -12,7 +12,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type XiReactionRate; type XiReactionRate;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
fields (b Xi Su); fields (b Xi Su);

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type add; type add;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
fields (<field names>); fields (<field names>);

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type components; type components;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field <fieldName>; field <fieldName>;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type ddt; type ddt;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field <fieldName>; field <fieldName>;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type div; type div;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field <fieldName>; field <fieldName>;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type energySpectrum; type energySpectrum;
libs ("librandomProcessesFunctionObjects.so"); libs (randomProcessesFunctionObjects);
executeControl writeTime; executeControl writeTime;
writeControl writeTime; writeControl writeTime;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type enstrophy; type enstrophy;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field U; field U;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type fieldMinMax; type fieldMinMax;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
fields (".*"); fields (".*");

View File

@ -14,7 +14,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type flowType; type flowType;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field U; field U;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type grad; type grad;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field <fieldName>; field <fieldName>;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type mag; type mag;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field <fieldName>; field <fieldName>;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type magSqr; type magSqr;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field <fieldName>; field <fieldName>;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type processorField; type processorField;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
executeControl writeTime; executeControl writeTime;
writeControl writeTime; writeControl writeTime;

View File

@ -12,7 +12,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type streamFunction; type streamFunction;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field phi; field phi;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type subtract; type subtract;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
fields (<field names>); fields (<field names>);

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type turbulenceFields; type turbulenceFields;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
fields (<field names>); fields (<field names>);

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type vorticity; type vorticity;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
field U; field U;

View File

@ -12,7 +12,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type wallHeatFlux; type wallHeatFlux;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
executeControl writeTime; executeControl writeTime;
writeControl writeTime; writeControl writeTime;

View File

@ -12,7 +12,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type wallShearStress; type wallShearStress;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
executeControl writeTime; executeControl writeTime;
writeControl writeTime; writeControl writeTime;

View File

@ -13,7 +13,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type writeCellCentres; type writeCellCentres;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
executeControl writeTime; executeControl writeTime;
writeControl writeTime; writeControl writeTime;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type writeCellVolumes; type writeCellVolumes;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
executeControl writeTime; executeControl writeTime;
writeControl writeTime; writeControl writeTime;

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type writeObjects; type writeObjects;
libs ("libutilityFunctionObjects.so"); libs (utilityFunctionObjects);
objects (<object names>); objects (<object names>);

View File

@ -11,7 +11,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
type yPlus; type yPlus;
libs ("libfieldFunctionObjects.so"); libs (fieldFunctionObjects);
executeControl writeTime; executeControl writeTime;
writeControl writeTime; writeControl writeTime;

View File

@ -52,28 +52,23 @@ Foam::functionObjects::FUNCTIONOBJECT::FUNCTIONOBJECT
) )
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
boolData_(dict.getOrDefault<bool>("boolData"), true),
labelData_(dict.get<label>("labelData")),
wordData_(dict.getOrDefault<word>("wordData", "defaultWord")), wordData_(dict.getOrDefault<word>("wordData", "defaultWord")),
scalarData_(dict.get<scalar>("scalarData")), scalarData_(dict.getOrDefault<scalar>("scalarData", 1.0))
labelData_(dict.get<label>("labelData"))
{ {
read(dict); read(dict);
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::FUNCTIONOBJECT::~FUNCTIONOBJECT()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::FUNCTIONOBJECT::read(const dictionary& dict) bool Foam::functionObjects::FUNCTIONOBJECT::read(const dictionary& dict)
{ {
dict.readIfPresent("wordData", wordData_); dict.readEntry("boolData", boolData_);
dict.readEntry("scalarData", scalarData_);
dict.readEntry("labelData", labelData_); dict.readEntry("labelData", labelData_);
dict.readIfPresent("wordData", wordData_);
dict.readEntry("scalarData", scalarData_);
return true; return true;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) YEAR YEAR AUTHOR,AFFILIATION Copyright (C) YEAR AUTHOR, AFFILIATION
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,34 +27,120 @@ Class
Foam::functionObjects::FUNCTIONOBJECT Foam::functionObjects::FUNCTIONOBJECT
Group Group
grpFieldFunctionObjects
Description Description
This function object... <minimal description of the function object>
Example of function object specification: <equation>
\f[
x = x_{ref}^x + \rho \omega
\f]
<variable-explanation table>
where
\vartable
\rho | <explanation> [units, e.g. kg/m3]
\omega | \f$ \nabla \cdot \vec U \f$
... | ...
\endvartable
<inline equation>
where \f$ x_k \f$ is ...
<input-output table>
\table
Operand | Type | Location
input | {vol,surface}\<Type\>Field(s) <!--
--> |$FOAM_CASE/\<time\>/\<inpField\>s
output file | dat <!--
--> | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
FUNCTIONOBJECT1 FUNCTIONOBJECT1
{ {
// Mandatory entries (unmodifiable)
type FUNCTIONOBJECT; type FUNCTIONOBJECT;
libs ("libFUNCTIONOBJECTFunctionObject.so"); libs (FUNCTIONOBJECTFunctionObject);
// Mandatory entries (runtime modifiable)
...
// Mandatory (inherited) entries (unmodifiable)
...
// Mandatory (inherited) entries (runtime unmodifiable)
...
// Optional entries (unmodifiable)
...
// Optional entries (runtime modifiable)
boolData <bool>;
labelData <label>;
wordData <word>;
scalarData <scalar>;
// Optional (inherited) entries
... ...
wordData someWord;
scalarData 1.0;
labelData 1;
} }
\endverbatim \endverbatim
Usage where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: FUNCTIONOBJECT | yes | type | Type name: FUNCTIONOBJECT | word | yes | -
wordData | some word option... | no | defaultWord libs | Library name: FUNCTIONOBJECTFunctionObject <!--
scalarData | some scalar value... | yes | --> | word | yes | -
labelData | some label value... | yes | boolData | <explanation> | bool | yes | -
labelData | <explanation> | label | yes | -
wordData | <explanation> | word | yes | -
scalarData | <explanation> | scalar | no | 1.0
wordListData | <explanation> | wordList | yes | -
\endtable \endtable
Options for the \c ENTRY entry:
\verbatim
<option1>
<option2> | <explanation>
...
\endverbatim
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
- \link fieldsExpression.H \endlink
- \link writeFile.H \endlink
...
<if \c postProcess is applicable>
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func FUNCTIONOBJECT
\endverbatim
<if \c postProcess is not applicable>
Usage by the \c postProcess utility is not available.
Note
- <note1>
- <note2>
...
See also
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::FUNCTIONOBJECT
...
SourceFiles SourceFiles
FUNCTIONOBJECT.C FUNCTIONOBJECT.C
FUNCTIONOBJECTTEMPLATES.C
...
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -78,7 +164,13 @@ class FUNCTIONOBJECT
: :
public fvMeshFunctionObject public fvMeshFunctionObject
{ {
// Private data // Private Data
//- bool
bool boolData_;
//- label
label labelData_;
//- word //- word
word wordData_; word wordData_;
@ -86,19 +178,6 @@ class FUNCTIONOBJECT
//- scalar //- scalar
scalar scalarData_; scalar scalarData_;
//- label
label labelData_;
// Private Member Functions
//- No copy construct
FUNCTIONOBJECT(const FUNCTIONOBJECT&);
//- No copy assignment
void operator=(const FUNCTIONOBJECT&);
public: public:
@ -116,9 +195,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
FUNCTIONOBJECT(const FUNCTIONOBJECT&) = delete;
//- No copy assignment
void operator=(const FUNCTIONOBJECT&) = delete;
//- Destructor //- Destructor
virtual ~FUNCTIONOBJECT(); virtual ~FUNCTIONOBJECT() = default;
// Member Functions // Member Functions

View File

@ -28,52 +28,88 @@ Namespace
Foam::functionObjects Foam::functionObjects
Description Description
Namespace for functionObjects. Function objects are OpenFOAM utilities to ease workflow configurations and
enhance workflows by producing additional user-requested data both during
runtime and postprocessing calculations, typically in the form of
additional logging to the screen, or generating text, image and field files.
OpenFOAM includes a collection of functionObjects selected by the user at Function objects eliminate the need to store all runtime generated data,
run-time to manipulate the simulation and provide mechanisms to extract hence saving considerable resources. Furthermore, function objects are
field and derived quantities. Alternatively, the same actions can be readily applied to batch-driven processes, improving reliability by
executed after the simulation using the \c -postProcess command-line option. standardising the sequence of operations and reducing the amount of manual
interaction.
In addition, the output of most function objects, e.g. output fields, are
stored on the mesh database so that it can be retrieved and used for other
applications (e.g. directly using \c wallShearStress function object output
in \c fieldAverage function object to produce \c wallShearStressMean field).
\section secFunctionObjects Using function objects \section secFunctionObjects Using function objects
FunctionObjects are selected by additional entries in the global case Function objects can be executed by using two methods:
system/controlDict dictionary. Each object is listed in the \c
functions sub-dictionary, e.g. to select the \c functionObjectType - \c functions sub-dictionary in the \c system/controlDict file
functionObject the following entry would be specified: - \c postProcess command-line utility
For the first method, each selected function object should be listed inside
\c functions sub-dictionary of the \c system/controlDict file as a nested
sub-dictionary, typically as in the following example:
\verbatim \verbatim
functions functions // sub-dictionary name under the system/controlDict file
{ {
<functionObjectName> <userDefinedSubDictName1>
{ {
type functionObjectType; // Mandatory entries
libs (myFunctionObjectLib); type <functionObjectTypeName>;
region defaultRegion; libs (<libType>FunctionObjects);
enabled yes;
// Mandatory entries defined in <functionObjectType>
...
// Optional entries defined in <functionObjectType>
...
// Optional (inherited) entries
region region0;
enabled true;
log true;
timeStart 0; timeStart 0;
timeEnd 10; timeEnd 1000;
writeControl writeTime; executeControl timeStep;
executeInterval 1;
writeControl timeStep;
writeInterval 1; writeInterval 1;
}
<userDefinedSubDictName2>
{
...
}
...
<userDefinedSubDictNameN>
{
... ...
} }
} }
\endverbatim \endverbatim
Where: where the entries mean:
\table \table
Property | Description | Required | Default Property | Description | Type | Req'd | Dflt
type | Type of function object | yes | type | Type name of function object | word | yes | -
libs | Libraries containing implementation | yes | libs | Library name containing implementation | word | yes | -
region | Name of region for multi-region cases | no | region | Name of region for multi-region cases | word | no | region0
enabled | On/off switch | no | yes enabled | Switch to turn function object on/off | bool | no | true
log | Log information to standard output | no | yes log | Switch to write log info to standard output | bool | no | true
timeStart| Start time | no | timeStart | Start time for function object execution | scalar | no | 0
timeEnd | End time | no | timeEnd | End time for function object execution | scalar | no | inf
executeControl | See time controls below | no | timeStep executeControl | See time controls below | word | no | timeStep
executeInterval | Steps/time between execute phases | no | 1 executeInterval | Steps/time between execute phases | label | no | 1
writeControl | See time controls below | no | timeStep writeControl | See time controls below | word | no | timeStep
writeInterval | Steps/time between write phases | no | 1 writeInterval | Steps/time between write phases | label | no | 1
\endtable \endtable
Time controls: Time controls:
@ -86,15 +122,17 @@ Description
adjustableRunTime | Currently identical to "runTime" adjustableRunTime | Currently identical to "runTime"
clockTime | Trigger every 'Interval' clock time period clockTime | Trigger every 'Interval' clock time period
cpuTime | Trigger every 'Interval' CPU time period cpuTime | Trigger every 'Interval' CPU time period
onEnd | Trigger on end of run onEnd | Trigger on end of simulation run
\endtable \endtable
The sub-dictionary name \c \<functionObjectName\> is chosen by the user, and The sub-dictionary name \c <userDefinedSubDictName> is chosen by the user,
is typically used as the name of the output directory for any data written and is typically used as the name of the output directory for any data
by the functionObject. The \c type entry defines the type of function written by the function object.
object properties that follow. FunctionObjects are packaged into separate
libraries and the \c libs entry is used to specify which library should be As the base mandatory entries, the \c type entry defines the type of
loaded. function object properties that follow. Function objects are packaged into
separate libraries for flexibility and the \c libs entry is used to specify
which library should be loaded.
Each function object has two separate run phases: Each function object has two separate run phases:
@ -104,6 +142,36 @@ Description
For each phase the respective time controls are provided, as listed above. For each phase the respective time controls are provided, as listed above.
The second method of executing function objects is to use \c postProcess
utility.
When specified without additional arguments, the \c postProcess utility
executes all function objects defined in the \c system/controlDict file
for all time directories:
\verbatim
postProcess
\endverbatim
Most function objects can be invoked directly without the need to specify
the input dictionary using the \c -func option, e.g. to execute the Courant
number function object:
\verbatim
postProcess -func CourantNo
\endverbatim
In addition, the \c -postProcess option is available to all solvers,
and operates similarly to the stand-alone \c postProcess utility.
For example, having completed a \c simpleFoam calculation, the following
will execute all function objects defined in the \c system/controlDict file
for all time directories:
\verbatim
simpleFoam -postProcess
\endverbatim
Class Class
Foam::functionObject Foam::functionObject
@ -111,8 +179,8 @@ Description
Abstract base-class for Time/database function objects. Abstract base-class for Time/database function objects.
See also See also
Foam::functionObjectList - Foam::functionObjectList
Foam::functionObjects::timeControl - Foam::functionObjects::timeControl
SourceFiles SourceFiles
functionObject.C functionObject.C
@ -142,7 +210,7 @@ class mapPolyMesh;
class functionObject class functionObject
{ {
// Private data // Private Data
//- Name //- Name
const word name_; const word name_;
@ -164,6 +232,7 @@ public:
//- Runtime type information //- Runtime type information
virtual const word& type() const = 0; virtual const word& type() const = 0;
//- Flag to execute debug content
static int debug; static int debug;
//- Global post-processing mode switch //- Global post-processing mode switch
@ -172,7 +241,7 @@ public:
//- Directory prefix //- Directory prefix
static word outputPrefix; static word outputPrefix;
//- Switch write log to Info //- Flag to write log into Info
bool log; bool log;

View File

@ -37,9 +37,9 @@ Description
Dictionary controls Dictionary controls
\table \table
Property | Description | Required | Default Property | Description | Type | Req'd | Dflt
region | Name of the mesh region | no | region0 region | Name of the mesh region | word | no | region0
subRegion | Name for alternative objectRegistry | no | "" subRegion | Name for alternative objectRegistry | word | no | ""
\endtable \endtable
See also See also

View File

@ -34,7 +34,7 @@ Description
Note: cannot access the state dictionary until after construction of the Note: cannot access the state dictionary until after construction of the
function objects, since the owner container functionObjectList is owned function objects, since the owner container functionObjectList is owned
by time, and time owns the state dictionary. I.e. need to wait for time by time, and time owns the state dictionary i.e. need to wait for time
to be fully constructed. to be fully constructed.
See also See also

View File

@ -214,7 +214,12 @@ Foam::functionObjects::writeFile::writeFile
bool Foam::functionObjects::writeFile::read(const dictionary& dict) bool Foam::functionObjects::writeFile::read(const dictionary& dict)
{ {
writePrecision_ = writePrecision_ =
dict.getOrDefault("writePrecision", IOstream::defaultPrecision()); dict.getCheckOrDefault
(
"writePrecision",
IOstream::defaultPrecision(),
labelMinMax::ge(0)
);
updateHeader_ = updateHeader_ =
dict.lookupOrDefault("updateHeader", updateHeader_); dict.lookupOrDefault("updateHeader", updateHeader_);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,11 +28,34 @@ Class
Foam::functionObjects::writeFile Foam::functionObjects::writeFile
Description Description
functionObject base class for writing single files Base class for writing single files from the function objects.
Usage
\verbatim
<userDefinedSubDictName1>
{
// Mandatory and other optional entries
...
// Optional (inherited) entries (runtime modifiable)
writePrecision 8;
writeToFile true;
useUserTime true;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
writePrecision | Number of decimal points | label | no | \<system dflt\>
writeToFile | Flag to produce text file output | bool | no | true
useUserTime | Flag to use user time, e.g. degrees | bool | no | true
\endtable
See also See also
Foam::functionObject - Foam::functionObject
Foam::functionObjects::logFiles - Foam::functionObjects::logFiles
SourceFiles SourceFiles
writeFile.C writeFile.C

View File

@ -370,7 +370,6 @@ bool Foam::functionObjects::AMIWeights::write()
} }
} }
return true; return true;
} }

View File

@ -30,33 +30,60 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Reports the min/max/average AMI weights to text file and optionally Computes the min/max/average weights of arbitrary mesh interface (AMI)
writes VTK surfaces of the sum of the weights, and mask field for patches, and optionally reports to a text file or writes VTK surfaces of
ACMI patches. the sum of the weights and mask fields for arbitrarily coupled mesh
interface (ACMI) patches.
Operands:
\table
Operand | Type | Location
input | - | -
output file | dat | $POST/\<file\>
output field | vtp | $POST/\<AMINames\>_{src,tgt}.vtp
\endtable
where \c $POST=$FOAM_CASE/postProcessing/\<FO\>/\<time\>.
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
AMIWeights1 AMIWeights1
{ {
// Mandatory entries (unmodifiable)
type AMIWeights; type AMIWeights;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
writeFields yes;
// Mandatory entries (runtime modifiable)
writeFields false;
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: AMIWeights | yes | type | Type name: AMIWeights | word | yes | -
writeFields | write weights as VTK fields | yes | libs | Library name: fieldFunctionObjects | word | yes | -
writeFields | Write weights as VTK fields | bool | yes | -
\endtable \endtable
Output data is written to the file \<timeDir\>/AMIWeights.dat The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link writeFile.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func AMIWeights
\endverbatim
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
Foam::functionObjects::writeFile - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::AMIWeights
SourceFiles SourceFiles
AMIWeights.C AMIWeights.C
@ -89,7 +116,7 @@ class AMIWeights
{ {
protected: protected:
// Protected data // Protected Data
//- Flag to write AMI fields (as VTK files) //- Flag to write AMI fields (as VTK files)
bool writeFields_; bool writeFields_;
@ -106,6 +133,7 @@ protected:
//- Helper function to report patch information //- Helper function to report patch information
virtual void reportPatch(const cyclicAMIPolyPatch& pp); virtual void reportPatch(const cyclicAMIPolyPatch& pp);
//- Write weight field
void writeWeightField void writeWeightField
( (
const cyclicAMIPolyPatch& cpp, const cyclicAMIPolyPatch& cpp,
@ -113,14 +141,9 @@ protected:
const word& side const word& side
) const; ) const;
//- Write weight fields if writeFields=true
void writeWeightFields(const cyclicAMIPolyPatch& cpp) const; void writeWeightFields(const cyclicAMIPolyPatch& cpp) const;
//- No copy construct
AMIWeights(const AMIWeights&) = delete;
//- No copy assignment
void operator=(const AMIWeights&) = delete;
public: public:
@ -138,6 +161,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
AMIWeights(const AMIWeights&) = delete;
//- No copy assignment
void operator=(const AMIWeights&) = delete;
//- Destructor //- Destructor
virtual ~AMIWeights() = default; virtual ~AMIWeights() = default;

View File

@ -39,13 +39,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(CourantNo, 0); defineTypeNameAndDebug(CourantNo, 0);
addToRunTimeSelectionTable(functionObject, CourantNo, dictionary);
addToRunTimeSelectionTable
(
functionObject,
CourantNo,
dictionary
);
} }
} }
@ -137,12 +131,6 @@ Foam::functionObjects::CourantNo::CourantNo
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::CourantNo::~CourantNo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::CourantNo::read(const dictionary& dict) bool Foam::functionObjects::CourantNo::read(const dictionary& dict)

View File

@ -31,34 +31,55 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
This function object calculates and outputs the Courant number as a Computes the Courant number field for time-variant simulations.
volScalarField. The field is stored on the mesh database so that it can
be retrieved and used for other applications. Operands:
\table
Operand | Type | Location
input | - | -
output file | - | -
output field | volScalarField | $FOAM_CASE/<time>/<outField>
\endtable
Usage Usage
Example of function object specification to calculate the Courant number: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
CourantNo1 CourantNo1
{ {
// Mandatory entries (unmodifiable)
type CourantNo; type CourantNo;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
// Optional entries (runtime modifiable)
rho rho;
// Optional (inherited) entries
... ...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | Type name: CourantNo | yes | type | Type name: CourantNo | word | yes | -
rho | Name of density field | no | rho libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of flux field | no | phi rho | Name of density field | word | no | rho
result | Name of Courant number field | no | \<function name\>
log | Log to standard output | no | yes
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func CourantNo
\endverbatim
See also See also
Foam::functionObjects::fieldExpression - Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fieldExpression
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::CourantNo
SourceFiles SourceFiles
CourantNo.C CourantNo.C
@ -86,9 +107,9 @@ class CourantNo
: :
public fieldExpression public fieldExpression
{ {
// Private data // Private Data
//- Name of density field (optional) //- Name of density field
word rhoName_; word rhoName_;
@ -120,9 +141,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
CourantNo(const CourantNo&) = delete;
//- No copy assignment
void operator=(const CourantNo&) = delete;
//- Destructor //- Destructor
virtual ~CourantNo(); virtual ~CourantNo() = default;
// Member Functions // Member Functions

View File

@ -39,13 +39,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(Curle, 0); defineTypeNameAndDebug(Curle, 0);
addToRunTimeSelectionTable(functionObject, Curle, dictionary);
addToRunTimeSelectionTable
(
functionObject,
Curle,
dictionary
);
} }
} }
@ -146,6 +140,13 @@ bool Foam::functionObjects::Curle::read(const dictionary& dict)
// Read the reference speed of sound // Read the reference speed of sound
dict.readEntry("c0", c0_); dict.readEntry("c0", c0_);
if (c0_.value() < VSMALL)
{
FatalErrorInFunction
<< "Reference speed of sound = " << c0_
<< " cannot be negative or zero."
<< abort(FatalError);
}
// Set the location of the effective point source to the area-average // Set the location of the effective point source to the area-average
// of the patch face centres // of the patch face centres

View File

@ -30,54 +30,71 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates the acoustic pressure based on Curle's analogy. Computes the acoustic pressure based on Curle's analogy.
Curle's analogy is implemented as: Curle's analogy is implemented as:
\f[ \f[
p' = \frac{1}{4 \pi c_0}\frac{\vec d}{|\vec d|^2}\frac{d(F)}{d(t)} p' = \frac{1}{4 \pi c_0}\frac{\vec d}{|\vec d|^2}\cdot\frac{d\vec F}{dt}
\f] \f]
where where
\vartable \vartable
p' | Curle's acoustic pressure [Pa] or [Pa (m3/rho)] p' | Curle's acoustic pressure [Pa] or [Pa \f$(m^3/\rho)\f$]
c_0 | Reference speed of sound [m/s] c_0 | Reference speed of sound [m/s]
\vec d | Distance vector to observer locations [m] \vec d | Distance vector to observer locations [m]
F | Force [N] or [N (m3/rho)] \vec F | Force [N] or [N (\f$m^3/\rho\f$)]
\endvartable \endvartable
Note Operands:
Only the normal-pressure force is included in the force calculation \table
Operand | Type | Location
input | volScalarField | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Note
Only the normal-pressure force is included in the force calculation.
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
Curle1 Curle1
{ {
// Mandatory entries (unmodifiable)
type Curle; type Curle;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
patches (<patch1> <patch2> ... <patchN>)
c0 343;
// Optional (inherited) entries
... ...
patches (surface1 surface2);
c0 330;
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | Type name: Curle | yes | type | Type name: Curle | word | yes | -
field | Pressure field name | no | p libs | Library name: fieldFunctionObjects | word | yes | -
result | Acoustic pressure field name | no | Curle patches | Names of the operand patches | wordList | yes | -
patches | Sound generation patch names | yes | c0 | Reference speed of sound [m/s] | scalar | yes | -
c0 | Reference speed of sound | yes |
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Usage by the \c postProcess utility is not available.
See also See also
- Foam::functionObjects::fieldExpression - Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::Curle
SourceFiles SourceFiles
Curle.C Curle.C
@ -122,6 +139,7 @@ class Curle
protected: protected:
<<<<<<< HEAD
// Protected Member Functions // Protected Member Functions
//- Calculate acoustic pressure field and return true if successful //- Calculate acoustic pressure field and return true if successful
@ -133,6 +151,11 @@ protected:
//- No copy assignment //- No copy assignment
void operator=(const Curle&) = delete; void operator=(const Curle&) = delete;
=======
//- Calculate the acoustic pressure field and return true if successful
virtual bool calc();
>>>>>>> DOC: elaborate the usage of function objects
public: public:
@ -150,6 +173,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
Curle(const Curle&) = delete;
//- No copy assignment
void operator=(const Curle&) = delete;
//- Destructor //- Destructor
virtual ~Curle() = default; virtual ~Curle() = default;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2015 OpenFOAM Foundation Copyright (C) 2013-2015 OpenFOAM Foundation
Copyright (C) 2015-2016 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,13 +39,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(DESModelRegions, 0); defineTypeNameAndDebug(DESModelRegions, 0);
addToRunTimeSelectionTable(functionObject, DESModelRegions, dictionary);
addToRunTimeSelectionTable
(
functionObject,
DESModelRegions,
dictionary
);
} }
} }
@ -98,12 +92,6 @@ Foam::functionObjects::DESModelRegions::DESModelRegions
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::DESModelRegions::~DESModelRegions()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::DESModelRegions::read(const dictionary& dict) bool Foam::functionObjects::DESModelRegions::read(const dictionary& dict)
@ -135,7 +123,7 @@ bool Foam::functionObjects::DESModelRegions::execute()
DESModelRegions == model.LESRegion(); DESModelRegions == model.LESRegion();
scalar prc = const scalar prc =
gSum(DESModelRegions.primitiveField()*mesh_.V()) gSum(DESModelRegions.primitiveField()*mesh_.V())
/gSum(mesh_.V())*100.0; /gSum(mesh_.V())*100.0;

View File

@ -31,33 +31,62 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
This function object writes out an indicator field for DES turbulence Computes an indicator field for detached eddy simulation (DES) turbulence
calculations, that is: calculations, where the values of the indicator mean:
- 0 for RAS regions
- 1 for LES regions
The field is stored on the mesh database so that it can be retrieved and \verbatim
used for other applications. 0 = Reynolds-averaged Navier-Stokes (RAS) regions
1 = Large eddy simulation (LES) regions
\endverbatim
Operands:
\table
Operand | Type | Location
input | - | -
output file | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage Usage
Example of function object specification to generate DES indicator field: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
DESModelRegions1 DESModelRegions1
{ {
// Mandatory entries (unmodifiable)
type DESModelRegions; type DESModelRegions;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
// Optional entries (runtime modifiable)
result DESField;
// Optional (inherited) entries
... ...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: DESModelRegions| yes | type | Type name: DESModelRegions | word | yes | -
resultName | Name of DES indicator field | no | \<function name\> libs | Library name: fieldFunctionObjects | word | yes | -
log | log to standard output | no | yes result | Name of DES indicator field | word | no | <FO>
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link writeFile.H \endlink
Usage by the \c postProcess utility is not available.
Note
\c DESModelRegions function object can only be executed for DES simulations.
See also
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::DESModelRegions
SourceFiles SourceFiles
DESModelRegions.C DESModelRegions.C
@ -89,9 +118,9 @@ class DESModelRegions
{ {
protected: protected:
// Protected data // Protected Data
//- Result name //- Name of DES indicator field
word resultName_; word resultName_;
@ -100,12 +129,6 @@ protected:
//- File header information //- File header information
virtual void writeFileHeader(Ostream& os) const; virtual void writeFileHeader(Ostream& os) const;
//- No copy construct
DESModelRegions(const DESModelRegions&) = delete;
//- No copy assignment
void operator=(const DESModelRegions&) = delete;
public: public:
@ -114,6 +137,7 @@ public:
// Constructors // Constructors
//- Construct from Time and dictionary //- Construct from Time and dictionary
DESModelRegions DESModelRegions
( (
@ -122,9 +146,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
DESModelRegions(const DESModelRegions&) = delete;
//- No copy assignment
void operator=(const DESModelRegions&) = delete;
//- Destructor //- Destructor
virtual ~DESModelRegions(); virtual ~DESModelRegions() = default;
// Member Functions // Member Functions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "lambVector.H" #include "LambVector.H"
#include "fvcCurl.H" #include "fvcCurl.H"
#include "fvcDiv.H" #include "fvcDiv.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
@ -36,14 +36,14 @@ namespace Foam
{ {
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(lambVector, 0); defineTypeNameAndDebug(LambVector, 0);
addToRunTimeSelectionTable(functionObject, lambVector, dictionary); addToRunTimeSelectionTable(functionObject, LambVector, dictionary);
} }
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::functionObjects::lambVector::calc() bool Foam::functionObjects::LambVector::calc()
{ {
if (foundObject<volVectorField>(fieldName_)) if (foundObject<volVectorField>(fieldName_))
{ {
@ -57,7 +57,7 @@ bool Foam::functionObjects::lambVector::calc()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::lambVector::lambVector Foam::functionObjects::LambVector::LambVector
( (
const word& name, const word& name,
const Time& runTime, const Time& runTime,
@ -66,7 +66,8 @@ Foam::functionObjects::lambVector::lambVector
: :
fieldExpression(name, runTime, dict, "U") fieldExpression(name, runTime, dict, "U")
{ {
setResultName(typeName, fieldName_); setResultName(typeName, "U");
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -24,47 +24,79 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::functionObjects::lambVector Foam::functionObjects::LambVector
Group Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates Lamb vector, i.e. the cross product of vorticity and velocity. Computes Lamb vector, i.e. the cross product of vorticity and velocity.
Calculation of the divergence of the Lamb vector can be performed by using Calculation of the divergence of the Lamb vector can be performed by using
'div' functionObject on this 'lambVector' functionObject. \c div function object on this \c LambVector function object.
The field is stored on the mesh database so that it can be retrieved The motivation of the function object is the literature-reported
and used for other applications. quantitative connection between the Lamb vector (divergence) and
the spatially localised instantaneous fluid motions, e.g. high- and
low-momentum fluid parcels, which possess considerable level of capacity
to affect the rate of change of momentum, and to generate forces such as
drag.
Operands:
\table
Operand | Type | Location
input | volVectorField | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | volVectorField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage Usage
Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
lambVector1 LambVector1
{ {
type lambVector; // Mandatory entries (unmodifiable)
type LambVector;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
field UMean;
... Base options of fieldExpression ... // Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | Type name: lambVector | yes | type | Type name: LambVector | word | yes | -
field | Name of volVectorField | no | U libs | Library name: fieldFunctionObjects | word | yes | -
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func LambVector
\endverbatim
Note
To execute \c LambVector function object on an input <field>, a numerical
scheme should be defined for \c div(LambVector) in
\c system/fvSchemes.divSchemes.
See also See also
Foam::functionObjects::fieldExpression - Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::LambVector
SourceFiles SourceFiles
lambVector.C LambVector.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef functionObjects_lambVector_H #ifndef functionObjects_LambVector_H
#define functionObjects_lambVector_H #define functionObjects_LambVector_H
#include "fieldExpression.H" #include "fieldExpression.H"
@ -76,38 +108,44 @@ namespace functionObjects
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class lambVector Declaration Class LambVector Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class lambVector class LambVector
: :
public fieldExpression public fieldExpression
{ {
// Private Member Functions // Private Member Functions
//- Calculate the lambVector field and return true if successful //- Calculate the LambVector field and return true if successful
virtual bool calc(); virtual bool calc();
public: public:
//- Runtime type information //- Runtime type information
TypeName("lambVector"); TypeName("LambVector");
// Constructors // Constructors
//- Construct from Time and dictionary //- Construct from Time and dictionary
lambVector LambVector
( (
const word& name, const word& name,
const Time& runTime, const Time& runTime,
const dictionary& dict const dictionary& dict
); );
//- No copy construct
LambVector(const LambVector&) = delete;
//- No copy assignment
void operator=(const LambVector&) = delete;
//- Destructor //- Destructor
virtual ~lambVector() = default; virtual ~LambVector() = default;
}; };

View File

@ -37,13 +37,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(Lambda2, 0); defineTypeNameAndDebug(Lambda2, 0);
addToRunTimeSelectionTable(functionObject, Lambda2, dictionary);
addToRunTimeSelectionTable
(
functionObject,
Lambda2,
dictionary
);
} }
} }
@ -93,10 +87,4 @@ Foam::functionObjects::Lambda2::Lambda2
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::Lambda2::~Lambda2()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,13 +31,52 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates and outputs the second largest eigenvalue of the sum of the Computes the second largest eigenvalue of the sum of the square of
square of the symmetrical and anti-symmetrical parts of the velocity the symmetrical and anti-symmetrical parts of the velocity gradient tensor.
gradient tensor.
Operands:
\table
Operand | Type | Location
input | volVectorField | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
Lambda21
{
// Mandatory entries (unmodifiable)
type Lambda2;
libs (fieldFunctionObjects);
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: Lambda2 | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func Lambda2
\endverbatim
See also See also
Foam::functionObjects::fieldExpression - Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::Lambda2
SourceFiles SourceFiles
Lambda2.C Lambda2.C
@ -85,9 +125,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
Lambda2(const Lambda2&) = delete;
//- No copy assignment
void operator=(const Lambda2&) = delete;
//- Destructor //- Destructor
virtual ~Lambda2(); virtual ~Lambda2() = default;
}; };

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,13 +37,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(MachNo, 0); defineTypeNameAndDebug(MachNo, 0);
addToRunTimeSelectionTable(functionObject, MachNo, dictionary);
addToRunTimeSelectionTable
(
functionObject,
MachNo,
dictionary
);
} }
} }
@ -89,10 +83,4 @@ Foam::functionObjects::MachNo::MachNo
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::MachNo::~MachNo()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,11 +31,51 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates and writes the Mach number as a volScalarField. Computes the Mach number as a \c volScalarField.
Operands:
\table
Operand | Type | Location
input | volVectorField | $FOAM_CASE/<time>/<inpField>
output file | - | -
output field | volScalarField | $FOAM_CASE/<time>/<outField>
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
MachNo1
{
// Mandatory entries (unmodifiable)
type MachNo;
libs (fieldFunctionObjects);
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: MachNo | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func MachNo
\endverbatim
See also See also
Foam::functionObjects::fieldExpression - Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::MachNo
SourceFiles SourceFiles
MachNo.C MachNo.C
@ -84,9 +125,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
MachNo(const MachNo&) = delete;
//- No copy assignment
void operator=(const MachNo&) = delete;
//- Destructor //- Destructor
virtual ~MachNo(); virtual ~MachNo() = default;
}; };

View File

@ -65,7 +65,7 @@ ddt/ddt.C
mag/mag.C mag/mag.C
magSqr/magSqr.C magSqr/magSqr.C
vorticity/vorticity.C vorticity/vorticity.C
lambVector/lambVector.C LambVector/LambVector.C
enstrophy/enstrophy.C enstrophy/enstrophy.C
Q/Q.C Q/Q.C
Lambda2/Lambda2.C Lambda2/Lambda2.C

View File

@ -38,13 +38,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(PecletNo, 0); defineTypeNameAndDebug(PecletNo, 0);
addToRunTimeSelectionTable(functionObject, PecletNo, dictionary);
addToRunTimeSelectionTable
(
functionObject,
PecletNo,
dictionary
);
} }
} }
@ -143,11 +137,6 @@ Foam::functionObjects::PecletNo::PecletNo
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::PecletNo::~PecletNo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::PecletNo::read(const dictionary& dict) bool Foam::functionObjects::PecletNo::read(const dictionary& dict)

View File

@ -31,29 +31,56 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates and outputs the Peclet number as a surfaceScalarField. Computes the Peclet number as a \c surfaceScalarField.
Operands:
\table
Operand | Type | Location
input | surfaceScalarField | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | surfaceScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage Usage
Example of function object specification to calculate the Peclet number: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
PecletNo1 PecletNo1
{ {
// Mandatory entries (unmodifiable)
type PecletNo; type PecletNo;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
// Optional entries (runtime modifiable)
rho rho;
// Optional (inherited) entries
... ...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: Peclet | yes | type | Type name: PecletNo | word | yes | -
phi | Name of flux field | no | phi libs | Library name: fieldFunctionObjects | word | yes | -
rho | Name of density field | no | rho rho | Name of density field | word | no | rho
result | Name of Peclet field | no | \<function name\>
log | Log to standard output | no | yes
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func PecletNo
\endverbatim
See also
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::PecletNo
SourceFiles SourceFiles
PecletNo.C PecletNo.C
@ -80,9 +107,9 @@ class PecletNo
: :
public fieldExpression public fieldExpression
{ {
// Private data // Private Data
//- Name of density field, default is "rho" //- Name of density field
word rhoName_; word rhoName_;
@ -111,9 +138,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
PecletNo(const PecletNo&) = delete;
//- No copy assignment
void operator=(const PecletNo&) = delete;
//- Destructor //- Destructor
virtual ~PecletNo(); virtual ~PecletNo() = default;
// Member Functions // Member Functions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,13 +37,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(Q, 0); defineTypeNameAndDebug(Q, 0);
addToRunTimeSelectionTable(functionObject, Q, dictionary);
addToRunTimeSelectionTable
(
functionObject,
Q,
dictionary
);
} }
} }
@ -84,10 +78,4 @@ Foam::functionObjects::Q::Q
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::Q::~Q()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -31,41 +31,63 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates and outputs the second invariant of the velocity gradient tensor Computes the second invariant of
[1/s^2]. the velocity gradient tensor \f$[s^{-2}]\f$.
\f[ \f[
Q = 0.5(sqr(tr(\nabla U)) - tr(((\nabla U) \cdot (\nabla U)))) \vec Q = \frac{1}{2}
[ (tr (\nabla \vec U) )^2
- tr (\nabla \vec U \cdot \nabla \vec U) ]
\f] \f]
where where
\vartable \vartable
U | velocity [m/s] \vec U | velocity [m/s]
\endvartable \endvartable
Operands:
\table
Operand | Type | Location
input | volVectorField | $FOAM_CASE/<time>/<inpField>
output file | - | -
output field | volScalarField | $FOAM_CASE/<time>/<outField>
\endtable
Usage Usage
Example of function object specification to calculate Q: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
Q1 Q1
{ {
// Mandatory entries (unmodifiable)
type Q; type Q;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
// Optional (inherited) entries
... ...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: Q | yes | type | Type name: Q | word | yes | -
U | Name of velocity field | no | U libs | Library name: fieldFunctionObjects | word | yes | -
result | Name of Q field | no | \<function name\>
log | Log to standard output | no | yes
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func Q
\endverbatim
See also See also
Foam::functionObjects::fieldExpression - Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fieldExpression
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::Q
SourceFiles SourceFiles
Q.C Q.C
@ -114,9 +136,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
Q(const Q&) = delete;
//- No copy assignment
void operator=(const Q&) = delete;
//- Destructor //- Destructor
virtual ~Q(); virtual ~Q() = default;
}; };

View File

@ -52,15 +52,16 @@ Description
PhD thesis. Munich: Technical University of Munich. PhD thesis. Munich: Technical University of Munich.
URL:mediatum.ub.tum.de/doc/1482652/1482652.pdf URL:mediatum.ub.tum.de/doc/1482652/1482652.pdf
Hemati, M. S., Rowley, C. W., Deem, E. A., & Cattafesta, L. N. (2017). Hemati, M. S., Rowley, C. W.,
De-biasing the dynamic mode decomposition for applied Koopman Deem, E. A., & Cattafesta, L. N. (2017).
spectral analysis of noisy datasets. De-biasing the dynamic mode decomposition
for applied Koopman spectral analysis of noisy datasets.
Theoretical and Computational Fluid Dynamics, 31(4), 349-368. Theoretical and Computational Fluid Dynamics, 31(4), 349-368.
DOI:10.1007/s00162-017-0432-2 DOI:10.1007/s00162-017-0432-2
Kou, J., & Zhang, W. (2017). Kou, J., & Zhang, W. (2017).
An improved criterion to select dominant modes from dynamic mode An improved criterion to select
decomposition. dominant modes from dynamic mode decomposition.
European Journal of Mechanics-B/Fluids, 62, 109-129. European Journal of Mechanics-B/Fluids, 62, 109-129.
DOI:10.1016/j.euromechflu.2016.11.015 DOI:10.1016/j.euromechflu.2016.11.015
@ -71,8 +72,8 @@ Description
Parallel classical Gram-Schmidt process (tag:Ka): Parallel classical Gram-Schmidt process (tag:Ka):
Katagiri, T. (2003). Katagiri, T. (2003).
Performance evaluation of parallel Gram-Schmidt re-orthogonalization Performance evaluation of parallel
methods. Gram-Schmidt re-orthogonalization methods.
In: Palma J. M. L. M., Sousa A. A., Dongarra J., Hernández V. (eds) In: Palma J. M. L. M., Sousa A. A., Dongarra J., Hernández V. (eds)
High Performance Computing for Computational Science — VECPAR 2002. High Performance Computing for Computational Science — VECPAR 2002.
Lecture Notes in Computer Science, vol 2565, p. 302-314. Lecture Notes in Computer Science, vol 2565, p. 302-314.
@ -81,14 +82,14 @@ Description
Parallel direct tall-skinny QR decomposition (tags:BGD, DGHL): Parallel direct tall-skinny QR decomposition (tags:BGD, DGHL):
Benson, A. R., Gleich, D. F., & Demmel, J. (2013). Benson, A. R., Gleich, D. F., & Demmel, J. (2013).
Direct QR factorizations for tall-and-skinny matrices in MapReduce Direct QR factorizations for
architectures. tall-and-skinny matrices in MapReduce architectures.
2013 IEEE International Conference on Big Data. 2013 IEEE International Conference on Big Data.
DOI:10.1109/bigdata.2013.6691583 DOI:10.1109/bigdata.2013.6691583
Demmel, J., Grigori, L., Hoemmen, M., & Langou, J. (2012). Demmel, J., Grigori, L., Hoemmen, M., & Langou, J. (2012).
Communication-optimal parallel and sequential QR and LU Communication-optimal parallel
factorizations. and sequential QR and LU factorizations.
SIAM Journal on Scientific Computing, 34(1), A206-A239. SIAM Journal on Scientific Computing, 34(1), A206-A239.
DOI:10.1137/080731992 DOI:10.1137/080731992
@ -109,7 +110,7 @@ Description
output field | volScalarField(s) | $FOAM_CASE/\<time\>/\<outField\>(s) output field | volScalarField(s) | $FOAM_CASE/\<time\>/\<outField\>(s)
\endtable \endtable
where Type={Scalar,SphericalTensor,SymmTensor,Tensor}. where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Output fields: Output fields:
\verbatim \verbatim

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,12 +58,6 @@ Foam::functionObjects::XiReactionRate::XiReactionRate
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::XiReactionRate::~XiReactionRate()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::XiReactionRate::read(const dictionary& dict) bool Foam::functionObjects::XiReactionRate::read(const dictionary& dict)
@ -89,7 +83,7 @@ bool Foam::functionObjects::XiReactionRate::write()
const volScalarField& Xi = const volScalarField& Xi =
mesh_.lookupObject<volScalarField>("Xi"); mesh_.lookupObject<volScalarField>("Xi");
volScalarField St const volScalarField St
( (
IOobject IOobject
( (
@ -105,7 +99,7 @@ bool Foam::functionObjects::XiReactionRate::write()
St.write(); St.write();
volScalarField wdot const volScalarField wdot
( (
IOobject IOobject
( (

View File

@ -34,25 +34,44 @@ Description
Writes the turbulent flame-speed and reaction-rate volScalarFields for the Writes the turbulent flame-speed and reaction-rate volScalarFields for the
Xi-based combustion models. Xi-based combustion models.
Operands:
\table
Operand | Type | Location
input | - | -
output file | - | -
output field | volScalarField | $FOAM_CASE/\<time\>/{St,wdot}
\endtable
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
XiReactionRate XiReactionRate1
{ {
// Mandatory entries (unmodifiable)
type XiReactionRate; type XiReactionRate;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
// Optional (inherited) entries
... ...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: XiReactionRate | yes | type | Type name: XiReactionRate | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
Usage by the \c postProcess utility is not available.
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::XiReactionRate
SourceFiles SourceFiles
XiReactionRate.C XiReactionRate.C
@ -79,15 +98,6 @@ class XiReactionRate
: :
public fvMeshFunctionObject public fvMeshFunctionObject
{ {
// Private member functions
//- No copy construct
XiReactionRate(const XiReactionRate&) = delete;
//- No copy assignment
void operator=(const XiReactionRate&) = delete;
public: public:
//- Runtime type information //- Runtime type information
@ -104,9 +114,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
XiReactionRate(const XiReactionRate&) = delete;
//- No copy assignment
void operator=(const XiReactionRate&) = delete;
//- Destructor //- Destructor
virtual ~XiReactionRate(); virtual ~XiReactionRate() = default;
// Member Functions // Member Functions

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,10 +64,4 @@ Foam::functionObjects::add::add
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::add::~add()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -31,30 +31,68 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Add a list of fields. Sums a given list of (at least two or more) fields and outputs the result
into a new field, where the fields possess the same sizes and dimensions:
The operation can be applied to any volume or surface fields generating a
volume or surface scalar field.
Example of function object specification:
\verbatim \verbatim
Ttot fieldResult = field1 + field2 + ... + fieldN
\endverbatim
Operands:
\table
Operand | Type | Location
input | {vol,surface}\<Type\>Field(s) <!--
--> |$FOAM_CASE/\<time\>/\<inpField\>s
output file | - |-
output field | {vol,surface}\<Type\>Field <!--
--> | $FOAM_CASE/\<time\>/\<outField\>
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
add1
{ {
// Mandatory entries (unmodifiable)
type add; type add;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
fields (T Tdelta);
result Ttot; // Mandatory (inherited) entry (runtime modifiable)
executeControl writeTime; fields (<field1> <field2> ... <fieldN>);
writeControl writeTime;
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: add | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
fields | Names of the operand fields | wordList | yes | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldsExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func "add(<field1>, <field2>, ..., <fieldN>)"
\endverbatim
See also See also
Foam::functionObjects::fieldsExpression - Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fieldsExpression
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::add
SourceFiles SourceFiles
add.C add.C
addTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -81,7 +119,7 @@ class add
// Private Member Functions // Private Member Functions
//- Add the list of fields of the specified type //- Add the list of fields of the specified type
// and return the result //- and return the result
template<class GeoFieldType> template<class GeoFieldType>
tmp<GeoFieldType> calcFieldType() const; tmp<GeoFieldType> calcFieldType() const;
@ -108,9 +146,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
add(const add&) = delete;
//- No copy assignment
void operator=(const add&) = delete;
//- Destructor //- Destructor
virtual ~add(); virtual ~add() = default;
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,7 +38,7 @@ Foam::functionObjects::add::calcFieldType() const
+ lookupObject<GeoFieldType>(fieldNames_[1]) + lookupObject<GeoFieldType>(fieldNames_[1])
); );
for (label i=2; i<fieldNames_.size(); i++) for (label i = 2; i < fieldNames_.size(); ++i)
{ {
tresult.ref() += lookupObject<GeoFieldType>(fieldNames_[i]); tresult.ref() += lookupObject<GeoFieldType>(fieldNames_[i]);
} }

View File

@ -103,12 +103,6 @@ Foam::functionObjects::blendingFactor::blendingFactor
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::blendingFactor::~blendingFactor()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::blendingFactor::read(const dictionary& dict) bool Foam::functionObjects::blendingFactor::read(const dictionary& dict)
@ -117,17 +111,13 @@ bool Foam::functionObjects::blendingFactor::read(const dictionary& dict)
{ {
phiName_ = dict.getOrDefault<word>("phi", "phi"); phiName_ = dict.getOrDefault<word>("phi", "phi");
tolerance_ = 0.001; tolerance_ =
if dict.getCheckOrDefault
( (
dict.readIfPresent("tolerance", tolerance_) "tolerance",
&& (tolerance_ < 0 || tolerance_ > 1) 0.001,
) [&](const scalar tol){ return (tol > 0) && (tol < 1); }
{ );
FatalErrorInFunction
<< "tolerance must be in the range 0 to 1. Supplied value: "
<< tolerance_ << exit(FatalError);
}
return true; return true;
} }
@ -147,10 +137,8 @@ bool Foam::functionObjects::blendingFactor::write()
label nCellsScheme1 = 0; label nCellsScheme1 = 0;
label nCellsScheme2 = 0; label nCellsScheme2 = 0;
label nCellsBlended = 0; label nCellsBlended = 0;
forAll(indicator, celli) for (const auto i : indicator)
{ {
scalar i = indicator[celli];
if (i < tolerance_) if (i < tolerance_)
{ {
nCellsScheme1++; nCellsScheme1++;

View File

@ -31,61 +31,85 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates and outputs the blendingFactor as used by the bended convection Computes the blending coefficient employed by blended divergence schemes,
schemes. The output is a volume field (cells) whose value is calculated via giving an indicator as to which of the schemes is active across the domain.
the maximum blending factor for any cell face.
The weight of a blended scheme is given by a function of the blending Blended schemes combine contributions from two schemes, i.e. \f$\phi_1\f$
factor, f: and \f$\phi_2\f$, using a weight field, i.e. \f$w\f$, such that the
effective scheme value, i.e. \f$\phi_{eff}\f$, is computed as follows:
\f[ \f[
weight = f scheme1 + (1 - f) scheme2 \phi_{eff} = w \phi_1 + (1 - w) \phi_2
\f] \f]
The factor is a face-based quantity, which is converted to a cell-based The weight field, i.e. \f$w\f$, is surface field and converted to a volume
quantity by assigning the minimum blending factor for any cell face. field for easier post-processing by setting the cell value to one minus
the minimum of the face values.
An indicator (volume) field, named \<functionObjectName\>:\<fieldName\>, is This conversion leads to blending indicator field whose values mean:
generated that is set to (1 - f), i.e. values of: \verbatim
- 0 represent scheme1 as active, and 0 = scheme 0
- 1 represent scheme2 as active. 1 = scheme 1
- intermediate values show the contribution to scheme2 0-1 = a blend between scheme 0 and scheme 1
\endverbatim
Additional reporting is written to the standard output, providing Operands:
statistics as to the number of cells used by each scheme. \table
Operand | Type | Location
input | - | -
output file | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage Usage
Example of function object specification to calculate the blending factor: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
blendingFactor1 blendingFactor1
{ {
// Mandatory entries (unmodifiable)
type blendingFactor; type blendingFactor;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
... // Mandatory (inherited) entry (runtime modifiable)
field <field>;
// Name of field // Optional entries (runtime modifiable)
field U; phi phi;
tolerance 0.001;
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Deflt
type | Type name: blendingFactor | yes | type | Type name: blendingFactor | word | yes | -
phi | Name of flux field | no | phi libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of field to evaluate | yes | field | Name of the operand field | word | yes | -
tolerance | Tolerance for number of blended cells | no | 0.001 phi | Name of flux field | word | no | phi
log | Log to standard output | no | yes tolerance | Tolerance for number of blended cells | scalar | no | 0.001
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
- \link writeFile.H \endlink
Usage by the \c postProcess utility is not available.
See also See also
Foam::functionObjects::fieldExpression - Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fieldExpression
Foam::functionObjects::writeFile - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- Foam::CoBlended
- ExtendedCodeGuide::functionObjects::field::blendingFactor
SourceFiles SourceFiles
blendingFactor.C blendingFactor.C
blendingFactorTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -112,9 +136,9 @@ class blendingFactor
public fieldExpression, public fieldExpression,
public writeFile public writeFile
{ {
// Private member data // Private Data
//- Name of flux field, default is "phi" //- Name of flux field
word phiName_; word phiName_;
//- Tolerance used when calculating the number of blended cells //- Tolerance used when calculating the number of blended cells
@ -163,9 +187,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
blendingFactor(const blendingFactor&) = delete;
//- No copy assignment
void operator=(const blendingFactor&) = delete;
//- Destructor //- Destructor
virtual ~blendingFactor(); virtual ~blendingFactor() = default;
// Member Functions // Member Functions

View File

@ -30,41 +30,66 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Averages columns of cells for layered meshes. Computes the arithmetic average of given quantities along columns of cells
in a given direction for structured-like layered meshes. It is, for example,
useful for channel-like cases where spanwise average of a field is desired.
However, the \c columnAverage function object does not operate on arbitrary
unstructured meshes.
For each patch face, calculates the average value of all cells attached in For each patch face, calculates the average value of all cells attached in
the patch face normal direction, and then pushes the average value back the patch face normal direction, and then pushes the average value back
to all cells in the column. to all cells in the column.
Useful for channel-like cases where we want to average fields in the Operands:
spanwise direction. \table
Operand | Type | Location
input | vol\<Type\>Field | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | vol\<Type\>Field | $FOAM_CASE/\<time\>/\<outField\>
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
columnAverage1 columnAverage1
{ {
// Mandatory entries (unmodifiable)
type columnAverage; type columnAverage;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
patches (<patch1> <patch2> ... <patchN>);
fields (<field1> <field2> ... <fieldN>);
// Optional (inherited) entries
... ...
patches (front side);
fields (U p);
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default Property | Description | Type | Req'd | Dflt
type | type name: columnAverage | yes | type | Type name: columnAverage | word | yes | -
patches | list of patches to collapse onto | yes | libs | Library name: fieldFunctionObjects | word | yes | -
fields | list of fields to process | yes | patches | Names of patches to collapse onto | word | yes | -
fields | Names of the operand fields | word | yes | -
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
Usage by the \c postProcess utility is not available.
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::columnAverage
SourceFiles SourceFiles
columnAverage.C columnAverage.C
columnAverageTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -137,6 +162,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
columnAverage(const columnAverage&) = delete;
//- No copy assignment
void operator=(const columnAverage&) = delete;
//- Destructor //- Destructor
virtual ~columnAverage() = default; virtual ~columnAverage() = default;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,16 +31,75 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates the components of a field. Extracts the components of elements of a field and outputs the result
into new fields, where the fields possess the same sizes and dimensions.
The operation can be applied to any volume or surface fields generating a Depending on the base type of the input field, the number of output fields
volume or surface scalar fields for each component. and output suffixes are as follows (the base type cannot be scalar since
scalars have no components):
\table
Base type | Number of components | Suffixes
vector | 3 | (x y z)
sphericalTensor | 3 | (x y z)
symmTensor | 6 | (xx xy xz yy yz zz)
tensor | 9 | (xx xy xz yx yy yz zx zy zz)
\endtable
Operands:
\table
Operand | Type | Location
input | {vol,surface}\<Type\>Field (Type != Scalar) <!--
--> | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | {vol,surface}ScalarField for each component <!--
--> | $FOAM_CASE/\<time\>/\<outField\>\<suffix\>
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
components1
{
// Mandatory entries (unmodifiable)
type components;
libs (fieldFunctionObjects);
// Mandatory (inherited) entry (runtime modifiable)
field <field>;
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: components | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of the operand field | word | yes | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func "components(<field>)"
\endverbatim
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::components
SourceFiles SourceFiles
components.C components.C
componentsTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -64,7 +123,7 @@ class components
: :
public fieldExpression public fieldExpression
{ {
// Private member data // Private Member Data
//- List of the component field names //- List of the component field names
wordList resultNames_; wordList resultNames_;
@ -73,12 +132,12 @@ class components
// Private Member Functions // Private Member Functions
//- Calculate the components of the field with the specified type //- Calculate the components of the field with the specified type
// and register the result //- and register the result
template<class GeoFieldType> template<class GeoFieldType>
bool calcFieldComponents(); bool calcFieldComponents();
//- Calculate the components of the field with the specified //- Calculate the components of the field with the specified
// element type and register the result //- element type and register the result
template<class Type> template<class Type>
bool calcComponents(); bool calcComponents();
@ -102,6 +161,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
components(const components&) = delete;
//- No copy assignment
void operator=(const components&) = delete;
//- Destructor //- Destructor
virtual ~components() = default; virtual ~components() = default;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,13 +36,13 @@ bool Foam::functionObjects::components::calcFieldComponents()
{ {
typedef typename GeoFieldType::value_type Type; typedef typename GeoFieldType::value_type Type;
const GeoFieldType& field(lookupObject<GeoFieldType>(fieldName_)); const GeoFieldType& field = lookupObject<GeoFieldType>(fieldName_);
resultNames_.setSize(Type::nComponents); resultNames_.setSize(Type::nComponents);
bool stored = true; bool stored = true;
for (direction i=0; i<Type::nComponents; i++) for (direction i = 0; i < Type::nComponents; ++i)
{ {
resultName_ = fieldName_ + word(Type::componentNames[i]); resultName_ = fieldName_ + word(Type::componentNames[i]);
resultNames_[i] = resultName_; resultNames_[i] = resultName_;

View File

@ -115,8 +115,8 @@ bool Foam::functionObjects::continuityError::write()
const volScalarField error(fvc::div(*phiPtr)); const volScalarField error(fvc::div(*phiPtr));
const scalar deltaT = mesh_.time().deltaTValue(); const scalar deltaT = mesh_.time().deltaTValue();
scalar local = deltaT*mag(error)().weightedAverage(mesh_.V()).value(); const scalar local = deltaT*mag(error)().weightedAverage(mesh_.V()).value();
scalar global = deltaT*error.weightedAverage(mesh_.V()).value(); const scalar global = deltaT*error.weightedAverage(mesh_.V()).value();
cumulative_ += global; cumulative_ += global;
Ostream& os = file(); Ostream& os = file();

View File

@ -30,40 +30,78 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates the continuity error for a flux field Computes local, global and cumulative continuity errors for a flux field.
Local continuity error, \f$ \epsilon_{local} \f$:
\f[
\epsilon_{local} = \Delta_t \langle |x| \rangle
\f]
Global continuity error, \f$ \epsilon_{global} \f$:
\f[
\epsilon_{global} = \Delta_t \langle |x| \rangle
\f]
Cumulative continuity, \f$ \epsilon_{cum} \f$:
\f[
\epsilon_{cum} += \epsilon_{global}
\f]
where
\vartable
\Delta_t | Time-step size
\langle . \rangle | Cell-volume weighted average operator
x | \f$ \div \phi \f$
phi | Flux field
\endvartable
Operands:
\table
Operand | Type | Location
input | - | -
output file | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | - | -
\endtable
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
continuityError1 continuityError1
{ {
// Mandatory entries (unmodifiable)
type continuityError; type continuityError;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
...
writeToFile yes; // Optional entries (runtime modifiable)
log yes;
phi phi; phi phi;
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: continuityError | yes | type | Type name: continuityError | word | yes | -
writeToFile | write min/max data to file | no | yes libs | Library name: fieldFunctionObjects | word | yes | -
log | write min/max data to standard output | no | yes phi | Name of flux field | word | no | phi
phi | name of flux field | no | phi
\endtable \endtable
Output data is written to the file \<timeDir\>/continuityError.dat The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link writeFile.H \endlink
Usage by the \c postProcess utility is not available.
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
Foam::functionObjects::writeFile - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::continuityError
SourceFiles SourceFiles
continuityError.C continuityError.C
continuityErrorTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -90,22 +128,11 @@ class continuityError
public fvMeshFunctionObject, public fvMeshFunctionObject,
public writeFile public writeFile
{ {
private:
// Private Member Functions
//- No copy construct
continuityError(const continuityError&) = delete;
//- No copy assignment
void operator=(const continuityError&) = delete;
protected: protected:
// Protected data // Protected Data
//- Name of the flux field; default = "phi //- Name of flux field
word phiName_; word phiName_;
//- Cumulative error //- Cumulative error
@ -134,6 +161,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
continuityError(const continuityError&) = delete;
//- No copy assignment
void operator=(const continuityError&) = delete;
//- Destructor //- Destructor
virtual ~continuityError() = default; virtual ~continuityError() = default;

View File

@ -31,13 +31,58 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates the Eulerian time derivative of a field. Computes the Eulerian time derivative of an input volume field for
time-variant simulations (not appropriate to steady-state simulations).
The operation can be applied to any volume field generating a field of the Operands:
same type. \table
Operand | Type | Location
input | vol\<Type\>Field | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | vol\<Type\>Field | $FOAM_CASE/\<time\>/\<outField\>
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
ddt1
{
// Mandatory entries (unmodifiable)
type ddt;
libs (fieldFunctionObjects);
// Mandatory (inherited) entries (runtime modifiable)
field <field>;
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: ddt | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of operand field | word | yes | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func "ddt(<field>)"
\endverbatim
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::ddt
SourceFiles SourceFiles
ddt.C ddt.C
@ -65,6 +110,7 @@ class ddt
: :
public fieldExpression public fieldExpression
{ {
// Private Member Functions // Private Member Functions
//- Calculate and store the result //- Calculate and store the result
@ -93,6 +139,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
ddt(const ddt&) = delete;
//- No copy assignment
void operator=(const ddt&) = delete;
//- Destructor //- Destructor
virtual ~ddt() = default; virtual ~ddt() = default;

View File

@ -40,13 +40,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(ddt2, 0); defineTypeNameAndDebug(ddt2, 0);
addToRunTimeSelectionTable(functionObject, ddt2, dictionary);
addToRunTimeSelectionTable
(
functionObject,
ddt2,
dictionary
);
} }
} }

View File

@ -30,37 +30,57 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
This function object calculates the magnitude squared Computes the magnitude or magnitude squared of the Eulerian time derivative
of d(scalarField)/dt. of an input volume field for time-variant simulations
(not appropriate to steady-state simulations).
The result can be used further for determining variance or RMS values The result can be further used for determining e.g. variance or RMS values.
(for example).
Operands:
\table
Operand | Type | Location
input | vol\<Type\>Field | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | vol\<Type\>Field | $FOAM_CASE/\<time\>/\<outField\>
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
dpdt2 ddt21
{ {
// Mandatory entries (unmodifiable)
type ddt2; type ddt2;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
fields (p);
// Mandatory entries (runtime modifiable)
fields (<field1> <field2> ... <fieldN>);
// Optional entries (unmodifiable)
mag false;
// Optional entries (runtime modifiable)
result d@@dt2; result d@@dt2;
// Optional (inherited) entries
... ...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: ddt2 | yes | type | Type name: ddt2 | word | yes | -
fields | Name of fields to process | yes | libs | Library name: fieldFunctionObjects | word | yes | -
result | Name of results | no | magSqr(ddt(@@)) fields | Names of the operand fields | wordList | yes | -
log | Log to standard output | no | yes mag | Compute 'mag' instead of 'magSqr' | bool | no | false
mag | Use 'mag' instead of 'magSqr' | no | false result | Name of results | word | no | magSqr(ddt2(@@))
\endtable \endtable
Note that the optional 'mag' entry cannot be changed during the simulation The inherited entries are elaborated in:
since it alters the dimensions of the output field. - \link functionObject.H \endlink
A list of fields can contain exact names or regular expressions. A list of fields can contain exact names or regular expressions.
The token '\@\@' in the result name is replaced by the name of the source The token '\@\@' in the result name is replaced by the name of the source
@ -70,6 +90,13 @@ Usage
The function object will skip over fields that appear to have The function object will skip over fields that appear to have
already been processed (ie, their names are similar to the output names). already been processed (ie, their names are similar to the output names).
Usage by the \c postProcess utility is not available.
See also
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::ddt2
SourceFiles SourceFiles
ddt2.C ddt2.C
ddt2Templates.C ddt2Templates.C
@ -101,29 +128,29 @@ class ddt2
: :
public fvMeshFunctionObject public fvMeshFunctionObject
{ {
// Private data // Private Data
//- Name of fields to process. //- Name of fields to process
wordRes selectFields_; wordRes selectFields_;
//- Formatting for the result fields. //- Formatting for the result fields
word resultName_; word resultName_;
//- Avoid processing the same field twice. //- Avoid processing the same field twice
mutable regExp blacklist_; mutable regExp blacklist_;
//- Hashed names of result fields. //- Hashed names of result fields
wordHashSet results_; wordHashSet results_;
//- Use 'mag' instead of 'magSqr'. //- Flat to use 'mag' instead of 'magSqr'
// Cannot be adjusted during the simulation since it alters the // Cannot be adjusted during the simulation since it alters the
// dimensions of the output field. // dimensions of the output field
const bool mag_; const bool mag_;
// Private Member Functions // Private Member Functions
//- Check that string contains the appropriate substitution token(s). //- Check that string contains the appropriate substitution token(s)
static bool checkFormatName(const std::string& str); static bool checkFormatName(const std::string& str);
@ -134,17 +161,10 @@ class ddt2
template<class FieldType> template<class FieldType>
int apply(const word& inputName, int& state); int apply(const word& inputName, int& state);
//- Process by trying to apply for various volume field types. //- Process by trying to apply for various volume field types
int process(const word& inputName); int process(const word& inputName);
//- No copy construct
ddt2(const ddt2&) = delete;
//- No copy assignment
void operator=(const ddt2&) = delete;
public: public:
//- Runtime type information //- Runtime type information
@ -161,6 +181,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
ddt2(const ddt2&) = delete;
//- No copy assignment
void operator=(const ddt2&) = delete;
//- Destructor //- Destructor
virtual ~ddt2() = default; virtual ~ddt2() = default;
@ -174,7 +200,7 @@ public:
//- Calculate the ddt2 fields //- Calculate the ddt2 fields
virtual bool execute(); virtual bool execute();
//- Write the ddt fields //- Write the ddt2 fields
virtual bool write(); virtual bool write();
}; };

View File

@ -39,13 +39,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(derivedFields, 0); defineTypeNameAndDebug(derivedFields, 0);
addToRunTimeSelectionTable(functionObject, derivedFields, dictionary);
addToRunTimeSelectionTable
(
functionObject,
derivedFields,
dictionary
);
} }
} }
@ -62,7 +56,6 @@ Foam::functionObjects::derivedFields::knownNames
}); });
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace Foam namespace Foam

View File

@ -30,34 +30,60 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
A limited set of predefined derived fields ("rhoU", "pTotal"). Computes two predefined derived fields, i.e. \c rhoU, and \c pTotal, where
the defined fields are hard-coded as follows:
\vartable
rhoU | \f$ \rho \vec U \f$
pTotal | \f$ p + 1/2 \rho \, mag(\vec U)^2 \f$
\endvartable
Operands:
\table
Operand | Type | Location
input | vol{Scalar,Vector}Field | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | vol{Scalar,Vector}Field | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
derived derivedFields1
{ {
// Mandatory entries (unmodifiable)
type derivedFields; type derivedFields;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
fields (rhoU pTotal); // Mandatory entries (runtime modifiable)
derived (rhoU pTotal);
// Optional: reference density for incompressible // Optional entries (runtime modifiable)
rhoRef 1.25; rhoRef 1.0;
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Entries: where the entries mean:
\table \table
Property | Description | Required | Default Property | Description | Type | Req'd | Dflt
type | derivedFields | yes | type | Type name: derivedFields | word | yes | -
derived | Derived fields (pTotal/rhoU) | yes | libs | Library name: fieldFunctionObjects | word | yes | -
rhoRef | Reference density (incompressible) | no | 1 derived | Names of operand fields (rhoU/pTotal) | word | yes | -
rhoRef | Reference density for incompressible flows | scalar | no | 1.0
\endtable \endtable
The known derived fields The inherited entries are elaborated in:
\plaintable - \link functionObject.H \endlink
rhoU | (rho * U)
pTotal | (p + 1/2 * rho * U) Usage by the \c postProcess utility is not available.
\endplaintable
See also
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::derivedFields
SourceFiles SourceFiles
derivedFields.C derivedFields.C
@ -89,7 +115,7 @@ public:
// Public Enumerations // Public Enumerations
//- Derived/calculated field type //- Options for the derived/calculated field type
enum derivedType enum derivedType
{ {
NONE = 0, //!< "none" NONE = 0, //!< "none"
@ -98,7 +124,7 @@ public:
UNKNOWN UNKNOWN
}; };
//- Known derived field types //- Names for derivedType
static const Enum<derivedType> knownNames; static const Enum<derivedType> knownNames;
@ -113,7 +139,7 @@ protected:
scalar rhoRef_; scalar rhoRef_;
// Private Member Functions // Protected Member Functions
//- Hard-coded derived field (rho * U) //- Hard-coded derived field (rho * U)
// \return true if field did not previously exist // \return true if field did not previously exist
@ -140,6 +166,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
derivedFields(const derivedFields&) = delete;
//- No copy assignment
void operator=(const derivedFields&) = delete;
//- Destructor //- Destructor
virtual ~derivedFields() = default; virtual ~derivedFields() = default;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -68,10 +69,4 @@ Foam::functionObjects::div::div
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::div::~div()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,15 +31,63 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates the divergence of a field. The operation is limited to Computes the divergence of an input field.
surfaceScalarFields and volVectorFields, and the output is a volScalarField.
Operands:
\table
Operand | Type | Location
input | {surfaceScalar,volVector}Field | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
div1
{
// Mandatory entries (unmodifiable)
type div;
libs (fieldFunctionObjects);
// Mandatory (inherited) entry (runtime modifiable)
field <field>;
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: add | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of the operand field | word | yes | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func "div(<field>)"
\endverbatim
Note
To execute \c div function object on an input <field>, a numerical scheme
should be defined for \c div(<field>) in \c system/fvSchemes.divSchemes.
See also See also
Foam::functionObjects::fieldExpression - Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::div
SourceFiles SourceFiles
div.C div.C
divTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -65,7 +114,7 @@ class div
// Private Member Functions // Private Member Functions
//- Calculate the divergence of either a //- Calculate the divergence of either a
// volScalarField or a surfaceScalarField and register the result //- volScalarField or a surfaceScalarField and register the result
template<class FieldType> template<class FieldType>
bool calcDiv(); bool calcDiv();
@ -89,9 +138,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
div(const div&) = delete;
//- No copy assignment
void operator=(const div&) = delete;
//- Destructor //- Destructor
virtual ~div(); virtual ~div() = default;
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,13 +37,7 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(enstrophy, 0); defineTypeNameAndDebug(enstrophy, 0);
addToRunTimeSelectionTable(functionObject, enstrophy, dictionary);
addToRunTimeSelectionTable
(
functionObject,
enstrophy,
dictionary
);
} }
} }
@ -79,10 +74,4 @@ Foam::functionObjects::enstrophy::enstrophy
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::enstrophy::~enstrophy()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,11 +31,59 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates the enstrophy of the velocity. Computes the enstrophy of an input \c volVectorField.
Enstrophy, i.e. \f$\xi\f$:
\f[
\xi = 0.5 mag(\nabla \times \vec U )^2
\f]
where \f$\vec U\f$ is the input \c volVectorField.
Operands:
\table
Operand | Type | Location
input | volVectorField | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
enstrophy1
{
// Mandatory entries (unmodifiable)
type enstrophy;
libs (fieldFunctionObjects);
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: enstrophy | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func enstrophy
\endverbatim
See also See also
Foam::functionObjects::fieldExpression - Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::enstrophy
SourceFiles SourceFiles
enstrophy.C enstrophy.C
@ -83,9 +132,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
enstrophy(const enstrophy&) = delete;
//- No copy assignment
void operator=(const enstrophy&) = delete;
//- Destructor //- Destructor
virtual ~enstrophy(); virtual ~enstrophy() = default;
}; };

View File

@ -42,15 +42,9 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(externalCoupled, 0); defineTypeNameAndDebug(externalCoupled, 0);
addToRunTimeSelectionTable(functionObject, externalCoupled, dictionary);
addToRunTimeSelectionTable }
( }
functionObject,
externalCoupled,
dictionary
);
} // End namespace functionObject
} // End namespace Foam
Foam::string Foam::functionObjects::externalCoupled::patchKey = "// Patch:"; Foam::string Foam::functionObjects::externalCoupled::patchKey = "// Patch:";
@ -568,7 +562,8 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict)
timeFunctionObject::read(dict); timeFunctionObject::read(dict);
externalFileCoupler::readDict(dict); externalFileCoupler::readDict(dict);
calcFrequency_ = dict.getOrDefault("calcFrequency", 1); calcFrequency_ =
dict.getCheckOrDefault("calcFrequency", 1, labelMinMax::ge(1));
// Leave trigger intact // Leave trigger intact

View File

@ -30,8 +30,10 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
This functionObject provides a simple interface for explicit coupling with Provides a simple file-based communication interface for explicit coupling
an external application. with an external application, so that data is transferred to- and from
OpenFOAM. The data exchange employs specialised boundary conditions to
provide either one-way or two-way coupling models.
The coupling is through plain text files where OpenFOAM boundary data The coupling is through plain text files where OpenFOAM boundary data
is read/written as one line per face (data from all processors collated): is read/written as one line per face (data from all processors collated):
@ -43,27 +45,28 @@ Description
<fld1> <fld2> .. <fldn> //faceN <fld1> <fld2> .. <fldn> //faceN
\endverbatim \endverbatim
where the actual entries depend on the bc type: where the actual entries depend on the boundary condition type:
- mixed: value, snGrad, refValue, refGrad, valueFraction - mixed: value, snGrad, refValue, refGrad, valueFraction
- externalCoupledMixed: output of writeDataMaster - externalCoupledMixed: output of writeDataMaster
- other: value, snGrad - other: value, snGrad
These text files are located in a user specified communications directory These text files are located in a user specified communications directory
which gets read/written on the master processor only. In the which gets read/written on the master processor only.
communications directory the structure will be
In the communications directory the structure will be:
\verbatim \verbatim
<regionsName>/<patchGroup>/<fieldName>.[in|out] <regionsName>/<patchGroup>/<fieldName>.[in|out]
\endverbatim \endverbatim
(where regionsName is either the name of a single region or a composite (where \c regionsName is either the name of a single region or a composite
of multiple region names) of multiple region names)
At start-up, the boundary creates a lock file, i.e.. At start-up, the boundary creates a lock file, i.e.:
\verbatim \verbatim
OpenFOAM.lock OpenFOAM.lock
\endverbatim \endverbatim
... to signal the external source to wait. During the functionObject ... to signal the external source to wait. During the function object
execution the boundary values are written to files (one per region, execution the boundary values are written to files (one per region,
per patch(group), per field), e.g. per patch(group), per field), e.g.
\verbatim \verbatim
@ -77,21 +80,19 @@ Description
<regionsName>/<patchGroup>/<fieldName>.in <regionsName>/<patchGroup>/<fieldName>.in
\endverbatim \endverbatim
... and then reinstate the lock file. The functionObject will then ... and then reinstate the lock file. The function object will then
read these values, apply them to the boundary conditions and pass read these values, apply them to the boundary conditions and pass
program execution back to OpenFOAM. program execution back to OpenFOAM.
Usage Usage
Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
externalCoupled externalCoupled1
{ {
// Mandatory entries (unmodifiable)
type externalCoupled; type externalCoupled;
... libs (fieldFunctionObjects);
log yes;
commsDir "<case>/comms"; commsDir "<case>/comms";
initByExternal yes;
statusDone done; // Any arbitrary status=... value
regions regions
{ {
"(region1|region0)" // Name of region(s) "(region1|region0)" // Name of region(s)
@ -103,6 +104,16 @@ Usage
} }
} }
} }
initByExternal true;
// Optional entries (runtime modifiable)
waitInterval 1;
timeOut 100;
statusDone done; // Any arbitrary status=... value
calcFrequency 1;
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
@ -126,17 +137,30 @@ Usage
The entries comprise: The entries comprise:
\table \table
Property | Description | Required | Default Property | Description | Type | Req'd | Dflt
type | Type name: externalCoupled | yes | type | Type name: externalCoupled | word | yes | -
commsDir | Communication directory | yes | libs | Library name: fieldFunctionObjects | word | yes | -
waitInterval | wait interval in (s) | no | 1 commsDir | Communication directory | word | yes | -
timeOut | timeout in (s) | no | 100*waitInterval regions | The regions to couple | word | yes | -
statusDone | Lockfile status=... on termination | no | done initByExternal | Initialization values supplied by external app <!--
initByExternal | Initialization values supplied by external app | yes --> | bool | yes | -
calcFrequency | Calculation frequency | no | 1 waitInterval | Wait interval in [s] | label | no | 1
regions | The regions to couple | yes | timeOut | Timeout in [s] | label | no | 100*waitInterval
statusDone | Lockfile status=... on termination | word | no | done
calcFrequency | Calculation frequency | label | no | 1
\endtable \endtable
The inherited entries are elaborated in:
- \link timeFunctionObject.H \endlink
Usage by the \c postProcess utility is not available.
See also
- Foam::functionObject
- Foam::functionObjects::timeFunctionObject
- Foam::externalFileCouple
- ExtendedCodeGuide::functionObjects::field::externalCoupled
SourceFiles SourceFiles
externalCoupled.C externalCoupled.C
externalCoupledTemplates.C externalCoupledTemplates.C
@ -267,12 +291,6 @@ class externalCoupled
//- Perform the coupling with necessary initialization etc. //- Perform the coupling with necessary initialization etc.
void performCoupling(); void performCoupling();
//- No copy construct
externalCoupled(const externalCoupled&) = delete;
//- No copy assignment
void operator=(const externalCoupled&) = delete;
public: public:
@ -296,6 +314,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
externalCoupled(const externalCoupled&) = delete;
//- No copy assignment
void operator=(const externalCoupled&) = delete;
//- Destructor //- Destructor
virtual ~externalCoupled() = default; virtual ~externalCoupled() = default;
@ -339,7 +363,7 @@ public:
// Other // Other
//- Create single name by appending words (in sorted order), //- Create single name by appending words (in sorted order),
// separated by '_' //- separated by '_'
static word compositeName(const wordList&); static word compositeName(const wordList&);
//- Write geometry for the group as region/patch //- Write geometry for the group as region/patch

View File

@ -95,7 +95,7 @@ Usage
Property | Description | Required | Default Property | Description | Required | Default
outputTemperature | Output temperature: fluid/wall | yes | outputTemperature | Output temperature: fluid/wall | yes |
htcRefTemperature | Fluid temperature for htc: cell/user | no | cell htcRefTemperature | Fluid temperature for htc: cell/user | no | cell
Tref | Reference temperature [K] for htc | partly | Tref | Reference temperature [K] for htc | conditional |
\endtable \endtable
SeeAlso SeeAlso

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2017 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "externalCoupled.H" #include "externalCoupled.H"
//#include "fvMesh.H"
#include "OSspecific.H" #include "OSspecific.H"
#include "Fstream.H" #include "Fstream.H"
#include "volFields.H" #include "volFields.H"

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -44,7 +44,6 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(extractEulerianParticles, 0); defineTypeNameAndDebug(extractEulerianParticles, 0);
addToRunTimeSelectionTable addToRunTimeSelectionTable
( (
functionObject, functionObject,
@ -272,7 +271,7 @@ void Foam::functionObjects::extractEulerianParticles::collectParticle
{ {
if (Pstream::master()) if (Pstream::master())
{ {
const scalar d = cbrt(6*p.V/constant::mathematical::pi); const scalar d = cbrt(6.0*p.V/constant::mathematical::pi);
const point position = p.VC/(p.V + ROOTVSMALL); const point position = p.VC/(p.V + ROOTVSMALL);
const vector U = p.VU/(p.V + ROOTVSMALL); const vector U = p.VU/(p.V + ROOTVSMALL);
label tag = -1; label tag = -1;

View File

@ -30,41 +30,80 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Generates particle size information from Eulerian calculations, e.g. VoF. Generates particle size information from Eulerian calculations, e.g. \c VoF.
Operands:
\table
Operand | Type | Location
input | - | -
output file | - | -
output field 1 | scalarField | $OUTPUT/d
output field 2 | scalarField | $OUTPUT/soi
output field 3 | labelField | $OUTPUT/tag
output field 4 | vectorField | $OUTPUT/U
\endtable
where \c $OUTPUT=$FOAM_CASE/\<time\>/lagrangian/eulerianParticleCloud.
Usage Usage
Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
extractEulerianParticles1 extractEulerianParticles1
{ {
// Mandatory entries (unmodifiable)
type extractEulerianParticles; type extractEulerianParticles;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
...
// Mandatory entries (runtime modifiable)
faceZone f0; faceZone f0;
nLocations 10;
alpha alpha.water; alpha alpha.water;
// Optional entries (runtime modifiable)
alphaThreshold 0.1;
nLocations 0;
U U; U U;
rho rho; rho rho;
phi phi; phi phi;
minDiameter 1e-30;
maxDiameter 1e30;
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: extractEulerianParticles | yes | type | Type name: extractEulerianParticles | word | yes | -
faceZone | Name of faceZone used as collection surface | yes | libs | Library name: fieldFunctionObjects | word | yes | -
alpha | Name of phase indicator field | yes | faceZone | Name of faceZone used as collection surface | word | yes | -
alphaThreshold | Threshold for alpha field | no | 0.1 | alpha | Name of phase indicator field | word | yes | -
nLocations | Number of injection bins to generate | no | 0 | alphaThreshold | Threshold for alpha field | scalar | no | 0.1
U | Name of velocity field | no | U | nLocations | Number of injection bins to generate | label | no | 0
rho | Name of density field | no | rho | U | Name of velocity field | word | no | U
phi | Name of flux field | no | phi | rho | Name of density field | word | no | rho
minDiameter | min diameter | no | small | phi | Name of flux field | word | no | phi
maxDiameter | max diameter | no | great | minDiameter | Minimum diameter | scalar | no | SMALL
maxDiameter | Maximum diameter | scalar | no | GREAT
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link writeFile.H \endlink
Usage by the \c postProcess utility is not available.
See also
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- Foam::eulerianParticle
- ExtendedCodeGuide::functionObjects::field::extractEulerianParticles
SourceFiles SourceFiles
extractEulerianParticles.C extractEulerianParticles.C
extractEulerianParticlesTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -95,10 +134,9 @@ class extractEulerianParticles
public fvMeshFunctionObject, public fvMeshFunctionObject,
public writeFile public writeFile
{ {
protected: protected:
// Protected data // Protected Data
//- Storage for collected particles //- Storage for collected particles
injectedParticleCloud cloud_; injectedParticleCloud cloud_;
@ -236,12 +274,6 @@ protected:
const label globalFaceI const label globalFaceI
) const; ) const;
//- No copy construct
extractEulerianParticles(const extractEulerianParticles&) = delete;
//- No copy assignment
void operator=(const extractEulerianParticles&) = delete;
public: public:
@ -261,6 +293,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
extractEulerianParticles(const extractEulerianParticles&) = delete;
//- No copy assignment
void operator=(const extractEulerianParticles&) = delete;
//- Destructor //- Destructor
virtual ~extractEulerianParticles() = default; virtual ~extractEulerianParticles() = default;

View File

@ -31,11 +31,9 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates average quantities for a user-specified selection of volumetric Computes ensemble- and/or time-based field averages, with optional
and surface fields. windowing, for a user-specified selection of volumetric and/or surface
With the %subRegion option, also supports fields on functionObject fields.
surface output (eg, sampledSurfaces).
Fields are entered as a list of sub-dictionaries, which indicate the type of Fields are entered as a list of sub-dictionaries, which indicate the type of
averages to perform, and can be updated during the calculation. The current averages to perform, and can be updated during the calculation. The current
@ -49,18 +47,19 @@ Description
\overline{x'}^2 = \frac{1}{N}\displaystyle\sum\limits_{i=0}^N \overline{x'}^2 = \frac{1}{N}\displaystyle\sum\limits_{i=0}^N
(x_i - \overline{x})^2 (x_i - \overline{x})^2
\f] \f]
- \c base: average over 'time', or 'iteration' (\f$N\f$ in the above) - \c base: average over 'time', or 'iteration' (\c N in the above)
- \c window: optional averaging window, specified in 'base' units - \c window: optional averaging window, specified in 'base' units
Average field names are constructed by concatenating the base field with Average field names are constructed by concatenating the base field with
the averaging type, e.g. when averaging field 'U', the resultant fields the averaging type, e.g. when averaging field 'U', the name of resultant
are: fields becomes:
- arithmetic mean field, \c UMean - arithmetic mean field, \c UMean
- prime-squared field, \c UPrime2Mean - prime-squared field, \c UPrime2Mean
Information regarding the number of averaging steps, and total averaging Information regarding the number of averaging steps, and total averaging
time are written on a per-field basis to the time are written on a per-field basis to the
\c "<functionObject name>Properties" dictionary, located in \<time\>/uniform \c "<functionObject name>Properties" dictionary,
located in \c \<time\>/uniform.
When restarting form a previous calculation, the averaging is continuous or When restarting form a previous calculation, the averaging is continuous or
may be restarted using the \c restartOnRestart option. may be restarted using the \c restartOnRestart option.
@ -70,61 +69,84 @@ Description
periodicRestart option and setting \c restartPeriod to the required periodicRestart option and setting \c restartPeriod to the required
averaging period. averaging period.
With the \c subRegion option, also supports fields on function object
surface output (e.g., \c sampledSurfaces).
Operands:
\table
Operand | Type | Location
input | {vol,surface}\<Type\>Field(s) <!--
--> |$FOAM_CASE/\<time\>/\<inpField\>s
output file | - | -
output field | {vol,surface}\<Type\>Field(s) <!--
--> | $FOAM_CASE/\<time\>/\<outField\>s
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Usage Usage
Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
fieldAverage1 fieldAverage1
{ {
// Mandatory entries (unmodifiable)
type fieldAverage; type fieldAverage;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
writeControl writeTime; // Mandatory entries (runtime modifiable)
fields
(
<field1>
{
// Optional (inherited) entries
...
}
...
<fieldN>
{
...
}
);
// Optional entries (runtime modifiable)
restartOnRestart false; restartOnRestart false;
restartOnOutput false; restartOnOutput false;
periodicRestart false; periodicRestart false;
restartPeriod 0.002; restartPeriod 0.002;
fields // Optional (inherited) entries
( ...
U
{
mean on;
prime2Mean on;
base time;
windowType exact;
window 10.0;
windowName w1;
}
p
{
mean on;
prime2Mean on;
base time;
}
);
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default Property | Description | Type | Req'd | Dflt
type | Type name: fieldAverage | yes | type | Type name: fieldAverage | word | yes | -
restartOnRestart| Restart the averaging on restart | no | no libs | Library name: fieldFunctionObjects | word | yes | -
restartOnOutput | Restart the averaging on output | no | no fields | Names of the operand fields and averaging options <!--
periodicRestart | Periodically restart the averaging | no | no --> | dict | yes | -
restartPeriod | Periodic restart period | conditional | restartOnRestart| Restart the averaging on restart | bool | no | false
restartTime | One-shot reset of the averaging | no | great restartOnOutput | Restart the averaging on output | bool | no | false
fields | list of fields and averaging options | yes | periodicRestart | Periodically restart the averaging | bool | no | false
subRegion | Name for alternative objectRegistry | no | "" restartPeriod | Periodic restart period | scalar | conditional | -
restartTime | One-shot reset of the averaging | scalar | no | GREAT
subRegion | Name for alternative objectRegistry | word | no | ""
\endtable \endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldAverageItem.H \endlink
Note Usage by the \c postProcess utility is not available.
To employ the \c prime2Mean option, the \c mean option must be selected.
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
Foam::functionObject - Foam::functionObjects::fieldAverageItem
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::fieldAverage
SourceFiles SourceFiles
fieldAverage.C fieldAverage.C
@ -159,7 +181,7 @@ class fieldAverage
{ {
protected: protected:
// Protected data // Protected Data
//- Time at last call, prevents repeated averaging //- Time at last call, prevents repeated averaging
label prevTimeIndex_; label prevTimeIndex_;
@ -279,13 +301,6 @@ protected:
void readAveragingProperties(); void readAveragingProperties();
//- No copy construct
fieldAverage(const fieldAverage&) = delete;
//- No copy assignment
void operator=(const fieldAverage&) = delete;
public: public:
//- Runtime type information //- Runtime type information
@ -302,6 +317,12 @@ public:
const dictionary& const dictionary&
); );
//- No copy construct
fieldAverage(const fieldAverage&) = delete;
//- No copy assignment
void operator=(const fieldAverage&) = delete;
//- Destructor //- Destructor
virtual ~fieldAverage() = default; virtual ~fieldAverage() = default;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,9 +29,11 @@ Class
Description Description
Helper class to describe what form of averaging to apply. A set will be Helper class to describe what form of averaging to apply. A set will be
applied to each base field in Foam::fieldAverage, of the form: applied to each base field in Foam::fieldAverage, of the following form.
Usage
\verbatim \verbatim
<field1>
{ {
mean on; mean on;
prime2Mean on; prime2Mean on;
@ -44,14 +46,33 @@ Description
} }
\endverbatim \endverbatim
The averaging window corresponds to the averaging interval (iters or time) where the entries mean:
If not specified, the averaging is over 'all iters/time' \table
Property | Description | Type | Req'd | Dflt
mean | Flag to calculate average | bool | yes | -
prime2Mean | Flag to calculate prime-square average | bool | yes | -
base | Type of averaging interval | word | yes | -
window | Averaging window | scalar | no |
windowName | Name of the averaging window | word | no | ""
windowType | Type of averaging window | word | no |
allowRestart | Flag to allow restart for windowType=exact | bool | no |
\endtable
Available window types: Options for the \c base entry:
- \c none : no windowing \verbatim
- \c exact : exact windowing - additional files will be stored and written time | Averaging interval is based on time
- \c approximate : approximate variant that does not store/write additional iter | Averaging interval is based on iterations
fields \endverbatim
Options for the \c windowType entry:
\verbatim
none | no windowing
exact | allow additional files will be stored and written
approximate | disallow additional files will be stored and written
\endverbatim
Note
To employ the \c prime2Mean option, the \c mean option must be enabled.
SourceFiles SourceFiles
fieldAverageItem.C fieldAverageItem.C
@ -92,7 +113,7 @@ class fieldAverageItem
{ {
public: public:
// Public data // Public Data
// File and field name extensions // File and field name extensions
@ -121,7 +142,7 @@ public:
private: private:
// Private data // Private Data
//- Active flag //- Active flag
bool active_; bool active_;

View File

@ -73,7 +73,11 @@ Foam::Istream& Foam::functionObjects::operator>>
faItem.mean_ = dict.get<bool>("mean"); faItem.mean_ = dict.get<bool>("mean");
faItem.prime2Mean_ = dict.get<bool>("prime2Mean"); faItem.prime2Mean_ = dict.get<bool>("prime2Mean");
faItem.base_ = faItem.baseTypeNames_.get("base", dict); faItem.base_ = faItem.baseTypeNames_.get("base", dict);
<<<<<<< HEAD
faItem.window_ = dict.getOrDefault<scalar>("window", -1); faItem.window_ = dict.getOrDefault<scalar>("window", -1);
=======
faItem.window_ = dict.getOrDefault<scalar>("window", -1.0);
>>>>>>> DOC: elaborate the usage of function objects
if (faItem.window_ > 0) if (faItem.window_ > 0)
{ {

View File

@ -36,7 +36,6 @@ namespace Foam
namespace functionObjects namespace functionObjects
{ {
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0); defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
addToRunTimeSelectionTable addToRunTimeSelectionTable
( (
functionObject, functionObject,

View File

@ -32,19 +32,31 @@ Group
Description Description
Transforms a user-specified selection of fields from global Cartesian Transforms a user-specified selection of fields from global Cartesian
coordinates to a local coordinate system. coordinates to a local user-specified coordinate system.
The fields are run-time modifiable.
Operands:
\table
Operand | Type | Location
input | {vol,surface}\<Type\>Field(s) <!--
--> | $FOAM_CASE/\<time\>/\<inpField\>s
output file | - | -
output field | {vol,surface}\<Type\>Field(s) <!--
--> | $FOAM_CASE/\<time\>/\<outField\>s
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
fieldCoordinateSystemTransform1 fieldCoordinateSystemTransform1
{ {
// Mandatory entries (unmodifiable)
type fieldCoordinateSystemTransform; type fieldCoordinateSystemTransform;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
...
fields ( U UMean UPrime2Mean );
// Mandatory entries (runtime modifiable)
fields ( U UMean UPrime2Mean );
coordinateSystem coordinateSystem
{ {
origin (0.001 0 0); origin (0.001 0 0);
@ -55,20 +67,31 @@ Usage
e3 (0 0 -1); e3 (0 0 -1);
} }
} }
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: fieldCoordinateSystemTransform | yes | type | Type name: fieldCoordinateSystemTransform | word | yes | -
fields | list of fields to be transformed | yes | libs | Library name: fieldFunctionObjects | word | yes | -
coordinateSystem | local coordinate system | yes | fields | Names of the operand fields | wordList | yes | -
\endtable coordinateSystem | Local coordinate system | dict | yes | -
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link coordinateSystem.H \endlink
Usage by the \c postProcess utility is not available.
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
Foam::coordinateSystem - Foam::functionObjects::fvMeshFunctionObject
- Foam::coordinateSystem
- ExtendedCodeGuide::functionObjects::field::fieldCoordinateSystemTransform
SourceFiles SourceFiles
fieldCoordinateSystemTransform.C fieldCoordinateSystemTransform.C
@ -162,6 +185,13 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
fieldCoordinateSystemTransform(const fieldCoordinateSystemTransform&)
= delete;
//- No copy assignment
void operator=(const fieldCoordinateSystemTransform&) = delete;
//- Destructor //- Destructor
virtual ~fieldCoordinateSystemTransform() = default; virtual ~fieldCoordinateSystemTransform() = default;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,13 +31,38 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Base class for field expression function objects Intermediate class for handling field expression function objects
(e.g. \c blendingFactor etc.) whereinto a single field is input.
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
<userDefinedSubDictName1>
{
// Mandatory and other optional entries
...
// Optional (inherited) entries (runtime modifiable)
field <field>;
result <fieldResult>;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
field | Name of the operand field | word | yes | -
result | Name of the output field | word | no | \<FO\>(\<field\>)
\endtable
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::fieldExpression
SourceFiles SourceFiles
fieldExpression.C fieldExpression.C
fieldExpressionTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -75,19 +100,16 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Calculate the components of the field and return true if successful
virtual bool calc() = 0; virtual bool calc() = 0;
//- Set the name of result field
void setResultName(const word& typeName, const word& defaultArg); void setResultName(const word& typeName, const word& defaultArg);
//- Return true if required objects are found
template<class Type> template<class Type>
bool foundObject(const word& name, const bool verbose = true) const; bool foundObject(const word& name, const bool verbose = true) const;
//- No copy construct
fieldExpression(const fieldExpression&) = delete;
//- No copy assignment
void operator=(const fieldExpression&) = delete;
public: public:
@ -107,6 +129,12 @@ public:
const word& resultName = word::null const word& resultName = word::null
); );
//- No copy construct
fieldExpression(const fieldExpression&) = delete;
//- No copy assignment
void operator=(const fieldExpression&) = delete;
//- Destructor //- Destructor
virtual ~fieldExpression() = default; virtual ~fieldExpression() = default;

View File

@ -126,10 +126,10 @@ bool Foam::functionObjects::fieldExtents::read(const dictionary& dict)
{ {
if (fvMeshFunctionObject::read(dict) && writeFile::read(dict)) if (fvMeshFunctionObject::read(dict) && writeFile::read(dict))
{ {
threshold_ = dict.get<scalar>("threshold");
dict.readIfPresent<bool>("internalField", internalField_); dict.readIfPresent<bool>("internalField", internalField_);
threshold_ = dict.get<scalar>("threshold");
dict.readIfPresent<vector>("referencePosition", C0_); dict.readIfPresent<vector>("referencePosition", C0_);
patchIDs_.clear(); patchIDs_.clear();

View File

@ -30,52 +30,72 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates the spatial minimum and maximum extents of a field Computes the spatial minimum and maximum extents of an input field.
The extents are derived from the bound box limits after identifying the The extents are derived from the bound box limits after identifying the
locations where field values exceed the user-supplied threshold value. locations where field values exceed the user-supplied threshold value.
Operands:
\table
Operand | Type | Location
input | - | -
output file | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | - | -
\endtable
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
fieldExtents1 fieldExtents1
{ {
// Mandatory entries (unmodifiable)
type fieldExtents; type fieldExtents;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
...
writeToFile yes; // Mandatory entries (runtime modifiable)
log yes; fields (<field1> <field2> ... <fieldN>);
fields (alpha);
threshold 0.5; threshold 0.5;
patches ();
// Optional entries (runtime modifiable)
internalField true;
referencePosition (0 0 0);
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: fieldExtents | yes | type | Type name: fieldExtents | word | yes | -
writeToFile | write extents data to file | no | yes libs | Library name: fieldFunctionObjects | word | yes | -
log | write extents data to standard output | no | yes threshold | Value to identify extents boundary | scalar | yes | -
internalField | Process the internal field | no | yes fields | List of operand fields | wordList | yes | -
threshold | Field value to identify extents boundary | yes | internalField | Flag to process the internal field | bool | no | true
referencePosition | Reference position | no | (0 0 0) referencePosition | Reference position | vector | no | (0 0 0)
fields | list of fields to process | yes | patches | List of patches to process | wordList | no | \<all patches\>
patches | list of patches to process | no | \<all patches\>
\endtable \endtable
Output data is written to the file \<timeDir\>/fieldExtents.dat The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link writeFile.H \endlink
Usage by the \c postProcess utility is not available.
Note Note
For non-scalar fields, the magnitude of the field is employed and compared For non-scalar fields, the magnitude of the field is employed and compared
to the threshold value. to the value of \c threshold.
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
Foam::functionObjects::writeFile - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::fieldExtents
SourceFiles SourceFiles
fieldExtents.C fieldExtents.C
fieldExtentsTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -102,9 +122,10 @@ class fieldExtents
public fvMeshFunctionObject, public fvMeshFunctionObject,
public writeFile public writeFile
{ {
protected: protected:
// Protected data // Protected Data
//- Flag to write the internal field extents //- Flag to write the internal field extents
bool internalField_; bool internalField_;
@ -112,7 +133,7 @@ protected:
//- Threshold value //- Threshold value
scalar threshold_; scalar threshold_;
//- Reference position; default = (0 0 0) //- Reference position
point C0_; point C0_;
//- Fields to assess //- Fields to assess
@ -142,12 +163,6 @@ protected:
const bool calcMag = false const bool calcMag = false
); );
//- No copy construct
fieldExtents(const fieldExtents&) = delete;
//- No copy assignment
void operator=(const fieldExtents&) = delete;
public: public:
@ -165,6 +180,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
fieldExtents(const fieldExtents&) = delete;
//- No copy assignment
void operator=(const fieldExtents&) = delete;
//- Destructor //- Destructor
virtual ~fieldExtents() = default; virtual ~fieldExtents() = default;

View File

@ -31,45 +31,66 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Calculates the value and location of scalar minimum and maximum for a list Computes the values and locations of field minima and maxima.
of user-specified fields. These are good indicators of calculation performance, e.g. to confirm that
predicted results are within expected bounds, or how well a case is
converging.
For variables with a rank greater than zero, either the min/max of a Multiple fields can be processed, where for rank > 0 primitives, e.g.
component value or the magnitude is reported. When operating in parallel, vectors and tensors, the extrema can be calculated per component, or by
the processor owning the value is also given. magnitude. In addition, spatial location and local processor index are
included in the output.
Operands:
\table
Operand | Type | Location
input | - | -
output file | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | - | -
\endtable
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
fieldMinMax1 fieldMinMax1
{ {
// Mandatory entries (unmodifiable)
type fieldMinMax; type fieldMinMax;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
...
writeToFile yes; // Mandatory entries (runtime modifiable)
log yes;
location yes;
mode magnitude; mode magnitude;
fields (U p); fields (<field1> <field2> ... <fieldN>);
// Optional entries (runtime modifiable)
location true;
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: fieldMinMax | yes | type | Type name: fieldMinMax | word | yes | -
writeToFile | write min/max data to file | no | yes libs | Library name: fieldFunctionObjects | word | yes | -
log | write min/max data to standard output | no | yes fields | List of operand fields | wordList | yes | -
location | write location of the min/max value | no | yes location | Write location of the min/max value | bool | no | true
mode | calculation mode: magnitude or component | no | magnitude mode | Calculation mode: magnitude or component | word | no | magnitude
fields | list of fields to process | yes |
\endtable \endtable
Output data is written to the file \<timeDir\>/fieldMinMax.dat The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link writeFile.H \endlink
Usage by the \c postProcess utility is not available.
See also See also
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObject
Foam::functionObjects::writeFile - Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::fieldMinMax
SourceFiles SourceFiles
fieldMinMax.C fieldMinMax.C
@ -103,9 +124,10 @@ class fieldMinMax
public fvMeshFunctionObject, public fvMeshFunctionObject,
public writeFile public writeFile
{ {
public: public:
// Public enumerations // Public Enumerations
enum modeType enum modeType
{ {
@ -116,12 +138,12 @@ public:
protected: protected:
// Protected data // Protected Data
//- Mode type names //- Mode type names
static const Enum<modeType> modeTypeNames_; static const Enum<modeType> modeTypeNames_;
//- Write location of min/max values? //- Flag to write location of min/max values
bool location_; bool location_;
//- Mode for min/max - only applicable for ranks > 0 //- Mode for min/max - only applicable for ranks > 0
@ -153,12 +175,6 @@ protected:
//- Output file header information //- Output file header information
virtual void writeFileHeader(Ostream& os); virtual void writeFileHeader(Ostream& os);
//- No copy construct
fieldMinMax(const fieldMinMax&) = delete;
//- No copy assignment
void operator=(const fieldMinMax&) = delete;
//- Calculate the field min/max for a given field type //- Calculate the field min/max for a given field type
template<class Type> template<class Type>
void calcMinMaxFieldType void calcMinMaxFieldType
@ -192,6 +208,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
fieldMinMax(const fieldMinMax&) = delete;
//- No copy assignment
void operator=(const fieldMinMax&) = delete;
//- Destructor //- Destructor
virtual ~fieldMinMax() = default; virtual ~fieldMinMax() = default;

View File

@ -54,11 +54,11 @@ Foam::functionObjects::fieldValue::fieldValue
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name, valueType, dict), writeFile(obr_, name, valueType, dict),
writeFields_(false),
regionName_(word::null),
scaleFactor_(1.0), scaleFactor_(1.0),
dict_(dict), dict_(dict),
regionName_(word::null), fields_()
fields_(),
writeFields_(false)
{ {
read(dict); read(dict);
} }
@ -74,22 +74,16 @@ Foam::functionObjects::fieldValue::fieldValue
: :
fvMeshFunctionObject(name, obr, dict), fvMeshFunctionObject(name, obr, dict),
writeFile(obr_, name, valueType, dict), writeFile(obr_, name, valueType, dict),
writeFields_(false),
regionName_(word::null),
scaleFactor_(1.0), scaleFactor_(1.0),
dict_(dict), dict_(dict),
regionName_(word::null), fields_()
fields_(),
writeFields_(false)
{ {
read(dict); read(dict);
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValue::~fieldValue()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldValue::read(const dictionary& dict) bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
@ -102,9 +96,9 @@ bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
fvMeshFunctionObject::read(dict); fvMeshFunctionObject::read(dict);
writeFile::read(dict); writeFile::read(dict);
dict.readEntry("fields", fields_);
dict.readEntry("writeFields", writeFields_); dict.readEntry("writeFields", writeFields_);
scaleFactor_ = dict.getOrDefault<scalar>("scaleFactor", 1); scaleFactor_ = dict.getOrDefault<scalar>("scaleFactor", 1.0);
dict.readEntry("fields", fields_);
return true; return true;
} }

View File

@ -31,15 +31,46 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Base class for field value-based function objects. Intermediate class for handling field value-based function objects.
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
<userDefinedSubDictName1>
{
// Mandatory and other optional entries
...
// Mandatory (inherited) entries (runtime modifiable)
fields (<field1> <field2> ... <fieldN>);
// Optional (inherited) entries (runtime modifiable)
writeFields false;
scaleFactor 1.0;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
fields | Names of operand fields | wordList | yes | -
writeFields | Flag to output field values | bool | no | false
scaleFactor | Scaling factor | scalar | no | 1.0
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link writeFile.H \endlink
See also See also
Foam::functionObject - Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject - Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile - Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::fieldValue
SourceFiles SourceFiles
fieldValue.C fieldValue.C
fieldValueTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -70,23 +101,23 @@ class fieldValue
protected: protected:
// Protected data // Protected Data
//- Optional scaling factor //- Flag to output field values
bool writeFields_;
//- Name of region (patch, zone, etc.)
word regionName_;
//- Scaling factor
scalar scaleFactor_; scalar scaleFactor_;
//- Construction dictionary //- Construction dictionary
dictionary dict_; dictionary dict_;
//- Name of region (patch, zone, etc.) //- Names of operand fields
word regionName_;
//- List of field names to operate on
wordList fields_; wordList fields_;
//- Output field values flag
bool writeFields_;
// Protected Member Functions // Protected Member Functions
@ -151,7 +182,7 @@ public:
//- Destructor //- Destructor
virtual ~fieldValue(); virtual ~fieldValue() = default;
// Member Functions // Member Functions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2017 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -112,12 +112,6 @@ Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::fieldValueDelta::~fieldValueDelta()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldValues::fieldValueDelta::read bool Foam::functionObjects::fieldValues::fieldValueDelta::read

View File

@ -31,20 +31,22 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Provides an operation between two 'field value' function objects. Computes a selected operation between two \c fieldValue function objects.
The operation is applied to all results of each fieldValue object. The operation is applied to all results of each \c fieldValue object.
Accordingly, each object must generate the same number and type of results. Accordingly, each object must generate the same number and type of results.
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
fieldValueDelta1 fieldValueDelta1
{ {
// Mandatory entries (unmodifiable)
type fieldValueDelta; type fieldValueDelta;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
operation subtract;
// Mandatory entries (runtime modifiable)
operation subtract;
region1 region1
{ {
... ...
@ -53,16 +55,23 @@ Usage
{ {
... ...
} }
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | type name: fieldValueDelta | yes | type | Type name: fieldValueDelta | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
operation | Operation type to apply to values | word | yes | -
region1 | Region1 properties | dict | yes | -
region2 | Region2 properties | dict | yes | -
\endtable \endtable
The \c operation is one of: Options for the \c operation entry:
\plaintable \plaintable
add | add add | add
subtract | subtract subtract | subtract
@ -71,14 +80,19 @@ Usage
average | average average | average
\endplaintable \endplaintable
The inherited entries are elaborated in:
- \link fieldValue.H \endlink
Usage by the \c postProcess utility is not available.
See also See also
Foam::functionObject - Foam::functionObject
Foam::functionObjects::fieldValue - Foam::functionObjects::fieldValue
Foam::functionObjects::regionFunctionObject - ExtendedCodeGuide::functionObjects::field::fieldValueDelta
Foam::functionObjects::writeFile
SourceFiles SourceFiles
fieldValueDelta.C fieldValueDelta.C
fieldValueDeltaTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -125,7 +139,7 @@ public:
private: private:
// Private data // Private Data
//- Operation to apply to values //- Operation to apply to values
operationType operation_; operationType operation_;
@ -176,9 +190,15 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
fieldValueDelta(const fieldValueDelta&) = delete;
//- No copy assignment
void operator=(const fieldValueDelta&) = delete;
//- Destructor //- Destructor
virtual ~fieldValueDelta(); virtual ~fieldValueDelta() = default;
// Public Member Functions // Public Member Functions

View File

@ -31,71 +31,86 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Provides a 'face regionType' variant of the fieldValues function object. Provides a 'face regionType' variant of the \c fieldValues function object.
Given a list of user-specified fields and a selection of mesh (or general Given a list of user-specified fields and a selection of mesh (or general
surface) faces, a number of operations can be performed, such as sums, surface) faces, a number of operations can be performed, such as sums,
averages and integrations. averages and integrations.
For example, to calculate the volumetric or mass flux across a patch, For example, to calculate the volumetric or mass flux across a patch,
apply the 'sum' operator to the flux field (typically \c phi) apply the 'sum' operator to the flux field (typically \c phi).
Usage Usage
Examples of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
movingWallPatch surfaceFieldValuePatch1
{ {
// Mandatory entries (unmodifiable)
type surfaceFieldValue; type surfaceFieldValue;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
log true; // Mandatory entries (runtime modifiable)
writeControl writeTime; fields (<field1> <field2> ... <fieldN>);
writeFields false; operation <operationType>;
regionType patch; regionType patch;
name movingWall; name <patch>;
operation areaAverage; // Optional entries (runtime modifiable)
fields (p phi U); postOperation none;
weightField alpha1;
scaleFactor 1.0;
writeArea false;
surfaceFormat none;
// Optional (inherited) entries
...
} }
surfaceFieldValue1 surfaceFieldValueFaceZone1
{ {
// Mandatory entries (unmodifiable)
type surfaceFieldValue; type surfaceFieldValue;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
log true; // Mandatory entries (runtime modifiable)
writeControl writeTime; fields (<field1> <field2> ... <fieldN>);
writeFields true; operation <operationType>;
surfaceFormat none;
regionType faceZone; regionType faceZone;
name f0; name <faceZone>;
operation sum; // Optional entries (runtime modifiable)
postOperation none;
weightField alpha1; weightField alpha1;
fields (p phi U); scaleFactor 1.0;
writeArea false;
surfaceFormat none;
// Optional (inherited) entries
...
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default Property | Description | Type | Req'd | Dflt
type | Type name: surfaceFieldValue | yes | type | Type name: surfaceFieldValue | word | yes | -
log | Write data to standard output | no | no libs | Library name: fieldFunctionObjects | word | yes | -
regionType | Face regionType: see below | yes | fields | Names of operand fields | wordList | yes | -
name | Name for regionType | yes | regionType | Face regionType: see below | word | yes | -
operation | Operation to perform | yes | name | Name for regionType | word | yes | -
postOperation | Post-operation to perform | no | none operation | Operation type: see below | word | yes | -
fields | List of fields to operate on | yes | postOperation | Post-operation type: see below | word | no | none
weightField | Name of field to apply weighting | no | weightField | Name of field to apply weighting | word | no | none
scaleFactor | Output value scaling factor | no | 1 scaleFactor | Output value scaling factor | scalar | no | 1.0
writeArea | Write the surface area | no | writeArea | Write the surface area | bool | no | false
writeFields | Write the region field values | yes | surfaceFormat | Output value format | word <!--
surfaceFormat | Output value format | no | none --> | conditional on writeFields | none
\endtable \endtable
Where \c regionType is defined by The inherited entries are elaborated in:
- \link fieldValue.H \endlink
Options for the \c regionType entry:
\plaintable \plaintable
faceZone | The \b name entry to specify the faceZone faceZone | The \b name entry to specify the faceZone
patch | The \b name entry to specify the patch patch | The \b name entry to specify the patch
@ -103,7 +118,7 @@ Usage
sampledSurface | A \b sampledSurfaceDict sub-dictionary and \b name sampledSurface | A \b sampledSurfaceDict sub-dictionary and \b name
\endplaintable \endplaintable
The \c operation is one of: Options for the \c operation entry:
\plaintable \plaintable
none | no operation none | no operation
min | minimum min | minimum
@ -131,20 +146,22 @@ Usage
absWeightedUniformity | uniformity index using absolute weighting absWeightedUniformity | uniformity index using absolute weighting
\endplaintable \endplaintable
The \c postOperation is one of: Options for the \c postOperation entry:
\plaintable \plaintable
none | No additional operation after calculation none | No additional operation after calculation
mag | Component-wise \c mag() after normal operation mag | Component-wise \c mag() after normal operation
sqrt | Component-wise \c sqrt() after normal operation sqrt | Component-wise \c sqrt() after normal operation
\endplaintable \endplaintable
Usage by the \c postProcess utility is not available.
Note Note
- The values reported by the areaNormalAverage and areaNormalIntegrate - The values reported by the \c areaNormalAverage and \c areaNormalIntegrate
operations are written as the first component of a field with the same operations are written as the first component of a field with the same
rank as the input field. rank as the input field.
- Faces on empty patches get ignored - Faces on empty patches get ignored.
- If the field is a volField the \c faceZone can only consist of boundary - If the field is a volField the \c faceZone
faces can only consist of boundary faces.
- Using \c functionObjectSurface: - Using \c functionObjectSurface:
- The keyword %subRegion should not be used to select surfaces. - The keyword %subRegion should not be used to select surfaces.
Instead specify the regionType 'functionObjectSurface' and provide Instead specify the regionType 'functionObjectSurface' and provide
@ -159,7 +176,7 @@ Note
- take care when using isoSurfaces - these might have duplicate - take care when using isoSurfaces - these might have duplicate
triangles and so integration might be wrong triangles and so integration might be wrong
Uniformity Uniformity:
\f[ \f[
UI(\phi) = 1 - \frac{1}{2 \overline{\phi} A} UI(\phi) = 1 - \frac{1}{2 \overline{\phi} A}
\int{\left| W \phi \cdot \hat{n} - \bar{W} \bar{\phi}\right| d\vec{A}} \int{\left| W \phi \cdot \hat{n} - \bar{W} \bar{\phi}\right| d\vec{A}}
@ -171,12 +188,13 @@ Note
\f$ \phi = \vec{U} \f$. \f$ \phi = \vec{U} \f$.
A scalar concentration uniformity index is calculated with either A scalar concentration uniformity index is calculated with either
\f$ \rho \vec{U} \f$ or \f$ \vec{U} \f$ for weighting and \f$ \rho \vec U \f$ or \f$ \vec U \f$ for weighting and
\f$ \phi = conc \f$. \f$ \phi = conc \f$.
See also See also
Foam::fieldValues - Foam::functionObject
Foam::functionObject - Foam::functionObjects::fieldValues::fieldValue
- ExtendedCodeGuide::functionObjects::field::surfaceFieldValue
SourceFiles SourceFiles
surfaceFieldValue.C surfaceFieldValue.C
@ -556,6 +574,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
surfaceFieldValue(const surfaceFieldValue&) = delete;
//- No copy assignment
void operator=(const surfaceFieldValue&) = delete;
//- Destructor //- Destructor
virtual ~surfaceFieldValue() = default; virtual ~surfaceFieldValue() = default;

View File

@ -31,58 +31,58 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Provides a 'volRegion' specialization of the fieldValue function object. Provides a 'volRegion' specialization of the \c fieldValue function object.
Given a list of user-specified fields and a 'volRegion', a number of Given a list of user-specified fields and a 'volRegion', a number of
operations can be performed, such as sums, averages and integrations. operations can be performed, such as sums, averages and integrations.
Usage Usage
Example of function object specification: Minimal example by using \c system/controlDict.functions:
\verbatim \verbatim
volFieldValue1 volFieldValue1
{ {
// Mandatory entries (unmodifiable)
type volFieldValue; type volFieldValue;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
log true; // Mandatory entries (runtime modifiable)
writeControl writeTime; fields (<field1> <field2> ... <fieldN>);
writeFields true; operation <operationType>;
regionType <volRegion>;
regionType cellZone;
name c0;
operation volAverage;
// Optional entries (runtime modifiable)
postOperation none;
weightField alpha1; weightField alpha1;
fields // Optional (inherited) entries
( ...
p
U
);
} }
\endverbatim \endverbatim
Where the entries comprise: where the entries mean:
\table \table
Property | Description | Required | Default value Property | Description | Type | Req'd | Dflt
type | Type name: volFieldValue | yes | type | Type name: volFieldValue | word | yes | -
log | Write data to standard output | no | no libs | Library name: fieldFunctionObjects | word | yes | -
writeFields | Write the region field values | yes | fields | Names of operand fields | wordList | yes | -
regionType | volRegion type: see below | yes | regionType | Face regionType: see below | word | yes | -
name | Name of volRegion if required | no | name | Name for regionType | word | yes | -
operation | Operation to perform | yes | operation | Operation type: see below | word | yes | -
postOperation | Post-operation to perform | no | none postOperation | Post-operation type: see below | word | no | none
weightField | Name of field to apply weighting | no | weightField | Name of field to apply weighting | word | no | none
fields | List of fields to operate on | yes |
\endtable \endtable
Where \c regionType is defined by The inherited entries are elaborated in:
- \link fieldValue.H \endlink
- \link volRegion.H \endlink
Options for the \c regionType entry:
\plaintable \plaintable
cellZone | requires a 'name' entry to specify the cellZone cellZone | requires a 'name' entry to specify the cellZone
all | all cells all | all cells
\endplaintable \endplaintable
The \c operation is one of: Options for the \c operation entry:
\plaintable \plaintable
none | No operation none | No operation
min | Minimum min | Minimum
@ -99,20 +99,23 @@ Usage
weightedVolIntegrate | Weighted volume integral weightedVolIntegrate | Weighted volume integral
\endplaintable \endplaintable
The \c postOperation is one of: Options for the \c postOperation entry:
\plaintable \plaintable
none | No additional operation after calculation none | No additional operation after calculation
mag | Component-wise \c mag() after normal operation mag | Component-wise \c mag() after normal operation
sqrt | Component-wise \c sqrt() after normal operation sqrt | Component-wise \c sqrt() after normal operation
\endplaintable \endplaintable
Usage by the \c postProcess utility is not available.
See also See also
Foam::functionObjects::fieldValues::fieldValue - Foam::functionObject
Foam::functionObjects::volRegion - Foam::functionObjects::fieldValues::fieldValue
Foam::functionObject - Foam::functionObjects::volRegion
SourceFiles SourceFiles
volFieldValue.C volFieldValue.C
volFieldValueTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -271,10 +274,10 @@ protected:
template<class Type> template<class Type>
tmp<Field<Type>> filterField(const Field<Type>& field) const; tmp<Field<Type>> filterField(const Field<Type>& field) const;
//- Output file header information //- Output file header information
virtual void writeFileHeader(Ostream& os) const; virtual void writeFileHeader(Ostream& os) const;
public: public:
//- Declare type-name, virtual type (with debug switch) //- Declare type-name, virtual type (with debug switch)
@ -299,6 +302,12 @@ public:
const dictionary& dict const dictionary& dict
); );
//- No copy construct
volFieldValue(const volFieldValue&) = delete;
//- No copy assignment
void operator=(const volFieldValue&) = delete;
//- Destructor //- Destructor
virtual ~volFieldValue() = default; virtual ~volFieldValue() = default;

Some files were not shown because too many files have changed in this diff Show More