mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
DOC: solverInfo FO: improve header-file documentation
- TUT: solverInfo FO: add an example to pisoFoam/cavity
This commit is contained in:
committed by
Andrew Heather
parent
02129b0846
commit
b4724c37ad
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2016 OpenFOAM Foundation
|
Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,13 +36,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(solverInfo, 0);
|
defineTypeNameAndDebug(solverInfo, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, solverInfo, dictionary);
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
functionObject,
|
|
||||||
solverInfo,
|
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +90,7 @@ void Foam::functionObjects::solverInfo::createResidualField
|
|||||||
|
|
||||||
if (!mesh_.foundObject<IOField<scalar>>(residualName))
|
if (!mesh_.foundObject<IOField<scalar>>(residualName))
|
||||||
{
|
{
|
||||||
IOField<scalar>* fieldPtr =
|
auto* fieldPtr =
|
||||||
new IOField<scalar>
|
new IOField<scalar>
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -129,8 +123,8 @@ Foam::functionObjects::solverInfo::solverInfo
|
|||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
writeFile(obr_, name, typeName, dict),
|
writeFile(obr_, name, typeName, dict),
|
||||||
fieldSet_(mesh_),
|
fieldSet_(mesh_),
|
||||||
writeResidualFields_(false),
|
|
||||||
residualFieldNames_(),
|
residualFieldNames_(),
|
||||||
|
writeResidualFields_(false),
|
||||||
initialised_(false)
|
initialised_(false)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
@ -147,8 +141,7 @@ bool Foam::functionObjects::solverInfo::read(const dictionary& dict)
|
|||||||
|
|
||||||
fieldSet_.read(dict);
|
fieldSet_.read(dict);
|
||||||
|
|
||||||
writeResidualFields_ =
|
writeResidualFields_ = dict.getOrDefault("writeResidualFields", false);
|
||||||
dict.getOrDefault("writeResidualFields", false);
|
|
||||||
|
|
||||||
residualFieldNames_.clear();
|
residualFieldNames_.clear();
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2016 OpenFOAM Foundation
|
Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,7 +31,7 @@ Group
|
|||||||
grpUtilitiesFunctionObjects
|
grpUtilitiesFunctionObjects
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Writes solver information for a list of user-specified fields
|
Writes solver information for a list of user-specified fields.
|
||||||
|
|
||||||
Information written to file includes:
|
Information written to file includes:
|
||||||
- residual fields
|
- residual fields
|
||||||
@ -39,39 +39,60 @@ Description
|
|||||||
- initial residual
|
- initial residual
|
||||||
- final residual
|
- final residual
|
||||||
- number of solver iterations
|
- number of solver iterations
|
||||||
- convergecnce flag
|
- convergence flag
|
||||||
|
|
||||||
|
Operands:
|
||||||
|
\table
|
||||||
|
Operand | Type | Location
|
||||||
|
input | - | -
|
||||||
|
output file | dat <!--
|
||||||
|
--> | postProcessing/\<FO\>/\<time\>/\<file\>(s)
|
||||||
|
output field | volScalarField(s) <!--
|
||||||
|
--> | \<time\>/initialResiduals:\<outField\>(s)
|
||||||
|
\endtable
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
Example of function object specification:
|
Minimal example by using \c system/controlDict.functions:
|
||||||
\verbatim
|
\verbatim
|
||||||
solverInfo
|
solverInfo1
|
||||||
{
|
{
|
||||||
|
// Mandatory entries (unmodifiable)
|
||||||
type solverInfo;
|
type solverInfo;
|
||||||
libs (utilityFunctionObjects);
|
libs (utilityFunctionObjects);
|
||||||
|
|
||||||
|
// Mandatory entries (runtime modifiable)
|
||||||
|
fields (<field1> <field2> ... <fieldN>);
|
||||||
|
|
||||||
|
// Optional entries (runtime modifiable)
|
||||||
|
writeResidualFields true;
|
||||||
|
|
||||||
|
// Inherited entries
|
||||||
...
|
...
|
||||||
fields (U p);
|
|
||||||
writeResidualFields yes;
|
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
Where the entries comprise:
|
where the entries mean:
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Type | Reqd | Deflt
|
||||||
type | Type name: solverInfo | yes |
|
type | Type name: solverInfo | word | yes | -
|
||||||
fields | List of fields to process | yes |
|
libs | Library name: utilityFunctionObjects | word | yes | -
|
||||||
writeResidualFields | Write the residual fields | no | no
|
fields | Names of operand fields | wordList | yes | -
|
||||||
|
writeResidualFields | Flag to write the initial-residual fields <!--
|
||||||
|
--> | bool | no | false
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Output data is written to the dir postProcessing/solverInfo/\<timeDir\>/
|
The inherited entries are elaborated in:
|
||||||
|
- \link functionObject.H \endlink
|
||||||
|
- \link writeFile.H \endlink
|
||||||
|
|
||||||
See also
|
See also
|
||||||
Foam::functionObject
|
- Foam::functionObject
|
||||||
Foam::functionObjects::fvMeshFunctionObject
|
- Foam::functionObjects::fvMeshFunctionObject
|
||||||
Foam::functionObjects::writeFile
|
- Foam::functionObjects::writeFile
|
||||||
Foam::functionObjects::timeControl
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
solverInfo.C
|
solverInfo.C
|
||||||
|
solverInfoTemplates.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -100,17 +121,17 @@ class solverInfo
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected Data
|
||||||
|
|
||||||
//- Fields to process
|
//- Names of operand fields
|
||||||
solverFieldSelection fieldSet_;
|
solverFieldSelection fieldSet_;
|
||||||
|
|
||||||
//- Flag to write the residual as a vol field
|
|
||||||
bool writeResidualFields_;
|
|
||||||
|
|
||||||
//- Names of (result) residual fields
|
//- Names of (result) residual fields
|
||||||
wordHashSet residualFieldNames_;
|
wordHashSet residualFieldNames_;
|
||||||
|
|
||||||
|
//- Flag to write the initial-residual as a vol field
|
||||||
|
bool writeResidualFields_;
|
||||||
|
|
||||||
//- Initialisation flag
|
//- Initialisation flag
|
||||||
bool initialised_;
|
bool initialised_;
|
||||||
|
|
||||||
@ -136,9 +157,7 @@ protected:
|
|||||||
void updateSolverInfo(const word& fieldName);
|
void updateSolverInfo(const word& fieldName);
|
||||||
|
|
||||||
|
|
||||||
private:
|
// Generated Methods
|
||||||
|
|
||||||
// Private member functions
|
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
solverInfo(const solverInfo&) = delete;
|
solverInfo(const solverInfo&) = delete;
|
||||||
@ -170,13 +189,13 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Read the controls
|
//- Read solverInfo settings
|
||||||
virtual bool read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Execute solverInfo
|
||||||
virtual bool execute();
|
virtual bool execute();
|
||||||
|
|
||||||
//- Write the solverInfo
|
//- Write solverInfo results
|
||||||
virtual bool write();
|
virtual bool write();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2016 OpenFOAM Foundation
|
Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -51,7 +51,7 @@ void Foam::functionObjects::solverInfo::writeFileHeader
|
|||||||
mesh_.validComponents<Type>()
|
mesh_.validComponents<Type>()
|
||||||
);
|
);
|
||||||
|
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
|
||||||
{
|
{
|
||||||
if (component(validComponents, cmpt) != -1)
|
if (component(validComponents, cmpt) != -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -0,0 +1,42 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2012 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
solverInfo1
|
||||||
|
{
|
||||||
|
// Mandatory entries
|
||||||
|
type solverInfo;
|
||||||
|
libs (utilityFunctionObjects);
|
||||||
|
fields
|
||||||
|
(
|
||||||
|
k
|
||||||
|
epsilon
|
||||||
|
p
|
||||||
|
U
|
||||||
|
)
|
||||||
|
|
||||||
|
// Optional entries
|
||||||
|
writeResidualFields true;
|
||||||
|
|
||||||
|
// Optional (inherited) entries
|
||||||
|
writePrecision 16;
|
||||||
|
writeToFile true;
|
||||||
|
useUserTime true;
|
||||||
|
|
||||||
|
region region0;
|
||||||
|
enabled true;
|
||||||
|
log true;
|
||||||
|
timeStart 0;
|
||||||
|
timeEnd 1000;
|
||||||
|
executeControl timeStep;
|
||||||
|
executeInterval 1;
|
||||||
|
writeControl writeTime;
|
||||||
|
writeInterval -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -47,6 +47,7 @@ runTimeModifiable true;
|
|||||||
|
|
||||||
functions
|
functions
|
||||||
{
|
{
|
||||||
|
// field function objects
|
||||||
#include "FOfieldAverage"
|
#include "FOfieldAverage"
|
||||||
#include "FOadd"
|
#include "FOadd"
|
||||||
#include "FOblendingFactor"
|
#include "FOblendingFactor"
|
||||||
@ -94,6 +95,9 @@ functions
|
|||||||
#include "FOwriteCellVolumes"
|
#include "FOwriteCellVolumes"
|
||||||
#include "FOyPlus"
|
#include "FOyPlus"
|
||||||
#include "FOzeroGradient"
|
#include "FOzeroGradient"
|
||||||
|
|
||||||
|
// utility function objects
|
||||||
|
#include "FOsolverInfo"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user