openfoam/etc/codeTemplates/functionObject/FUNCTIONOBJECT.H
Kutalmis Bercin a5c6516e23 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
2020-06-08 15:43:47 +01:00

235 lines
6.2 KiB
C++

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) YEAR AUTHOR, AFFILIATION
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::FUNCTIONOBJECT
Group
grpFieldFunctionObjects
Description
<minimal description of the function object>
<equation>
\f[
x = x_{ref}^x + \rho \omega
\f]
<variable-explanation table>
where
\vartable
\rho | <explanation> [units, e.g. kg/m3]
\omega | \f$ \nabla \cdot \vec U \f$
... | ...
\endvartable
<inline equation>
where \f$ x_k \f$ is ...
<input-output table>
\table
Operand | Type | Location
input | {vol,surface}\<Type\>Field(s) <!--
--> |$FOAM_CASE/\<time\>/\<inpField\>s
output file | dat <!--
--> | $FOAM_CASE/postProcessing/\<FO\>/\<time\>/\<file\>
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
\endtable
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
FUNCTIONOBJECT1
{
// Mandatory entries (unmodifiable)
type FUNCTIONOBJECT;
libs (FUNCTIONOBJECTFunctionObject);
// Mandatory entries (runtime modifiable)
...
// Mandatory (inherited) entries (unmodifiable)
...
// Mandatory (inherited) entries (runtime unmodifiable)
...
// Optional entries (unmodifiable)
...
// Optional entries (runtime modifiable)
boolData <bool>;
labelData <label>;
wordData <word>;
scalarData <scalar>;
// Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Dflt
type | Type name: FUNCTIONOBJECT | word | yes | -
libs | Library name: FUNCTIONOBJECTFunctionObject <!--
--> | word | yes | -
boolData | <explanation> | bool | yes | -
labelData | <explanation> | label | yes | -
wordData | <explanation> | word | yes | -
scalarData | <explanation> | scalar | no | 1.0
wordListData | <explanation> | wordList | yes | -
\endtable
Options for the \c ENTRY entry:
\verbatim
<option1>
<option2> | <explanation>
...
\endverbatim
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
- \link fieldsExpression.H \endlink
- \link writeFile.H \endlink
...
<if \c postProcess is applicable>
Minimal example by using the \c postProcess utility:
\verbatim
postProcess -func FUNCTIONOBJECT
\endverbatim
<if \c postProcess is not applicable>
Usage by the \c postProcess utility is not available.
Note
- <note1>
- <note2>
...
See also
- Foam::functionObject
- Foam::functionObjects::fvMeshFunctionObject
- ExtendedCodeGuide::functionObjects::field::FUNCTIONOBJECT
...
SourceFiles
FUNCTIONOBJECT.C
FUNCTIONOBJECTTEMPLATES.C
...
\*---------------------------------------------------------------------------*/
#ifndef FUNCTIONOBJECT_H
#define FUNCTIONOBJECT_H
#include "fvMeshFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class FUNCTIONOBJECT Declaration
\*---------------------------------------------------------------------------*/
class FUNCTIONOBJECT
:
public fvMeshFunctionObject
{
// Private Data
//- bool
bool boolData_;
//- label
label labelData_;
//- word
word wordData_;
//- scalar
scalar scalarData_;
public:
//- Runtime type information
TypeName("FUNCTIONOBJECT");
// Constructors
//- Construct from Time and dictionary
FUNCTIONOBJECT
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- No copy construct
FUNCTIONOBJECT(const FUNCTIONOBJECT&) = delete;
//- No copy assignment
void operator=(const FUNCTIONOBJECT&) = delete;
//- Destructor
virtual ~FUNCTIONOBJECT() = default;
// Member Functions
//- Read the FUNCTIONOBJECT data
virtual bool read(const dictionary& dict);
//- Execute, currently does nothing
virtual bool execute();
//- Execute at the final time-loop, currently does nothing
virtual bool end();
//- Write the FUNCTIONOBJECT
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //