mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
wallDist: Add support for distance to any patch set
This commit is contained in:
@ -77,7 +77,6 @@ private:
|
|||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const patchDistMethod&);
|
void operator=(const patchDistMethod&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -129,7 +128,7 @@ public:
|
|||||||
//- Return the patch types for y and n
|
//- Return the patch types for y and n
|
||||||
// These are fixedValue for the set provided otherwise zero-gradient
|
// These are fixedValue for the set provided otherwise zero-gradient
|
||||||
template<class Type>
|
template<class Type>
|
||||||
static inline wordList patchTypes
|
static wordList patchTypes
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const labelHashSet& patchIDs
|
const labelHashSet& patchIDs
|
||||||
@ -166,30 +165,11 @@ public:
|
|||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * //
|
#ifdef NoRepository
|
||||||
|
# include "patchDistMethodTemplates.C"
|
||||||
template<class Type>
|
#endif
|
||||||
inline Foam::wordList Foam::patchDistMethod::patchTypes
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const labelHashSet& patchIDs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
wordList yTypes
|
|
||||||
(
|
|
||||||
mesh.boundary().size(),
|
|
||||||
zeroGradientFvPatchField<Type>::typeName
|
|
||||||
);
|
|
||||||
|
|
||||||
forAllConstIter(labelHashSet, patchIDs, iter)
|
|
||||||
{
|
|
||||||
yTypes[iter.key()] = fixedValueFvPatchField<Type>::typeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
return yTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -44,20 +44,19 @@ void Foam::wallDist::constructn() const
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"nWall",
|
"n" & patchTypeName_,
|
||||||
mesh().time().timeName(),
|
mesh().time().timeName(),
|
||||||
mesh()
|
mesh()
|
||||||
),
|
),
|
||||||
mesh(),
|
mesh(),
|
||||||
dimensionedVector("nWall", dimless, vector::zero),
|
dimensionedVector("n" & patchTypeName_, dimless, vector::zero),
|
||||||
patchDistMethod::patchTypes<vector>(mesh(), pdm_->patchIDs())
|
patchDistMethod::patchTypes<vector>(mesh(), patchIDs_)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const labelHashSet& patchIDs = pdm_->patchIDs();
|
|
||||||
const fvPatchList& patches = mesh().boundary();
|
const fvPatchList& patches = mesh().boundary();
|
||||||
|
|
||||||
forAllConstIter(labelHashSet, patchIDs, iter)
|
forAllConstIter(labelHashSet, patchIDs_, iter)
|
||||||
{
|
{
|
||||||
label patchi = iter.key();
|
label patchi = iter.key();
|
||||||
n_().boundaryField()[patchi] == patches[patchi].nf();
|
n_().boundaryField()[patchi] == patches[patchi].nf();
|
||||||
@ -67,33 +66,84 @@ void Foam::wallDist::constructn() const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::wallDist::wallDist(const fvMesh& mesh)
|
Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName)
|
||||||
:
|
:
|
||||||
MeshObject<fvMesh, Foam::UpdateableMeshObject, wallDist>(mesh),
|
MeshObject<fvMesh, Foam::UpdateableMeshObject, wallDist>(mesh),
|
||||||
|
patchIDs_(mesh.boundaryMesh().findPatchIDs<wallPolyPatch>()),
|
||||||
|
patchTypeName_(patchTypeName),
|
||||||
pdm_
|
pdm_
|
||||||
(
|
(
|
||||||
patchDistMethod::New
|
patchDistMethod::New
|
||||||
(
|
(
|
||||||
static_cast<const fvSchemes&>(mesh).subDict("wallDist"),
|
static_cast<const fvSchemes&>(mesh)
|
||||||
|
.subDict(patchTypeName_ & "Dist"),
|
||||||
mesh,
|
mesh,
|
||||||
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>()
|
patchIDs_
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
y_
|
y_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"yWall",
|
"y" & patchTypeName_,
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh
|
mesh
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
dimensionedScalar("yWall", dimLength, SMALL),
|
dimensionedScalar("y" & patchTypeName_, dimLength, SMALL),
|
||||||
patchDistMethod::patchTypes<scalar>(mesh, pdm_->patchIDs())
|
patchDistMethod::patchTypes<scalar>(mesh, patchIDs_)
|
||||||
),
|
),
|
||||||
nRequired_
|
nRequired_
|
||||||
(
|
(
|
||||||
static_cast<const fvSchemes&>(mesh).subDict("wallDist")
|
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
|
||||||
|
.lookupOrDefault<Switch>("nRequired", false)
|
||||||
|
),
|
||||||
|
n_(volVectorField::null())
|
||||||
|
{
|
||||||
|
if (nRequired_)
|
||||||
|
{
|
||||||
|
constructn();
|
||||||
|
}
|
||||||
|
|
||||||
|
movePoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wallDist::wallDist
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const labelHashSet& patchIDs,
|
||||||
|
const word& patchTypeName
|
||||||
|
)
|
||||||
|
:
|
||||||
|
MeshObject<fvMesh, Foam::UpdateableMeshObject, wallDist>(mesh),
|
||||||
|
patchIDs_(patchIDs),
|
||||||
|
patchTypeName_(patchTypeName),
|
||||||
|
pdm_
|
||||||
|
(
|
||||||
|
patchDistMethod::New
|
||||||
|
(
|
||||||
|
static_cast<const fvSchemes&>(mesh)
|
||||||
|
.subDict(patchTypeName_ & "Dist"),
|
||||||
|
mesh,
|
||||||
|
patchIDs_
|
||||||
|
)
|
||||||
|
),
|
||||||
|
y_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"y" & patchTypeName_,
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("y" & patchTypeName_, dimLength, SMALL),
|
||||||
|
patchDistMethod::patchTypes<scalar>(mesh, patchIDs_)
|
||||||
|
),
|
||||||
|
nRequired_
|
||||||
|
(
|
||||||
|
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
|
||||||
.lookupOrDefault<Switch>("nRequired", false)
|
.lookupOrDefault<Switch>("nRequired", false)
|
||||||
),
|
),
|
||||||
n_(volVectorField::null())
|
n_(volVectorField::null())
|
||||||
@ -120,8 +170,8 @@ const Foam::volVectorField& Foam::wallDist::n() const
|
|||||||
if (isNull(n_()))
|
if (isNull(n_()))
|
||||||
{
|
{
|
||||||
WarningIn("Foam::wallDist::n()")
|
WarningIn("Foam::wallDist::n()")
|
||||||
<< "n requested but 'nRequired' not specified in the wallDist "
|
<< "n requested but 'nRequired' not specified in the "
|
||||||
"dictionary" << nl
|
<< (patchTypeName_ & "Dist") << " dictionary" << nl
|
||||||
<< " Recalculating y and n fields." << endl;
|
<< " Recalculating y and n fields." << endl;
|
||||||
|
|
||||||
nRequired_ = true;
|
nRequired_ = true;
|
||||||
|
|||||||
@ -55,7 +55,6 @@ SourceFiles
|
|||||||
|
|
||||||
#include "MeshObject.H"
|
#include "MeshObject.H"
|
||||||
#include "patchDistMethod.H"
|
#include "patchDistMethod.H"
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -73,6 +72,12 @@ class wallDist
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
//- Set of patch IDs
|
||||||
|
const labelHashSet patchIDs_;
|
||||||
|
|
||||||
|
//- Name for the patch set, e.g. "wall"
|
||||||
|
const word patchTypeName_;
|
||||||
|
|
||||||
//- Run-time selected method to generate the distance-to-wall field
|
//- Run-time selected method to generate the distance-to-wall field
|
||||||
mutable autoPtr<patchDistMethod> pdm_;
|
mutable autoPtr<patchDistMethod> pdm_;
|
||||||
|
|
||||||
@ -106,8 +111,20 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh
|
//- Construct from mesh and optional patch type name
|
||||||
wallDist(const fvMesh& mesh);
|
wallDist
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& patchTypeName = "wall"
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from mesh, patch IDs and optional patch type name
|
||||||
|
wallDist
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const labelHashSet& patchIDs,
|
||||||
|
const word& patchTypeName = "patch"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -116,6 +133,12 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the patchIDs
|
||||||
|
const labelHashSet& patchIDs() const
|
||||||
|
{
|
||||||
|
return patchIDs_;
|
||||||
|
}
|
||||||
|
|
||||||
//- Return reference to cached distance-to-wall field
|
//- Return reference to cached distance-to-wall field
|
||||||
const volScalarField& y() const
|
const volScalarField& y() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user