mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,5 +2,6 @@ LESdelta/LESdelta.C
|
|||||||
cubeRootVolDelta/cubeRootVolDelta.C
|
cubeRootVolDelta/cubeRootVolDelta.C
|
||||||
PrandtlDelta/PrandtlDelta.C
|
PrandtlDelta/PrandtlDelta.C
|
||||||
smoothDelta/smoothDelta.C
|
smoothDelta/smoothDelta.C
|
||||||
|
maxhxhyhzDelta/maxhxhyhzDelta.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libLESdeltas
|
LIB = $(FOAM_LIBBIN)/libLESdeltas
|
||||||
|
|||||||
@ -0,0 +1,142 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
|
\\/ 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 "maxhxhyhzDelta.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(maxhxhyhzDelta, 0);
|
||||||
|
addToRunTimeSelectionTable(LESdelta, maxhxhyhzDelta, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void maxhxhyhzDelta::calcDelta()
|
||||||
|
{
|
||||||
|
label nD = mesh().nGeometricD();
|
||||||
|
|
||||||
|
tmp<volScalarField> hmax
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"hmax",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
dimensionedScalar("zrero", dimLength, 0.0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const cellList& cells = mesh().cells();
|
||||||
|
|
||||||
|
forAll(cells,cellI)
|
||||||
|
{
|
||||||
|
scalar deltaMaxTmp = 0.0;
|
||||||
|
const labelList& cFaces = mesh().cells()[cellI];
|
||||||
|
const point& centrevector = mesh().cellCentres()[cellI];
|
||||||
|
|
||||||
|
forAll(cFaces, cFaceI)
|
||||||
|
{
|
||||||
|
label faceI = cFaces[cFaceI];
|
||||||
|
const point& facevector = mesh().faceCentres()[faceI];
|
||||||
|
scalar tmp = mag(facevector - centrevector);
|
||||||
|
if (tmp > deltaMaxTmp)
|
||||||
|
{
|
||||||
|
deltaMaxTmp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hmax()[cellI] = deltaCoeff_*deltaMaxTmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nD == 3)
|
||||||
|
{
|
||||||
|
delta_.internalField() = hmax();
|
||||||
|
}
|
||||||
|
else if (nD == 2)
|
||||||
|
{
|
||||||
|
WarningIn("maxhxhyhzDelta::calcDelta()")
|
||||||
|
<< "Case is 2D, LES is not strictly applicable\n"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
delta_.internalField() = hmax();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn("maxhxhyhzDelta::calcDelta()")
|
||||||
|
<< "Case is not 3D or 2D, LES is not applicable"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
maxhxhyhzDelta::maxhxhyhzDelta
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& dd
|
||||||
|
)
|
||||||
|
:
|
||||||
|
LESdelta(name, mesh),
|
||||||
|
deltaCoeff_(readScalar(dd.subDict(type() + "Coeffs").lookup("deltaCoeff")))
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void maxhxhyhzDelta::read(const dictionary& dd)
|
||||||
|
{
|
||||||
|
dd.subDict(type() + "Coeffs").lookup("deltaCoeff") >> deltaCoeff_;
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void maxhxhyhzDelta::correct()
|
||||||
|
{
|
||||||
|
if (mesh_.changing())
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,111 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
|
\\/ 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::maxhxhyhzDelta
|
||||||
|
|
||||||
|
Description
|
||||||
|
maxhxhyhzDelta takes the maximum of the three dimensions per cell:
|
||||||
|
max(hx, hy, hz). Valid for structures hexahedral cells only.
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
maxhxhyhzDelta.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef maxhxhyhzDeltaDelta_H
|
||||||
|
#define maxhxhyhzDeltaDelta_H
|
||||||
|
|
||||||
|
#include "LESdelta.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class maxhxhyhzDelta Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class maxhxhyhzDelta
|
||||||
|
:
|
||||||
|
public LESdelta
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
scalar deltaCoeff_; //
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct and assignment
|
||||||
|
maxhxhyhzDelta(const maxhxhyhzDelta&);
|
||||||
|
void operator=(const maxhxhyhzDelta&);
|
||||||
|
|
||||||
|
// Calculate the delta values
|
||||||
|
void calcDelta();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("maxhxhyhzDelta");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from name, mesh and IOdictionary
|
||||||
|
maxhxhyhzDelta
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~maxhxhyhzDelta()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the LESdelta dictionary
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
// Correct values
|
||||||
|
virtual void correct();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -182,7 +182,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Access function to filter width
|
//- Access function to filter width
|
||||||
inline const volScalarField& delta() const
|
virtual const volScalarField& delta() const
|
||||||
{
|
{
|
||||||
return delta_();
|
return delta_();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "IDDESDelta.H"
|
#include "IDDESDelta.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "wallDistReflection.H"
|
||||||
#include "wallDist.H"
|
#include "wallDist.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -42,25 +43,50 @@ void Foam::IDDESDelta::calcDelta()
|
|||||||
{
|
{
|
||||||
label nD = mesh().nGeometricD();
|
label nD = mesh().nGeometricD();
|
||||||
|
|
||||||
volScalarField delta
|
const volScalarField& hmax = hmax_();
|
||||||
|
|
||||||
|
// initialise wallNorm
|
||||||
|
wallDistReflection wallNorm(mesh());
|
||||||
|
|
||||||
|
const volVectorField& n = wallNorm.n();
|
||||||
|
|
||||||
|
tmp<volScalarField> faceToFacenMax
|
||||||
(
|
(
|
||||||
IOobject
|
new volScalarField
|
||||||
(
|
(
|
||||||
"delta",
|
IOobject
|
||||||
mesh_.time().timeName(),
|
(
|
||||||
mesh_,
|
"faceToFaceMax",
|
||||||
IOobject::NO_READ,
|
mesh().time().timeName(),
|
||||||
IOobject::NO_WRITE
|
mesh(),
|
||||||
),
|
IOobject::NO_READ,
|
||||||
mesh_,
|
IOobject::NO_WRITE
|
||||||
dimensionedScalar("zero", dimLength, SMALL),
|
),
|
||||||
calculatedFvPatchScalarField::typeName
|
mesh(),
|
||||||
|
dimensionedScalar("zrero", dimLength, 0.0)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
delta.internalField() = pow(mesh_.V(), 1.0/3.0);
|
const cellList& cells = mesh().cells();
|
||||||
|
|
||||||
// initialise hwn as wall distance
|
forAll(cells,cellI)
|
||||||
volScalarField hwn = wallDist(mesh()).y();
|
{
|
||||||
|
scalar deltaMaxTmp = 0.0;
|
||||||
|
const labelList& cFaces = mesh().cells()[cellI];
|
||||||
|
const point& faceCentre = mesh().faceCentres()[cFaces[0]];
|
||||||
|
const vector nCell = n[cellI];
|
||||||
|
forAll(cFaces, cFaceI)
|
||||||
|
{
|
||||||
|
label faceI = cFaces[cFaceI];
|
||||||
|
const point& faceCentreTwo = mesh().faceCentres()[faceI];
|
||||||
|
scalar tmp = (faceCentre - faceCentreTwo) & nCell;
|
||||||
|
if (tmp > deltaMaxTmp)
|
||||||
|
{
|
||||||
|
deltaMaxTmp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
faceToFacenMax()[cellI] = deltaMaxTmp;
|
||||||
|
}
|
||||||
|
|
||||||
if (nD == 3)
|
if (nD == 3)
|
||||||
{
|
{
|
||||||
@ -68,8 +94,12 @@ void Foam::IDDESDelta::calcDelta()
|
|||||||
deltaCoeff_
|
deltaCoeff_
|
||||||
*min
|
*min
|
||||||
(
|
(
|
||||||
max(max(cw_*wallDist(mesh()).y(), cw_*delta), hwn),
|
max
|
||||||
delta
|
(
|
||||||
|
max(cw_*wallDist(mesh()).y(), cw_*hmax),
|
||||||
|
faceToFacenMax()
|
||||||
|
),
|
||||||
|
hmax
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (nD == 2)
|
else if (nD == 2)
|
||||||
@ -82,8 +112,8 @@ void Foam::IDDESDelta::calcDelta()
|
|||||||
deltaCoeff_
|
deltaCoeff_
|
||||||
*min
|
*min
|
||||||
(
|
(
|
||||||
max(max(cw_*wallDist(mesh()).y(), cw_*delta), hwn),
|
max(max(cw_*wallDist(mesh()).y(), cw_*hmax), faceToFacenMax()),
|
||||||
delta
|
hmax
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -105,8 +135,12 @@ Foam::IDDESDelta::IDDESDelta
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
LESdelta(name, mesh),
|
LESdelta(name, mesh),
|
||||||
deltaCoeff_(readScalar(dd.subDict(type() + "Coeffs").lookup("deltaCoeff"))),
|
hmax_(LESdelta::New("hmax", mesh, dd.parent())),
|
||||||
cw_(0)
|
deltaCoeff_
|
||||||
|
(
|
||||||
|
readScalar(dd.subDict(type()+"Coeffs").lookup("deltaCoeff"))
|
||||||
|
),
|
||||||
|
cw_(0.15)
|
||||||
{
|
{
|
||||||
dd.subDict(type() + "Coeffs").readIfPresent("cw", cw_);
|
dd.subDict(type() + "Coeffs").readIfPresent("cw", cw_);
|
||||||
calcDelta();
|
calcDelta();
|
||||||
@ -127,6 +161,7 @@ void Foam::IDDESDelta::correct()
|
|||||||
if (mesh_.changing())
|
if (mesh_.changing())
|
||||||
{
|
{
|
||||||
calcDelta();
|
calcDelta();
|
||||||
|
hmax_().correct();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,6 +54,7 @@ class IDDESDelta
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
autoPtr<LESdelta> hmax_;
|
||||||
scalar deltaCoeff_;
|
scalar deltaCoeff_;
|
||||||
scalar cw_;
|
scalar cw_;
|
||||||
|
|
||||||
@ -85,9 +86,10 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
// Destructor
|
||||||
~IDDESDelta()
|
|
||||||
{}
|
~IDDESDelta()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -44,26 +44,9 @@ addToRunTimeSelectionTable(LESModel, SpalartAllmarasIDDES, dictionary);
|
|||||||
|
|
||||||
tmp<volScalarField> SpalartAllmarasIDDES::alpha() const
|
tmp<volScalarField> SpalartAllmarasIDDES::alpha() const
|
||||||
{
|
{
|
||||||
volScalarField delta
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"delta",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimLength, SMALL),
|
|
||||||
calculatedFvPatchScalarField::typeName
|
|
||||||
);
|
|
||||||
|
|
||||||
delta.internalField() = pow(mesh_.V(), 1.0/3.0);
|
|
||||||
|
|
||||||
return max
|
return max
|
||||||
(
|
(
|
||||||
0.25 - y_/delta,
|
0.25 - y_/static_cast<const volScalarField&>(hmax_()),
|
||||||
scalar(-5)
|
scalar(-5)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -166,7 +149,24 @@ SpalartAllmarasIDDES::SpalartAllmarasIDDES
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
SpalartAllmaras(U, phi, transport, turbulenceModelName, modelName),
|
SpalartAllmaras(U, phi, transport, turbulenceModelName, modelName),
|
||||||
|
hmax_
|
||||||
|
(
|
||||||
|
LESdelta::New
|
||||||
|
(
|
||||||
|
"hmax",
|
||||||
|
mesh_,
|
||||||
|
*this
|
||||||
|
)
|
||||||
|
),
|
||||||
|
IDDESDelta_
|
||||||
|
(
|
||||||
|
LESdelta::New
|
||||||
|
(
|
||||||
|
"IDDESDelta",
|
||||||
|
mesh_,
|
||||||
|
this->subDict(typeName + "Coeffs")
|
||||||
|
)
|
||||||
|
),
|
||||||
fwStar_
|
fwStar_
|
||||||
(
|
(
|
||||||
dimensioned<scalar>::lookupOrAddToDict
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
|||||||
@ -58,6 +58,8 @@ class SpalartAllmarasIDDES
|
|||||||
|
|
||||||
// Model constants
|
// Model constants
|
||||||
|
|
||||||
|
autoPtr<LESdelta> hmax_;
|
||||||
|
autoPtr<LESdelta> IDDESDelta_;
|
||||||
dimensionedScalar fwStar_;
|
dimensionedScalar fwStar_;
|
||||||
dimensionedScalar cl_;
|
dimensionedScalar cl_;
|
||||||
dimensionedScalar ct_;
|
dimensionedScalar ct_;
|
||||||
@ -117,6 +119,12 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Access function to filter width
|
||||||
|
virtual const volScalarField& delta() const
|
||||||
|
{
|
||||||
|
return IDDESDelta_();
|
||||||
|
}
|
||||||
|
|
||||||
//- Read LESProperties dictionary
|
//- Read LESProperties dictionary
|
||||||
virtual bool read();
|
virtual bool read();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user