wallDist: now a MeshObject cached and updated automatically with a run-time selected algorithm

When using models which require the wallDist e.g. kOmegaSST it will
request the method to be used from the wallDist sub-dictionary in
fvSchemes e.g.

wallDist
{
    method meshWave;
}

specifies the mesh-wave method as hard-coded in previous OpenFOAM versions.
This commit is contained in:
Henry
2015-01-08 10:40:23 +00:00
parent 2028973e19
commit bb2c2efd49
76 changed files with 778 additions and 294 deletions

View File

@ -45,29 +45,7 @@ Foam::wallDependentModel::~wallDependentModel()
const Foam::volScalarField& Foam::wallDependentModel::yWall() const const Foam::volScalarField& Foam::wallDependentModel::yWall() const
{ {
if (!mesh_.foundObject<volScalarField>("yWall")) return wallDist::New(mesh_).y();
{
volScalarField* yPtr
(
new volScalarField
(
IOobject
(
"yWall",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
true
),
wallDist(mesh_).y()
)
);
yPtr->checkIn();
}
return mesh_.lookupObject<volScalarField>("yWall");
} }
@ -77,28 +55,6 @@ const Foam::volVectorField& Foam::wallDependentModel::nWall() const
{ {
wallDistReflection w(mesh_); wallDistReflection w(mesh_);
if (!mesh_.foundObject<volScalarField>("yWall"))
{
volScalarField* yPtr
(
new volScalarField
(
IOobject
(
"yWall",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
true
),
w.y()
)
);
yPtr->checkIn();
}
volVectorField* nPtr volVectorField* nPtr
( (
new volVectorField new volVectorField

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,46 +26,36 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "argList.H"
#include "Time.H"
#include "fvMesh.H"
#include "wallDist.H" #include "wallDist.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
# include "setRootCase.H" #include "setRootCase.H"
# include "createTime.H" #include "createTime.H"
# include "createMesh.H" #include "createMesh.H"
Info<< "Mesh read in = " Info<< "Mesh read in = "
<< runTime.cpuTimeIncrement() << runTime.cpuTimeIncrement()
<< " s\n" << endl << endl; << " s\n" << endl << endl;
Info<< "Time now = " << runTime.timeName() << endl; Info<< "Time now = " << runTime.timeName() << endl;
// Wall distance // Wall distance
const volScalarField& y = wallDist::New(mesh).y();
wallDist y(mesh, true);
if (y.nUnset() != 0)
{
WarningIn(args.executable())
<< "There are " << y.nUnset()
<< " remaining unset cells and/or boundary values" << endl;
}
y.write(); y.write();
runTime++; runTime++;
Info<< "Time now = " << runTime.timeName() << endl; Info<< "Time now = " << runTime.timeName() << endl;
// Move points // Move points
boundBox meshBb(mesh.points()); boundBox meshBb(mesh.points());
@ -83,14 +73,11 @@ int main(int argc, char *argv[])
} }
mesh.movePoints(newPoints); mesh.movePoints(newPoints);
mesh.write(); mesh.write();
y.correct(); y.correct();
y.write(); y.write();
Info<< "End\n" << endl; Info<< "End\n" << endl;
return 0; return 0;

View File

@ -34,7 +34,6 @@ Description
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "LESModel.H" #include "LESModel.H"
#include "nearWallDist.H" #include "nearWallDist.H"
#include "wallDist.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,17 +52,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
fvMesh::readUpdateState state = mesh.readUpdate(); fvMesh::readUpdateState state = mesh.readUpdate();
// Wall distance
if (timeI == 0 || state != fvMesh::UNCHANGED)
{
Info<< "Calculating wall distance\n" << endl;
wallDist y(mesh);
Info<< "Writing wall distance to field "
<< y.name() << nl << endl;
y.write();
}
volScalarField yPlus volScalarField yPlus
( (
IOobject IOobject

View File

@ -43,8 +43,6 @@ Description
#include "compressible/RAS/RASModel/RASModel.H" #include "compressible/RAS/RASModel/RASModel.H"
#include "mutWallFunction/mutWallFunctionFvPatchScalarField.H" #include "mutWallFunction/mutWallFunctionFvPatchScalarField.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void calcIncompressibleYPlus void calcIncompressibleYPlus
@ -204,15 +202,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
fvMesh::readUpdateState state = mesh.readUpdate(); fvMesh::readUpdateState state = mesh.readUpdate();
// Wall distance
if (timeI == 0 || state != fvMesh::UNCHANGED)
{
Info<< "Calculating wall distance\n" << endl;
wallDist y(mesh);
Info<< "Writing wall distance to field " << y.name() << nl << endl;
y.write();
}
volScalarField yPlus volScalarField yPlus
( (
IOobject IOobject

View File

@ -38,7 +38,7 @@ volVectorField U
); );
Info<< "Calculating wall distance field" << endl; Info<< "Calculating wall distance field" << endl;
volScalarField y(wallDist(mesh).y()); const volScalarField& y(wallDist::New(mesh).y());
// Set the mean boundary-layer thickness // Set the mean boundary-layer thickness
dimensionedScalar ybl("ybl", dimLength, 0); dimensionedScalar ybl("ybl", dimLength, 0);

View File

@ -610,6 +610,7 @@ DebugSwitches
meshCutAndRemove 0; meshCutAndRemove 0;
meshCutter 0; meshCutter 0;
meshModifier 0; meshModifier 0;
meshObject 0;
meshRefinement 0; meshRefinement 0;
meshSearch 0; meshSearch 0;
meshToMesh 0; meshToMesh 0;

View File

@ -43,7 +43,7 @@ void Foam::PrandtlDelta::calcDelta()
delta_ = min delta_ = min
( (
static_cast<const volScalarField&>(geometricDelta_()), static_cast<const volScalarField&>(geometricDelta_()),
(kappa_/Cdelta_)*wallDist(mesh_).y() (kappa_/Cdelta_)*wallDist::New(mesh_).y()
); );
} }

View File

@ -261,7 +261,7 @@ kOmegaSST<BasicTurbulenceModel>::kOmegaSST
) )
), ),
y_(this->mesh_), y_(wallDist::New(this->mesh_).y()),
k_ k_
( (

View File

@ -148,12 +148,13 @@ protected:
Switch F3_; Switch F3_;
//- Wall distance
// Note: different to wall distance in parent RASModel
wallDist y_;
// Fields // Fields
//- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField k_; volScalarField k_;
volScalarField omega_; volScalarField omega_;

View File

@ -42,8 +42,8 @@ $(wallDist)/wallPointYPlus/wallPointYPlus.C
$(wallDist)/nearWallDist/nearWallDistNoSearch.C $(wallDist)/nearWallDist/nearWallDistNoSearch.C
$(wallDist)/nearWallDist/nearWallDist.C $(wallDist)/nearWallDist/nearWallDist.C
$(wallDist)/wallDist/wallDist.C $(wallDist)/wallDist/wallDist.C
$(wallDist)/meshWaveWallDist/patchDist.C $(wallDist)/patchDistMethods/patchDistMethod/patchDistMethod.C
$(wallDist)/meshWaveWallDist/meshWaveWallDist.C $(wallDist)/patchDistMethods/meshWave/meshWavePatchDistMethod.C
$(wallDist)/wallDistReflection/reflectionVectors.C $(wallDist)/wallDistReflection/reflectionVectors.C
$(wallDist)/wallDistReflection/wallDistReflection.C $(wallDist)/wallDistReflection/wallDistReflection.C

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,8 +49,19 @@ namespace Foam
void Foam::fvMesh::clearGeomNotOldVol() void Foam::fvMesh::clearGeomNotOldVol()
{ {
meshObject::clear<fvMesh, GeometricMeshObject>(*this); meshObject::clearUpto
meshObject::clear<lduMesh, GeometricMeshObject>(*this); <
fvMesh,
GeometricMeshObject,
MoveableMeshObject
>(*this);
meshObject::clearUpto
<
lduMesh,
GeometricMeshObject,
MoveableMeshObject
>(*this);
slicedVolScalarField::DimensionedInternalField* VPtr = slicedVolScalarField::DimensionedInternalField* VPtr =
static_cast<slicedVolScalarField::DimensionedInternalField*>(VPtr_); static_cast<slicedVolScalarField::DimensionedInternalField*>(VPtr_);

View File

@ -23,22 +23,47 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "patchDist.H" #include "meshWavePatchDistMethod.H"
#include "patchWave.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volFields.H"
#include "patchWave.H"
#include "emptyFvPatchFields.H" #include "emptyFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace patchDistMethods
{
defineTypeNameAndDebug(meshWave, 0);
addToRunTimeSelectionTable(patchDistMethod, meshWave, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::patchDist::patchDist Foam::patchDistMethods::meshWave::meshWave
(
const dictionary& dict,
const fvMesh& mesh,
const labelHashSet& patchIDs
)
:
patchDistMethod(mesh, patchIDs),
correctWalls_(dict.lookupOrDefault<Switch>("correctWalls", true)),
nUnset_(0)
{}
Foam::patchDistMethods::meshWave::meshWave
( (
const fvMesh& mesh, const fvMesh& mesh,
const labelHashSet& patchIDs, const labelHashSet& patchIDs,
const bool correctWalls const bool correctWalls
) )
: :
mesh_(mesh), patchDistMethod(mesh, patchIDs),
patchIDs_(patchIDs),
correctWalls_(correctWalls), correctWalls_(correctWalls),
nUnset_(0) nUnset_(0)
{} {}
@ -46,28 +71,8 @@ Foam::patchDist::patchDist
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::patchDist::y() const bool Foam::patchDistMethods::meshWave::correct(volScalarField& y)
{ {
tmp<volScalarField> ty
(
new volScalarField
(
IOobject
(
"y",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("y", dimLength, GREAT)
)
);
volScalarField& y = ty();
// Calculate distance starting from patch faces // Calculate distance starting from patch faces
patchWave wave(mesh_, patchIDs_, correctWalls_); patchWave wave(mesh_, patchIDs_, correctWalls_);
@ -88,7 +93,7 @@ Foam::tmp<Foam::volScalarField> Foam::patchDist::y() const
// Transfer number of unset values // Transfer number of unset values
nUnset_ = wave.nUnset(); nUnset_ = wave.nUnset();
return ty; return nUnset_ > 0;
} }

View File

@ -39,36 +39,32 @@ Description
takes the pointFaces() of the wall point to look for the nearest point. takes the pointFaces() of the wall point to look for the nearest point.
SourceFiles SourceFiles
patchDist.C meshWavePatchDistMethod.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef patchDist_H #ifndef meshWavePatchDistMethod_H
#define patchDist_H #define meshWavePatchDistMethod_H
#include "volFields.H" #include "patchDistMethod.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
namespace patchDistMethods
class fvMesh; {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class patchDist Declaration Class meshWave Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class patchDist class meshWave
:
public patchDistMethod
{ {
// Private Member Data // Private Member Data
//- Reference to the mesh
const fvMesh& mesh_;
//- Set of patch IDs
const labelHashSet patchIDs_;
//- Do accurate distance calculation for near-wall cells. //- Do accurate distance calculation for near-wall cells.
const bool correctWalls_; const bool correctWalls_;
@ -79,20 +75,33 @@ class patchDist
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
patchDist(const patchDist&); meshWave(const meshWave&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const patchDist&); void operator=(const meshWave&);
public: public:
//- Runtime type information
TypeName("meshWave");
// Constructors // Constructors
//- Construct from mesh and flag whether or not to correct wall.
// Calculate for all cells.
meshWave
(
const dictionary& dict,
const fvMesh& mesh,
const labelHashSet& patchIDs
);
//- Construct from mesh and flag whether or not to correct wall. //- Construct from mesh and flag whether or not to correct wall.
// Calculate for all cells. correctWalls : correct wall (face&point) // Calculate for all cells. correctWalls : correct wall (face&point)
// cells for correct distance, searching neighbours. // cells for correct distance, searching neighbours.
patchDist meshWave
( (
const fvMesh& mesh, const fvMesh& mesh,
const labelHashSet& patchIDs, const labelHashSet& patchIDs,
@ -102,19 +111,19 @@ public:
// Member Functions // Member Functions
//- Calculate and return the distance to nearest patch
// for all cells and boundary
tmp<volScalarField> y() const;
label nUnset() const label nUnset() const
{ {
return nUnset_; return nUnset_;
} }
//- Correct the given distance-to-patch field
virtual bool correct(volScalarField& y);
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace patchDistMethods
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,86 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "patchDistMethod.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(patchDistMethod, 0);
defineRunTimeSelectionTable(patchDistMethod, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::patchDistMethod::patchDistMethod
(
const fvMesh& mesh,
const labelHashSet& patchIDs
)
:
mesh_(mesh),
patchIDs_(patchIDs)
{}
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::patchDistMethod> Foam::patchDistMethod::New
(
const dictionary& dict,
const fvMesh& mesh,
const labelHashSet& patchIDs
)
{
word patchDistMethodType(dict.lookup("method"));
Info<< "Selecting patchDistMethod " << patchDistMethodType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(patchDistMethodType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn("patchDistMethod::New")
<< "Unknown patchDistMethodType type "
<< patchDistMethodType << endl << endl
<< "Valid patchDistMethod types are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return cstrIter()(dict, mesh, patchIDs);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::patchDistMethod::~patchDistMethod()
{}
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
Class
Foam::patchDistMethod
Description
Specialisation of patchDist for wall distance calculation
SourceFiles
patchDistMethod.C
\*---------------------------------------------------------------------------*/
#ifndef patchDistMethod_H
#define patchDistMethod_H
#include "dictionary.H"
#include "HashSet.H"
#include "volFieldsFwd.H"
#include "mapPolyMesh.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class patchDistMethod Declaration
\*---------------------------------------------------------------------------*/
class patchDistMethod
{
protected:
// Protected Member Data
//- Reference to the mesh
const fvMesh& mesh_;
//- Set of patch IDs
const labelHashSet patchIDs_;
private:
// Private Member Functions
//- Disallow default bitwise copy construct
patchDistMethod(const patchDistMethod&);
//- Disallow default bitwise assignment
void operator=(const patchDistMethod&);
public:
//- Runtime type information
TypeName("patchDistMethod");
// Declare runtime construction
declareRunTimeSelectionTable
(
autoPtr,
patchDistMethod,
dictionary,
(
const dictionary& dict,
const fvMesh& mesh,
const labelHashSet& patchIDs
),
(dict, mesh, patchIDs)
);
// Constructors
//- Construct from mesh and patch ID set
patchDistMethod
(
const fvMesh& mesh,
const labelHashSet& patchIDs
);
// Selectors
static autoPtr<patchDistMethod> New
(
const dictionary& dict,
const fvMesh& mesh,
const labelHashSet& patchIDs
);
//- Destructor
virtual ~patchDistMethod();
// Member Functions
//- Update cached geometry when the mesh moves
virtual bool movePoints()
{
return true;
}
//- Update cached topology and geometry when the mesh changes
virtual void updateMesh(const mapPolyMesh&)
{}
//- Correct the given distance-to-patch field
virtual bool correct(volScalarField& y) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,25 +24,43 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "wallDist.H" #include "wallDist.H"
#include "meshWaveWallDist.H" #include "wallPolyPatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(wallDist, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallDist::wallDist(const fvMesh& mesh) Foam::wallDist::wallDist(const fvMesh& mesh)
: :
volScalarField MeshObject<fvMesh, Foam::UpdateableMeshObject, wallDist>(mesh),
pdm_
(
patchDistMethod::New
(
static_cast<const fvSchemes&>(mesh).subDict("wallDist"),
mesh,
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>()
)
),
y_
( (
IOobject IOobject
( (
"y", "yWall",
mesh.time().timeName(), mesh.time().timeName(),
mesh mesh
), ),
mesh, mesh,
dimensionedScalar("y", dimLength, GREAT) dimensionedScalar("yWall", dimLength, GREAT)
) )
{ {
correct(); movePoints();
} }
@ -54,9 +72,23 @@ Foam::wallDist::~wallDist()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::wallDist::correct() bool Foam::wallDist::movePoints()
{ {
volScalarField::operator=(meshWaveWallDist(mesh()).y()); if (pdm_->movePoints())
{
return pdm_->correct(y_);
}
else
{
return false;
}
}
void Foam::wallDist::updateMesh(const mapPolyMesh& mpm)
{
pdm_->updateMesh(mpm);
pdm_->correct(y_);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,8 @@ Class
Foam::wallDist Foam::wallDist
Description Description
Specialisation of patchDist for wall distance calculation Interface to run-time selectable methods to calculate the distance-to-wall
field.
SourceFiles SourceFiles
wallDist.C wallDist.C
@ -35,6 +36,9 @@ SourceFiles
#ifndef wallDist_H #ifndef wallDist_H
#define wallDist_H #define wallDist_H
#include "MeshObject.H"
#include "patchDistMethod.H"
#include "fvMesh.H"
#include "volFields.H" #include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,8 +52,17 @@ namespace Foam
class wallDist class wallDist
: :
public volScalarField public MeshObject<fvMesh, UpdateableMeshObject, wallDist>
{ {
// Private data
//- Run-time selected method to generate the distance-to-wall field
autoPtr<patchDistMethod> pdm_;
//- Distance-to-wall field
volScalarField y_;
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
@ -61,6 +74,10 @@ class wallDist
public: public:
// Declare name of the class and its debug switch
ClassName("wallDist");
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
@ -75,11 +92,14 @@ public:
const volScalarField& y() const const volScalarField& y() const
{ {
return *this; return y_;
} }
//- Correct for mesh changes //- Update the y-field when the mesh moves
virtual void correct(); virtual bool movePoints();
//- Update the y-field when the mesh changes
virtual void updateMesh(const mapPolyMesh&);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,8 +32,14 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(twoDPointCorrector, 0);
}
const Foam::scalar Foam::twoDPointCorrector::edgeOrthogonalityTol = 1.0 - 1e-4; const Foam::scalar Foam::twoDPointCorrector::edgeOrthogonalityTol = 1.0 - 1e-4;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::twoDPointCorrector::calcAddressing() const void Foam::twoDPointCorrector::calcAddressing() const

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -111,6 +111,10 @@ class twoDPointCorrector
public: public:
// Declare name of the class and its debug switch
ClassName("twoDPointCorrector");
// Constructors // Constructors
//- Construct from components //- Construct from components

View File

@ -28,7 +28,7 @@ License
#include "fvcGrad.H" #include "fvcGrad.H"
#include "unitConversion.H" #include "unitConversion.H"
#include "fvPatchField.H" #include "fvPatchField.H"
#include "patchDist.H" #include "meshWavePatchDistMethod.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -66,9 +66,25 @@ void contactAngleForce::initialise()
Info<< " " << pbm[patchI].name() << endl; Info<< " " << pbm[patchI].name() << endl;
} }
patchDist dist(owner_.regionMesh(), patchIDs); // Temporary implementation until run-time selection covers this case
patchDistMethods::meshWave dist(owner_.regionMesh(), patchIDs);
volScalarField y
(
IOobject
(
"y",
owner_.regionMesh().time().timeName(),
owner_.regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
owner_.regionMesh(),
dimensionedScalar("y", dimLength, GREAT)
);
dist.correct(y);
mask_ = pos(dist.y() - dimensionedScalar("dLim", dimLength, dLim)); mask_ = pos(y - dimensionedScalar("dLim", dimLength, dLim));
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -45,7 +45,7 @@ void PrandtlDelta::calcDelta()
delta_ = min delta_ = min
( (
static_cast<const volScalarField&>(geometricDelta_()), static_cast<const volScalarField&>(geometricDelta_()),
(kappa_/Cdelta_)*wallDist(mesh_).y() (kappa_/Cdelta_)*wallDist::New(mesh_).y()
); );
} }

View File

@ -111,7 +111,11 @@ tmp<volScalarField> SpalartAllmaras::fv3() const
} }
tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const tmp<volScalarField> SpalartAllmaras::fw
(
const volScalarField& Stilda,
const volScalarField& dTilda
) const
{ {
volScalarField r volScalarField r
( (
@ -124,7 +128,7 @@ tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
Stilda, Stilda,
dimensionedScalar("SMALL", Stilda.dimensions(), SMALL) dimensionedScalar("SMALL", Stilda.dimensions(), SMALL)
) )
*sqr(kappa_*dTilda_) *sqr(kappa_*dTilda)
), ),
scalar(10.0) scalar(10.0)
) )
@ -137,6 +141,14 @@ tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
} }
tmp<volScalarField> SpalartAllmaras::dTilda() const
{
tmp<volScalarField> tdTilda(CDES_*delta());
min(tdTilda().dimensionedInternalField(), tdTilda(), y_);
return tdTilda;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
SpalartAllmaras::SpalartAllmaras SpalartAllmaras::SpalartAllmaras
@ -255,6 +267,8 @@ SpalartAllmaras::SpalartAllmaras
ashfordCorrection_(coeffDict_.lookupOrDefault("ashfordCorrection", true)), ashfordCorrection_(coeffDict_.lookupOrDefault("ashfordCorrection", true)),
y_(wallDist::New(mesh_).y()),
nuTilda_ nuTilda_
( (
IOobject IOobject
@ -268,7 +282,6 @@ SpalartAllmaras::SpalartAllmaras
mesh_ mesh_
), ),
dTilda_(min(CDES_*delta(), wallDist(mesh_).y())),
muSgs_ muSgs_
( (
IOobject IOobject
@ -340,14 +353,10 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& tgradU)
const volTensorField& gradU = tgradU(); const volTensorField& gradU = tgradU();
LESModel::correct(gradU); LESModel::correct(gradU);
if (mesh_.changing()) const volScalarField dTilda(this->dTilda());
{
dTilda_ = min(CDES_*delta(), wallDist(mesh_).y());
}
volScalarField Stilda volScalarField Stilda
( (
fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda_) fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda)
); );
tmp<fvScalarMatrix> nuTildaEqn tmp<fvScalarMatrix> nuTildaEqn
@ -363,7 +372,7 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& tgradU)
- rho()*Cb2_/sigmaNut_*magSqr(fvc::grad(nuTilda_)) - rho()*Cb2_/sigmaNut_*magSqr(fvc::grad(nuTilda_))
== ==
rho()*Cb1_*Stilda*nuTilda_ rho()*Cb1_*Stilda*nuTilda_
- fvm::Sp(rho()*Cw1_*fw(Stilda)*nuTilda_/sqr(dTilda_), nuTilda_) - fvm::Sp(rho()*Cw1_*fw(Stilda, dTilda)*nuTilda_/sqr(dTilda), nuTilda_)
); );
nuTildaEqn().relax(); nuTildaEqn().relax();
@ -407,8 +416,6 @@ bool SpalartAllmaras::read()
tmp<volScalarField> SpalartAllmaras::LESRegion() const tmp<volScalarField> SpalartAllmaras::LESRegion() const
{ {
volScalarField wd(wallDist(mesh_).y());
tmp<volScalarField> tLESRegion tmp<volScalarField> tLESRegion
( (
new volScalarField new volScalarField
@ -421,9 +428,7 @@ tmp<volScalarField> SpalartAllmaras::LESRegion() const
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
neg(min(CDES_*delta(), wd) - wd) neg(dTilda() - y_)
// mesh_,
// dimensionedScalar("zero", dimless, 0.0)
) )
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,6 +49,7 @@ SourceFiles
#include "DESModel.H" #include "DESModel.H"
#include "volFields.H" #include "volFields.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -92,8 +93,12 @@ class SpalartAllmaras
// Fields // Fields
//- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField nuTilda_; volScalarField nuTilda_;
volScalarField dTilda_;
volScalarField muSgs_; volScalarField muSgs_;
volScalarField alphaSgs_; volScalarField alphaSgs_;
@ -106,7 +111,15 @@ class SpalartAllmaras
tmp<volScalarField> fv1() const; tmp<volScalarField> fv1() const;
tmp<volScalarField> fv2() const; tmp<volScalarField> fv2() const;
tmp<volScalarField> fv3() const; tmp<volScalarField> fv3() const;
tmp<volScalarField> fw(const volScalarField& Stilda) const;
tmp<volScalarField> fw
(
const volScalarField& Stilda,
const volScalarField& dTilda
) const;
//- Length scale
tmp<volScalarField> dTilda() const;
// Disallow default bitwise copy construct and assignment // Disallow default bitwise copy construct and assignment
SpalartAllmaras(const SpalartAllmaras&); SpalartAllmaras(const SpalartAllmaras&);
@ -148,7 +161,7 @@ public:
//- Return SGS kinetic energy //- Return SGS kinetic energy
virtual tmp<volScalarField> k() const virtual tmp<volScalarField> k() const
{ {
return sqr(muSgs()/rho()/ck_/dTilda_); return sqr(muSgs()/rho()/ck_/dTilda());
} }
//- Return sub-grid disipation rate //- Return sub-grid disipation rate

View File

@ -184,7 +184,7 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
) )
), ),
y_(mesh_), yr_(mesh_),
R_ R_
( (
@ -375,7 +375,7 @@ void LaunderGibsonRSTM::correct()
if (mesh_.changing()) if (mesh_.changing())
{ {
y_.correct(); yr_.correct();
} }
volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_))); volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_)));
@ -443,10 +443,10 @@ void LaunderGibsonRSTM::correct()
// wall reflection terms // wall reflection terms
+ symm + symm
( (
I*((y_.n() & reflect) & y_.n()) I*((yr_.n() & reflect) & yr_.n())
- 1.5*(y_.n()*(reflect & y_.n()) - 1.5*(yr_.n()*(reflect & yr_.n())
+ (y_.n() & reflect)*y_.n()) + (yr_.n() & reflect)*yr_.n())
)*pow(Cmu_, 0.75)*rho_*pow(k_, 1.5)/(kappa_*y_*epsilon_) )*pow(Cmu_, 0.75)*rho_*pow(k_, 1.5)/(kappa_*yr_*epsilon_)
); );
REqn().relax(); REqn().relax();

View File

@ -109,7 +109,7 @@ protected:
// Fields // Fields
wallDistReflection y_; wallDistReflection yr_;
volSymmTensorField R_; volSymmTensorField R_;
volScalarField k_; volScalarField k_;

View File

@ -126,7 +126,7 @@ tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
Stilda, Stilda,
dimensionedScalar("SMALL", Stilda.dimensions(), SMALL) dimensionedScalar("SMALL", Stilda.dimensions(), SMALL)
) )
*sqr(kappa_*d_) *sqr(kappa_*y_)
), ),
scalar(10.0) scalar(10.0)
) )
@ -276,7 +276,7 @@ SpalartAllmaras::SpalartAllmaras
autoCreateAlphat("alphat", mesh_) autoCreateAlphat("alphat", mesh_)
), ),
d_(mesh_) y_(wallDist::New(mesh_).y())
{ {
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions(); alphat_.correctBoundaryConditions();
@ -435,18 +435,13 @@ void SpalartAllmaras::correct()
RASModel::correct(); RASModel::correct();
if (mesh_.changing())
{
d_.correct();
}
const volScalarField chi(this->chi()); const volScalarField chi(this->chi());
const volScalarField fv1(this->fv1(chi)); const volScalarField fv1(this->fv1(chi));
const volScalarField Stilda const volScalarField Stilda
( (
fv3(chi, fv1)*::sqrt(2.0)*mag(skew(fvc::grad(U_))) fv3(chi, fv1)*::sqrt(2.0)*mag(skew(fvc::grad(U_)))
+ fv2(chi, fv1)*nuTilda_/sqr(kappa_*d_) + fv2(chi, fv1)*nuTilda_/sqr(kappa_*y_)
); );
tmp<fvScalarMatrix> nuTildaEqn tmp<fvScalarMatrix> nuTildaEqn
@ -457,7 +452,7 @@ void SpalartAllmaras::correct()
- Cb2_/sigmaNut_*rho_*magSqr(fvc::grad(nuTilda_)) - Cb2_/sigmaNut_*rho_*magSqr(fvc::grad(nuTilda_))
== ==
Cb1_*rho_*Stilda*nuTilda_ Cb1_*rho_*Stilda*nuTilda_
- fvm::Sp(Cw1_*fw(Stilda)*nuTilda_*rho_/sqr(d_), nuTilda_) - fvm::Sp(Cw1_*fw(Stilda)*nuTilda_*rho_/sqr(y_), nuTilda_)
); );
nuTildaEqn().relax(); nuTildaEqn().relax();

View File

@ -122,9 +122,10 @@ protected:
volScalarField mut_; volScalarField mut_;
volScalarField alphat_; volScalarField alphat_;
//- Wall distance
//- Wall distance // Note: different to wall distance in parent RASModel
wallDist d_; // which is for near-wall cells only
const volScalarField& y_;
// Protected Member Functions // Protected Member Functions

View File

@ -251,7 +251,7 @@ kOmegaSST::kOmegaSST
) )
), ),
y_(mesh_), y_(wallDist::New(mesh_).y()),
k_ k_
( (
@ -424,11 +424,6 @@ void kOmegaSST::correct()
volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_))); volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_)));
if (mesh_.changing())
{
y_.correct();
}
if (mesh_.moving()) if (mesh_.moving())
{ {
divU += fvc::div(mesh_.phi()); divU += fvc::div(mesh_.phi());

View File

@ -149,12 +149,13 @@ protected:
Switch F3_; Switch F3_;
//- Wall distance
// Note: different to wall distance in parent RASModel
wallDist y_;
// Fields // Fields
//- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField k_; volScalarField k_;
volScalarField omega_; volScalarField omega_;
volScalarField mut_; volScalarField mut_;

View File

@ -168,7 +168,9 @@ tmp<volScalarField> SpalartAllmaras::fw
tmp<volScalarField> SpalartAllmaras::dTilda(const volScalarField&) const tmp<volScalarField> SpalartAllmaras::dTilda(const volScalarField&) const
{ {
return min(CDES_*delta(), y_); tmp<volScalarField> tdTilda(CDES_*delta());
min(tdTilda().dimensionedInternalField(), tdTilda(), y_);
return tdTilda;
} }
@ -279,7 +281,7 @@ SpalartAllmaras::SpalartAllmaras
ashfordCorrection_(coeffDict_.lookupOrDefault("ashfordCorrection", true)), ashfordCorrection_(coeffDict_.lookupOrDefault("ashfordCorrection", true)),
y_(mesh_), y_(wallDist::New(mesh_).y()),
nuTilda_ nuTilda_
( (
@ -322,12 +324,6 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
{ {
LESModel::correct(gradU); LESModel::correct(gradU);
if (mesh_.changing())
{
y_.correct();
y_.boundaryField() = max(y_.boundaryField(), VSMALL);
}
const volScalarField S(this->S(gradU)); const volScalarField S(this->S(gradU));
const volScalarField dTilda(this->dTilda(S)); const volScalarField dTilda(this->dTilda(S));
const volScalarField STilda(this->STilda(S, dTilda)); const volScalarField STilda(this->STilda(S, dTilda));
@ -451,8 +447,6 @@ tmp<volScalarField> SpalartAllmaras::LESRegion() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
neg(dTilda(S(fvc::grad(U_))) - y_) neg(dTilda(S(fvc::grad(U_))) - y_)
// mesh_,
// dimensionedScalar("zero", dimless, 0.0)
) )
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -105,7 +105,11 @@ protected:
// Fields // Fields
wallDist y_; //- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField nuTilda_; volScalarField nuTilda_;
volScalarField nuSgs_; volScalarField nuSgs_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -116,7 +116,7 @@ void Foam::IDDESDelta::calcDelta()
( (
max max
( (
cw_*wallDist(mesh()).y(), cw_*wallDist::New(mesh()).y(),
cw_*hmax cw_*hmax
), ),
tfaceToFacenMax tfaceToFacenMax

View File

@ -264,7 +264,7 @@ kOmegaSSTSAS::kOmegaSSTSAS
), ),
omegaMin_("omegaMin", dimless/dimTime, SMALL), omegaMin_("omegaMin", dimless/dimTime, SMALL),
y_(mesh_),
Cmu_ Cmu_
( (
dimensioned<scalar>::lookupOrAddToDict dimensioned<scalar>::lookupOrAddToDict
@ -284,6 +284,8 @@ kOmegaSSTSAS::kOmegaSSTSAS
) )
), ),
y_(wallDist::New(mesh_).y()),
k_ k_
( (
IOobject IOobject
@ -340,11 +342,6 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU)
{ {
LESModel::correct(gradU); LESModel::correct(gradU);
if (mesh_.changing())
{
y_.correct();
}
volScalarField S2(2.0*magSqr(symm(gradU()))); volScalarField S2(2.0*magSqr(symm(gradU())));
gradU.clear(); gradU.clear();

View File

@ -117,13 +117,17 @@ protected:
dimensionedScalar omegaMin_; dimensionedScalar omegaMin_;
wallDist y_;
dimensionedScalar Cmu_; dimensionedScalar Cmu_;
dimensionedScalar kappa_; dimensionedScalar kappa_;
// Fields // Fields
//- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField k_; volScalarField k_;
volScalarField omega_; volScalarField omega_;
volScalarField nuSgs_; volScalarField nuSgs_;

View File

@ -118,7 +118,7 @@ LamBremhorstKE::LamBremhorstKE
mesh_ mesh_
), ),
y_(mesh_), y_(wallDist::New(mesh_).y()),
Rt_(sqr(k_)/(nu()*bound(epsilon_, epsilonMin_))), Rt_(sqr(k_)/(nu()*bound(epsilon_, epsilonMin_))),
@ -247,11 +247,6 @@ void LamBremhorstKE::correct()
return; return;
} }
if (mesh_.changing())
{
y_.correct();
}
volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_)))); volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_))));

View File

@ -72,7 +72,11 @@ protected:
volScalarField k_; volScalarField k_;
volScalarField epsilon_; volScalarField epsilon_;
wallDist y_; //- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField Rt_; volScalarField Rt_;
volScalarField fMu_; volScalarField fMu_;

View File

@ -218,7 +218,7 @@ LienCubicKELowRe::LienCubicKELowRe
mesh_ mesh_
), ),
y_(mesh_), y_(wallDist::New(mesh_).y()),
eta_ eta_
( (
@ -420,11 +420,6 @@ void LienCubicKELowRe::correct()
return; return;
} }
if (mesh_.changing())
{
y_.correct();
}
tmp<volTensorField> tgradU = fvc::grad(U_); tmp<volTensorField> tgradU = fvc::grad(U_);
const volTensorField& gradU = tgradU(); const volTensorField& gradU = tgradU();

View File

@ -104,7 +104,10 @@ protected:
volScalarField k_; volScalarField k_;
volScalarField epsilon_; volScalarField epsilon_;
wallDist y_; //- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField eta_; volScalarField eta_;
volScalarField ksi_; volScalarField ksi_;

View File

@ -164,7 +164,7 @@ LienLeschzinerLowRe::LienLeschzinerLowRe
mesh_ mesh_
), ),
y_(mesh_), y_(wallDist::New(mesh_).y()),
yStar_(sqrt(k_)*y_/nu() + SMALL), yStar_(sqrt(k_)*y_/nu() + SMALL),
@ -296,11 +296,6 @@ void LienLeschzinerLowRe::correct()
return; return;
} }
if (mesh_.changing())
{
y_.correct();
}
scalar Cmu75 = pow(Cmu_.value(), 0.75); scalar Cmu75 = pow(Cmu_.value(), 0.75);
const volTensorField gradU(fvc::grad(U_)); const volTensorField gradU(fvc::grad(U_));

View File

@ -83,7 +83,10 @@ protected:
volScalarField k_; volScalarField k_;
volScalarField epsilon_; volScalarField epsilon_;
wallDist y_; //- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField yStar_; volScalarField yStar_;

View File

@ -124,7 +124,7 @@ tmp<volScalarField> SpalartAllmaras::fw(const volScalarField& Stilda) const
Stilda, Stilda,
dimensionedScalar("SMALL", Stilda.dimensions(), SMALL) dimensionedScalar("SMALL", Stilda.dimensions(), SMALL)
) )
*sqr(kappa_*d_) *sqr(kappa_*y_)
), ),
scalar(10.0) scalar(10.0)
) )
@ -253,7 +253,7 @@ SpalartAllmaras::SpalartAllmaras
mesh_ mesh_
), ),
d_(mesh_) y_(wallDist::New(mesh_).y())
{ {
printCoeffs(); printCoeffs();
@ -429,18 +429,13 @@ void SpalartAllmaras::correct()
return; return;
} }
if (mesh_.changing())
{
d_.correct();
}
const volScalarField chi(this->chi()); const volScalarField chi(this->chi());
const volScalarField fv1(this->fv1(chi)); const volScalarField fv1(this->fv1(chi));
const volScalarField Stilda const volScalarField Stilda
( (
fv3(chi, fv1)*::sqrt(2.0)*mag(skew(fvc::grad(U_))) fv3(chi, fv1)*::sqrt(2.0)*mag(skew(fvc::grad(U_)))
+ fv2(chi, fv1)*nuTilda_/sqr(kappa_*d_) + fv2(chi, fv1)*nuTilda_/sqr(kappa_*y_)
); );
tmp<fvScalarMatrix> nuTildaEqn tmp<fvScalarMatrix> nuTildaEqn
@ -451,7 +446,7 @@ void SpalartAllmaras::correct()
- Cb2_/sigmaNut_*magSqr(fvc::grad(nuTilda_)) - Cb2_/sigmaNut_*magSqr(fvc::grad(nuTilda_))
== ==
Cb1_*Stilda*nuTilda_ Cb1_*Stilda*nuTilda_
- fvm::Sp(Cw1_*fw(Stilda)*nuTilda_/sqr(d_), nuTilda_) - fvm::Sp(Cw1_*fw(Stilda)*nuTilda_/sqr(y_), nuTilda_)
); );
nuTildaEqn().relax(); nuTildaEqn().relax();

View File

@ -119,7 +119,10 @@ protected:
volScalarField nuTilda_; volScalarField nuTilda_;
volScalarField nut_; volScalarField nut_;
wallDist d_; //- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
// Protected Member Functions // Protected Member Functions

View File

@ -242,7 +242,7 @@ kOmegaSST::kOmegaSST
) )
), ),
y_(mesh_), y_(wallDist::New(mesh_).y()),
k_ k_
( (
@ -404,11 +404,6 @@ void kOmegaSST::correct()
return; return;
} }
if (mesh_.changing())
{
y_.correct();
}
const volScalarField S2(2*magSqr(symm(fvc::grad(U_)))); const volScalarField S2(2*magSqr(symm(fvc::grad(U_))));
volScalarField G(GName(), nut_*S2); volScalarField G(GName(), nut_*S2);

View File

@ -143,12 +143,13 @@ protected:
Switch F3_; Switch F3_;
//- Wall distance field
// Note: different to wall distance in parent RASModel
wallDist y_;
// Fields // Fields
//- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
volScalarField k_; volScalarField k_;
volScalarField omega_; volScalarField omega_;
volScalarField nut_; volScalarField nut_;

View File

@ -504,7 +504,7 @@ kkLOmega::kkLOmega
), ),
autoCreateNut("nut", mesh_) autoCreateNut("nut", mesh_)
), ),
y_(mesh_) y_(wallDist::New(mesh_).y())
{ {
bound(kt_, kMin_); bound(kt_, kMin_);
bound(kl_, kMin_); bound(kl_, kMin_);
@ -637,12 +637,6 @@ void kkLOmega::correct()
return; return;
} }
if (mesh_.changing())
{
y_.correct();
y_.boundaryField() = max(y_.boundaryField(), VSMALL);
}
const volScalarField kT(kt_ + kl_); const volScalarField kT(kt_ + kl_);
@ -773,7 +767,9 @@ void kkLOmega::correct()
, omega_ , omega_
) )
- fvm::Sp(Cw2_*omega_, omega_) - fvm::Sp(Cw2_*omega_, omega_)
+ Cw3_*fOmega(lambdaEff, lambdaT)*alphaTEff*sqr(fw)*sqrt(kt_)/pow3(y_) + (
Cw3_*fOmega(lambdaEff, lambdaT)*alphaTEff*sqr(fw)*sqrt(kt_)
)().dimensionedInternalField()/pow3(y_.dimensionedInternalField())
); );

View File

@ -181,7 +181,11 @@ protected:
volScalarField omega_; volScalarField omega_;
volScalarField kl_; volScalarField kl_;
volScalarField nut_; volScalarField nut_;
wallDist y_;
//- Wall distance
// Note: different to wall distance in parent RASModel
// which is for near-wall cells only
const volScalarField& y_;
public: public:

View File

@ -63,5 +63,10 @@ fluxRequired
p ; p ;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -58,5 +58,10 @@ fluxRequired
p_rgh; p_rgh;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -58,5 +58,10 @@ fluxRequired
p_rgh; p_rgh;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -60,5 +60,10 @@ fluxRequired
p ; p ;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -57,5 +57,10 @@ snGradSchemes
default corrected; default corrected;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -57,4 +57,10 @@ fluxRequired
p; p;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -56,4 +56,10 @@ fluxRequired
p; p;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -62,5 +62,10 @@ fluxRequired
p ; p ;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -64,4 +64,10 @@ fluxRequired
p; p;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -58,5 +58,10 @@ fluxRequired
p ; p ;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -54,5 +54,10 @@ fluxRequired
p ; p ;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -55,4 +55,10 @@ fluxRequired
p; p;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -61,5 +61,10 @@ fluxRequired
p; p;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -60,5 +60,10 @@ fluxRequired
p; p;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -61,5 +61,10 @@ fluxRequired
p; p;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -59,5 +59,10 @@ fluxRequired
alpha.water; alpha.water;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -57,5 +57,10 @@ fluxRequired
rho ; rho ;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -59,5 +59,10 @@ fluxRequired
alpha.water; alpha.water;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.00015;
boundaryField
{
atmosphere
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
walls
{
type kqRWallFunction;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 5e-07;
boundaryField
{
atmosphere
{
type zeroGradient;
}
walls
{
type nutkRoughWallFunction;
Ks uniform 100e-6;
Cs uniform 0.5;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField uniform 2;
boundaryField
{
atmosphere
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
walls
{
type omegaWallFunction;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
RASModel laminar; RASModel kOmegaSST;
turbulence on; turbulence on;

View File

@ -15,7 +15,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar; simulationType laminar; //RASModel;
// ************************************************************************* // // ************************************************************************* //

View File

@ -30,6 +30,8 @@ divSchemes
div(rhoPhi,U) Gauss upwind; div(rhoPhi,U) Gauss upwind;
div(phi,alpha) Gauss vanLeer; div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear; div(phirb,alpha) Gauss linear;
div(phi,k) Gauss upwind;
div(phi,omega) Gauss upwind;
div((muEff*dev(T(grad(U))))) Gauss linear; div((muEff*dev(T(grad(U))))) Gauss linear;
} }
@ -55,5 +57,10 @@ fluxRequired
pcorr; pcorr;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -60,7 +60,7 @@ solvers
nSweeps 1; nSweeps 1;
} }
"(k|B|nuTilda)" "(k|omega|B|nuTilda).*"
{ {
solver smoothSolver; solver smoothSolver;
smoother symGaussSeidel; smoother symGaussSeidel;

View File

@ -60,5 +60,10 @@ fluxRequired
alpha.water; alpha.water;
} }
wallDist
{
method meshWave;
}
// ************************************************************************* // // ************************************************************************* //