Commit 7edd801c authored by Andrew Heather's avatar Andrew Heather
Browse files

BUG: wall/patch distance and inverseDistanceDiffusivity - updated dimensions...

BUG: wall/patch distance and inverseDistanceDiffusivity - updated dimensions and use meshWave as a default method for backwards compatibility.  Fixes #462
parent c9df5f92
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -77,6 +77,36 @@ Foam::autoPtr<Foam::patchDistMethod> Foam::patchDistMethod::New
}
Foam::autoPtr<Foam::patchDistMethod> Foam::patchDistMethod::New
(
const dictionary& dict,
const fvMesh& mesh,
const labelHashSet& patchIDs,
const word& defaultPatchDistMethod
)
{
word patchDistMethodType = defaultPatchDistMethod;
dict.readIfPresent("method", patchDistMethodType);
Info<< "Selecting patchDistMethod " << patchDistMethodType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(patchDistMethodType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown patchDistMethodType type "
<< patchDistMethodType << endl << endl
<< "Valid patchDistMethod types are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return cstrIter()(dict, mesh, patchIDs);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::patchDistMethod::~patchDistMethod()
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -118,6 +118,14 @@ public:
const labelHashSet& patchIDs
);
static autoPtr<patchDistMethod> New
(
const dictionary& dict,
const fvMesh& mesh,
const labelHashSet& patchIDs,
const word& defaultPatchDistMethod
);
//- Destructor
virtual ~patchDistMethod();
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -68,17 +68,28 @@ void Foam::wallDist::constructn() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName)
Foam::wallDist::wallDist
(
const fvMesh& mesh,
const labelHashSet& patchIDs,
const word& patchTypeName
)
:
MeshObject<fvMesh, Foam::UpdateableMeshObject, wallDist>(mesh),
patchIDs_(mesh.boundaryMesh().findPatchIDs<wallPolyPatch>()),
patchIDs_(patchIDs),
patchTypeName_(patchTypeName),
dict_
(
static_cast<const fvSchemes&>(mesh).subOrEmptyDict
(
patchTypeName_ & "Dist"
)
),
pdm_
(
patchDistMethod::New
(
static_cast<const fvSchemes&>(mesh)
.subDict(patchTypeName_ & "Dist"),
dict_,
mesh,
patchIDs_
)
......@@ -95,17 +106,9 @@ Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName)
dimensionedScalar("y" & patchTypeName_, dimLength, SMALL),
patchDistMethod::patchTypes<scalar>(mesh, patchIDs_)
),
nRequired_
(
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
.lookupOrDefault<Switch>("nRequired", false)
),
nRequired_(dict_.lookupOrDefault<Switch>("nRequired", false)),
n_(volVectorField::null()),
updateInterval_
(
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
.lookupOrDefault<label>("updateInterval", 1)
),
updateInterval_(dict_.lookupOrDefault<label>("updateInterval", 1)),
requireUpdate_(true)
{
if (nRequired_)
......@@ -120,6 +123,7 @@ Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName)
Foam::wallDist::wallDist
(
const fvMesh& mesh,
const word& defaultPatchDistMethod,
const labelHashSet& patchIDs,
const word& patchTypeName
)
......@@ -127,14 +131,21 @@ Foam::wallDist::wallDist
MeshObject<fvMesh, Foam::UpdateableMeshObject, wallDist>(mesh),
patchIDs_(patchIDs),
patchTypeName_(patchTypeName),
dict_
(
static_cast<const fvSchemes&>(mesh).subOrEmptyDict
(
patchTypeName_ & "Dist"
)
),
pdm_
(
patchDistMethod::New
(
static_cast<const fvSchemes&>(mesh)
.subDict(patchTypeName_ & "Dist"),
dict_,
mesh,
patchIDs_
patchIDs_,
defaultPatchDistMethod
)
),
y_
......@@ -149,17 +160,9 @@ Foam::wallDist::wallDist
dimensionedScalar("y" & patchTypeName_, dimLength, SMALL),
patchDistMethod::patchTypes<scalar>(mesh, patchIDs_)
),
nRequired_
(
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
.lookupOrDefault<Switch>("nRequired", false)
),
nRequired_(dict_.lookupOrDefault<Switch>("nRequired", false)),
n_(volVectorField::null()),
updateInterval_
(
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
.lookupOrDefault<label>("updateInterval", 1)
),
updateInterval_(dict_.lookupOrDefault<label>("updateInterval", 1)),
requireUpdate_(true)
{
if (nRequired_)
......@@ -171,6 +174,17 @@ Foam::wallDist::wallDist
}
Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName)
:
wallDist
(
mesh,
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>(),
patchTypeName
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallDist::~wallDist()
......
......@@ -82,6 +82,9 @@ class wallDist
//- Name for the patch set, e.g. "wall"
const word patchTypeName_;
//- Construction dictionary
const dictionary dict_;
//- Run-time selected method to generate the distance-to-wall field
mutable autoPtr<patchDistMethod> pdm_;
......@@ -121,21 +124,31 @@ public:
// Constructors
//- Construct from mesh and optional patch type name
//- Construct from mesh, patch IDs and optional patch type name
wallDist
(
const fvMesh& mesh,
const word& patchTypeName = "wall"
const labelHashSet& patchIDs,
const word& patchTypeName = "patch"
);
//- Construct from mesh, patch IDs and optional patch type name
//- Construct from mesh, patch IDs, default patch distance method
// and optional patch type name
wallDist
(
const fvMesh& mesh,
const word& defaultPatchDistMethod,
const labelHashSet& patchIDs,
const word& patchTypeName = "patch"
);
//- Construct from mesh and optional patch type name
wallDist
(
const fvMesh& mesh,
const word& patchTypeName = "wall"
);
//- Destructor
virtual ~wallDist();
......
......@@ -30,6 +30,7 @@ License
#include "surfaceInterpolate.H"
#include "zeroGradientFvPatchFields.H"
#include "wallDist.H"
#include "meshWavePatchDistMethod.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -72,12 +73,13 @@ Foam::inverseDistanceDiffusivity::~inverseDistanceDiffusivity()
void Foam::inverseDistanceDiffusivity::correct()
{
faceDiffusivity_ =
1.0
dimensionedScalar("one", dimLength, 1)
/fvc::interpolate
(
wallDist::New
(
mesh(),
patchDistMethods::meshWave::typeName,
mesh().boundaryMesh().patchSet(patchNames_)
).y()
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment