functionObjects::writeLocalObjects: Provides support for controlled writing of field

defined by functionObjects, e.g. wallHeatFlux, wallShearStress and yPlus.

Patch contributed by Bruno Santos
Resolves bug-report http://bugs.openfoam.org/view.php?id=2353
This commit is contained in:
Henry Weller
2016-12-09 21:54:13 +00:00
parent 3140cfa906
commit 249c09933e
13 changed files with 731 additions and 123 deletions

View File

@ -104,6 +104,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
:
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name),
writeLocalObjects(obr_, log),
patchSet_()
{
volScalarField* wallHeatFluxPtr
@ -127,6 +128,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
read(dict);
resetName(typeName);
resetLocalObjectName(typeName);
}
@ -141,6 +143,7 @@ Foam::functionObjects::wallHeatFlux::~wallHeatFlux()
bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
writeLocalObjects::read(dict);
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
@ -229,16 +232,15 @@ bool Foam::functionObjects::wallHeatFlux::execute()
bool Foam::functionObjects::wallHeatFlux::write()
{
Log << type() << " " << name() << " write:" << nl;
writeLocalObjects::write();
logFiles::write();
const volScalarField& wallHeatFlux =
obr_.lookupObject<volScalarField>(type());
Log << type() << " " << name() << " write:" << nl
<< " writing field " << wallHeatFlux.name() << endl;
wallHeatFlux.write();
const fvPatchList& patches = mesh_.boundary();
const surfaceScalarField::Boundary& magSf =
@ -249,8 +251,7 @@ bool Foam::functionObjects::wallHeatFlux::write()
label patchi = iter.key();
const fvPatch& pp = patches[patchi];
const scalarField& hfp =
wallHeatFlux.boundaryField()[patchi];
const scalarField& hfp = wallHeatFlux.boundaryField()[patchi];
const scalar minHfp = gMin(hfp);
const scalar maxHfp = gMax(hfp);
@ -267,10 +268,12 @@ bool Foam::functionObjects::wallHeatFlux::write()
<< endl;
}
Log << " min/max(" << pp.name() << ") = "
Log << " min/max/integ(" << pp.name() << ") = "
<< minHfp << ", " << maxHfp << ", " << integralHfp << endl;
}
Log << endl;
return true;
}

View File

@ -52,10 +52,15 @@ Usage
patches | list of patches to process | no | all wall patches
\endtable
Note
Writing field 'wallHeatFlux' is done by default, but it can be overridden by
defining an empty \c objects list. For details see writeLocalObjects.
See also
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::logFiles
Foam::functionObjects::writeLocalObjects
Foam::functionObjects::pressureTools
Foam::functionObjects::timeControl
@ -69,6 +74,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "logFiles.H"
#include "writeLocalObjects.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "HashSet.H"
@ -88,7 +94,8 @@ namespace functionObjects
class wallHeatFlux
:
public fvMeshFunctionObject,
public logFiles
public logFiles,
public writeLocalObjects
{
protected:

View File

@ -90,6 +90,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
:
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name),
writeLocalObjects(obr_, log),
patchSet_()
{
volVectorField* wallShearStressPtr
@ -118,6 +119,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
read(dict);
resetName(typeName);
resetLocalObjectName(typeName);
}
@ -132,6 +134,7 @@ Foam::functionObjects::wallShearStress::~wallShearStress()
bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
writeLocalObjects::read(dict);
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
@ -225,16 +228,15 @@ bool Foam::functionObjects::wallShearStress::execute()
bool Foam::functionObjects::wallShearStress::write()
{
Log << type() << " " << name() << " write:" << nl;
writeLocalObjects::write();
logFiles::write();
const volVectorField& wallShearStress =
obr_.lookupObject<volVectorField>(type());
Log << type() << " " << name() << " write:" << nl
<< " writing field " << wallShearStress.name() << endl;
wallShearStress.write();
const fvPatchList& patches = mesh_.boundary();
forAllConstIter(labelHashSet, patchSet_, iter)
@ -260,6 +262,8 @@ bool Foam::functionObjects::wallShearStress::write()
<< minSsp << ", " << maxSsp << endl;
}
Log << endl;
return true;
}

View File

@ -63,10 +63,15 @@ Usage
patches | list of patches to process | no | all wall patches
\endtable
Note
Writing field 'wallShearStress' is done by default, but it can be overridden
by defining an empty \c objects list. For details see writeLocalObjects.
See also
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::logFiles
Foam::functionObjects::writeLocalObjects
Foam::functionObjects::pressureTools
Foam::functionObjects::timeControl
@ -80,6 +85,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "logFiles.H"
#include "writeLocalObjects.H"
#include "volFieldsFwd.H"
#include "HashSet.H"
@ -97,7 +103,8 @@ namespace functionObjects
class wallShearStress
:
public fvMeshFunctionObject,
public logFiles
public logFiles,
public writeLocalObjects
{
protected:

View File

@ -121,7 +121,8 @@ Foam::functionObjects::yPlus::yPlus
)
:
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name)
logFiles(obr_, name),
writeLocalObjects(obr_, log)
{
volScalarField* yPlusPtr
(
@ -144,6 +145,7 @@ Foam::functionObjects::yPlus::yPlus
read(dict);
resetName(typeName);
resetLocalObjectName(typeName);
}
@ -158,6 +160,7 @@ Foam::functionObjects::yPlus::~yPlus()
bool Foam::functionObjects::yPlus::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
writeLocalObjects::read(dict);
return true;
}
@ -193,16 +196,15 @@ bool Foam::functionObjects::yPlus::execute()
bool Foam::functionObjects::yPlus::write()
{
const volScalarField& yPlus =
obr_.lookupObject<volScalarField>(type());
Log << type() << " " << name() << " write:" << nl;
Log << type() << " " << name() << " write:" << nl
<< " writing field " << yPlus.name() << endl;
yPlus.write();
writeLocalObjects::write();
logFiles::write();
const volScalarField& yPlus =
mesh_.lookupObject<volScalarField>(type());
const volScalarField::Boundary& yPlusBf = yPlus.boundaryField();
const fvPatchList& patches = mesh_.boundary();
@ -235,6 +237,8 @@ bool Foam::functionObjects::yPlus::write()
}
}
Log << endl;
return true;
}

View File

@ -28,13 +28,34 @@ Group
grpFieldFunctionObjects
Description
Evaluates and outputs turbulence y+ for models. Values written to
time directories as field 'yPlus'
Evaluates and outputs turbulence y+ for models. Values written to
time directories as field 'yPlus'.
Example of function object specification:
\verbatim
yPlus1
{
type yPlus;
libs ("libfieldFunctionObjects.so");
...
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | type name: yPlus | yes |
\endtable
Note
Writing field 'yPlus' is done by default, but it can be overridden by
defining an empty \c objects list. For details see writeLocalObjects.
See also
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::logFiles
Foam::functionObjects::writeLocalObjects
Foam::functionObjects::timeControl
SourceFiles
@ -47,6 +68,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "logFiles.H"
#include "writeLocalObjects.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -67,7 +89,8 @@ namespace functionObjects
class yPlus
:
public fvMeshFunctionObject,
public logFiles
public logFiles,
public writeLocalObjects
{
// Private Member Functions