Commit ce7a93a8 authored by andy's avatar andy
Browse files

ENH: Added new yPlusLES function object

parent 7df1e911
......@@ -12,6 +12,9 @@ staticPressure/staticPressureFunctionObject.C
timeActivatedFileUpdate/timeActivatedFileUpdate.C
timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C
yPlusLES/yPlusLES.C
yPlusLES/yPlusLESFunctionObject.C
yPlusRAS/yPlusRAS.C
yPlusRAS/yPlusRASFunctionObject.C
......
......@@ -8,7 +8,8 @@ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude
LIB_LIBS = \
-lfiniteVolume \
......@@ -19,4 +20,6 @@ LIB_LIBS = \
-lincompressibleTransportModels \
-lcompressibleRASModels \
-lincompressibleRASModels \
-lcompressibleLESModels \
-lincompressibleLESModels \
-lbasicThermophysicalModels
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Typedef
Foam::IOyPlusLES
Description
Instance of the generic IOOutputFilter for yPlusLES.
\*---------------------------------------------------------------------------*/
#ifndef IOyPlusLES_H
#define IOyPlusLES_H
#include "yPlusLES.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<yPlusLES> IOyPlusLES;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
#include "yPlusLES.H"
#include "volFields.H"
#include "incompressible/LES/LESModel/LESModel.H"
#include "compressible/LES/LESModel/LESModel.H"
#include "wallFvPatch.H"
#include "nearWallDist.H"
//#include "wallDist.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::yPlusLES, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::yPlusLES::calcIncompressibleYPlus
(
const fvMesh& mesh,
const volVectorField& U,
volScalarField& yPlus
) const
{
const incompressible::LESModel& model =
mesh.lookupObject<incompressible::LESModel>("LESProperties");
volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y();
volScalarField nuEff(model.nuEff());
const fvPatchList& patches = mesh.boundary();
const volScalarField nuLam(model.nu());
Info<< type() << " output:" << nl;
bool foundPatch = false;
forAll(patches, patchI)
{
const fvPatch& currPatch = patches[patchI];
if (isA<wallFvPatch>(currPatch))
{
foundPatch = true;
yPlus.boundaryField()[patchI] =
d[patchI]
*sqrt
(
nuEff.boundaryField()[patchI]
*mag(U.boundaryField()[patchI].snGrad())
)
/nuLam.boundaryField()[patchI];
const scalarField& Yp = yPlus.boundaryField()[patchI];
Info<< " patch " << currPatch.name()
<< " y+ : min = " << min(Yp) << ", max = " << max(Yp)
<< ", average = " << average(Yp) << nl;
}
}
if (!foundPatch)
{
Info<< " no " << wallFvPatch::typeName << " patches" << endl;
}
}
void Foam::yPlusLES::calcCompressibleYPlus
(
const fvMesh& mesh,
const volVectorField& U,
volScalarField& yPlus
) const
{
const compressible::LESModel& model =
mesh.lookupObject<compressible::LESModel>("LESProperties");
volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y();
volScalarField muEff(model.muEff());
const fvPatchList& patches = mesh.boundary();
const volScalarField muLam(model.mu());
Info<< type() << " output:" << nl;
bool foundPatch = false;
forAll(patches, patchI)
{
const fvPatch& currPatch = patches[patchI];
if (isA<wallFvPatch>(currPatch))
{
foundPatch = true;
yPlus.boundaryField()[patchI] =
d[patchI]
*sqrt
(
muEff.boundaryField()[patchI]
*mag(U.boundaryField()[patchI].snGrad())
)
/muLam.boundaryField()[patchI];
const scalarField& Yp = yPlus.boundaryField()[patchI];
Info<< " patch " << currPatch.name()
<< " y+ : min = " << min(Yp) << ", max = " << max(Yp)
<< ", average = " << average(Yp) << nl;
}
}
if (!foundPatch)
{
Info<< " no " << wallFvPatch::typeName << " patches" << endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::yPlusLES::yPlusLES
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
phiName_("phi"),
UName_("U")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"yPlusLES::yPlusLES"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
<< endl;
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::yPlusLES::~yPlusLES()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::yPlusLES::read(const dictionary& dict)
{
if (active_)
{
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
}
}
void Foam::yPlusLES::execute()
{
// Do nothing - only valid on write
}
void Foam::yPlusLES::end()
{
// Do nothing - only valid on write
}
void Foam::yPlusLES::write()
{
if (active_)
{
const surfaceScalarField& phi =
obr_.lookupObject<surfaceScalarField>(phiName_);
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField yPlusLES
(
IOobject
(
"yPlusLES",
mesh.time().timeName(),
mesh,
IOobject::NO_READ
),
mesh,
dimensionedScalar("0", dimless, 0.0)
);
if (phi.dimensions() == dimMass/dimTime)
{
calcCompressibleYPlus(mesh, U, yPlusLES);
}
else
{
calcIncompressibleYPlus(mesh, U, yPlusLES);
}
Info<< endl;
yPlusLES.write();
}
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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::yPlusLES
Description
Evaluates and outputs turbulence y+ for LES models. Values written to
time folders as field 'yPlusLES'
SourceFiles
yPlusLES.C
IOyPlusLES.H
\*---------------------------------------------------------------------------*/
#ifndef yPlusLES_H
#define yPlusLES_H
#include "volFieldsFwd.H"
#include "pointFieldFwd.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class yPlusLES Declaration
\*---------------------------------------------------------------------------*/
class yPlusLES
{
// Private data
//- Name of this set of yPlusLES objects
word name_;
const objectRegistry& obr_;
//- on/off switch
bool active_;
//- Name of mass/volume flux field (optional, default = phi)
word phiName_;
//- Name of velocity field
word UName_;
// Private Member Functions
//- Calculate incompressible form of y+
void calcIncompressibleYPlus
(
const fvMesh& mesh,
const volVectorField& U,
volScalarField& yPlus
) const;
//- Calculate compressible form of y+
void calcCompressibleYPlus
(
const fvMesh& mesh,
const volVectorField& U,
volScalarField& yPlus
) const;
//- Disallow default bitwise copy construct
yPlusLES(const yPlusLES&);
//- Disallow default bitwise assignment
void operator=(const yPlusLES&);
public:
//- Runtime type information
TypeName("yPlusLES");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
yPlusLES
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~yPlusLES();
// Member Functions
//- Return name of the set of yPlusLES
virtual const word& name() const
{
return name_;
}
//- Read the yPlusLES data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the yPlusLES and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
#include "yPlusLESFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(yPlusLESFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
yPlusLESFunctionObject,
dictionary
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Typedef
Foam::yPlusLESFunctionObject
Description
FunctionObject wrapper around yPlusLES to allow it to be created
via the functions entry within controlDict.
SourceFiles
yPlusLESFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef yPlusLESFunctionObject_H
#define yPlusLESFunctionObject_H
#include "yPlusLES.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<yPlusLES> yPlusLESFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -59,12 +59,12 @@ void Foam::yPlusRAS::calcIncompressibleYPlus
Info<< type() << " output:" << nl;
bool foundNutPatch = false;
bool foundPatch = false;
forAll(nutPatches, patchi)
{
if (isA<wallFunctionPatchField>(nutPatches[patchi]))
{
foundNutPatch = true;
foundPatch = true;
const wallFunctionPatchField& nutPw =
dynamic_cast<const wallFunctionPatchField&>(nutPatches[patchi]);
......@@ -78,7 +78,7 @@ void Foam::yPlusRAS::calcIncompressibleYPlus
}
}