mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
wallDist: moved patchTypes into patchDistMethod
This commit is contained in:
@ -67,8 +67,8 @@ Foam::patchDistMethods::advectionDiffusion::advectionDiffusion
|
||||
)
|
||||
),
|
||||
epsilon_(coeffs_.lookupOrDefault<scalar>("epsilon", 0.1)),
|
||||
maxIter_(coeffs_.lookupOrDefault<int>("maxIter", 10)),
|
||||
tolerance_(coeffs_.lookupOrDefault<scalar>("tolerance", 1e-3))
|
||||
tolerance_(coeffs_.lookupOrDefault<scalar>("tolerance", 1e-3)),
|
||||
maxIter_(coeffs_.lookupOrDefault<int>("maxIter", 10))
|
||||
{}
|
||||
|
||||
|
||||
@ -79,30 +79,6 @@ bool Foam::patchDistMethods::advectionDiffusion::correct(volScalarField& y)
|
||||
return correct(y, const_cast<volVectorField&>(volVectorField::null()));
|
||||
}
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<class Type>
|
||||
wordList 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::patchDistMethods::advectionDiffusion::correct
|
||||
(
|
||||
@ -112,36 +88,38 @@ bool Foam::patchDistMethods::advectionDiffusion::correct
|
||||
{
|
||||
pdmPredictor_->correct(y);
|
||||
|
||||
volVectorField ny
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"ny",
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector("nWall", dimless, vector::zero),
|
||||
patchTypes<vector>(mesh_, patchIDs_)
|
||||
);
|
||||
|
||||
const fvPatchList& patches = mesh_.boundary();
|
||||
|
||||
forAllConstIter(labelHashSet, patchIDs_, iter)
|
||||
{
|
||||
label patchi = iter.key();
|
||||
ny.boundaryField()[patchi] == -patches[patchi].nf();
|
||||
}
|
||||
|
||||
int iter = 0;
|
||||
scalar initialResidual = 0;
|
||||
|
||||
do
|
||||
{
|
||||
volVectorField ny
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"ny",
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector("nWall", dimless, vector::zero),
|
||||
patchTypes<vector>(mesh_, patchIDs_)
|
||||
);
|
||||
|
||||
const fvPatchList& patches = mesh_.boundary();
|
||||
|
||||
forAllConstIter(labelHashSet, patchIDs_, iter)
|
||||
{
|
||||
label patchi = iter.key();
|
||||
ny.boundaryField()[patchi] == -patches[patchi].nf();
|
||||
}
|
||||
|
||||
ny = fvc::grad(y);
|
||||
ny /= (mag(ny) + SMALL);
|
||||
|
||||
surfaceVectorField nf(fvc::interpolate(ny));
|
||||
nf /= (mag(nf) + SMALL);
|
||||
|
||||
surfaceScalarField yPhi("yPhi", mesh_.Sf() & nf);
|
||||
|
||||
fvScalarMatrix yEqn
|
||||
@ -155,15 +133,14 @@ bool Foam::patchDistMethods::advectionDiffusion::correct
|
||||
|
||||
yEqn.relax();
|
||||
initialResidual = yEqn.solve().initialResidual();
|
||||
|
||||
// Only calculate n if the field is defined
|
||||
if (notNull(n))
|
||||
{
|
||||
n = -ny;
|
||||
}
|
||||
|
||||
} while (initialResidual > tolerance_ && ++iter < maxIter_);
|
||||
|
||||
// Only calculate n if the field is defined
|
||||
if (notNull(n))
|
||||
{
|
||||
n = -ny;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -39,9 +39,10 @@ SourceFiles
|
||||
#include "HashSet.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -66,7 +67,6 @@ protected:
|
||||
//- Set of patch IDs
|
||||
const labelHashSet patchIDs_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
@ -124,6 +124,18 @@ public:
|
||||
virtual ~patchDistMethod();
|
||||
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Return the patch types for y and n
|
||||
// These are fixedValue for the set provided otherwise zero-gradient
|
||||
template<class Type>
|
||||
static inline wordList patchTypes
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelHashSet& patchIDs
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the patchIDs
|
||||
@ -154,6 +166,31 @@ public:
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
@ -25,8 +25,6 @@ License
|
||||
|
||||
#include "wallDist.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,26 +34,6 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::wordList Foam::wallDist::patchTypes(const labelHashSet& patchIDs) const
|
||||
{
|
||||
wordList yTypes
|
||||
(
|
||||
mesh().boundary().size(),
|
||||
zeroGradientFvPatchField<Type>::typeName
|
||||
);
|
||||
|
||||
forAllConstIter(labelHashSet, patchIDs, iter)
|
||||
{
|
||||
yTypes[iter.key()] = fixedValueFvPatchField<Type>::typeName;
|
||||
}
|
||||
|
||||
return yTypes;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::wallDist::wallDist(const fvMesh& mesh)
|
||||
@ -80,7 +58,7 @@ Foam::wallDist::wallDist(const fvMesh& mesh)
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("yWall", dimLength, SMALL),
|
||||
patchTypes<scalar>(pdm_->patchIDs())
|
||||
patchDistMethod::patchTypes<scalar>(mesh, pdm_->patchIDs())
|
||||
),
|
||||
n_(NULL)
|
||||
{
|
||||
@ -98,7 +76,7 @@ Foam::wallDist::wallDist(const fvMesh& mesh)
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector("nWall", dimless, vector::zero),
|
||||
patchTypes<vector>(pdm_->patchIDs())
|
||||
patchDistMethod::patchTypes<vector>(mesh, pdm_->patchIDs())
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -68,11 +68,6 @@ class wallDist
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Return the patch types for y and n
|
||||
// These are fixedValue for the set provided otherwise zero-gradient
|
||||
template<class Type>
|
||||
wordList patchTypes(const labelHashSet& patchIDs) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
wallDist(const wallDist&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user