Enable turbulent walls for coupled patches

This commit is contained in:
Henrik Rusche 2011-01-14 13:16:23 +01:00 committed by Hrvoje Jasak
parent 9e064e038e
commit 2063c78b8d
10 changed files with 84 additions and 14 deletions

View file

@ -172,13 +172,15 @@ Foam::regionCouplePolyPatch::regionCouplePolyPatch
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& shadowRegionName, const word& shadowRegionName,
const word& shadowPatchName, const word& shadowPatchName,
const bool attached const bool attached,
const bool attachedWalls
) )
: :
coupledPolyPatch(name, size, start, index, bm), coupledPolyPatch(name, size, start, index, bm),
shadowRegionName_(shadowRegionName), shadowRegionName_(shadowRegionName),
shadowPatchName_(shadowPatchName), shadowPatchName_(shadowPatchName),
attached_(attached), attached_(attached),
attachedWalls_(attachedWalls),
shadowIndex_(-1), shadowIndex_(-1),
patchToPatchPtr_(NULL), patchToPatchPtr_(NULL),
reconFaceCellCentresPtr_(NULL) reconFaceCellCentresPtr_(NULL)
@ -198,6 +200,7 @@ Foam::regionCouplePolyPatch::regionCouplePolyPatch
shadowRegionName_(dict.lookup("shadowRegion")), shadowRegionName_(dict.lookup("shadowRegion")),
shadowPatchName_(dict.lookup("shadowPatch")), shadowPatchName_(dict.lookup("shadowPatch")),
attached_(dict.lookup("attached")), attached_(dict.lookup("attached")),
attachedWalls_(dict.lookup("attachedWalls")),
shadowIndex_(-1), shadowIndex_(-1),
patchToPatchPtr_(NULL), patchToPatchPtr_(NULL),
reconFaceCellCentresPtr_(NULL) reconFaceCellCentresPtr_(NULL)
@ -215,6 +218,7 @@ Foam::regionCouplePolyPatch::regionCouplePolyPatch
shadowRegionName_(pp.shadowRegionName_), shadowRegionName_(pp.shadowRegionName_),
shadowPatchName_(pp.shadowPatchName_), shadowPatchName_(pp.shadowPatchName_),
attached_(pp.attached_), attached_(pp.attached_),
attachedWalls_(pp.attachedWalls_),
shadowIndex_(-1), shadowIndex_(-1),
patchToPatchPtr_(NULL), patchToPatchPtr_(NULL),
reconFaceCellCentresPtr_(NULL) reconFaceCellCentresPtr_(NULL)
@ -235,6 +239,7 @@ Foam::regionCouplePolyPatch::regionCouplePolyPatch
shadowRegionName_(pp.shadowRegionName_), shadowRegionName_(pp.shadowRegionName_),
shadowPatchName_(pp.shadowPatchName_), shadowPatchName_(pp.shadowPatchName_),
attached_(pp.attached_), attached_(pp.attached_),
attachedWalls_(pp.attachedWalls_),
shadowIndex_(-1), shadowIndex_(-1),
patchToPatchPtr_(NULL), patchToPatchPtr_(NULL),
reconFaceCellCentresPtr_(NULL) reconFaceCellCentresPtr_(NULL)

View file

@ -69,6 +69,9 @@ class regionCouplePolyPatch
//- Are the regions attached //- Are the regions attached
mutable Switch attached_; mutable Switch attached_;
//- Are the region attached walls
mutable Switch attachedWalls_;
//- Shadow patch index. Delayed evaluation for construction //- Shadow patch index. Delayed evaluation for construction
mutable label shadowIndex_; mutable label shadowIndex_;
@ -139,7 +142,8 @@ public:
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const word& shadowRegionName, const word& shadowRegionName,
const word& shadowPatchName, const word& shadowPatchName,
const bool attached const bool attached,
const bool attachedWall
); );
//- Construct from dictionary //- Construct from dictionary
@ -233,6 +237,12 @@ public:
return attached_; return attached_;
} }
//AJ: read from dictionary if coupled patch is also a wall
bool isWall() const
{
return attachedWalls_;
}
//- Attach regions //- Attach regions
void attach() const; void attach() const;

View file

@ -114,6 +114,11 @@ public:
); );
} }
// Virtual function for wall handling of derived class
virtual bool isWall() const
{
return true;
}
// Destructor // Destructor

View file

@ -368,6 +368,12 @@ public:
return false; return false;
} }
// Virtual function for wall handling of all derived calsses
virtual bool isWall() const
{
return false;
}
//- Return true if the given type is a constraint type //- Return true if the given type is a constraint type
static bool constraintType(const word& pt); static bool constraintType(const word& pt);

View file

@ -170,6 +170,12 @@ public:
return polyPatch_.coupled(); return polyPatch_.coupled();
} }
//- Return true if this patch is wall
bool isWall() const
{
return polyPatch_.isWall();
}
//- Return true if the given type is a constraint type //- Return true if the given type is a constraint type
static bool constraintType(const word& pt); static bool constraintType(const word& pt);
@ -200,10 +206,7 @@ public:
} }
template<class T> template<class T>
const typename Field<T>::subField patchSlice const typename Field<T>::subField patchSlice(const Field<T>& l) const
(
const Field<T>& l
) const
{ {
return typename Field<T>::subField return typename Field<T>::subField
( (

View file

@ -36,8 +36,19 @@ void Foam::nearWallDist::doAll()
{ {
cellDistFuncs wallUtils(mesh_); cellDistFuncs wallUtils(mesh_);
// AJ: make sure to pick up all patches that are specified as a wall
const polyBoundaryMesh& bMesh = wallUtils.mesh().boundaryMesh();
labelHashSet wallPatchIDs(bMesh.size());
forAll(bMesh, patchI)
{
if (bMesh[patchI].isWall())
{
wallPatchIDs.insert(patchI);
}
}
// Get patch ids of walls // Get patch ids of walls
labelHashSet wallPatchIDs(wallUtils.getPatchIDs<wallPolyPatch>()); // labelHashSet wallPatchIDs(wallUtils.getPatchIDs<wallPolyPatch>());
// Size neighbours array for maximum possible // Size neighbours array for maximum possible
@ -54,7 +65,9 @@ void Foam::nearWallDist::doAll()
const fvPatch& patch = mesh_.boundary()[patchI]; const fvPatch& patch = mesh_.boundary()[patchI];
if (isA<wallFvPatch>(patch)) // AJ: Allow other patch types to be seen as a wall type
// if (isA<wallFvPatch>(patch))
if (patch.isWall())
{ {
const polyPatch& pPatch = patch.patch(); const polyPatch& pPatch = patch.patch();

View file

@ -67,8 +67,19 @@ Foam::wallDist::~wallDist()
// future (if only small topology change) // future (if only small topology change)
void Foam::wallDist::correct() void Foam::wallDist::correct()
{ {
// AJ: make sure to pick up all patches that are specified as a wall
const polyBoundaryMesh& bMesh = cellDistFuncs::mesh().boundaryMesh();
labelHashSet wallPatchIDs(bMesh.size());
forAll(bMesh, patchI)
{
if (bMesh[patchI].isWall())
{
wallPatchIDs.insert(patchI);
}
}
// Get patchids of walls // Get patchids of walls
labelHashSet wallPatchIDs(getPatchIDs<wallPolyPatch>()); // labelHashSet wallPatchIDs(getPatchIDs<wallPolyPatch>());
// Calculate distance starting from wallPatch faces. // Calculate distance starting from wallPatch faces.
patchWave wave(cellDistFuncs::mesh(), wallPatchIDs, correctWalls_); patchWave wave(cellDistFuncs::mesh(), wallPatchIDs, correctWalls_);

View file

@ -73,14 +73,25 @@ Foam::wallDistData<TransferType>::~wallDistData()
template<class TransferType> template<class TransferType>
void Foam::wallDistData<TransferType>::correct() void Foam::wallDistData<TransferType>::correct()
{ {
Info<< "wallDistData.correct() called" << endl;
const polyMesh& mesh = cellDistFuncs::mesh(); const polyMesh& mesh = cellDistFuncs::mesh();
// //
// Fill data on wall patches with initial values // Fill data on wall patches with initial values
// //
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
labelHashSet wallPatchIDs(bMesh.size());
forAll(bMesh, patchI)
{
if (bMesh[patchI].isWall())
{
wallPatchIDs.insert(patchI);
}
}
// Get patchids of walls // Get patchids of walls
labelHashSet wallPatchIDs(getPatchIDs<wallPolyPatch>()); // labelHashSet wallPatchIDs(getPatchIDs<wallPolyPatch>());
// Collect pointers to data on patches // Collect pointers to data on patches
UPtrList<Field<Type> > patchData(mesh.boundaryMesh().size()); UPtrList<Field<Type> > patchData(mesh.boundaryMesh().size());

View file

@ -44,7 +44,9 @@ namespace RASModels
void epsilonWallFunctionFvPatchScalarField::checkType() void epsilonWallFunctionFvPatchScalarField::checkType()
{ {
if (!isA<wallFvPatch>(patch())) // AJ: Allow other patch types to be seen as wall type
// if (!isA<wallFvPatch>(patch()))
if (!this->patch().isWall())
{ {
FatalErrorIn("epsilonWallFunctionFvPatchScalarField::checkType()") FatalErrorIn("epsilonWallFunctionFvPatchScalarField::checkType()")
<< "Invalid wall function specification" << nl << "Invalid wall function specification" << nl

View file

@ -28,6 +28,8 @@ License
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "regionCoupleFvPatch.H"
#include "movingWallVelocityFvPatchVectorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,7 +45,9 @@ namespace RASModels
template<class Type> template<class Type>
void kqRWallFunctionFvPatchField<Type>::checkType() void kqRWallFunctionFvPatchField<Type>::checkType()
{ {
if (!isA<wallFvPatch>(this->patch())) // AJ: Allow other patch types to be seemovingWalln as wall type
// if (!isA<wallFvPatch>(this->patch()))
if (!this->patch().isWall())
{ {
FatalErrorIn("kqRWallFunctionFvPatchField::checkType()") FatalErrorIn("kqRWallFunctionFvPatchField::checkType()")
<< "Invalid wall function specification" << nl << "Invalid wall function specification" << nl