diff --git a/src/postProcessing/functionObjects/utilities/Make/files b/src/postProcessing/functionObjects/utilities/Make/files index 5737e2f473..f6e23536e0 100644 --- a/src/postProcessing/functionObjects/utilities/Make/files +++ b/src/postProcessing/functionObjects/utilities/Make/files @@ -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 diff --git a/src/postProcessing/functionObjects/utilities/Make/options b/src/postProcessing/functionObjects/utilities/Make/options index ecc2c0a411..9acdda40ef 100644 --- a/src/postProcessing/functionObjects/utilities/Make/options +++ b/src/postProcessing/functionObjects/utilities/Make/options @@ -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 diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/IOyPlusLES.H b/src/postProcessing/functionObjects/utilities/yPlusLES/IOyPlusLES.H new file mode 100644 index 0000000000..55c541ab8f --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/IOyPlusLES.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +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 IOyPlusLES; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C new file mode 100644 index 0000000000..59436ba7da --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C @@ -0,0 +1,248 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#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("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(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("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(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(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("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(phiName_); + + const volVectorField& U = obr_.lookupObject(UName_); + + const fvMesh& mesh = refCast(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(); + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H new file mode 100644 index 0000000000..48b9a1186a --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H @@ -0,0 +1,163 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +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 + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.C b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.C new file mode 100644 index 0000000000..77ea1c21a3 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#include "yPlusLESFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(yPlusLESFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + yPlusLESFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.H b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.H new file mode 100644 index 0000000000..35a19abb69 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLESFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +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 yPlusLESFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C index 788d9f19ff..188c79bba5 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C @@ -59,12 +59,12 @@ void Foam::yPlusRAS::calcIncompressibleYPlus Info<< type() << " output:" << nl; - bool foundNutPatch = false; + bool foundPatch = false; forAll(nutPatches, patchi) { if (isA(nutPatches[patchi])) { - foundNutPatch = true; + foundPatch = true; const wallFunctionPatchField& nutPw = dynamic_cast(nutPatches[patchi]); @@ -78,7 +78,7 @@ void Foam::yPlusRAS::calcIncompressibleYPlus } } - if (!foundNutPatch) + if (!foundPatch) { Info<< " no " << wallFunctionPatchField::typeName << " patches" << endl; @@ -104,12 +104,12 @@ void Foam::yPlusRAS::calcCompressibleYPlus Info<< type() << " output:" << nl; - bool foundMutPatch = false; + bool foundPatch = false; forAll(mutPatches, patchi) { if (isA(mutPatches[patchi])) { - foundMutPatch = true; + foundPatch = true; const wallFunctionPatchField& mutPw = dynamic_cast(mutPatches[patchi]); @@ -123,7 +123,7 @@ void Foam::yPlusRAS::calcCompressibleYPlus } } - if (!foundMutPatch) + if (!foundPatch) { Info<< " no " << wallFunctionPatchField::typeName << " patches" << endl; diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H index 5b8a0031cc..040e6f86bb 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H @@ -52,7 +52,7 @@ class dictionary; class mapPolyMesh; /*---------------------------------------------------------------------------*\ - Class yPlusRAS Declaration + Class yPlusRAS Declaration \*---------------------------------------------------------------------------*/ class yPlusRAS