functionObjects: Further simplification and rationalization using the fvMeshFunctionObject base-class

This commit is contained in:
Henry Weller
2016-08-10 12:29:19 +01:00
parent 5602c48426
commit 4765702445
35 changed files with 256 additions and 447 deletions

View File

@ -65,11 +65,10 @@ void Foam::functionObjects::yPlus::writeFileHeader(const label i)
void Foam::functionObjects::yPlus::calcYPlus
(
const turbulenceModel& turbModel,
const fvMesh& mesh,
volScalarField& yPlus
)
{
volScalarField::Boundary d = nearWallDist(mesh).y();
volScalarField::Boundary d = nearWallDist(mesh_).y();
const volScalarField::Boundary nutBf =
turbModel.nut()().boundaryField();
@ -80,7 +79,7 @@ void Foam::functionObjects::yPlus::calcYPlus
const volScalarField::Boundary nuBf =
turbModel.nu()().boundaryField();
const fvPatchList& patches = mesh.boundary();
const fvPatchList& patches = mesh_.boundary();
volScalarField::Boundary& yPlusBf = yPlus.boundaryFieldRef();
@ -121,17 +120,9 @@ Foam::functionObjects::yPlus::yPlus
const dictionary& dict
)
:
regionFunctionObject(name, runTime, dict),
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name)
{
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField* yPlusPtr
(
new volScalarField
@ -139,17 +130,17 @@ Foam::functionObjects::yPlus::yPlus
IOobject
(
type(),
mesh.time().timeName(),
mesh,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
mesh_,
dimensionedScalar("0", dimless, 0.0)
)
);
mesh.objectRegistry::store(yPlusPtr);
mesh_.objectRegistry::store(yPlusPtr);
resetName(typeName);
}
@ -165,7 +156,7 @@ Foam::functionObjects::yPlus::~yPlus()
bool Foam::functionObjects::yPlus::read(const dictionary& dict)
{
regionFunctionObject::read(dict);
fvMeshFunctionObject::read(dict);
return true;
}
@ -173,20 +164,20 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict)
bool Foam::functionObjects::yPlus::execute()
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField& yPlus =
const_cast<volScalarField&>
(
mesh.lookupObject<volScalarField>(type())
mesh_.lookupObject<volScalarField>(type())
);
if (mesh.foundObject<turbulenceModel>(turbulenceModel::propertiesName))
if (mesh_.foundObject<turbulenceModel>(turbulenceModel::propertiesName))
{
const turbulenceModel& model =
mesh.lookupObject<turbulenceModel>(turbulenceModel::propertiesName);
const turbulenceModel& model = mesh_.lookupObject<turbulenceModel>
(
turbulenceModel::propertiesName
);
calcYPlus(model, mesh, yPlus);
calcYPlus(model, yPlus);
}
else
{
@ -212,9 +203,7 @@ bool Foam::functionObjects::yPlus::write()
logFiles::write();
const volScalarField::Boundary& yPlusBf = yPlus.boundaryField();
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const fvPatchList& patches = mesh.boundary();
const fvPatchList& patches = mesh_.boundary();
forAll(patches, patchi)
{
@ -236,7 +225,7 @@ bool Foam::functionObjects::yPlus::write()
writeTime(file());
file()
<< token::TAB << patch.name()
<< token::TAB << patch.name()
<< token::TAB << minYplus
<< token::TAB << maxYplus
<< token::TAB << avgYplus

View File

@ -33,7 +33,7 @@ Description
See also
Foam::functionObject
Foam::functionObjects::regionFunctionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::logFiles
Foam::functionObjects::timeControl
@ -45,7 +45,7 @@ SourceFiles
#ifndef functionObjects_yPlus_H
#define functionObjects_yPlus_H
#include "regionFunctionObject.H"
#include "fvMeshFunctionObject.H"
#include "logFiles.H"
#include "volFieldsFwd.H"
@ -55,7 +55,6 @@ namespace Foam
{
// Forward declaration of classes
class fvMesh;
class turbulenceModel;
namespace functionObjects
@ -67,7 +66,7 @@ namespace functionObjects
class yPlus
:
public regionFunctionObject,
public fvMeshFunctionObject,
public logFiles
{
// Private Member Functions
@ -79,7 +78,6 @@ class yPlus
void calcYPlus
(
const turbulenceModel& turbModel,
const fvMesh& mesh,
volScalarField& yPlus
);