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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) YEAR YEAR AUTHOR,AFFILIATION
Copyright (C) YEAR AUTHOR, AFFILIATION
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,34 +27,120 @@ Class
Foam::functionObjects::FUNCTIONOBJECT
Group
grpFieldFunctionObjects
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
FUNCTIONOBJECT1
{
// Mandatory entries (unmodifiable)
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
Usage
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: FUNCTIONOBJECT | yes |
wordData | some word option... | no | defaultWord
scalarData | some scalar value... | yes |
labelData | some label value... | yes |
Property | Description | Type | Req'd | Dflt
type | Type name: FUNCTIONOBJECT | word | yes | -
libs | Library name: FUNCTIONOBJECTFunctionObject <!--
--> | word | yes | -
boolData | <explanation> | bool | yes | -
labelData | <explanation> | label | yes | -
wordData | <explanation> | word | yes | -
scalarData | <explanation> | scalar | no | 1.0
wordListData | <explanation> | wordList | yes | -
\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
FUNCTIONOBJECT.C
FUNCTIONOBJECTTEMPLATES.C
...
\*---------------------------------------------------------------------------*/
@ -78,7 +164,13 @@ class FUNCTIONOBJECT
:
public fvMeshFunctionObject
{
// Private data
// Private Data
//- bool
bool boolData_;
//- label
label labelData_;
//- word
word wordData_;
@ -86,19 +178,6 @@ class FUNCTIONOBJECT
//- scalar
scalar scalarData_;
//- label
label labelData_;
// Private Member Functions
//- No copy construct
FUNCTIONOBJECT(const FUNCTIONOBJECT&);
//- No copy assignment
void operator=(const FUNCTIONOBJECT&);
public:
@ -116,9 +195,15 @@ public:
const dictionary& dict
);
//- No copy construct
FUNCTIONOBJECT(const FUNCTIONOBJECT&) = delete;
//- No copy assignment
void operator=(const FUNCTIONOBJECT&) = delete;
//- Destructor
virtual ~FUNCTIONOBJECT();
virtual ~FUNCTIONOBJECT() = default;
// Member Functions

View File

@ -28,52 +28,88 @@ Namespace
Foam::functionObjects
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
run-time to manipulate the simulation and provide mechanisms to extract
field and derived quantities. Alternatively, the same actions can be
executed after the simulation using the \c -postProcess command-line option.
Function objects eliminate the need to store all runtime generated data,
hence saving considerable resources. Furthermore, function objects are
readily applied to batch-driven processes, improving reliability by
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
FunctionObjects are selected by additional entries in the global case
system/controlDict dictionary. Each object is listed in the \c
functions sub-dictionary, e.g. to select the \c functionObjectType
functionObject the following entry would be specified:
Function objects can be executed by using two methods:
- \c functions sub-dictionary in the \c system/controlDict file
- \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
functions
functions // sub-dictionary name under the system/controlDict file
{
<functionObjectName>
<userDefinedSubDictName1>
{
type functionObjectType;
libs (myFunctionObjectLib);
region defaultRegion;
enabled yes;
// Mandatory entries
type <functionObjectTypeName>;
libs (<libType>FunctionObjects);
// Mandatory entries defined in <functionObjectType>
...
// Optional entries defined in <functionObjectType>
...
// Optional (inherited) entries
region region0;
enabled true;
log true;
timeStart 0;
timeEnd 10;
writeControl writeTime;
timeEnd 1000;
executeControl timeStep;
executeInterval 1;
writeControl timeStep;
writeInterval 1;
}
<userDefinedSubDictName2>
{
...
}
...
<userDefinedSubDictNameN>
{
...
}
}
\endverbatim
Where:
where the entries mean:
\table
Property | Description | Required | Default
type | Type of function object | yes |
libs | Libraries containing implementation | yes |
region | Name of region for multi-region cases | no |
enabled | On/off switch | no | yes
log | Log information to standard output | no | yes
timeStart| Start time | no |
timeEnd | End time | no |
executeControl | See time controls below | no | timeStep
executeInterval | Steps/time between execute phases | no | 1
writeControl | See time controls below | no | timeStep
writeInterval | Steps/time between write phases | no | 1
Property | Description | Type | Req'd | Dflt
type | Type name of function object | word | yes | -
libs | Library name containing implementation | word | yes | -
region | Name of region for multi-region cases | word | no | region0
enabled | Switch to turn function object on/off | bool | no | true
log | Switch to write log info to standard output | bool | no | true
timeStart | Start time for function object execution | scalar | no | 0
timeEnd | End time for function object execution | scalar | no | inf
executeControl | See time controls below | word | no | timeStep
executeInterval | Steps/time between execute phases | label | no | 1
writeControl | See time controls below | word | no | timeStep
writeInterval | Steps/time between write phases | label | no | 1
\endtable
Time controls:
@ -86,15 +122,17 @@ Description
adjustableRunTime | Currently identical to "runTime"
clockTime | Trigger every 'Interval' clock time period
cpuTime | Trigger every 'Interval' CPU time period
onEnd | Trigger on end of run
onEnd | Trigger on end of simulation run
\endtable
The sub-dictionary name \c \<functionObjectName\> is chosen by the user, and
is typically used as the name of the output directory for any data written
by the functionObject. The \c type entry defines the type of function
object properties that follow. FunctionObjects are packaged into separate
libraries and the \c libs entry is used to specify which library should be
loaded.
The sub-dictionary name \c <userDefinedSubDictName> is chosen by the user,
and is typically used as the name of the output directory for any data
written by the function object.
As the base mandatory entries, the \c type entry defines the type of
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:
@ -104,6 +142,36 @@ Description
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
Foam::functionObject
@ -111,8 +179,8 @@ Description
Abstract base-class for Time/database function objects.
See also
Foam::functionObjectList
Foam::functionObjects::timeControl
- Foam::functionObjectList
- Foam::functionObjects::timeControl
SourceFiles
functionObject.C
@ -142,7 +210,7 @@ class mapPolyMesh;
class functionObject
{
// Private data
// Private Data
//- Name
const word name_;
@ -164,6 +232,7 @@ public:
//- Runtime type information
virtual const word& type() const = 0;
//- Flag to execute debug content
static int debug;
//- Global post-processing mode switch
@ -172,7 +241,7 @@ public:
//- Directory prefix
static word outputPrefix;
//- Switch write log to Info
//- Flag to write log into Info
bool log;

View File

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

View File

@ -34,7 +34,7 @@ Description
Note: cannot access the state dictionary until after construction of the
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.
See also

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,11 +28,34 @@ Class
Foam::functionObjects::writeFile
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
Foam::functionObject
Foam::functionObjects::logFiles
- Foam::functionObject
- Foam::functionObjects::logFiles
SourceFiles
writeFile.C

View File

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

View File

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

View File

@ -39,13 +39,7 @@ namespace Foam
namespace functionObjects
{
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 * * * * * * * * * * * * * //
bool Foam::functionObjects::CourantNo::read(const dictionary& dict)

View File

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

View File

@ -39,13 +39,7 @@ namespace Foam
namespace functionObjects
{
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
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
// of the patch face centres

View File

@ -30,54 +30,71 @@ Group
grpFieldFunctionObjects
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:
\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]
where
\vartable
p' | Curle's acoustic pressure [Pa] or [Pa (m3/rho)]
c_0 | Reference speed of sound [m/s]
\vec d | Distance vector to observer locations [m]
F | Force [N] or [N (m3/rho)]
p' | Curle's acoustic pressure [Pa] or [Pa \f$(m^3/\rho)\f$]
c_0 | Reference speed of sound [m/s]
\vec d | Distance vector to observer locations [m]
\vec F | Force [N] or [N (\f$m^3/\rho\f$)]
\endvartable
Note
Only the normal-pressure force is included in the force calculation
Operands:
\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
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
Curle1
{
type Curle;
libs (fieldFunctionObjects);
// Mandatory entries (unmodifiable)
type Curle;
libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
patches (<patch1> <patch2> ... <patchN>)
c0 343;
// Optional (inherited) entries
...
patches (surface1 surface2);
c0 330;
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | Type name: Curle | yes |
field | Pressure field name | no | p
result | Acoustic pressure field name | no | Curle
patches | Sound generation patch names | yes |
c0 | Reference speed of sound | yes |
Property | Description | Type | Req'd | Dflt
type | Type name: Curle | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
patches | Names of the operand patches | wordList | yes | -
c0 | Reference speed of sound [m/s] | scalar | yes | -
\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
- Foam::functionObjects::fieldExpression
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::Curle
SourceFiles
Curle.C
@ -122,6 +139,7 @@ class Curle
protected:
<<<<<<< HEAD
// Protected Member Functions
//- Calculate acoustic pressure field and return true if successful
@ -133,6 +151,11 @@ protected:
//- No copy assignment
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:
@ -150,6 +173,12 @@ public:
const dictionary& dict
);
//- No copy construct
Curle(const Curle&) = delete;
//- No copy assignment
void operator=(const Curle&) = delete;
//- Destructor
virtual ~Curle() = default;

View File

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

View File

@ -31,33 +31,62 @@ Group
grpFieldFunctionObjects
Description
This function object writes out an indicator field for DES turbulence
calculations, that is:
- 0 for RAS regions
- 1 for LES regions
Computes an indicator field for detached eddy simulation (DES) turbulence
calculations, where the values of the indicator mean:
The field is stored on the mesh database so that it can be retrieved and
used for other applications.
\verbatim
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
Example of function object specification to generate DES indicator field:
Minimal example by using \c system/controlDict.functions:
\verbatim
DESModelRegions1
{
// Mandatory entries (unmodifiable)
type DESModelRegions;
libs (fieldFunctionObjects);
// Optional entries (runtime modifiable)
result DESField;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: DESModelRegions| yes |
resultName | Name of DES indicator field | no | \<function name\>
log | log to standard output | no | yes
Property | Description | Type | Req'd | Dflt
type | Type name: DESModelRegions | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
result | Name of DES indicator field | word | no | <FO>
\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
DESModelRegions.C
@ -89,9 +118,9 @@ class DESModelRegions
{
protected:
// Protected data
// Protected Data
//- Result name
//- Name of DES indicator field
word resultName_;
@ -100,12 +129,6 @@ protected:
//- File header information
virtual void writeFileHeader(Ostream& os) const;
//- No copy construct
DESModelRegions(const DESModelRegions&) = delete;
//- No copy assignment
void operator=(const DESModelRegions&) = delete;
public:
@ -114,6 +137,7 @@ public:
// Constructors
//- Construct from Time and dictionary
DESModelRegions
(
@ -122,9 +146,15 @@ public:
const dictionary& dict
);
//- No copy construct
DESModelRegions(const DESModelRegions&) = delete;
//- No copy assignment
void operator=(const DESModelRegions&) = delete;
//- Destructor
virtual ~DESModelRegions();
virtual ~DESModelRegions() = default;
// Member Functions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "lambVector.H"
#include "LambVector.H"
#include "fvcCurl.H"
#include "fvcDiv.H"
#include "addToRunTimeSelectionTable.H"
@ -36,14 +36,14 @@ namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(lambVector, 0);
addToRunTimeSelectionTable(functionObject, lambVector, dictionary);
defineTypeNameAndDebug(LambVector, 0);
addToRunTimeSelectionTable(functionObject, LambVector, dictionary);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::functionObjects::lambVector::calc()
bool Foam::functionObjects::LambVector::calc()
{
if (foundObject<volVectorField>(fieldName_))
{
@ -57,7 +57,7 @@ bool Foam::functionObjects::lambVector::calc()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::lambVector::lambVector
Foam::functionObjects::LambVector::LambVector
(
const word& name,
const Time& runTime,
@ -66,7 +66,8 @@ Foam::functionObjects::lambVector::lambVector
:
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/>.
Class
Foam::functionObjects::lambVector
Foam::functionObjects::LambVector
Group
grpFieldFunctionObjects
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
'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
and used for other applications.
The motivation of the function object is the literature-reported
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
Minimal example by using \c system/controlDict.functions:
\verbatim
lambVector1
LambVector1
{
type lambVector;
libs (fieldFunctionObjects);
field UMean;
... Base options of fieldExpression ...
// Mandatory entries (unmodifiable)
type LambVector;
libs (fieldFunctionObjects);
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | Type name: lambVector | yes |
field | Name of volVectorField | no | U
Property | Description | Type | Req'd | Dflt
type | Type name: LambVector | 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 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
Foam::functionObjects::fieldExpression
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::LambVector
SourceFiles
lambVector.C
LambVector.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_lambVector_H
#define functionObjects_lambVector_H
#ifndef functionObjects_LambVector_H
#define functionObjects_LambVector_H
#include "fieldExpression.H"
@ -76,38 +108,44 @@ namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class lambVector Declaration
Class LambVector Declaration
\*---------------------------------------------------------------------------*/
class lambVector
class LambVector
:
public fieldExpression
{
// Private Member Functions
//- Calculate the lambVector field and return true if successful
//- Calculate the LambVector field and return true if successful
virtual bool calc();
public:
//- Runtime type information
TypeName("lambVector");
TypeName("LambVector");
// Constructors
//- Construct from Time and dictionary
lambVector
LambVector
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- No copy construct
LambVector(const LambVector&) = delete;
//- No copy assignment
void operator=(const LambVector&) = delete;
//- Destructor
virtual ~lambVector() = default;
virtual ~LambVector() = default;
};

View File

@ -37,13 +37,7 @@ namespace Foam
namespace functionObjects
{
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 |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,13 +31,52 @@ Group
grpFieldFunctionObjects
Description
Calculates and outputs the second largest eigenvalue of the sum of the
square of the symmetrical and anti-symmetrical parts of the velocity
gradient tensor.
Computes the second largest eigenvalue of the sum of the square of
the symmetrical and anti-symmetrical parts of the velocity 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
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::Lambda2
SourceFiles
Lambda2.C
@ -85,9 +125,15 @@ public:
const dictionary& dict
);
//- No copy construct
Lambda2(const Lambda2&) = delete;
//- No copy assignment
void operator=(const Lambda2&) = delete;
//- Destructor
virtual ~Lambda2();
virtual ~Lambda2() = default;
};

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,13 +37,7 @@ namespace Foam
namespace functionObjects
{
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 |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,11 +31,51 @@ Group
grpFieldFunctionObjects
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
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::MachNo
SourceFiles
MachNo.C
@ -84,9 +125,15 @@ public:
const dictionary& dict
);
//- No copy construct
MachNo(const MachNo&) = delete;
//- No copy assignment
void operator=(const MachNo&) = delete;
//- Destructor
virtual ~MachNo();
virtual ~MachNo() = default;
};

View File

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

View File

@ -38,13 +38,7 @@ namespace Foam
namespace functionObjects
{
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 * * * * * * * * * * * * * //
bool Foam::functionObjects::PecletNo::read(const dictionary& dict)

View File

@ -31,29 +31,56 @@ Group
grpFieldFunctionObjects
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
Example of function object specification to calculate the Peclet number:
Minimal example by using \c system/controlDict.functions:
\verbatim
PecletNo1
{
type PecletNo;
libs (fieldFunctionObjects);
// Mandatory entries (unmodifiable)
type PecletNo;
libs (fieldFunctionObjects);
// Optional entries (runtime modifiable)
rho rho;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: Peclet | yes |
phi | Name of flux field | no | phi
rho | Name of density field | no | rho
result | Name of Peclet field | no | \<function name\>
log | Log to standard output | no | yes
Property | Description | Type | Req'd | Dflt
type | Type name: PecletNo | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
rho | Name of density field | word | no | rho
\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
PecletNo.C
@ -80,9 +107,9 @@ class PecletNo
:
public fieldExpression
{
// Private data
// Private Data
//- Name of density field, default is "rho"
//- Name of density field
word rhoName_;
@ -111,9 +138,15 @@ public:
const dictionary& dict
);
//- No copy construct
PecletNo(const PecletNo&) = delete;
//- No copy assignment
void operator=(const PecletNo&) = delete;
//- Destructor
virtual ~PecletNo();
virtual ~PecletNo() = default;
// Member Functions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,13 +37,7 @@ namespace Foam
namespace functionObjects
{
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
Description
Calculates and outputs the second invariant of the velocity gradient tensor
[1/s^2].
Computes the second invariant of
the velocity gradient tensor \f$[s^{-2}]\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]
where
\vartable
U | velocity [m/s]
\vec U | velocity [m/s]
\endvartable
Operands:
\table
Operand | Type | Location
input | volVectorField | $FOAM_CASE/<time>/<inpField>
output file | - | -
output field | volScalarField | $FOAM_CASE/<time>/<outField>
\endtable
Usage
Example of function object specification to calculate Q:
Minimal example by using \c system/controlDict.functions:
\verbatim
Q1
{
// Mandatory entries (unmodifiable)
type Q;
libs (fieldFunctionObjects);
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: Q | yes |
U | Name of velocity field | no | U
result | Name of Q field | no | \<function name\>
log | Log to standard output | no | yes
Property | Description | Type | Req'd | Dflt
type | Type name: Q | 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 Q
\endverbatim
See also
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fieldExpression
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::Q
SourceFiles
Q.C
@ -114,9 +136,15 @@ public:
const dictionary& dict
);
//- No copy construct
Q(const Q&) = delete;
//- No copy assignment
void operator=(const Q&) = delete;
//- Destructor
virtual ~Q();
virtual ~Q() = default;
};

View File

@ -46,57 +46,58 @@ Description
References:
\verbatim
STDMD and mode-sorting algorithms (tags:K, HRDC, KZ, HWR):
Kiewat, M. (2019).
Streaming modal decomposition approaches for vehicle aerodynamics.
PhD thesis. Munich: Technical University of Munich.
URL:mediatum.ub.tum.de/doc/1482652/1482652.pdf
STDMD and mode-sorting algorithms (tags:K, HRDC, KZ, HWR):
Kiewat, M. (2019).
Streaming modal decomposition approaches for vehicle aerodynamics.
PhD thesis. Munich: Technical University of Munich.
URL:mediatum.ub.tum.de/doc/1482652/1482652.pdf
Hemati, M. S., Rowley, C. W., Deem, E. A., & Cattafesta, L. N. (2017).
De-biasing the dynamic mode decomposition for applied Koopman
spectral analysis of noisy datasets.
Theoretical and Computational Fluid Dynamics, 31(4), 349-368.
DOI:10.1007/s00162-017-0432-2
Hemati, M. S., Rowley, C. W.,
Deem, E. A., & Cattafesta, L. N. (2017).
De-biasing the dynamic mode decomposition
for applied Koopman spectral analysis of noisy datasets.
Theoretical and Computational Fluid Dynamics, 31(4), 349-368.
DOI:10.1007/s00162-017-0432-2
Kou, J., & Zhang, W. (2017).
An improved criterion to select dominant modes from dynamic mode
decomposition.
European Journal of Mechanics-B/Fluids, 62, 109-129.
DOI:10.1016/j.euromechflu.2016.11.015
Kou, J., & Zhang, W. (2017).
An improved criterion to select
dominant modes from dynamic mode decomposition.
European Journal of Mechanics-B/Fluids, 62, 109-129.
DOI:10.1016/j.euromechflu.2016.11.015
Hemati, M. S., Williams, M. O., & Rowley, C. W. (2014).
Dynamic mode decomposition for large and streaming datasets.
Physics of Fluids, 26(11), 111701.
DOI:10.1063/1.4901016
Hemati, M. S., Williams, M. O., & Rowley, C. W. (2014).
Dynamic mode decomposition for large and streaming datasets.
Physics of Fluids, 26(11), 111701.
DOI:10.1063/1.4901016
Parallel classical Gram-Schmidt process (tag:Ka):
Katagiri, T. (2003).
Performance evaluation of parallel Gram-Schmidt re-orthogonalization
methods.
In: Palma J. M. L. M., Sousa A. A., Dongarra J., Hernández V. (eds)
High Performance Computing for Computational Science — VECPAR 2002.
Lecture Notes in Computer Science, vol 2565, p. 302-314.
Berlin, Heidelberg: Springer.
DOI:10.1007/3-540-36569-9_19
Parallel classical Gram-Schmidt process (tag:Ka):
Katagiri, T. (2003).
Performance evaluation of parallel
Gram-Schmidt re-orthogonalization methods.
In: Palma J. M. L. M., Sousa A. A., Dongarra J., Hernández V. (eds)
High Performance Computing for Computational Science — VECPAR 2002.
Lecture Notes in Computer Science, vol 2565, p. 302-314.
Berlin, Heidelberg: Springer.
DOI:10.1007/3-540-36569-9_19
Parallel direct tall-skinny QR decomposition (tags:BGD, DGHL):
Benson, A. R., Gleich, D. F., & Demmel, J. (2013).
Direct QR factorizations for tall-and-skinny matrices in MapReduce
architectures.
2013 IEEE International Conference on Big Data.
DOI:10.1109/bigdata.2013.6691583
Parallel direct tall-skinny QR decomposition (tags:BGD, DGHL):
Benson, A. R., Gleich, D. F., & Demmel, J. (2013).
Direct QR factorizations for
tall-and-skinny matrices in MapReduce architectures.
2013 IEEE International Conference on Big Data.
DOI:10.1109/bigdata.2013.6691583
Demmel, J., Grigori, L., Hoemmen, M., & Langou, J. (2012).
Communication-optimal parallel and sequential QR and LU
factorizations.
SIAM Journal on Scientific Computing, 34(1), A206-A239.
DOI:10.1137/080731992
Demmel, J., Grigori, L., Hoemmen, M., & Langou, J. (2012).
Communication-optimal parallel
and sequential QR and LU factorizations.
SIAM Journal on Scientific Computing, 34(1), A206-A239.
DOI:10.1137/080731992
DMD properties:
Brunton S. L. (2018).
Dynamic mode decomposition overview.
Seattle, Washington: University of Washington.
youtu.be/sQvrK8AGCAo (Retrieved:24-04-20)
DMD properties:
Brunton S. L. (2018).
Dynamic mode decomposition overview.
Seattle, Washington: University of Washington.
youtu.be/sQvrK8AGCAo (Retrieved:24-04-20)
\endverbatim
Operands:
@ -109,7 +110,7 @@ Description
output field | volScalarField(s) | $FOAM_CASE/\<time\>/\<outField\>(s)
\endtable
where Type={Scalar,SphericalTensor,SymmTensor,Tensor}.
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Output fields:
\verbatim

View File

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

View File

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

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
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
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
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;
libs (fieldFunctionObjects);
fields (T Tdelta);
result Ttot;
executeControl writeTime;
writeControl writeTime;
// Mandatory (inherited) entry (runtime modifiable)
fields (<field1> <field2> ... <fieldN>);
// 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 | -
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
Foam::functionObjects::fieldsExpression
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fieldsExpression
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::add
SourceFiles
add.C
addTemplates.C
\*---------------------------------------------------------------------------*/
@ -81,7 +119,7 @@ class add
// Private Member Functions
//- Add the list of fields of the specified type
// and return the result
//- and return the result
template<class GeoFieldType>
tmp<GeoFieldType> calcFieldType() const;
@ -108,9 +146,15 @@ public:
const dictionary& dict
);
//- No copy construct
add(const add&) = delete;
//- No copy assignment
void operator=(const add&) = delete;
//- Destructor
virtual ~add();
virtual ~add() = default;
};

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,7 +38,7 @@ Foam::functionObjects::add::calcFieldType() const
+ 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]);
}

View File

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

View File

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

View File

@ -30,41 +30,66 @@ Group
grpFieldFunctionObjects
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
the patch face normal direction, and then pushes the average value back
to all cells in the column.
Useful for channel-like cases where we want to average fields in the
spanwise direction.
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
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
columnAverage1
{
type columnAverage;
libs (fieldFunctionObjects);
// Mandatory entries (unmodifiable)
type columnAverage;
libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
patches (<patch1> <patch2> ... <patchN>);
fields (<field1> <field2> ... <fieldN>);
// Optional (inherited) entries
...
patches (front side);
fields (U p);
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default
type | type name: columnAverage | yes |
patches | list of patches to collapse onto | yes |
fields | list of fields to process | yes |
Property | Description | Type | Req'd | Dflt
type | Type name: columnAverage | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
patches | Names of patches to collapse onto | word | yes | -
fields | Names of the operand fields | word | yes | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
Usage by the \c postProcess utility is not available.
See also
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::columnAverage
SourceFiles
columnAverage.C
columnAverageTemplates.C
\*---------------------------------------------------------------------------*/
@ -137,6 +162,12 @@ public:
const dictionary& dict
);
//- No copy construct
columnAverage(const columnAverage&) = delete;
//- No copy assignment
void operator=(const columnAverage&) = delete;
//- Destructor
virtual ~columnAverage() = default;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,16 +31,75 @@ Group
grpFieldFunctionObjects
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
volume or surface scalar fields for each component.
Depending on the base type of the input field, the number of output fields
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
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::components
SourceFiles
components.C
componentsTemplates.C
\*---------------------------------------------------------------------------*/
@ -64,7 +123,7 @@ class components
:
public fieldExpression
{
// Private member data
// Private Member Data
//- List of the component field names
wordList resultNames_;
@ -73,12 +132,12 @@ class components
// Private Member Functions
//- Calculate the components of the field with the specified type
// and register the result
//- and register the result
template<class GeoFieldType>
bool calcFieldComponents();
//- Calculate the components of the field with the specified
// element type and register the result
//- element type and register the result
template<class Type>
bool calcComponents();
@ -102,6 +161,12 @@ public:
const dictionary& dict
);
//- No copy construct
components(const components&) = delete;
//- No copy assignment
void operator=(const components&) = delete;
//- Destructor
virtual ~components() = default;

View File

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

View File

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

View File

@ -30,40 +30,78 @@ Group
grpFieldFunctionObjects
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
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
continuityError1
{
// Mandatory entries (unmodifiable)
type continuityError;
libs (fieldFunctionObjects);
...
writeToFile yes;
log yes;
// Optional entries (runtime modifiable)
phi phi;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: continuityError | yes |
writeToFile | write min/max data to file | no | yes
log | write min/max data to standard output | no | yes
phi | name of flux field | no | phi
Property | Description | Type | Req'd | Dflt
type | Type name: continuityError | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
phi | Name of flux field | word | no | phi
\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
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::continuityError
SourceFiles
continuityError.C
continuityErrorTemplates.C
\*---------------------------------------------------------------------------*/
@ -90,22 +128,11 @@ class continuityError
public fvMeshFunctionObject,
public writeFile
{
private:
// Private Member Functions
//- No copy construct
continuityError(const continuityError&) = delete;
//- No copy assignment
void operator=(const continuityError&) = delete;
protected:
// Protected data
// Protected Data
//- Name of the flux field; default = "phi
//- Name of flux field
word phiName_;
//- Cumulative error
@ -134,6 +161,12 @@ public:
const dictionary& dict
);
//- No copy construct
continuityError(const continuityError&) = delete;
//- No copy assignment
void operator=(const continuityError&) = delete;
//- Destructor
virtual ~continuityError() = default;

View File

@ -31,13 +31,58 @@ Group
grpFieldFunctionObjects
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
same type.
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
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
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::ddt
SourceFiles
ddt.C
@ -65,6 +110,7 @@ class ddt
:
public fieldExpression
{
// Private Member Functions
//- Calculate and store the result
@ -93,6 +139,12 @@ public:
const dictionary& dict
);
//- No copy construct
ddt(const ddt&) = delete;
//- No copy assignment
void operator=(const ddt&) = delete;
//- Destructor
virtual ~ddt() = default;

View File

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

View File

@ -30,37 +30,57 @@ Group
grpFieldFunctionObjects
Description
This function object calculates the magnitude squared
of d(scalarField)/dt.
Computes the magnitude or magnitude squared of the Eulerian time derivative
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
(for example).
The result can be further used for determining e.g. variance or RMS values.
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
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
dpdt2
ddt21
{
type ddt2;
libs (fieldFunctionObjects);
fields (p);
result d@@dt2;
// Mandatory entries (unmodifiable)
type ddt2;
libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
fields (<field1> <field2> ... <fieldN>);
// Optional entries (unmodifiable)
mag false;
// Optional entries (runtime modifiable)
result d@@dt2;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: ddt2 | yes |
fields | Name of fields to process | yes |
result | Name of results | no | magSqr(ddt(@@))
log | Log to standard output | no | yes
mag | Use 'mag' instead of 'magSqr' | no | false
Property | Description | Type | Req'd | Dflt
type | Type name: ddt2 | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
fields | Names of the operand fields | wordList | yes | -
mag | Compute 'mag' instead of 'magSqr' | bool | no | false
result | Name of results | word | no | magSqr(ddt2(@@))
\endtable
Note that the optional 'mag' entry cannot be changed during the simulation
since it alters the dimensions of the output field.
The inherited entries are elaborated in:
- \link functionObject.H \endlink
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
@ -70,6 +90,13 @@ Usage
The function object will skip over fields that appear to have
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
ddt2.C
ddt2Templates.C
@ -101,29 +128,29 @@ class ddt2
:
public fvMeshFunctionObject
{
// Private data
// Private Data
//- Name of fields to process.
//- Name of fields to process
wordRes selectFields_;
//- Formatting for the result fields.
//- Formatting for the result fields
word resultName_;
//- Avoid processing the same field twice.
//- Avoid processing the same field twice
mutable regExp blacklist_;
//- Hashed names of result fields.
//- Hashed names of result fields
wordHashSet results_;
//- Use 'mag' instead of 'magSqr'.
//- Flat to use 'mag' instead of 'magSqr'
// Cannot be adjusted during the simulation since it alters the
// dimensions of the output field.
// dimensions of the output field
const bool mag_;
// 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);
@ -134,17 +161,10 @@ class ddt2
template<class FieldType>
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);
//- No copy construct
ddt2(const ddt2&) = delete;
//- No copy assignment
void operator=(const ddt2&) = delete;
public:
//- Runtime type information
@ -161,6 +181,12 @@ public:
const dictionary& dict
);
//- No copy construct
ddt2(const ddt2&) = delete;
//- No copy assignment
void operator=(const ddt2&) = delete;
//- Destructor
virtual ~ddt2() = default;
@ -174,7 +200,7 @@ public:
//- Calculate the ddt2 fields
virtual bool execute();
//- Write the ddt fields
//- Write the ddt2 fields
virtual bool write();
};

View File

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

View File

@ -30,34 +30,60 @@ Group
grpFieldFunctionObjects
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
derived
derivedFields1
{
type derivedFields;
libs (fieldFunctionObjects);
// Mandatory entries (unmodifiable)
type derivedFields;
libs (fieldFunctionObjects);
fields (rhoU pTotal);
// Mandatory entries (runtime modifiable)
derived (rhoU pTotal);
// Optional: reference density for incompressible
rhoRef 1.25;
// Optional entries (runtime modifiable)
rhoRef 1.0;
// Optional (inherited) entries
...
}
\endverbatim
Entries:
where the entries mean:
\table
Property | Description | Required | Default
type | derivedFields | yes |
derived | Derived fields (pTotal/rhoU) | yes |
rhoRef | Reference density (incompressible) | no | 1
Property | Description | Type | Req'd | Dflt
type | Type name: derivedFields | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
derived | Names of operand fields (rhoU/pTotal) | word | yes | -
rhoRef | Reference density for incompressible flows | scalar | no | 1.0
\endtable
The known derived fields
\plaintable
rhoU | (rho * U)
pTotal | (p + 1/2 * rho * U)
\endplaintable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
Usage by the \c postProcess utility is not available.
See also
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::derivedFields
SourceFiles
derivedFields.C
@ -89,7 +115,7 @@ public:
// Public Enumerations
//- Derived/calculated field type
//- Options for the derived/calculated field type
enum derivedType
{
NONE = 0, //!< "none"
@ -98,7 +124,7 @@ public:
UNKNOWN
};
//- Known derived field types
//- Names for derivedType
static const Enum<derivedType> knownNames;
@ -113,7 +139,7 @@ protected:
scalar rhoRef_;
// Private Member Functions
// Protected Member Functions
//- Hard-coded derived field (rho * U)
// \return true if field did not previously exist
@ -140,6 +166,12 @@ public:
const dictionary& dict
);
//- No copy construct
derivedFields(const derivedFields&) = delete;
//- No copy assignment
void operator=(const derivedFields&) = delete;
//- Destructor
virtual ~derivedFields() = default;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
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 |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,15 +31,63 @@ Group
grpFieldFunctionObjects
Description
Calculates the divergence of a field. The operation is limited to
surfaceScalarFields and volVectorFields, and the output is a volScalarField.
Computes the divergence of an input field.
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
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::div
SourceFiles
div.C
divTemplates.C
\*---------------------------------------------------------------------------*/
@ -65,7 +114,7 @@ class div
// Private Member Functions
//- 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>
bool calcDiv();
@ -89,9 +138,15 @@ public:
const dictionary& dict
);
//- No copy construct
div(const div&) = delete;
//- No copy assignment
void operator=(const div&) = delete;
//- Destructor
virtual ~div();
virtual ~div() = default;
};

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,13 +37,7 @@ namespace Foam
namespace functionObjects
{
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 |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,11 +31,59 @@ Group
grpFieldFunctionObjects
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
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::enstrophy
SourceFiles
enstrophy.C
@ -83,9 +132,15 @@ public:
const dictionary& dict
);
//- No copy construct
enstrophy(const enstrophy&) = delete;
//- No copy assignment
void operator=(const enstrophy&) = delete;
//- Destructor
virtual ~enstrophy();
virtual ~enstrophy() = default;
};

View File

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

View File

@ -30,8 +30,10 @@ Group
grpFieldFunctionObjects
Description
This functionObject provides a simple interface for explicit coupling with
an external application.
Provides a simple file-based communication interface for explicit coupling
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
is read/written as one line per face (data from all processors collated):
@ -43,27 +45,28 @@ Description
<fld1> <fld2> .. <fldn> //faceN
\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
- externalCoupledMixed: output of writeDataMaster
- other: value, snGrad
These text files are located in a user specified communications directory
which gets read/written on the master processor only. In the
communications directory the structure will be
which gets read/written on the master processor only.
In the communications directory the structure will be:
\verbatim
<regionsName>/<patchGroup>/<fieldName>.[in|out]
\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)
At start-up, the boundary creates a lock file, i.e..
At start-up, the boundary creates a lock file, i.e.:
\verbatim
OpenFOAM.lock
\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,
per patch(group), per field), e.g.
\verbatim
@ -77,21 +80,19 @@ Description
<regionsName>/<patchGroup>/<fieldName>.in
\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
program execution back to OpenFOAM.
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
externalCoupled
externalCoupled1
{
// Mandatory entries (unmodifiable)
type externalCoupled;
...
log yes;
libs (fieldFunctionObjects);
commsDir "<case>/comms";
initByExternal yes;
statusDone done; // Any arbitrary status=... value
regions
{
"(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
@ -126,17 +137,30 @@ Usage
The entries comprise:
\table
Property | Description | Required | Default
type | Type name: externalCoupled | yes |
commsDir | Communication directory | yes |
waitInterval | wait interval in (s) | no | 1
timeOut | timeout in (s) | no | 100*waitInterval
statusDone | Lockfile status=... on termination | no | done
initByExternal | Initialization values supplied by external app | yes
calcFrequency | Calculation frequency | no | 1
regions | The regions to couple | yes |
Property | Description | Type | Req'd | Dflt
type | Type name: externalCoupled | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
commsDir | Communication directory | word | yes | -
regions | The regions to couple | word | yes | -
initByExternal | Initialization values supplied by external app <!--
--> | bool | yes | -
waitInterval | Wait interval in [s] | label | no | 1
timeOut | Timeout in [s] | label | no | 100*waitInterval
statusDone | Lockfile status=... on termination | word | no | done
calcFrequency | Calculation frequency | label | no | 1
\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
externalCoupled.C
externalCoupledTemplates.C
@ -267,12 +291,6 @@ class externalCoupled
//- Perform the coupling with necessary initialization etc.
void performCoupling();
//- No copy construct
externalCoupled(const externalCoupled&) = delete;
//- No copy assignment
void operator=(const externalCoupled&) = delete;
public:
@ -296,6 +314,12 @@ public:
const dictionary& dict
);
//- No copy construct
externalCoupled(const externalCoupled&) = delete;
//- No copy assignment
void operator=(const externalCoupled&) = delete;
//- Destructor
virtual ~externalCoupled() = default;
@ -339,7 +363,7 @@ public:
// Other
//- Create single name by appending words (in sorted order),
// separated by '_'
//- separated by '_'
static word compositeName(const wordList&);
//- Write geometry for the group as region/patch

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -44,7 +44,6 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(extractEulerianParticles, 0);
addToRunTimeSelectionTable
(
functionObject,
@ -272,7 +271,7 @@ void Foam::functionObjects::extractEulerianParticles::collectParticle
{
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 vector U = p.VU/(p.V + ROOTVSMALL);
label tag = -1;

View File

@ -30,41 +30,80 @@ Group
grpFieldFunctionObjects
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
Minimal example by using \c system/controlDict.functions:
\verbatim
extractEulerianParticles1
{
// Mandatory entries (unmodifiable)
type extractEulerianParticles;
libs (fieldFunctionObjects);
...
// Mandatory entries (runtime modifiable)
faceZone f0;
nLocations 10;
alpha alpha.water;
// Optional entries (runtime modifiable)
alphaThreshold 0.1;
nLocations 0;
U U;
rho rho;
phi phi;
minDiameter 1e-30;
maxDiameter 1e30;
// Optional (inherited) entries
...
}
\endverbatim
where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: extractEulerianParticles | yes |
faceZone | Name of faceZone used as collection surface | yes |
alpha | Name of phase indicator field | yes |
alphaThreshold | Threshold for alpha field | no | 0.1 |
nLocations | Number of injection bins to generate | no | 0 |
U | Name of velocity field | no | U |
rho | Name of density field | no | rho |
phi | Name of flux field | no | phi |
minDiameter | min diameter | no | small |
maxDiameter | max diameter | no | great |
Property | Description | Type | Req'd | Dflt
type | Type name: extractEulerianParticles | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
faceZone | Name of faceZone used as collection surface | word | yes | -
alpha | Name of phase indicator field | word | yes | -
alphaThreshold | Threshold for alpha field | scalar | no | 0.1
nLocations | Number of injection bins to generate | label | no | 0
U | Name of velocity field | word | no | U
rho | Name of density field | word | no | rho
phi | Name of flux field | word | no | phi
minDiameter | Minimum diameter | scalar | no | SMALL
maxDiameter | Maximum diameter | scalar | no | GREAT
\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
extractEulerianParticles.C
extractEulerianParticlesTemplates.C
\*---------------------------------------------------------------------------*/
@ -95,10 +134,9 @@ class extractEulerianParticles
public fvMeshFunctionObject,
public writeFile
{
protected:
// Protected data
// Protected Data
//- Storage for collected particles
injectedParticleCloud cloud_;
@ -236,12 +274,6 @@ protected:
const label globalFaceI
) const;
//- No copy construct
extractEulerianParticles(const extractEulerianParticles&) = delete;
//- No copy assignment
void operator=(const extractEulerianParticles&) = delete;
public:
@ -261,6 +293,12 @@ public:
const dictionary& dict
);
//- No copy construct
extractEulerianParticles(const extractEulerianParticles&) = delete;
//- No copy assignment
void operator=(const extractEulerianParticles&) = delete;
//- Destructor
virtual ~extractEulerianParticles() = default;

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,9 +29,11 @@ Class
Description
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
<field1>
{
mean on;
prime2Mean on;
@ -44,14 +46,33 @@ Description
}
\endverbatim
The averaging window corresponds to the averaging interval (iters or time)
If not specified, the averaging is over 'all iters/time'
where the entries mean:
\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:
- \c none : no windowing
- \c exact : exact windowing - additional files will be stored and written
- \c approximate : approximate variant that does not store/write additional
fields
Options for the \c base entry:
\verbatim
time | Averaging interval is based on time
iter | Averaging interval is based on iterations
\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
fieldAverageItem.C
@ -92,7 +113,7 @@ class fieldAverageItem
{
public:
// Public data
// Public Data
// File and field name extensions
@ -121,7 +142,7 @@ public:
private:
// Private data
// Private Data
//- Active flag
bool active_;

View File

@ -73,7 +73,11 @@ Foam::Istream& Foam::functionObjects::operator>>
faItem.mean_ = dict.get<bool>("mean");
faItem.prime2Mean_ = dict.get<bool>("prime2Mean");
faItem.base_ = faItem.baseTypeNames_.get("base", dict);
<<<<<<< HEAD
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)
{

View File

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

View File

@ -32,19 +32,31 @@ Group
Description
Transforms a user-specified selection of fields from global Cartesian
coordinates to a local coordinate system.
The fields are run-time modifiable.
coordinates to a local user-specified coordinate system.
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
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
fieldCoordinateSystemTransform1
{
// Mandatory entries (unmodifiable)
type fieldCoordinateSystemTransform;
libs (fieldFunctionObjects);
...
fields ( U UMean UPrime2Mean );
// Mandatory entries (runtime modifiable)
fields ( U UMean UPrime2Mean );
coordinateSystem
{
origin (0.001 0 0);
@ -55,20 +67,31 @@ Usage
e3 (0 0 -1);
}
}
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: fieldCoordinateSystemTransform | yes |
fields | list of fields to be transformed | yes |
coordinateSystem | local coordinate system | yes |
\endtable
Property | Description | Type | Req'd | Dflt
type | Type name: fieldCoordinateSystemTransform | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
fields | Names of the operand fields | wordList | yes | -
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
Foam::functionObjects::fvMeshFunctionObject
Foam::coordinateSystem
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::coordinateSystem
- ExtendedCodeGuide::functionObjects::field::fieldCoordinateSystemTransform
SourceFiles
fieldCoordinateSystemTransform.C
@ -162,6 +185,13 @@ public:
const dictionary& dict
);
//- No copy construct
fieldCoordinateSystemTransform(const fieldCoordinateSystemTransform&)
= delete;
//- No copy assignment
void operator=(const fieldCoordinateSystemTransform&) = delete;
//- Destructor
virtual ~fieldCoordinateSystemTransform() = default;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,13 +31,38 @@ Group
grpFieldFunctionObjects
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
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::fieldExpression
SourceFiles
fieldExpression.C
fieldExpressionTemplates.C
\*---------------------------------------------------------------------------*/
@ -75,19 +100,16 @@ protected:
// Protected Member Functions
//- Calculate the components of the field and return true if successful
virtual bool calc() = 0;
//- Set the name of result field
void setResultName(const word& typeName, const word& defaultArg);
//- Return true if required objects are found
template<class Type>
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:
@ -107,6 +129,12 @@ public:
const word& resultName = word::null
);
//- No copy construct
fieldExpression(const fieldExpression&) = delete;
//- No copy assignment
void operator=(const fieldExpression&) = delete;
//- Destructor
virtual ~fieldExpression() = default;

View File

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

View File

@ -30,52 +30,72 @@ Group
grpFieldFunctionObjects
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
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
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
fieldExtents1
{
type fieldExtents;
libs (fieldFunctionObjects);
// Mandatory entries (unmodifiable)
type fieldExtents;
libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
fields (<field1> <field2> ... <fieldN>);
threshold 0.5;
// Optional entries (runtime modifiable)
internalField true;
referencePosition (0 0 0);
// Optional (inherited) entries
...
writeToFile yes;
log yes;
fields (alpha);
threshold 0.5;
patches ();
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: fieldExtents | yes |
writeToFile | write extents data to file | no | yes
log | write extents data to standard output | no | yes
internalField | Process the internal field | no | yes
threshold | Field value to identify extents boundary | yes |
referencePosition | Reference position | no | (0 0 0)
fields | list of fields to process | yes |
patches | list of patches to process | no | \<all patches\>
Property | Description | Type | Req'd | Dflt
type | Type name: fieldExtents | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
threshold | Value to identify extents boundary | scalar | yes | -
fields | List of operand fields | wordList | yes | -
internalField | Flag to process the internal field | bool | no | true
referencePosition | Reference position | vector | no | (0 0 0)
patches | List of patches to process | wordList | no | \<all patches\>
\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
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
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::fieldExtents
SourceFiles
fieldExtents.C
fieldExtentsTemplates.C
\*---------------------------------------------------------------------------*/
@ -102,9 +122,10 @@ class fieldExtents
public fvMeshFunctionObject,
public writeFile
{
protected:
// Protected data
// Protected Data
//- Flag to write the internal field extents
bool internalField_;
@ -112,7 +133,7 @@ protected:
//- Threshold value
scalar threshold_;
//- Reference position; default = (0 0 0)
//- Reference position
point C0_;
//- Fields to assess
@ -142,12 +163,6 @@ protected:
const bool calcMag = false
);
//- No copy construct
fieldExtents(const fieldExtents&) = delete;
//- No copy assignment
void operator=(const fieldExtents&) = delete;
public:
@ -165,6 +180,12 @@ public:
const dictionary& dict
);
//- No copy construct
fieldExtents(const fieldExtents&) = delete;
//- No copy assignment
void operator=(const fieldExtents&) = delete;
//- Destructor
virtual ~fieldExtents() = default;

View File

@ -31,45 +31,66 @@ Group
grpFieldFunctionObjects
Description
Calculates the value and location of scalar minimum and maximum for a list
of user-specified fields.
Computes the values and locations of field minima and maxima.
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
component value or the magnitude is reported. When operating in parallel,
the processor owning the value is also given.
Multiple fields can be processed, where for rank > 0 primitives, e.g.
vectors and tensors, the extrema can be calculated per component, or by
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
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
fieldMinMax1
{
// Mandatory entries (unmodifiable)
type fieldMinMax;
libs (fieldFunctionObjects);
...
writeToFile yes;
log yes;
location yes;
// Mandatory entries (runtime modifiable)
mode magnitude;
fields (U p);
fields (<field1> <field2> ... <fieldN>);
// Optional entries (runtime modifiable)
location true;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: fieldMinMax | yes |
writeToFile | write min/max data to file | no | yes
log | write min/max data to standard output | no | yes
location | write location of the min/max value | no | yes
mode | calculation mode: magnitude or component | no | magnitude
fields | list of fields to process | yes |
Property | Description | Type | Req'd | Dflt
type | Type name: fieldMinMax | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
fields | List of operand fields | wordList | yes | -
location | Write location of the min/max value | bool | no | true
mode | Calculation mode: magnitude or component | word | no | magnitude
\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
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::fieldMinMax
SourceFiles
fieldMinMax.C
@ -103,9 +124,10 @@ class fieldMinMax
public fvMeshFunctionObject,
public writeFile
{
public:
// Public enumerations
// Public Enumerations
enum modeType
{
@ -116,12 +138,12 @@ public:
protected:
// Protected data
// Protected Data
//- Mode type names
static const Enum<modeType> modeTypeNames_;
//- Write location of min/max values?
//- Flag to write location of min/max values
bool location_;
//- Mode for min/max - only applicable for ranks > 0
@ -153,12 +175,6 @@ protected:
//- Output file header information
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
template<class Type>
void calcMinMaxFieldType
@ -192,6 +208,12 @@ public:
const dictionary& dict
);
//- No copy construct
fieldMinMax(const fieldMinMax&) = delete;
//- No copy assignment
void operator=(const fieldMinMax&) = delete;
//- Destructor
virtual ~fieldMinMax() = default;

View File

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

View File

@ -31,15 +31,46 @@ Group
grpFieldFunctionObjects
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
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::fieldValue
SourceFiles
fieldValue.C
fieldValueTemplates.C
\*---------------------------------------------------------------------------*/
@ -70,23 +101,23 @@ class fieldValue
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_;
//- Construction dictionary
dictionary dict_;
//- Name of region (patch, zone, etc.)
word regionName_;
//- List of field names to operate on
//- Names of operand fields
wordList fields_;
//- Output field values flag
bool writeFields_;
// Protected Member Functions
@ -151,7 +182,7 @@ public:
//- Destructor
virtual ~fieldValue();
virtual ~fieldValue() = default;
// Member Functions

View File

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

View File

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

View File

@ -31,120 +31,137 @@ Group
grpFieldFunctionObjects
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
surface) faces, a number of operations can be performed, such as sums,
averages and integrations.
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
Examples of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
movingWallPatch
surfaceFieldValuePatch1
{
// Mandatory entries (unmodifiable)
type surfaceFieldValue;
libs (fieldFunctionObjects);
log true;
writeControl writeTime;
writeFields false;
// Mandatory entries (runtime modifiable)
fields (<field1> <field2> ... <fieldN>);
operation <operationType>;
regionType patch;
name movingWall;
name <patch>;
operation areaAverage;
fields (p phi U);
// Optional entries (runtime modifiable)
postOperation none;
weightField alpha1;
scaleFactor 1.0;
writeArea false;
surfaceFormat none;
// Optional (inherited) entries
...
}
surfaceFieldValue1
surfaceFieldValueFaceZone1
{
// Mandatory entries (unmodifiable)
type surfaceFieldValue;
libs (fieldFunctionObjects);
log true;
writeControl writeTime;
writeFields true;
surfaceFormat none;
// Mandatory entries (runtime modifiable)
fields (<field1> <field2> ... <fieldN>);
operation <operationType>;
regionType faceZone;
name f0;
name <faceZone>;
operation sum;
// Optional entries (runtime modifiable)
postOperation none;
weightField alpha1;
fields (p phi U);
scaleFactor 1.0;
writeArea false;
surfaceFormat none;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default
type | Type name: surfaceFieldValue | yes |
log | Write data to standard output | no | no
regionType | Face regionType: see below | yes |
name | Name for regionType | yes |
operation | Operation to perform | yes |
postOperation | Post-operation to perform | no | none
fields | List of fields to operate on | yes |
weightField | Name of field to apply weighting | no |
scaleFactor | Output value scaling factor | no | 1
writeArea | Write the surface area | no |
writeFields | Write the region field values | yes |
surfaceFormat | Output value format | no | none
Property | Description | Type | Req'd | Dflt
type | Type name: surfaceFieldValue | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
fields | Names of operand fields | wordList | yes | -
regionType | Face regionType: see below | word | yes | -
name | Name for regionType | word | yes | -
operation | Operation type: see below | word | yes | -
postOperation | Post-operation type: see below | word | no | none
weightField | Name of field to apply weighting | word | no | none
scaleFactor | Output value scaling factor | scalar | no | 1.0
writeArea | Write the surface area | bool | no | false
surfaceFormat | Output value format | word <!--
--> | conditional on writeFields | none
\endtable
Where \c regionType is defined by
The inherited entries are elaborated in:
- \link fieldValue.H \endlink
Options for the \c regionType entry:
\plaintable
faceZone | The \b name entry to specify the faceZone
patch | The \b name entry to specify the patch
functionObjectSurface | The \b name entry to specify a polySurface
sampledSurface | A \b sampledSurfaceDict sub-dictionary and \b name
faceZone | The \b name entry to specify the faceZone
patch | The \b name entry to specify the patch
functionObjectSurface | The \b name entry to specify a polySurface
sampledSurface | A \b sampledSurfaceDict sub-dictionary and \b name
\endplaintable
The \c operation is one of:
Options for the \c operation entry:
\plaintable
none | no operation
min | minimum
max | maximum
sum | sum
sumMag | sum of component magnitudes
sumDirection | sum values that are positive in given direction
sumDirectionBalance | sum of balance of values in given direction
average | ensemble average
areaAverage | area-weighted average
areaIntegrate | area integral
CoV | coefficient of variation: standard deviation/mean
areaNormalAverage | area-weighted average in face normal direction
areaNormalIntegrate | area-weighted integral in face normal directon
uniformity | uniformity index
weightedSum | weighted sum
weightedAverage | weighted average
weightedAreaAverage | weighted area average
weightedAreaIntegrate | weighted area integral
weightedUniformity | weighted uniformity index
absWeightedSum | sum using absolute weighting
absWeightedAverage | average using absolute weighting
absWeightedAreaAverage | area average using absolute weighting
absWeightedAreaIntegrate | area integral using absolute weighting
absWeightedUniformity | uniformity index using absolute weighting
none | no operation
min | minimum
max | maximum
sum | sum
sumMag | sum of component magnitudes
sumDirection | sum values that are positive in given direction
sumDirectionBalance | sum of balance of values in given direction
average | ensemble average
areaAverage | area-weighted average
areaIntegrate | area integral
CoV | coefficient of variation: standard deviation/mean
areaNormalAverage | area-weighted average in face normal direction
areaNormalIntegrate | area-weighted integral in face normal directon
uniformity | uniformity index
weightedSum | weighted sum
weightedAverage | weighted average
weightedAreaAverage | weighted area average
weightedAreaIntegrate | weighted area integral
weightedUniformity | weighted uniformity index
absWeightedSum | sum using absolute weighting
absWeightedAverage | average using absolute weighting
absWeightedAreaAverage | area average using absolute weighting
absWeightedAreaIntegrate | area integral using absolute weighting
absWeightedUniformity | uniformity index using absolute weighting
\endplaintable
The \c postOperation is one of:
Options for the \c postOperation entry:
\plaintable
none | No additional operation after calculation
mag | Component-wise \c mag() after normal operation
sqrt | Component-wise \c sqrt() after normal operation
\endplaintable
Usage by the \c postProcess utility is not available.
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
rank as the input field.
- Faces on empty patches get ignored
- If the field is a volField the \c faceZone can only consist of boundary
faces
- Faces on empty patches get ignored.
- If the field is a volField the \c faceZone
can only consist of boundary faces.
- Using \c functionObjectSurface:
- The keyword %subRegion should not be used to select surfaces.
Instead specify the regionType 'functionObjectSurface' and provide
@ -159,7 +176,7 @@ Note
- take care when using isoSurfaces - these might have duplicate
triangles and so integration might be wrong
Uniformity
Uniformity:
\f[
UI(\phi) = 1 - \frac{1}{2 \overline{\phi} 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$.
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$.
See also
Foam::fieldValues
Foam::functionObject
- Foam::functionObject
- Foam::functionObjects::fieldValues::fieldValue
- ExtendedCodeGuide::functionObjects::field::surfaceFieldValue
SourceFiles
surfaceFieldValue.C
@ -556,6 +574,12 @@ public:
const dictionary& dict
);
//- No copy construct
surfaceFieldValue(const surfaceFieldValue&) = delete;
//- No copy assignment
void operator=(const surfaceFieldValue&) = delete;
//- Destructor
virtual ~surfaceFieldValue() = default;

View File

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

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