functionObjects: Upgrade to use new turbulence modeling library

This commit is contained in:
Henry
2015-05-17 14:56:40 +01:00
parent 03264802a3
commit b5d3f85bd4
25 changed files with 276 additions and 1410 deletions

View File

@ -52,7 +52,6 @@ void calcYPlus
(
const TurbulenceModel& turbulenceModel,
const fvMesh& mesh,
const Time& runTime,
const volVectorField& U,
volScalarField& yPlus
)
@ -128,7 +127,7 @@ void calcIncompressibleYPlus
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
calcYPlus(turbulenceModel, mesh, runTime, U, yPlus);
calcYPlus(turbulenceModel, mesh, U, yPlus);
}
@ -174,7 +173,7 @@ void calcCompressibleYPlus
)
);
calcYPlus(turbulenceModel, mesh, runTime, U, yPlus);
calcYPlus(turbulenceModel, mesh, U, yPlus);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,51 +24,32 @@ License
\*---------------------------------------------------------------------------*/
#include "CourantNo.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "dictionary.H"
#include "zeroGradientFvPatchFields.H"
#include "fvcSurfaceIntegrate.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(CourantNo, 0);
defineTypeNameAndDebug(CourantNo, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::CourantNo::rho
Foam::tmp<Foam::volScalarField::DimensionedInternalField>
Foam::CourantNo::byRho
(
const surfaceScalarField& phi
const tmp<volScalarField::DimensionedInternalField>& Co
) const
{
if (phi.dimensions() == dimMass/dimTime)
if (Co().dimensions() == dimDensity)
{
return (obr_.lookupObject<volScalarField>(rhoName_));
return Co/obr_.lookupObject<volScalarField>(rhoName_);
}
else
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"rho",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("rho", dimless, 1.0)
)
);
return Co;
}
}
@ -162,23 +143,19 @@ void Foam::CourantNo::execute()
const surfaceScalarField& phi =
mesh.lookupObject<surfaceScalarField>(phiName_);
volScalarField& CourantNo =
volScalarField& Co =
const_cast<volScalarField&>
(
mesh.lookupObject<volScalarField>(type())
);
scalarField& iField = CourantNo.internalField();
const scalarField sumPhi
Co.dimensionedInternalField() = byRho
(
fvc::surfaceSum(mag(phi))().internalField()
/rho(phi)().internalField()
(0.5*mesh.time().deltaT())
*fvc::surfaceSum(mag(phi))().dimensionedInternalField()
/mesh.V()
);
iField = 0.5*sumPhi/mesh.V().field()*mesh.time().deltaTValue();
CourantNo.correctBoundaryConditions();
Co.correctBoundaryConditions();
}
}
@ -193,9 +170,7 @@ void Foam::CourantNo::end()
void Foam::CourantNo::timeSet()
{
// Do nothing
}
{}
void Foam::CourantNo::write()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,10 +41,7 @@ SourceFiles
#ifndef CourantNo_H
#define CourantNo_H
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "OFstream.H"
#include "Switch.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -83,9 +80,11 @@ class CourantNo
// Private Member Functions
//- Return 1 if the flux field is volumetric, otherwise return rho
// from the database
tmp<volScalarField> rho(const surfaceScalarField& p) const;
//- Divide Co by rho if required
tmp<volScalarField::DimensionedInternalField> byRho
(
const tmp<volScalarField::DimensionedInternalField>& Co
) const;
//- Disallow default bitwise copy construct
CourantNo(const CourantNo&);

View File

@ -1,242 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 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 "DESModelRegions.H"
#include "volFields.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "compressible/LES/DESModel/DESModel.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "incompressible/LES/DESModel/DESModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(DESModelRegions, 0);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::DESModelRegions::writeFileHeader(const label i)
{
writeHeader(file(), "DES model region coverage (% volume)");
writeCommented(file(), "Time");
writeTabbed(file(), "LES");
writeTabbed(file(), "RAS");
file() << endl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::DESModelRegions::DESModelRegions
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName),
name_(name),
obr_(obr),
active_(true),
log_(false)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"DESModelRegions::DESModelRegions"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField* DESModelRegionsPtr
(
new volScalarField
(
IOobject
(
type(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimless, 0.0)
)
);
mesh.objectRegistry::store(DESModelRegionsPtr);
}
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::DESModelRegions::~DESModelRegions()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::DESModelRegions::read(const dictionary& dict)
{
if (active_)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
}
}
void Foam::DESModelRegions::execute()
{
typedef incompressible::turbulenceModel icoModel;
typedef incompressible::DESModel icoDESModel;
typedef compressible::turbulenceModel cmpModel;
typedef compressible::DESModel cmpDESModel;
if (active_)
{
functionObjectFile::write();
const fvMesh& mesh = refCast<const fvMesh>(obr_);
Info(log_)<< type() << " " << name_ << " output:" << nl;
volScalarField& DESModelRegions =
const_cast<volScalarField&>
(
mesh.lookupObject<volScalarField>(type())
);
label DESpresent = false;
if (mesh.foundObject<icoModel>(turbulenceModel::propertiesName))
{
const icoModel& model =
mesh.lookupObject<icoModel>(turbulenceModel::propertiesName);
if (isA<icoDESModel>(model))
{
const icoDESModel& des =
dynamic_cast<const icoDESModel&>(model);
DESModelRegions == des.LESRegion();
DESpresent = true;
}
}
else if (mesh.foundObject<cmpModel>(turbulenceModel::propertiesName))
{
const cmpModel& model =
mesh.lookupObject<cmpModel>(turbulenceModel::propertiesName);
if (isA<cmpDESModel>(model))
{
const cmpDESModel& des =
dynamic_cast<const cmpDESModel&>(model);
DESModelRegions == des.LESRegion();
DESpresent = true;
}
}
if (DESpresent)
{
scalar prc =
gSum(DESModelRegions.internalField()*mesh.V())
/gSum(mesh.V())*100.0;
if (Pstream::master() && log_)
{
file() << obr_.time().value()
<< token::TAB << prc
<< token::TAB << 100.0 - prc
<< endl;
}
Info(log_)
<< " LES = " << prc << " % (volume)" << nl
<< " RAS = " << 100.0 - prc << " % (volume)" << endl;
}
else
{
Info(log_)<< " No DES turbulence model found in database" << nl
<< endl;
}
}
}
void Foam::DESModelRegions::end()
{
if (active_)
{
execute();
}
}
void Foam::DESModelRegions::timeSet()
{
// Do nothing
}
void Foam::DESModelRegions::write()
{
if (log_)
{
const volScalarField& DESModelRegions =
obr_.lookupObject<volScalarField>(type());
Info<< type() << " " << name_ << " output:" << nl
<< " writing field " << DESModelRegions.name() << nl
<< endl;
DESModelRegions.write();
}
}
// ************************************************************************* //

View File

@ -1,163 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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::DESModelRegions
Group
grpUtilitiesFunctionObjects
Description
This function object writes out an indicator field for DES turbulence
calculations, that is:
- 0 for RAS regions
- 1 for LES regions
SourceFiles
DESModelRegions.C
IODESModelRegions.H
\*---------------------------------------------------------------------------*/
#ifndef DESModelRegions_H
#define DESModelRegions_H
#include "functionObjectFile.H"
#include "volFieldsFwd.H"
#include "Switch.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
class fvMesh;
/*---------------------------------------------------------------------------*\
Class DESModelRegions Declaration
\*---------------------------------------------------------------------------*/
class DESModelRegions
:
public functionObjectFile
{
protected:
// Protected data
//- Name of this set of DESModelRegions object
word name_;
const objectRegistry& obr_;
//- on/off switch
bool active_;
//- Switch to send output to Info as well as to file
Switch log_;
// Protected Member Functions
//- File header information
virtual void writeFileHeader(const label i);
//- Disallow default bitwise copy construct
DESModelRegions(const DESModelRegions&);
//- Disallow default bitwise assignment
void operator=(const DESModelRegions&);
public:
//- Runtime type information
TypeName("DESModelRegions");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
DESModelRegions
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~DESModelRegions();
// Member Functions
//- Return name of the set of DESModelRegions
virtual const word& name() const
{
return name_;
}
//- Read the DESModelRegions 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();
//- Called when time was set at the end of the Time::operator++
virtual void timeSet();
//- Calculate the DESModelRegions and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const polyMesh&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,42 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "DESModelRegionsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(DESModelRegionsFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
DESModelRegionsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -1,54 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::DESModelRegionsFunctionObject
Description
FunctionObject wrapper around DESModelRegions to allow it to be created
via the functions entry within controlDict.
SourceFiles
DESModelRegionsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef DESModelRegionsFunctionObject_H
#define DESModelRegionsFunctionObject_H
#include "DESModelRegions.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<DESModelRegions>
DESModelRegionsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,49 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::IODESModelRegions
Description
Instance of the generic IOOutputFilter for DESModelRegions.
\*---------------------------------------------------------------------------*/
#ifndef IODESModelRegions_H
#define IODESModelRegions_H
#include "DESModelRegions.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<DESModelRegions> IODESModelRegions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -5,50 +5,39 @@ CourantNo/CourantNoFunctionObject.C
Lambda2/Lambda2.C
Lambda2/Lambda2FunctionObject.C
/*
Peclet/Peclet.C
Peclet/PecletFunctionObject.C
*/
Q/Q.C
Q/QFunctionObject.C
blendingFactor/blendingFactor.C
blendingFactor/blendingFactorFunctionObject.C
/*
DESModelRegions/DESModelRegions.C
DESModelRegions/DESModelRegionsFunctionObject.C
*/
dsmcFields/dsmcFields.C
dsmcFields/dsmcFieldsFunctionObject.C
pressureTools/pressureTools.C
pressureTools/pressureToolsFunctionObject.C
/*
scalarTransport/scalarTransport.C
scalarTransport/scalarTransportFunctionObject.C
*/
timeActivatedFileUpdate/timeActivatedFileUpdate.C
timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C
/*
turbulenceFields/turbulenceFields.C
turbulenceFields/turbulenceFieldsFunctionObject.C
*/
vorticity/vorticity.C
vorticity/vorticityFunctionObject.C
/*
wallShearStress/wallShearStress.C
wallShearStress/wallShearStressFunctionObject.C
*/
/*
yPlusLES/yPlusLES.C
yPlusLES/yPlusLESFunctionObject.C
*/
yPlusRAS/yPlusRAS.C
yPlusRAS/yPlusRASFunctionObject.C
yPlus/yPlus.C
yPlus/yPlusFunctionObject.C
setTimeStep/setTimeStepFunctionObject.C

View File

@ -1,20 +1,29 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/DSMC/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lsampling \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-llagrangian \
-lDSMC \
-lincompressibleTransportModels \
-lturbulenceModels \
-lfluidThermophysicalModels
-lfiniteVolume \
-lmeshTools \
-lsampling

View File

@ -27,8 +27,8 @@ License
#include "volFields.H"
#include "dictionary.H"
#include "surfaceFields.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "surfaceInterpolate.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -34,14 +34,14 @@ License
#include "fvcDiv.H"
#include "fvmLaplacian.H"
#include "fvmSup.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(scalarTransport, 0);
defineTypeNameAndDebug(scalarTransport, 0);
}

View File

@ -25,8 +25,8 @@ License
#include "turbulenceFields.H"
#include "dictionary.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -26,15 +26,15 @@ License
#include "wallShearStress.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(wallShearStress, 0);
defineTypeNameAndDebug(wallShearStress, 0);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,24 +22,24 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::IOyPlusLES
Foam::IOyPlus
Description
Instance of the generic IOOutputFilter for yPlusLES.
Instance of the generic IOOutputFilter for yPlus.
\*---------------------------------------------------------------------------*/
#ifndef IOyPlusLES_H
#define IOyPlusLES_H
#ifndef IOyPlus_H
#define IOyPlus_H
#include "yPlusLES.H"
#include "yPlus.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<yPlusLES> IOyPlusLES;
typedef IOOutputFilter<yPlus> IOyPlus;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,24 +23,24 @@ License
\*---------------------------------------------------------------------------*/
#include "yPlusRAS.H"
#include "yPlus.H"
#include "volFields.H"
#include "turbulenceModel.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(yPlusRAS, 0);
defineTypeNameAndDebug(yPlus, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::yPlusRAS::writeFileHeader(const label i)
void Foam::yPlus::writeFileHeader(const label i)
{
writeHeader(file(), "y+ (RAS)");
writeHeader(file(), "y+ ()");
writeCommented(file(), "Time");
writeTabbed(file(), "patch");
@ -51,68 +51,9 @@ void Foam::yPlusRAS::writeFileHeader(const label i)
}
void Foam::yPlusRAS::calcYPlus
(
const fvMesh& mesh,
volScalarField& yPlus
)
{
const turbulenceModel& model = mesh.lookupObject<turbulenceModel>
(
turbulenceModel::propertiesName
);
const volScalarField nut(model.nut());
const volScalarField::GeometricBoundaryField& nutPatches =
nut.boundaryField();
bool foundPatch = false;
forAll(nutPatches, patchi)
{
if (isA<nutWallFunctionFvPatchScalarField>(nutPatches[patchi]))
{
foundPatch = true;
const nutWallFunctionFvPatchScalarField& nutPw =
dynamic_cast
<
const nutWallFunctionFvPatchScalarField&
>(nutPatches[patchi]);
yPlus.boundaryField()[patchi] = nutPw.yPlus();
const scalarField& Yp = yPlus.boundaryField()[patchi];
scalar minYp = gMin(Yp);
scalar maxYp = gMax(Yp);
scalar avgYp = gAverage(Yp);
if (Pstream::master())
{
Info(log_)<< " patch " << nutPw.patch().name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
file() << obr_.time().value()
<< token::TAB << nutPw.patch().name()
<< token::TAB << minYp
<< token::TAB << maxYp
<< token::TAB << avgYp
<< endl;
}
}
}
if (log_ && !foundPatch)
{
Info<< " no " << nutWallFunctionFvPatchScalarField::typeName
<< " patches" << endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::yPlusRAS::yPlusRAS
Foam::yPlus::yPlus
(
const word& name,
const objectRegistry& obr,
@ -133,7 +74,7 @@ Foam::yPlusRAS::yPlusRAS
active_ = false;
WarningIn
(
"yPlusRAS::yPlusRAS"
"yPlus::yPlus"
"("
"const word&, "
"const objectRegistry&, "
@ -148,7 +89,7 @@ Foam::yPlusRAS::yPlusRAS
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField* yPlusRASPtr
volScalarField* yPlusPtr
(
new volScalarField
(
@ -165,20 +106,20 @@ Foam::yPlusRAS::yPlusRAS
)
);
mesh.objectRegistry::store(yPlusRASPtr);
mesh.objectRegistry::store(yPlusPtr);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::yPlusRAS::~yPlusRAS()
Foam::yPlus::~yPlus()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::yPlusRAS::read(const dictionary& dict)
void Foam::yPlus::read(const dictionary& dict)
{
if (active_)
{
@ -188,15 +129,18 @@ void Foam::yPlusRAS::read(const dictionary& dict)
}
void Foam::yPlusRAS::execute()
void Foam::yPlus::execute()
{
typedef compressible::turbulenceModel cmpModel;
typedef incompressible::turbulenceModel icoModel;
if (active_)
{
functionObjectFile::write();
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField& yPlusRAS =
volScalarField& yPlus =
const_cast<volScalarField&>
(
mesh.lookupObject<volScalarField>(type())
@ -204,12 +148,32 @@ void Foam::yPlusRAS::execute()
Info(log_)<< type() << " " << name_ << " output:" << nl;
calcYPlus(mesh, yPlusRAS);
tmp<volSymmTensorField> Reff;
if (mesh.foundObject<cmpModel>(turbulenceModel::propertiesName))
{
const cmpModel& model =
mesh.lookupObject<cmpModel>(turbulenceModel::propertiesName);
calcYPlus(model, mesh, yPlus);
}
else if (mesh.foundObject<icoModel>(turbulenceModel::propertiesName))
{
const icoModel& model =
mesh.lookupObject<icoModel>(turbulenceModel::propertiesName);
calcYPlus(model, mesh, yPlus);
}
else
{
FatalErrorIn("void Foam::yPlus::write()")
<< "Unable to find turbulence model in the "
<< "database" << exit(FatalError);
}
}
}
void Foam::yPlusRAS::end()
void Foam::yPlus::end()
{
if (active_)
{
@ -218,24 +182,24 @@ void Foam::yPlusRAS::end()
}
void Foam::yPlusRAS::timeSet()
void Foam::yPlus::timeSet()
{
// Do nothing
}
void Foam::yPlusRAS::write()
void Foam::yPlus::write()
{
if (active_)
{
functionObjectFile::write();
const volScalarField& yPlusRAS =
const volScalarField& yPlus =
obr_.lookupObject<volScalarField>(type());
Info(log_)<< " writing field " << yPlusRAS.name() << nl << endl;
Info(log_)<< " writing field " << yPlus.name() << nl << endl;
yPlusRAS.write();
yPlus.write();
}
}

View File

@ -22,23 +22,23 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::yPlusRAS
Foam::yPlus
Group
grpUtilitiesFunctionObjects
Description
Evaluates and outputs turbulence y+ for RAS models. Values written to
time directories as field 'yPlusRAS'
Evaluates and outputs turbulence y+ for models. Values written to
time directories as field 'yPlus'
SourceFiles
yPlusRAS.C
IOyPlusRAS.H
yPlus.C
IOyPlus.H
\*---------------------------------------------------------------------------*/
#ifndef yPlusRAS_H
#define yPlusRAS_H
#ifndef yPlus_H
#define yPlus_H
#include "functionObjectFile.H"
#include "volFieldsFwd.H"
@ -58,16 +58,16 @@ class mapPolyMesh;
class fvMesh;
/*---------------------------------------------------------------------------*\
Class yPlusRAS Declaration
Class yPlus Declaration
\*---------------------------------------------------------------------------*/
class yPlusRAS
class yPlus
:
public functionObjectFile
{
// Private data
//- Name of this set of yPlusRAS objects
//- Name of this set of yPlus objects
word name_;
const objectRegistry& obr_;
@ -88,26 +88,32 @@ class yPlusRAS
virtual void writeFileHeader(const label i);
//- Calculate y+
void calcYPlus(const fvMesh& mesh, volScalarField& yPlus);
template<class TurbulenceModel>
void calcYPlus
(
const TurbulenceModel& turbulenceModel,
const fvMesh& mesh,
volScalarField& yPlus
);
//- Disallow default bitwise copy construct
yPlusRAS(const yPlusRAS&);
yPlus(const yPlus&);
//- Disallow default bitwise assignment
void operator=(const yPlusRAS&);
void operator=(const yPlus&);
public:
//- Runtime type information
TypeName("yPlusRAS");
TypeName("yPlus");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
yPlusRAS
yPlus
(
const word& name,
const objectRegistry&,
@ -117,18 +123,18 @@ public:
//- Destructor
virtual ~yPlusRAS();
virtual ~yPlus();
// Member Functions
//- Return name of the set of yPlusRAS
//- Return name of the set of yPlus
virtual const word& name() const
{
return name_;
}
//- Read the yPlusRAS data
//- Read the yPlus data
virtual void read(const dictionary&);
//- Execute, currently does nothing
@ -140,7 +146,7 @@ public:
//- Called when time was set at the end of the Time::operator++
virtual void timeSet();
//- Calculate the yPlusRAS and write
//- Calculate the yPlus and write
virtual void write();
//- Update for changes of mesh
@ -159,6 +165,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "yPlusTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,18 +23,18 @@ License
\*---------------------------------------------------------------------------*/
#include "yPlusRASFunctionObject.H"
#include "yPlusFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(yPlusRASFunctionObject, 0);
defineNamedTemplateTypeNameAndDebug(yPlusFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
yPlusRASFunctionObject,
yPlusFunctionObject,
dictionary
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,28 +22,28 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::yPlusRASFunctionObject
Foam::yPlusFunctionObject
Description
FunctionObject wrapper around yPlusRAS to allow it to be created
FunctionObject wrapper around yPlus to allow it to be created
via the functions entry within controlDict.
SourceFiles
yPlusRASFunctionObject.C
yPlusFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef yPlusRASFunctionObject_H
#define yPlusRASFunctionObject_H
#ifndef yPlusFunctionObject_H
#define yPlusFunctionObject_H
#include "yPlusRAS.H"
#include "yPlus.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<yPlusRAS> yPlusRASFunctionObject;
typedef OutputFilterFunctionObject<yPlus> yPlusFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,122 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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 "yPlus.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "nearWallDist.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class TurbulenceModel>
void Foam::yPlus::calcYPlus
(
const TurbulenceModel& turbulenceModel,
const fvMesh& mesh,
volScalarField& yPlus
)
{
volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y();
const volScalarField::GeometricBoundaryField nutBf =
turbulenceModel.nut()().boundaryField();
const volScalarField::GeometricBoundaryField nuEffBf =
turbulenceModel.nuEff()().boundaryField();
const volScalarField::GeometricBoundaryField nuBf =
turbulenceModel.nu()().boundaryField();
const fvPatchList& patches = mesh.boundary();
forAll(patches, patchi)
{
const fvPatch& patch = patches[patchi];
if (isA<nutWallFunctionFvPatchScalarField>(nutBf[patchi]))
{
const nutWallFunctionFvPatchScalarField& nutPf =
dynamic_cast<const nutWallFunctionFvPatchScalarField&>
(
nutBf[patchi]
);
yPlus.boundaryField()[patchi] = nutPf.yPlus();
const scalarField& yPlusp = yPlus.boundaryField()[patchi];
const scalar minYplus = gMin(yPlusp);
const scalar maxYplus = gMax(yPlusp);
const scalar avgYplus = gAverage(yPlusp);
if (Pstream::master())
{
Info(log_)
<< " patch " << patch.name()
<< " y+ : min = " << minYplus << ", max = " << maxYplus
<< ", average = " << avgYplus << nl;
file() << obr_.time().value()
<< token::TAB << patch.name()
<< token::TAB << minYplus
<< token::TAB << maxYplus
<< token::TAB << avgYplus
<< endl;
}
}
else if (isA<wallFvPatch>(patch))
{
yPlus.boundaryField()[patchi] =
d[patchi]
*sqrt
(
nuEffBf[patchi]
*mag(turbulenceModel.U().boundaryField()[patchi].snGrad())
)/nuBf[patchi];
const scalarField& yPlusp = yPlus.boundaryField()[patchi];
const scalar minYplus = gMin(yPlusp);
const scalar maxYplus = gMax(yPlusp);
const scalar avgYplus = gAverage(yPlusp);
if (Pstream::master())
{
Info(log_)
<< " patch " << patch.name()
<< " y+ : min = " << minYplus << ", max = " << maxYplus
<< ", average = " << avgYplus << nl;
file() << obr_.time().value()
<< token::TAB << patch.name()
<< token::TAB << minYplus
<< token::TAB << maxYplus
<< token::TAB << avgYplus
<< endl;
}
}
}
}
// ************************************************************************* //

View File

@ -1,329 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 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"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(yPlusLES, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::yPlusLES::writeFileHeader(const label i)
{
writeHeader(file(), "y+ (LES)");
writeCommented(file(), "Time");
writeTabbed(file(), "patch");
writeTabbed(file(), "min");
writeTabbed(file(), "max");
writeTabbed(file(), "average");
file() << endl;
}
void Foam::yPlusLES::calcIncompressibleYPlus
(
const fvMesh& mesh,
const volVectorField& U,
volScalarField& yPlus
)
{
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());
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];
scalar minYp = gMin(Yp);
scalar maxYp = gMax(Yp);
scalar avgYp = gAverage(Yp);
if (Pstream::master())
{
Info(log_)<< " patch " << currPatch.name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
file() << obr_.time().value()
<< token::TAB << currPatch.name()
<< token::TAB << minYp
<< token::TAB << maxYp
<< token::TAB << avgYp
<< endl;
}
}
}
if (log_ && !foundPatch)
{
Info<< " no " << wallFvPatch::typeName << " patches" << endl;
}
}
void Foam::yPlusLES::calcCompressibleYPlus
(
const fvMesh& mesh,
const volVectorField& U,
volScalarField& yPlus
)
{
const compressible::LESModel& model =
mesh.lookupObject<compressible::LESModel>("LESProperties");
volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y();
volScalarField muEff(model.muEff());
const volScalarField& rho(model.rho());
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]/rho.boundaryField()[patchi])
*mag(U.boundaryField()[patchi].snGrad())
)
/(muLam.boundaryField()[patchi]/rho.boundaryField()[patchi]);
const scalarField& Yp = yPlus.boundaryField()[patchi];
scalar minYp = gMin(Yp);
scalar maxYp = gMax(Yp);
scalar avgYp = gAverage(Yp);
if (Pstream::master())
{
Info(log_)<< " patch " << currPatch.name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
file() << obr_.time().value()
<< token::TAB << currPatch.name()
<< token::TAB << minYp
<< token::TAB << maxYp
<< token::TAB << avgYp
<< endl;
}
}
}
if (log_ && !foundPatch)
{
Info<< " no " << wallFvPatch::typeName << " patches" << endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::yPlusLES::yPlusLES
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName),
name_(name),
obr_(obr),
active_(true),
log_(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 " << name_ << nl
<< endl;
}
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField* yPlusLESPtr
(
new volScalarField
(
IOobject
(
type(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimless, 0.0)
)
);
mesh.objectRegistry::store(yPlusLESPtr);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::yPlusLES::~yPlusLES()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::yPlusLES::read(const dictionary& dict)
{
if (active_)
{
log_ = dict.lookupOrDefault<Switch>("log", true);
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
}
}
void Foam::yPlusLES::execute()
{
if (active_)
{
functionObjectFile::write();
const surfaceScalarField& phi =
obr_.lookupObject<surfaceScalarField>(phiName_);
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField& yPlusLES =
const_cast<volScalarField&>
(
mesh.lookupObject<volScalarField>(type())
);
Info(log_)<< type() << " " << name_ << " output:" << nl;
if (phi.dimensions() == dimMass/dimTime)
{
calcCompressibleYPlus(mesh, U, yPlusLES);
}
else
{
calcIncompressibleYPlus(mesh, U, yPlusLES);
}
}
}
void Foam::yPlusLES::end()
{
if (active_)
{
execute();
}
}
void Foam::yPlusLES::timeSet()
{
// Do nothing
}
void Foam::yPlusLES::write()
{
if (active_)
{
functionObjectFile::write();
const volScalarField& yPlusLES =
obr_.lookupObject<volScalarField>(type());
Info(log_)<< " writing field " << yPlusLES.name() << nl << endl;
yPlusLES.write();
}
}
// ************************************************************************* //

View File

@ -1,180 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 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
Group
grpUtilitiesFunctionObjects
Description
Evaluates and outputs turbulence y+ for LES models. Values written to
time directories as field 'yPlusLES'
SourceFiles
yPlusLES.C
IOyPlusLES.H
\*---------------------------------------------------------------------------*/
#ifndef yPlusLES_H
#define yPlusLES_H
#include "functionObjectFile.H"
#include "volFieldsFwd.H"
#include "Switch.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
class fvMesh;
/*---------------------------------------------------------------------------*\
Class yPlusLES Declaration
\*---------------------------------------------------------------------------*/
class yPlusLES
:
public functionObjectFile
{
// Private data
//- Name of this set of yPlusLES objects
word name_;
const objectRegistry& obr_;
//- on/off switch
bool active_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Name of mass/volume flux field (optional, default = phi)
word phiName_;
//- Name of velocity field
word UName_;
// Private Member Functions
//- File header information
virtual void writeFileHeader(const label i);
//- Calculate incompressible form of y+
void calcIncompressibleYPlus
(
const fvMesh& mesh,
const volVectorField& U,
volScalarField& yPlus
);
//- Calculate compressible form of y+
void calcCompressibleYPlus
(
const fvMesh& mesh,
const volVectorField& U,
volScalarField& yPlus
);
//- 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();
//- Called when time was set at the end of the Time::operator++
virtual void timeSet();
//- 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 polyMesh&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,42 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
);
}
// ************************************************************************* //

View File

@ -1,53 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //

View File

@ -1,49 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::IOyPlusRAS
Description
Instance of the generic IOOutputFilter for yPlusRAS.
\*---------------------------------------------------------------------------*/
#ifndef IOyPlusRAS_H
#define IOyPlusRAS_H
#include "yPlusRAS.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<yPlusRAS> IOyPlusRAS;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //