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

@ -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;

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
Intermediate class for handling field expressions (add, subtract etc).
Intermediate class for handling field expression function objects
(e.g. \c add, \c subtract etc.) whereinto more than one fields are input.
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
<userDefinedSubDictName1>
{
// Mandatory and other optional entries
...
// Optional (inherited) entries (runtime modifiable)
fields (<field1> <field2> ... <fieldN>);
result <fieldResult>;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
fields | Names of operand fields | wordList | yes | -
result | Names of output fields | wordList | no | \<FO\>(\<f1\>,...)
\endtable
See also
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::fieldsExpression
SourceFiles
fieldsExpression.C
fieldsExpressionTemplates.C
\*---------------------------------------------------------------------------*/
@ -64,7 +89,7 @@ class fieldsExpression
{
protected:
// Protected member data
// Protected Member Data
//- Names of fields to process
wordList fieldNames_;
@ -98,12 +123,6 @@ protected:
//- Calculate expression
virtual bool calc() = 0;
//- No copy construct
fieldsExpression(const fieldsExpression&) = delete;
//- No copy assignment
void operator=(const fieldsExpression&) = delete;
public:
@ -123,6 +142,12 @@ public:
const word& resultName = word::null
);
//- No copy construct
fieldsExpression(const fieldsExpression&) = delete;
//- No copy assignment
void operator=(const fieldsExpression&) = delete;
//- Destructor
virtual ~fieldsExpression() = default;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-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(flowType, 0);
addToRunTimeSelectionTable
(
functionObject,
flowType,
dictionary
);
addToRunTimeSelectionTable(functionObject, flowType, dictionary);
}
}
@ -58,9 +52,9 @@ bool Foam::functionObjects::flowType::calc()
const tmp<volTensorField> tgradU(fvc::grad(U));
const volTensorField& gradU = tgradU();
volScalarField magD(mag(symm(gradU)));
volScalarField magOmega (mag(skew(gradU)));
dimensionedScalar smallMagD("smallMagD", magD.dimensions(), SMALL);
const volScalarField magD(mag(symm(gradU)));
const volScalarField magOmega(mag(skew(gradU)));
const dimensionedScalar smallMagD("sMagD", magD.dimensions(), SMALL);
const volTensorField SSplusWW
(
@ -94,10 +88,4 @@ Foam::functionObjects::flowType::flowType
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::flowType::~flowType()
{}
// ************************************************************************* //

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,22 +31,70 @@ Group
grpFieldFunctionObjects
Description
Calculates and writes the flowType of a velocity field.
Computes the flow type indicator of an input velocity field.
The flow type parameter is obtained according to the following equation:
The flow type indicator is obtained according to the following equation:
\f[
\lambda = \frac{|D| - |\omega|}{|D| + |\omega|}
\f]
where
\vartable
\lambda | Flow type indicator
D | Symmetric part of the gradient tensor of velocity
\omega | Skew-symmetric part of the gradient tensor of velocity
\endvartable
The flow type indicator values mean:
\verbatim
|D| - |Omega|
lambda = -------------
|D| + |Omega|
-1 = rotational flow
0 = simple shear flow
1 = planar extensional flow
\endverbatim
-1 = rotational flow
0 = simple shear flow
1 = planar extensional flow
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
flowType1
{
// Mandatory entries (unmodifiable)
type flowType;
libs (fieldFunctionObjects);
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: flowType | 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 flowType
\endverbatim
See also
Foam::functionObjects::fieldExpression
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fieldExpression
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::flowType
SourceFiles
flowType.C
@ -94,9 +143,15 @@ public:
const dictionary& dict
);
//- No copy construct
flowType(const flowType&) = delete;
//- No copy assignment
void operator=(const flowType&) = delete;
//- Destructor
virtual ~flowType();
virtual ~flowType() = default;
};

View File

@ -85,10 +85,4 @@ Foam::functionObjects::flux::flux
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::flux::~flux()
{}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,16 +30,56 @@ Group
grpFieldFunctionObjects
Description
Calculates the flux of a field. The operation is limited to
surfaceVectorFields and volVectorFields, and the output is a
surfaceScalarField.
Computes the flux of an input vector field.
Operands:
\table
Operand | Type | Location
input | {vol,surface}VectorField | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | surfaceScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
flowType1
{
// Mandatory entries (unmodifiable)
type flux;
libs (fieldFunctionObjects);
// Optional entries (runtime modifiable)
rho none;
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: flux | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
rho | Name of density field | word | no | none
\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::fieldExpression
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::flux
SourceFiles
flux.C
fluxTemplates.C
\*---------------------------------------------------------------------------*/
@ -63,6 +103,12 @@ class flux
:
public fieldExpression
{
// Private Data
//- Name of density field
word rhoName_;
// Private Member Functions
//- Calculate the flux of a volVectorField and register the result
@ -76,9 +122,6 @@ class flux
//- Calculate the flux field and return true if successful
virtual bool calc();
//- rho flied name
word rhoName_;
public:
@ -96,9 +139,15 @@ public:
const dictionary& dict
);
//- No copy construct
flux(const flux&) = delete;
//- No copy assignment
void operator=(const flux&) = delete;
//- Destructor
virtual ~flux();
virtual ~flux() = default;
};

View File

@ -46,13 +46,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(fluxSummary, 0);
addToRunTimeSelectionTable
(
functionObject,
fluxSummary,
dictionary
);
addToRunTimeSelectionTable(functionObject, fluxSummary, dictionary);
}
}
@ -71,7 +65,7 @@ Foam::functionObjects::fluxSummary::modeTypeNames_
});
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fluxSummary::isSurfaceMode() const
{
@ -975,8 +969,13 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
needsUpdate_ = true;
mode_ = modeTypeNames_.get("mode", dict);
phiName_ = dict.getOrDefault<word>("phi", "phi");
<<<<<<< HEAD
scaleFactor_ = dict.getOrDefault<scalar>("scaleFactor", 1);
tolerance_ = dict.getOrDefault<scalar>("tolerance", 0.8);
=======
scaleFactor_ = dict.getOrDefault<scalar>("scaleFactor", 1.0);
tolerance_ = dict.getOrDefault<scalar>("tolerance", 0.8);
>>>>>>> DOC: elaborate the usage of function objects
zoneNames_.clear();
zoneDirections_.clear();

View File

@ -31,60 +31,78 @@ Group
grpFieldFunctionObjects
Description
This function object calculates the flux across selections of faces.
Computes the volumetric- or mass-flux
information across selections of face zones.
Output comprises, per set of faces, the fluxes:
- positive
- negative
- net
- absolute
Operands:
\table
Operand | Type | Location
input | - | -
output file | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<faceN\>
output field | - | -
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
fluxSummary1
{
type fluxSummary;
libs (fieldFunctionObjects);
...
write yes;
log yes;
mode cellZoneAndDirection;
// Mandatory entries (unmodifiable)
type fluxSummary;
libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
mode cellZoneAndDirection;
cellZoneAndDirection
(
(porosity (1 0 0))
);
scaleFactor 1.2;
// Optional entries (runtime modifiable)
phi phi;
scaleFactor 1.0;
tolerance 0.8;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default
type | Type name: fluxSummary | yes |
write | Write flux data to file | no | yes
log | Write flux data to standard output | no | yes
mode | Mode to generate faces to test | yes |
scaleFactor | Optional factor to scale result | no | 1
tolerance | Tolerance for the reference direction | no | 0.8
phi | Surface flux field | no | phi
Property | Description | Type | Req'd | Dflt
type | Type name: fluxSummary | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
mode | Mode to generate faces to test | word | yes | -
phi | Name of surface flux field | word | no | phi
scaleFactor | Factor to scale results | scalar | no | 1.0
tolerance | Tolerance for reference direction | scalar | no | 0.8
\endtable
The mode is one of:
- faceZone
- faceZoneAndDirection
- cellZoneAndDirection
- surface
- surfaceAndDirection
Options for the \c mode entry:
\verbatim
faceZone
faceZoneAndDirection
cellZoneAndDirection
surface
surfaceAndDirection
\endverbatim
Output data is written to files of the form \<timeDir\>/\<faceZoneName\>.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 surface and direction, can use phi = 'U' for determining the fluxes.
For surface and direction, phi='U' can be used for determining the fluxes.
See also
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
Foam::functionObjects::timeControl
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- Foam::functionObjects::timeControl
- ExtendedCodeGuide::functionObjects::field::fluxSummary
SourceFiles
fluxSummary.C
@ -121,7 +139,7 @@ class fluxSummary
{
public:
// Public enumerations
// Public Enumerations
//- Face mode type
enum modeType
@ -144,13 +162,13 @@ protected:
//- Track if the surface needs an update
bool needsUpdate_;
//- Mode for face determination
//- Mode for face determination/to generate faces to test
modeType mode_;
//- Scale factor
//- Factor to scale results
scalar scaleFactor_;
//- Name of flux field, default = phi
//- Name of flux field
word phiName_;
@ -179,12 +197,12 @@ protected:
scalar tolerance_;
// Private Member Functions
// Protected Member Functions
//- Check if surface mode instead of zone mode
bool isSurfaceMode() const;
//- Check flowType (mass or volume).
//- Check flowType (mass or volume)
// Return name on success, fatal error on failure.
word checkFlowType
(
@ -252,7 +270,6 @@ protected:
//- Initialise - after read(), before write()
bool update();
//- Output file header information
virtual void writeFileHeader
(
@ -265,12 +282,6 @@ protected:
//- Specialized write for surfaces
bool surfaceModeWrite();
//- No copy construct
fluxSummary(const fluxSummary&) = delete;
//- No copy assignment
void operator=(const fluxSummary&) = delete;
public:
@ -288,6 +299,12 @@ public:
const dictionary& dict
);
//- No copy construct
fluxSummary(const fluxSummary&) = delete;
//- No copy assignment
void operator=(const fluxSummary&) = delete;
//- Destructor
virtual ~fluxSummary() = 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,16 +31,64 @@ Group
grpFieldFunctionObjects
Description
Calculates the gradient of a field.
Computes the gradient of an input field.
The operation is limited to scalar and vector volume or surface fields, and
the output is a volume vector or tensor field.
Operands:
\table
Operand | Type | Location
input | {vol,surface}{Scalar,Vector}Field <!--
--> | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | vol{Vector,Tensor}Field <!--
--> | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
grad1
{
// Mandatory entries (unmodifiable)
type grad;
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: grad | 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 "grad(<field>)"
\endverbatim
See also
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::grad
SourceFiles
grad.C
gradTemplates.C
\*---------------------------------------------------------------------------*/
@ -90,6 +138,12 @@ public:
const dictionary& dict
);
//- No copy construct
grad(const grad&) = delete;
//- No copy assignment
void operator=(const grad&) = delete;
//- Destructor
virtual ~grad() = default;

View File

@ -88,12 +88,6 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::heatTransferCoeff::~heatTransferCoeff()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::heatTransferCoeff::read(const dictionary& dict)

View File

@ -30,21 +30,26 @@ Group
grpFieldFunctionObjects
Description
This function object calculates and writes the heat transfer coefficient
as a volScalarField for a set of patches.
Computes the heat transfer coefficient as a \c volScalarField
for a set of patches.
The field is stored on the mesh database so that it can be retrieved and
used for other applications. Heat transfer coefficient, htc [W/m2/K]
can be evaluated using one of the following modes:
- ReynoldsAnalogy: Reynold's analogy
- localReferenceTemperature: local reference temperature
- fixedReferenceTemperature: specified reference temperature
used for other applications.
Operands:
\table
Operand | Type | Location
input | - | -
output file | - | -
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Example usage for mode 'ReynoldsAnalogy' for incompressible case
Minimal example by using \c system/controlDict.functions:
\verbatim
htc
heatTransferCoeff1
{
// Mandatory entries (unmodifiable)
type heatTransferCoeff;
libs (fieldFunctionObjects);
@ -60,7 +65,27 @@ Usage
}
\endverbatim
Example usage for mode 'ReynoldsAnalogy' for compressible case
Example usage for mode \c ReynoldsAnalogy for incompressible case:
\verbatim
heatTransferCoeff1
{
// Mandatory entries (unmodifiable)
type heatTransferCoeff;
libs (fieldFunctionObjects);
field T;
patches ("walls.*");
htcModel ReynoldsAnalogy;
UInf (20 0 0);
Cp CpInf;
CpInf 1000;
rho rhoInf;
rhoInf 1.2;
}
\endverbatim
Example usage for mode \c ReynoldsAnalogy for compressible case:
\verbatim
htc
{
@ -75,7 +100,7 @@ Usage
}
\endverbatim
Example usage for mode 'localReferenceTemperature' for compressible case
Example usage for mode \c localReferenceTemperature for compressible case:
\verbatim
htc
{
@ -84,11 +109,11 @@ Usage
field T;
patches ("walls.*");
htcModel local;
htcModel localReferenceTemperature;
}
\endverbatim
Example usage for mode 'fixedReferenceTemperature' for compressible case
Example usage for mode \c fixedReferenceTemperature for compressible case:
\verbatim
htc
{
@ -97,15 +122,30 @@ Usage
field T;
patches ("walls.*");
htcModel local;
htcModel fixedReferenceTemperature;
TRef 300;
}
\endverbatim
Options for the \c htcModel entry:
\verbatim
ReynoldsAnalogy | Reynold's analogy
localReferenceTemperature | Local reference temperature
fixedReferenceTemperature | Specified reference temperature
\endverbatim
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::heatTransferCoeffModels::fixedReferenceTemperature
Foam::heatTransferCoeffModels::localReferenceTemperature
- Foam::functionObject
- Foam::functionObjects::fieldExpression
- Foam::heatTransferCoeffModels::fixedReferenceTemperature
- Foam::heatTransferCoeffModels::localReferenceTemperature
- ExtendedCodeGuide::functionObjects::field::heatTransferCoeff
SourceFiles
heatTransferCoeff.C
@ -144,18 +184,10 @@ class heatTransferCoeff
protected:
// Protected Member Functions
//- Calculate the heat transfer coefficient field
// \return true on success
//- Calculate the heat transfer coefficient field and return true
//- if successful
virtual bool calc();
//- No copy construct
heatTransferCoeff(const heatTransferCoeff&) = delete;
//- No copy assignment
void operator=(const heatTransferCoeff&) = delete;
public:
@ -174,9 +206,15 @@ public:
const dictionary& dict
);
//- No copy construct
heatTransferCoeff(const heatTransferCoeff&) = delete;
//- No copy assignment
void operator=(const heatTransferCoeff&) = delete;
//- Destructor
virtual ~heatTransferCoeff();
virtual ~heatTransferCoeff() = default;
// Member Functions

View File

@ -104,7 +104,7 @@ public:
TypeName("heatTransferCoeffModel");
// Declare run-time constructor selection table
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(

View File

@ -95,12 +95,6 @@ Foam::functionObjects::histogram::histogram
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::histogram::~histogram()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::histogram::read(const dictionary& dict)
@ -114,6 +108,14 @@ bool Foam::functionObjects::histogram::read(const dictionary& dict)
min_ = dict.getOrDefault<scalar>("min", GREAT);
dict.readEntry("nBins", nBins_);
if (nBins_ < 1)
{
FatalErrorInFunction
<< "Number of histogram bins = " << nBins_
<< " cannot be negative or zero."
<< abort(FatalError);
}
const word format(dict.get<word>("setFormat"));
formatterPtr_ = writer<scalar>::New(format);

View File

@ -31,45 +31,69 @@ Group
grpFieldFunctionObjects
Description
Write the volume-weighted histogram of a volScalarField.
Computes the volume-weighted histogram of an input \c volScalarField.
Operands:
\table
Operand | Type | Location
input | volScalarField | $FOAM_CASE/\<time\>/\<inpField\>
output file | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | - | -
\endtable
The set written contains two columns, the first the volume averaged values,
the second the raw bin count.
Usage
Example:
Minimal example by using \c system/controlDict.functions:
\verbatim
histogram1
{
type histogram;
libs (fieldFunctionObjects);
// Mandatory entries (unmodifiable)
type histogram;
libs (fieldFunctionObjects);
field p;
nBins 100;
min -5;
max 5;
setFormat gnuplot;
// Mandatory (inherited) entries (runtime modifiable)
field p;
nBins 100;
setFormat gnuplot;
// Optional entries (runtime modifiable)
max 5;
min -5;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: histogram | yes |
field | Field to analyse | yes |
nBins | Number of bins for the histogram | yes|
max | Maximum value sampled | no | field max
min | minimum value sampled | no | 0
setFormat | Output format | yes |
Property | Description | Type | Req'd | Dflt
type | Type name: histogram | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of operand field | word | yes | -
nBins | Number of histogram bins | label | yes | -
setFormat | Output format | word | yes | -
max | Maximum value sampled | scalar | no | fieldMax
min | minimum value sampled | scalar | no | 0.0
\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
If max is not provided it will use the field's min and max as the bin
extremes. If max is provided but not min it will use 0. The set written
contains two columns, the first the volume averaged values, the second
the raw bin count.
If \c max is not provided it will use the field's min and max as the bin
extremes. If \c max is provided but not \c min it will use 0.
See also
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::histogram
SourceFiles
histogram.C
@ -99,7 +123,10 @@ class histogram
public fvMeshFunctionObject,
public writeFile
{
// Private data
// Private Data
//- Number of bins
label nBins_;
//- Name of field
word fieldName_;
@ -110,9 +137,6 @@ class histogram
//- Minimum value
scalar min_;
//- Number of bins
label nBins_;
//- Output formatter to write
autoPtr<writer<scalar>> formatterPtr_;
@ -127,12 +151,6 @@ class histogram
const scalarField& absoluteValues
) const;
//- No copy construct
histogram(const histogram&) = delete;
//- No copy assignment
void operator=(const histogram&) = delete;
public:
@ -150,9 +168,15 @@ public:
const dictionary& dict
);
//- No copy construct
histogram(const histogram&) = delete;
//- No copy assignment
void operator=(const histogram&) = delete;
// Destructor
virtual ~histogram();
virtual ~histogram() = default;
// Member Functions
@ -160,10 +184,10 @@ public:
//- Read the histogram data
virtual bool read(const dictionary&);
//- Execute, currently does nothing
//- Execute (effectively no-op)
virtual bool execute();
//- Calculate the histogram and write.
//- Calculate the histogram and write
// postProcess overrides the usual writeControl behaviour and
// forces writing always (used in post-processing mode)
virtual bool write();

View File

@ -230,11 +230,11 @@ Foam::functionObjects::interfaceHeight::interfaceHeight
:
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name),
alphaName_("alpha"),
liquid_(true),
locations_(),
alphaName_("alpha"),
interpolationScheme_("cellPoint"),
direction_(vector::zero)
direction_(vector::zero),
locations_()
{
read(dict);
resetNames({"height", "position"});
@ -244,12 +244,6 @@ Foam::functionObjects::interfaceHeight::interfaceHeight
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::interfaceHeight::~interfaceHeight()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::interfaceHeight::read(const dictionary& dict)

View File

@ -29,33 +29,71 @@ Class
Description
This function object reports the height of the interface above a set of
locations. For each location, it writes the vertical distance of the
locations.
For each location, it writes the vertical distance of the
interface above both the location and the lowest boundary. It also writes
the point on the interface from which these heights are computed. It uses
an integral approach, so if there are multiple interfaces above or below a
location then this method will generate average values.
Example of function object specification:
Operands:
\table
Operand | Type | Location
input | - | -
output file 1 | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/height
output file 2 | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/position
output field | - | -
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
interfaceHeight1
{
type interfaceHeight;
libs (fieldFunctionObjects);
alpha alpha.water;
locations ((0 0 0) (10 0 0) (20 0 0));
// Mandatory entries (unmodifiable)
type interfaceHeight;
libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
locations ((0 0 0) (10 0 0) (20 0 0));
// Optional entries (runtime modifiable)
alpha alpha.water;
liquid true;
direction (1 0 0);
interpolationScheme cellPoint;
// Optional (inherited) entries
...
}
\endverbatim
Usage
where the entries mean:
\table
Property | Description | Required | Default value
type | type name | yes |
alpha | name of the alpha field | no | alpha
locations | list of locations to report the height at | yes |
liquid | is the alpha field that of the liquid | no | true
direction | direction of interface | no | g
Property | Description | Type | Req'd | Dflt
type | Type name: interfaceHeight | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
locations | Locations to report the height at | vectorList | yes | -
alpha | Name of alpha field | word | no | alpha
liquid | Flag if the alpha field that of the liquid | bool | no | true
direction | Direction of interface | vector | no | g
interpolationScheme | Interpolation scheme | word | no | cellPoint
\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::functionObjects::logFile
- ExtendedCodeGuide::functionObjects::field::interfaceHeight
SourceFiles
interfaceHeight.C
@ -86,14 +124,11 @@ class interfaceHeight
{
// Private Data
//- Name of the alpha field
word alphaName_;
//- Is the alpha field that of the liquid under the wave?
bool liquid_;
//- List of locations to report the height at
List<point> locations_;
//- Name of the alpha field
word alphaName_;
//- Interpolation scheme
word interpolationScheme_;
@ -101,6 +136,9 @@ class interfaceHeight
//- Direction of interface motion
vector direction_;
//- List of locations to report the height at
List<point> locations_;
// Private Member Functions
@ -148,9 +186,15 @@ public:
const dictionary& dict
);
//- No copy construct
interfaceHeight(const interfaceHeight&) = delete;
//- No copy assignment
void operator=(const interfaceHeight&) = delete;
//- Destructor
virtual ~interfaceHeight();
virtual ~interfaceHeight() = default;
// Member Functions

View File

@ -30,44 +30,68 @@ Group
grpFieldFunctionObjects
Description
Limits fields to user-specified min and max bounds
Limits input fields to user-specified min and max bounds.
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.
Note
For non-scalar field types, the user limit is used to create a
For non-scalar types of input field, the user limit is used to create a
scaling factor using the field magnitudes.
Usage
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
limitFields1
{
type limitFields;
libs (fieldFunctionObjects);
// Mandatory entries (unmodifiable)
type limitFields;
libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
fields (U);
limit max;
max 100;
// Optional (inherited) entries
...
fields (U);
limit max;
max 100;
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default
type | type name: limitFields | yes |
fields | list of fields to process | yes |
limit | bound to limit - see below | yes |
min | min limit value | partly |
max | max limit value | partly |
Property | Description | Type | Req'd | Dflt
type | Type name: limitFields | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
fields | List of fields to process | wordList | yes | -
limit | Bound to limit - see below | word | yes | -
min | Min limit value | scalar | conditional | -
max | Max limit value | scalar | conditional | -
\endtable
The \c limit entry can take the value:
- \c min : specify a minimum value
- \c max : specify a maximum value
- \c both : specify a minimum value and a maximum value
Options for the \c limit entry:
\verbatim
min : specify a minimum value
max : specify a maximum value
both : specify a minimum value and a maximum value
\endverbatim
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::limitFields
SourceFiles
limitFields.C
@ -141,13 +165,6 @@ protected:
bool limitField(const word& fieldName);
//- No copy construct
limitFields(const limitFields&) = delete;
//- No copy assignment
void operator=(const limitFields&) = delete;
public:
//- Runtime type information
@ -164,6 +181,12 @@ public:
const dictionary& dict
);
//- No copy construct
limitFields(const limitFields&) = delete;
//- No copy assignment
void operator=(const limitFields&) = delete;
//- Destructor
virtual ~limitFields() = 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,18 +31,64 @@ Group
grpFieldFunctionObjects
Description
Calculates the magnitude of a field.
Computes the magnitude of an input field.
The operation can be applied to any volume or surface fields generating a
volume or surface scalar field.
With the %subRegion option, also supports fields on functionObject
surface output (eg, sampledSurfaces).
Operands:
\table
Operand | Type | Location
input | {vol,surface}\<Type\>Field | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | {vol,surface}ScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
With the \c subRegion option, also supports fields on function object
surface output (e.g. sampledSurfaces).
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
mag1
{
// Mandatory entries (unmodifiable)
type mag;
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: mag | 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 "mag(<field>)"
\endverbatim
See also
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::mag
SourceFiles
mag.C
magTemplates.C
\*---------------------------------------------------------------------------*/
@ -92,6 +138,12 @@ public:
const dictionary& dict
);
//- No copy construct
mag(const mag&) = delete;
//- No copy assignment
void operator=(const mag&) = delete;
//- Destructor
virtual ~mag() = default;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,18 +31,64 @@ Group
grpFieldFunctionObjects
Description
Calculates the magnitude of the sqr of a field.
Computes the magnitude of the square of an input field.
The operation can be applied to any volume or surface field generating a
volume or surface scalar field.
With the %subRegion option, also supports fields on functionObject
surface output (eg, sampledSurfaces).
Operands:
\table
Operand | Type | Location
input | {vol,surface}\<Type\>Field | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | {vol,surface}ScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
With the \c subRegion option, also supports fields on functionObject
surface output (e.g. sampledSurfaces).
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
magSqr1
{
// Mandatory entries (unmodifiable)
type magSqr;
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: magSqr | 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 "magSqr(<field>)"
\endverbatim
See also
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::fieldExpression
- ExtendedCodeGuide::functionObjects::field::magSqr
SourceFiles
magSqr.C
magSqrTemplates.C
\*---------------------------------------------------------------------------*/
@ -69,12 +115,12 @@ class magSqr
// Private Member Functions
//- Calculate the magnitude of the sqr of the field
// and register the result
//- and register the result
template<class Type>
bool calcMagSqr();
//- Calculate the magnitude of the sqr of the field
// and return true if successful
//- and return true if successful
virtual bool calc();
@ -94,6 +140,12 @@ public:
const dictionary& dict
);
//- No copy construct
magSqr(const magSqr&) = delete;
//- No copy assignment
void operator=(const magSqr&) = delete;
//- Destructor
virtual ~magSqr() = default;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,13 +36,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(mapFields, 0);
addToRunTimeSelectionTable
(
functionObject,
mapFields,
dictionary
);
addToRunTimeSelectionTable(functionObject, mapFields, dictionary);
}
}

View File

@ -30,40 +30,91 @@ Group
grpFieldFunctionObjects
Description
Map fields from local mesh to secondary mesh at run-time.
Maps input fields from local mesh to secondary mesh at runtime.
Operands:
\table
Operand | Type | Location
input | {vol,surface}\<Type\>Field <!--
--> | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | {vol,surface}\<Type\>Field <!--
--> | $FOAM_CASE/\<time\>/\<outField\>
\endtable
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Usage
Example of function object specification to map fields:
Minimal example by using \c system/controlDict.functions:
\verbatim
mapFields1
{
// Mandatory entries (unmodifiable)
type mapFields;
libs (fieldFunctionObjects);
...
// Mandatory (inherited) entries (runtime modifiable)
fields (<field1> <field2> ... <fieldN>);
mapRegion coarseMesh;
mapMethod cellVolumeWeight;
consistent yes;
consistent true;
fields ("U.*" p);
// Optional entries (runtime modifiable)
// patchMapMethod direct; // AMI-related entry
// enabled if consistent=false
// patchMap (<patchSrc> <patchTgt>);
// cuttingPatches (<patchTgt1> <patchTgt2> ... <patchTgtN>);
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | Type name: mapFields | yes |
mapRegion | Name of region to map to | yes |
mapMethod | Mapping method | yes |
patchMapMethod | Patch mapping method | no | \<auto\>
consistent | Mapping meshes have consistent boundaries | yes |
fields | List of field names to map | yes |
log | Log to standard output | no | yes
Property | Description | Type | Req'd | Dflt
type | Type name: mapFields | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
fields | Names of operand fields | wordList | yes | -
mapRegion | Name of region to map to | word | yes | -
mapMethod | Mapping method | word | yes | -
consistent | Mapping meshes have consistent boundaries | bool | yes | -
patchMapMethod | Patch mapping method for AMI cases | word | no | -
patchMap | Coincident source/target patches in two cases <!--
--> | wordHashTable | no | -
cuttingPatches | Target patches cutting the source domain <!--
--> | wordList | no | -
\endtable
Options for the \c mapMethod entry:
\verbatim
direct
mapNearest
cellVolumeWeight
correctedCellVolumeWeight
\endverbatim
Options for the \c patchMapMethod entry:
\verbatim
directAMI
mapNearestAMI
faceAreaWeightAMI
partialFaceAreaWeightAMI
\endverbatim
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::mapFields
SourceFiles
mapFields.C
mapFieldsTemplates.C
\*---------------------------------------------------------------------------*/
@ -91,7 +142,7 @@ class mapFields
:
public fvMeshFunctionObject
{
// Private data
// Private Data
//- Locally cached map region mesh (map to this mesh)
autoPtr<fvMesh> mapRegionPtr_;
@ -105,12 +156,6 @@ class mapFields
// Private Member Functions
//- No copy construct
mapFields(const mapFields&) = delete;
//- No copy assignment
void operator=(const mapFields&) = delete;
//- Helper function to create the mesh-to-mesh interpolation
void createInterpolation(const dictionary& dict);
@ -146,6 +191,12 @@ public:
const dictionary& dict
);
//- No copy construct
mapFields(const mapFields&) = delete;
//- No copy assignment
void operator=(const mapFields&) = delete;
//- Destructor
virtual ~mapFields() = default;

View File

@ -430,7 +430,7 @@ bool Foam::functionObjects::momentum::read(const dictionary& dict)
UName_ = dict.getOrDefault<word>("U", "U");
pName_ = dict.getOrDefault<word>("p", "p");
rhoName_ = dict.getOrDefault<word>("rho", "rho");
rhoRef_ = dict.getOrDefault<scalar>("rhoRef", 1);
rhoRef_ = dict.getOrDefault<scalar>("rhoRef", 1.0);
hasCsys_ = dict.getOrDefault("cylindrical", false);
if (hasCsys_)

View File

@ -30,53 +30,70 @@ Group
grpFieldFunctionObjects
Description
Calculates linear/angular momentum, reporting integral values
Computes linear/angular momentum, reporting integral values
and optionally writing the fields.
Data is written into momentum.dat in the
postProcessing/\<functionObjectName\> directory.
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
momentum1
{
type momentum;
libs (fieldFunctionObjects);
...
log yes;
// Mandatory entries (unmodifiable)
type momentum;
libs (fieldFunctionObjects);
// Optional entries (runtime modifiable)
regionType all;
writeMomentum yes;
writePosition yes;
writeVelocity yes;
p p;
U U;
rho rho;
rhoRef 1.0;
cylindrical true;
origin (0 0 0);
e1 (1 0 0);
e3 (0 0 1);
origin (0 0 0);
e1 (1 0 0);
e3 (0 0 1);
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default
type | Type name: momentum | yes |
log | Log information to standard output | no | no
writeMomentum | Write (linear, angular) momentum fields | no | no
writePosition | Write angular position component fields | no | no
writeVelocity | Write angular velocity fields | no | no
p | Pressure field name | no | p
U | Velocity field name | no | U
rho | Density field name | no | rho
rhoRef | Reference density (incompressible) | no | 1.0
cylindrical | Use cylindrical coordinates | no | false
origin | Origin for cylindrical coordinates | no |
regionType | Selection type: all/cellSet/cellZone | no | all
name | Name of cellSet/cellZone if required | no |
Property | Description | Type | Req'd | Dflt
type | Type name: momentum | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
regionType | Selection type: all/cellSet/cellZone | word | no | all
writeMomentum | Write (linear, angular) momentum fields | bool | no | no
writePosition | Write angular position component fields | bool | no | no
writeVelocity | Write angular velocity fields | bool | no | no
p | Pressure field name | word | no | p
U | Velocity field name | word | no | U
rho | Density field name | word | no | rho
rhoRef | Reference density (incompressible) | scalar | no | 1.0
cylindrical | Use cylindrical coordinates | bool | no | no
origin | Origin for cylindrical coordinates | vector | conditional | -
name | Name of cellSet/cellZone if required | word | conditional | -
\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
- For incompressible cases, the value of \c rhoRef is used.
- When specifying the cylindrical coordinate system, the rotation
@ -93,11 +110,11 @@ Note
\endverbatim
See also
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::volRegion
Foam::functionObjects::writeFile
Foam::functionObjects::timeControl
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::volRegion
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::momentum
SourceFiles
momentum.C
@ -154,7 +171,7 @@ class momentum
protected:
// Protected data
// Protected Data
//- Integral (linear) momentum
vector sumMomentum_;
@ -208,12 +225,6 @@ protected:
//- Write momentum data
void writeValues(Ostream& os);
//- No copy construct
momentum(const momentum&) = delete;
//- No copy assignment
void operator=(const momentum&) = delete;
public:
@ -241,6 +252,12 @@ public:
const bool readFields = true
);
//- No copy construct
momentum(const momentum&) = delete;
//- No copy assignment
void operator=(const momentum&) = delete;
//- Destructor
virtual ~momentum() = default;

View File

@ -25,19 +25,15 @@ License
\*---------------------------------------------------------------------------*/
#include "momentumError.H"
#include "fvcDiv.H"
#include "fvcGrad.H"
#include "fvcLaplacian.H"
#include "turbulenceModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
@ -213,4 +209,5 @@ bool Foam::functionObjects::momentumError::write()
return true;
}
// ************************************************************************* //

View File

@ -30,28 +30,54 @@ Group
grpForcesFunctionObjects
Description
Produces a balance terms result for the steady momentum equation
Computes balance terms for the steady momentum equation.
Operands:
\table
Operand | Type | Location
input | - | -
output file | - | -
output field | volVectorField | $FOAM_CASE/\<time\>/\<file\>
\endtable
Usage
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
momErr
momentumError1
{
// Mandatory entries (unmodifiable)
type momentumError;
libs (fieldFunctionObjects);
// Optional entries (runtime modifiable)
p <pName>;
U <UName>;
phi <phiName>;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | Type name: momentumError| yes |
p | Pressure field name | no | p
U | Velocity field name | no | U
phi | Flux field name | no | phi
Property | Description | Type | Req'd | Dflt
type | Type name: momentumError | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
p | Name of pressure field | word | no | p
U | Name of velocity field | word | no | U
phi | Name of flux field | word | no | phi
\endtable
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
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::momentumError
SourceFiles
momentumError.C
@ -79,10 +105,9 @@ class momentumError
:
public fvMeshFunctionObject
{
protected:
// Protected data
// Protected Data
// Read from dictionary
@ -92,7 +117,7 @@ protected:
//- Name of velocity field
word UName_;
//- Flux
//- Name of flux field
word phiName_;
@ -101,12 +126,6 @@ protected:
//- Return the effective viscous stress (laminar + turbulent).
tmp<volVectorField> divDevRhoReff();
//- No copy construct
momentumError(const momentumError&) = delete;
//- No copy assignment
void operator=(const momentumError&) = delete;
public:
@ -124,9 +143,17 @@ public:
const dictionary& dict
);
//- No copy construct
momentumError(const momentumError&) = delete;
//- No copy assignment
void operator=(const momentumError&) = delete;
//- Destructor
virtual ~momentumError() = default;
// Member Functions
//- Read the forces data

View File

@ -31,53 +31,62 @@ Group
grpFieldFunctionObjects
Description
Samples near-patch volume fields.
Samples near-patch volume fields within an input distance range.
Fields are stored
- every time step the field is updated with new values
- at output it writes the fields
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
This functionObject can either be used
- to calculate a new field as a post-processing step or
- since the fields are registered, used in another functionObject
where \c \<Type\>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
Usage
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
nearWallFields1
{
type nearWallFields;
libs (fieldFunctionObjects);
writeControl writeTime;
// Mandatory entries (unmodifiable)
type nearWallFields;
libs (fieldFunctionObjects);
fields
(
(p pNear)
(U UNear)
(<field1> <outField1>)
(<field2> <outField2>)
);
patches (<patch1> <patch2> ... <patchN>);
distance 0.01;
patches (movingWall);
distance 0.13;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: nearWallFields | yes |
fields | list of fields with corresponding output field names | yes |
patches | list of patches to sample | yes |
distance | distance from patch to sample | yes |
log | Log to standard output | no | yes
Property | Description | Type | Req'd | Dflt
type | Type name: nearWallFields | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
fields | Names of input-output fields | wordHashTable | yes | -
patches | Names of patches to sample | wordList | yes | -
distance | Wall-normal distance from patch to sample | scalar | 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::nearWallFields
SourceFiles
nearWallFields.C
nearWallFieldsTemplates.C
\*---------------------------------------------------------------------------*/
@ -106,16 +115,13 @@ class nearWallFields
{
protected:
// Protected Member Data
// Protected Data
// Read from dictionary
//- Fields to process (input-name output-name)
List<Tuple2<word, word>> fieldSet_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Patches to sample
labelHashSet patchSet_;
@ -176,12 +182,6 @@ protected:
) const;
//- No copy construct
nearWallFields(const nearWallFields&) = delete;
//- No copy assignment
void operator=(const nearWallFields&) = delete;
public:
//- Runtime type information
@ -199,6 +199,12 @@ public:
const dictionary& dict
);
//- No copy construct
nearWallFields(const nearWallFields&) = delete;
//- No copy assignment
void operator=(const nearWallFields&) = delete;
//- Destructor
virtual ~nearWallFields() = default;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,7 +38,6 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(particleDistribution, 0);
addToRunTimeSelectionTable
(
functionObject,
@ -61,21 +60,15 @@ Foam::functionObjects::particleDistribution::particleDistribution
fvMeshFunctionObject(name, runTime, dict),
writeFile(runTime, name),
cloudName_("unknown-cloudName"),
nameVsBinWidth_(),
tagFieldName_("none"),
rndGen_(),
nameVsBinWidth_(),
writerPtr_(nullptr)
{
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::particleDistribution::~particleDistribution()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::particleDistribution::read(const dictionary& dict)
@ -83,8 +76,8 @@ bool Foam::functionObjects::particleDistribution::read(const dictionary& dict)
if (fvMeshFunctionObject::read(dict) && writeFile::read(dict))
{
dict.readEntry("cloud", cloudName_);
dict.readEntry("nameVsBinWidth", nameVsBinWidth_);
dict.readIfPresent("tagField", tagFieldName_);
dict.readEntry("nameVsBinWidth", nameVsBinWidth_);
const word format(dict.get<word>("setFormat"));
writerPtr_ = writer<scalar>::New(format);

View File

@ -32,40 +32,66 @@ Group
Description
Generates a particle distribution for lagrangian data at a given time.
Operands:
\table
Operand | Type | Location
input | - | -
output file | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | - | -
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
particleDistribution1
{
// Mandatory entries (unmodifiable)
type particleDistribution;
libs (fieldFunctionObjects);
...
cloud "myCloud";
// Mandatory entries (runtime modifiable)
cloud <cloudName>;
nameVsBinWidth
(
(d 0.1)
(U 10)
);
setFormat raw;
// Optional entries (runtime modifiable)
tagField none;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | Type name: particleDistribution | yes |
cloud | Name of cloud to process | Yes |
nameVsBinWidth | List of cloud field vs bin width | Yes |
tagField | Name of cloud field to use to group particles | no | none
setFormat | Output format | yes |
Property | Description | Type | Req'd | Dflt
type | Type name: particleDistribution | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
cloud | Name of cloud to process | word | yes | -
nameVsBinWidth | List of cloud field-bin width | wordHashTable | yes | -
setFormat | Output format | word | yes | -
tagField | Name of cloud field to use group particles | word | no | none
\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::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
Foam::functionObjects::timeControl
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::particleDistribution
SourceFiles
particleDistribution.C
particleDistributionTemplates.C
\*---------------------------------------------------------------------------*/
@ -97,20 +123,20 @@ class particleDistribution
{
protected:
// Protected data
// Protected Data
//- Cloud name
word cloudName_;
//- List of field name vs. bin width
List<Tuple2<word, scalar>> nameVsBinWidth_;
//- Tag field name - used to filter the particles into groups
word tagFieldName_;
//- Random number generator - used by distribution models
Random rndGen_;
//- List of field name vs. bin width
List<Tuple2<word, scalar>> nameVsBinWidth_;
//- Writer
autoPtr<writer<scalar>> writerPtr_;
@ -135,12 +161,6 @@ protected:
const List<DynamicList<label>>& addr
);
//- No copy construct
particleDistribution(const particleDistribution&) = delete;
//- No copy assignment
void operator=(const particleDistribution&) = delete;
public:
@ -158,9 +178,15 @@ public:
const dictionary& dict
);
//- No copy construct
particleDistribution(const particleDistribution&) = delete;
//- No copy assignment
void operator=(const particleDistribution&) = delete;
//- Destructor
virtual ~particleDistribution();
virtual ~particleDistribution() = default;
// Member Functions

View File

@ -43,6 +43,7 @@ namespace functionObjects
}
}
const Foam::Enum
<
Foam::functionObjects::pressure::mode
@ -56,6 +57,7 @@ Foam::functionObjects::pressure::modeNames
{ TOTAL_COEFF, "totalCoeff" },
});
const Foam::Enum
<
Foam::functionObjects::pressure::hydrostaticMode
@ -67,6 +69,7 @@ Foam::functionObjects::pressure::hydrostaticModeNames
{ SUBTRACT, "subtract" },
});
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::word Foam::functionObjects::pressure::resultName() const
@ -284,7 +287,6 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::calcPressure
return tresult;
}
return tresult;
}
@ -439,14 +441,13 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict)
}
if (mode_ & COEFF)
{
dict.readEntry("pInf", pInf_);
dict.readEntry("UInf", UInf_);
dict.readEntry("rhoInf", rhoInf_);
scalar zeroCheck = 0.5*rhoInf_*magSqr(UInf_) + pInf_;
const scalar zeroCheck = 0.5*rhoInf_*magSqr(UInf_) + pInf_;
if (mag(zeroCheck) < ROOTVSMALL)
{

View File

@ -31,93 +31,122 @@ Group
grpFieldFunctionObjects
Description
Includes tools to manipulate the pressure into different forms.
Provides several methods to convert an input pressure
field into derived forms, including:
These currently include:
- static pressure
\f[
p_s = p_{ref} + \rho p_k
\f]
- total pressure
\f[
p_0 = p_{ref} + p + 0.5 \rho |U|^2
p_0 = p_{ref} + p + 0.5 \rho |\vec U|^2
\f]
- isentropic pressure
\f[
p_i = p*(1 + ((gamma-1)*M^2)/2)^(gamma/(gamma - 1))
p_i = p*(1 + ((\gamma-1)*M^2)/2)^{(\gamma/(\gamma - 1))}
\f]
- static pressure coefficient
\f[
Cp = \frac{p_s - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2}
Cp = \frac{p_s - p_{\inf}}{0.5 \rho_{\inf} |\vec U_{\inf}|^2}
\f]
- total pressure coefficient
\f[
Cp_0 = \frac{p_0 - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2}
Cp_0 = \frac{p_0 - p_{\inf}}{0.5 \rho_{\inf} |\vec U_{\inf}|^2}
\f]
where
\vartable
\rho | Density [kg/m3]
U | Velocity [m/s]
\rho_{\inf} | Freestream density [kg/m3]
p_{\inf} | Freestream pressure [Pa]
U_{\inf} | Freestream velocity [m/s]
p_k | Kinematic pressure (p/rho)[m2/s2]
p_s | Statoc pressure [Pa]
p_0 | Total pressure [Pa]
p_{ref} | Reference pressure level [Pa]
p_i | Total isentropic pressure
Cp | Pressure coefficient
Cp_0 | Total pressure coefficient
\rho | Density [kg/m3]
\vec U | Velocity [m/s]
\rho_{\inf} | Freestream density [kg/m3]
p_{\inf} | Freestream pressure [Pa]
U_{\inf} | Freestream velocity [m/s]
p_k | Kinematic pressure (p/rho)[m2/s2]
p_s | Static pressure [Pa]
p_0 | Total pressure [Pa]
p_{ref} | Reference pressure level [Pa]
p_i | Total isentropic pressure
Cp | Pressure coefficient
Cp_0 | Total pressure coefficient
\gamma | Specific heat ratio
\endvartable
The function object will operate on both kinematic (\f$ p_k \f$) and static
pressure (\f$ p \f$) fields, and the result is written as a
volScalarField.
pressure (\f$ p \f$) fields.
Operands:
\table
Operand | Type | Location
input | volScalarField | $FOAM_CASE/<time>/<inpField>
output file | - | -
output field | volScalarField | $FOAM_CASE/<time>/<outField>
\endtable
Usage
Example of function object specification to calculate pressure coefficient:
Minimal example by using \c system/controlDict.functions:
\verbatim
pressure1
{
type pressure;
libs (fieldFunctionObjects);
// Mandatory entries (unmodifiable)
type pressure;
libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
mode <option>;
// Optional entries (runtime modifiable)
p <pName>;
U <UName>;
rho <rhoName>;
rhoInf 1.0; // enabled if rho=rhoInf
pRef 0.0;
hydroStaticMode none;
g (0 -9.81 0); // enabled if hydroStaticMode != none
hRef 0.0; // enabled if hydroStaticMode != none
pInf 0.0;
UInf (1 0 0);
// Optional (inherited) entries
...
mode staticCoeff;
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: pressure | yes |
field | Name of the pressure field | no | p
U | Name of the velocity field | no | U
rho | Name of the density field | no | rho
result | Name of the resulting field | no | derived from p
mode | Calculation mode (see below) | yes |
pRef | Reference pressure for total pressure | no | 0
pInf | Freestream pressure for coefficient calculation | no |
UInf | Freestream velocity for coefficient calculation | no |
rhoInf | Freestream density for coefficient calculation | no |
hydrostaticMode | Hydrostatic contributions (see below) | no | none
g | Gravity vector (see below) | no |
hRef | Reference height (see below) | no |
Property | Description | Type | Req'd | Dflt
type | Type name: pressure | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
mode | Calculation mode (see below) | word | yes | -
p | Name of the pressure field | word | no | p
U | Name of the velocity field | word | no | U
rho | Name of the density field | word | no | rho
rhoInf | Freestream density for coefficient calculation | scalar <!--
--> | conditional| -
pRef | Reference pressure for total pressure | scalar | no | 0
hydrostaticMode | Hydrostatic contributions (see below) | word | no | none
g | Gravity vector (see below) | vector | no | -
hRef | Reference height (see below) | scalar | no | -
pInf | Freestream pressure for coefficient calculation | scalar | no | -
UInf | Freestream velocity for coefficient calculation | vector | no | -
\endtable
The \c mode entry is used to select the type of pressure that is calculated.
Selections include:
- static
- total
- isentropic
- staticCoeff
- totalCoeff
Options for the \c mode entry:
\verbatim
static | static pressure
total | total pressure
isentropic | isentropic pressure
staticCoeff | static pressure coefficient
totalCoeff | total pressure coefficient
\endverbatim
The optional \c hydrostaticMode entry provides handling for the term
\f$ \rho (\vec{g} \dot \vec{h})\f$ where options include
- \c none : not included
- \c add : add the term, e.g. to convert from p_rgh to p
- \c subtract : subtract the term, e.g. to convert from p to p_rgh
\verbatim
none | not included
add | add the term, e.g. to convert from p_rgh to p
subtract | subtract the term, e.g. to convert from p to p_rgh
\endverbatim
If the \c hydrostaticMode is active, values are also required for
gravity, \c g, and reference height, \c hRef. By default these will be
@ -128,10 +157,17 @@ Usage
hRef 0;
\endverbatim
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::fieldExpression
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::pressure
SourceFiles
pressure.C
@ -191,7 +227,7 @@ public:
private:
// Private data
// Private Data
//- Calculation mode
mode mode_;
@ -199,10 +235,10 @@ private:
//- Hydrostatic constribution mode
hydrostaticMode hydrostaticMode_;
//- Name of velocity field, default is "U"
//- Name of velocity field
word UName_;
//- Name of density field, default is "rho"
//- Name of density field
word rhoName_;
@ -294,6 +330,12 @@ public:
const dictionary&
);
//- No copy construct
pressure(const pressure&) = delete;
//- No copy assignment
void operator=(const pressure&) = delete;
//- Destructor
virtual ~pressure() = default;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -75,12 +76,6 @@ Foam::functionObjects::processorField::processorField
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::processorField::~processorField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::processorField::read(const dictionary& dict)

View File

@ -32,28 +32,49 @@ Group
Description
Writes a scalar field whose value is the local processor ID. The output
field name is 'processorID'.
field name is \c processorID.
Operands:
\table
Operand | Type | Location
input | volScalarField | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
processorField1
{
// Mandatory entries (unmodifiable)
type processorField;
libs (fieldFunctionObjects);
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: processorField | yes |
log | Log to standard output | no | yes
Property | Description | Type | Req'd | Dflt
type | Type name: processorField | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func processorField
\endverbatim
See also
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::processorField
SourceFiles
processorField.C
@ -80,21 +101,6 @@ class processorField
:
public fvMeshFunctionObject
{
//- Result name
word resultName_;
//- Switch to send output to Info as well as to file
Switch log_;
// Private member functions
//- No copy construct
processorField(const processorField&) = delete;
//- No copy assignment
void operator=(const processorField&) = delete;
public:
//- Runtime type information
@ -111,9 +117,15 @@ public:
const dictionary& dict
);
//- No copy construct
processorField(const processorField&) = delete;
//- No copy assignment
void operator=(const processorField&) = delete;
//- Destructor
virtual ~processorField();
virtual ~processorField() = default;
// Member Functions

View File

@ -115,9 +115,9 @@ Foam::functionObjects::proudmanAcousticPower::proudmanAcousticPower
)
:
fvMeshFunctionObject(name, runTime, dict),
alphaEps_(0.1),
rhoInf_("0", dimDensity, -1),
aRef_(dimVelocity, Zero),
alphaEps_(0.1)
aRef_(dimVelocity, Zero)
{
read(dict);
@ -167,9 +167,9 @@ bool Foam::functionObjects::proudmanAcousticPower::read(const dictionary& dict)
{
if (fvMeshFunctionObject::read(dict))
{
dict.readIfPresent("alphaEps", alphaEps_);
rhoInf_.readIfPresent("rhoInf", dict);
aRef_.readIfPresent("aRef", dict);
dict.readIfPresent("alphaEps", alphaEps_);
return true;
}

View File

@ -30,17 +30,18 @@ Group
grpFieldFunctionObjects
Description
Calculates the acoustic power due to the volume of isotropic turbulence
using Proudman's formula
Computes the acoustic power due to the volume of isotropic turbulence
using Proudman's formula.
The acoustic power \f$ P_A \f$ [W/m3] in terms of turbulence \f$ k \f$
and \f$ \epsilon \f$ is given as:
The acoustic power, i.e. \f$ P_A \f$ [\f$W/m^3\f$], in terms of turbulent
kinetic energy, i.e. \f$ k \f$, and turbulent kinetic energy dissipation
rate, i.e. \f$ \epsilon \f$, is given as:
\f[
P_A = alpha_\epsilon \rho \epsilon M_t^5
P_A = \alpha_\epsilon \rho \epsilon M_t^5
\f]
where \f$ alpha_\epsilon \f$ is a constant (0.1) and
where \f$ \alpha_\epsilon = 0.1 \f$ is a constant and
\f[
M_t = \frac{\sqrt{2 k}}{a_0}
@ -50,43 +51,65 @@ Description
dB using:
\f[
L_P = 10 \log \frac{P_A}{P_ref}
L_P = 10 \log \frac{P_A}{P_{ref}}
\f]
where \f$ P_ref \f$ is a constant (1e-12 W/m3)
where \f$ P_{ref} = 1e^{-12} \f$ [\f$W/m^3\f$] is a constant.
Operands:
\table
Operand | Type | Location
input | volScalarField | $FOAM_CASE/\<time\>/\<inpField\>
output file | - | -
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Example of function object specification to calculate the Proudman acoustic
power:
Minimal example by using \c system/controlDict.functions:
\verbatim
proudmanAcousticPower1
{
// Mandatory entries (unmodifiable)
type proudmanAcousticPower;
libs (fieldFunctionObjects);
...
// Required additional entries for incompressible calculations
// Optional entries (runtime modifiable)
alphaEps 0.1;
// For incompressible flow simulations
rhoInf 1.225;
aRef 340;
// Optional (inherited) entries
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default
type | type name: proudmanAcousticPower | yes |
rhoInf | Freestream density (for incompressible) | no |
aRef | Reference speed of sound (for incompressible) | no |
alphaEps | Model coefficient | no | 0.1
Property | Description | Type | Req'd | Dflt
type | Type name: proudmanAcousticPower | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
rhoInf | Freestream density (for incompressible) | scalar <!--
--> | conditional | -
aRef | Speed of sound (incompressible) | scalar <!--
--> | conditional | -
alphaEps | Empirical model coefficient | scalar | no | 0.1
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
Usage by the \c postProcess utility is not available.
Note
The freestream density and reference speed of sound are only necessary
when a thermodynamics package is unavailable, typically for incompressible
cases.
See also
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::proudmanAcousticPower
SourceFiles
proudmanAcousticPower.C
@ -114,19 +137,17 @@ class proudmanAcousticPower
:
public fvMeshFunctionObject
{
private:
// Private Data
//- Empirical model coefficient
scalar alphaEps_;
//- Freestream density (incompressible calcs only)
dimensionedScalar rhoInf_;
//- Reference speed of sound (incompressible calcs only)
dimensionedScalar aRef_;
//- Model coefficient; default = 0.1
scalar alphaEps_;
// Private Member Functions
@ -153,6 +174,12 @@ public:
const dictionary&
);
//- No copy construct
proudmanAcousticPower(const proudmanAcousticPower&) = delete;
//- No copy assignment
void operator=(const proudmanAcousticPower&) = delete;
//- Destructor
virtual ~proudmanAcousticPower() = 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.
@ -71,12 +72,6 @@ Foam::functionObjects::randomise::randomise
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::randomise::~randomise()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::randomise::read(const dictionary& dict)

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,15 +31,66 @@ Group
grpFieldFunctionObjects
Description
Adds a random component to a field, with a specified perturbation magnitude.
Adds a random component to an input field,
with a specified perturbation magnitude.
The operation can be applied to any volume field.
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
randomise1
{
// Mandatory entries (unmodifiable)
type randomise;
libs (fieldFunctionObjects);
// Mandatory entries (runtime modifiable)
magPerturbation 0.1;
// 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: randomise | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
magPerturbation | The magnitude of the perturbation | scalar | 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 "randomise(<field>)"
\endverbatim
See also
Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObject
- Foam::functionObjects::fieldExpression
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::randomise
SourceFiles
randomise.C
randomiseTemplates.C
\*---------------------------------------------------------------------------*/
@ -62,7 +114,7 @@ class randomise
:
public fieldExpression
{
// Private member data
// Private Data
//- The magnitude of the perturbation
scalar magPerturbation_;
@ -94,9 +146,15 @@ public:
const dictionary& dict
);
//- No copy construct
randomise(const randomise&) = delete;
//- No copy assignment
void operator=(const randomise&) = delete;
//- Destructor
virtual ~randomise();
virtual ~randomise() = default;
// Member Functions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -182,14 +182,14 @@ reactionsSensitivityAnalysis
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(mesh_, name),
nReactions_(0),
startTime_(0),
endTime_(0),
production_(0),
consumption_(0),
productionInt_(0),
consumptionInt_(0),
startTime_(0),
endTime_(0),
speciesNames_(),
nReactions_(0),
prodFilePtr_(),
consFilePtr_(),
prodIntFilePtr_(),
@ -249,14 +249,6 @@ reactionsSensitivityAnalysis
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class chemistryType>
Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::
~reactionsSensitivityAnalysis()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class chemistryType>
@ -267,6 +259,7 @@ bool Foam::functionObjects::reactionsSensitivityAnalysis<chemistryType>::read
{
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
return true;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,19 +30,64 @@ Group
grpFieldFunctionObjects grpThermophysicalFunctionObjects
Description
This function object creates four data files named:
- "consumption" : consumption rate
- "production" : destruction rate
- "productionInt" : integral between dumps of the production rate
- "consumptionInt" : integral between dumps of the consumption rate
The function object indicates reaction rates of creation or destruction
Computes indicators for reaction rates of creation or destruction
of species in each reaction.
This function object creates four data files named:
- \c consumption : consumption rate
- \c production : destruction rate
- \c productionInt : integral between dumps of the production rate
- \c consumptionInt : integral between dumps of the consumption rate
Operands:
\table
Operand | Type | Location
input | - | -
output file | dat | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | - | -
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
reactionSensitivityAnalysis1
{
// Mandatory entries (unmodifiable)
type reactionSensitivityAnalysis;
libs (fieldFunctionObjects);
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: reactionSensitivityAnalysis | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
\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
- Function object only applicable to single cell cases.
- Needs a \c chemistryModel chosen.
See also
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- ExtendedCodeGuide::functionObjects::field::reactionsSensitivityAnalysis
SourceFiles
reactionsSensitivityAnalysis.C
reactionsSensitivityAnalysisObjects.C
\*---------------------------------------------------------------------------*/
@ -72,9 +117,17 @@ class reactionsSensitivityAnalysis
:
public fvMeshFunctionObject,
public writeFile
{
// Private data
// Private Data
//- Number of reactions
label nReactions_;
//- Start time of integration
scalar startTime_;
//- End time of integration
scalar endTime_;
//- List list for species production
scalarListList production_;
@ -88,19 +141,9 @@ class reactionsSensitivityAnalysis
//- List list for species consumption integral
scalarListList consumptionInt_;
//- Start time of integration
scalar startTime_;
//- End time of integration
scalar endTime_;
//- Word list of species
wordList speciesNames_;
//-Number of reactions
label nReactions_;
// File streams
//- Integrated coefficients
@ -116,10 +159,8 @@ class reactionsSensitivityAnalysis
autoPtr<OFstream> consIntFilePtr_;
// Private Member Functions
//- Create file names for forces and bins
void createFileNames();
@ -133,16 +174,6 @@ class reactionsSensitivityAnalysis
void writeSpeciesRR();
//- No copy construct
reactionsSensitivityAnalysis
(
const reactionsSensitivityAnalysis&
) = delete;
//- No copy assignment
void operator=(const reactionsSensitivityAnalysis&) = delete;
public:
//- Runtime type information
@ -159,9 +190,18 @@ public:
const dictionary& dict
);
//- No copy construct
reactionsSensitivityAnalysis
(
const reactionsSensitivityAnalysis&
) = delete;
//- No copy assignment
void operator=(const reactionsSensitivityAnalysis&) = delete;
//- Destructor
virtual ~reactionsSensitivityAnalysis();
virtual ~reactionsSensitivityAnalysis() = default;
// Member Functions

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.
@ -53,8 +53,8 @@ Foam::functionObjects::readFields::readFields
)
:
fvMeshFunctionObject(name, runTime, dict),
fieldSet_(),
readOnStart_(true)
readOnStart_(true),
fieldSet_()
{
read(dict);
@ -65,20 +65,14 @@ Foam::functionObjects::readFields::readFields
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::readFields::~readFields()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::readFields::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
dict.readEntry("fields", fieldSet_);
dict.readIfPresent("readOnStart", readOnStart_);
dict.readEntry("fields", fieldSet_);
return true;
}

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