ENH: Updated wallShearStress function object to handle specific patches

This commit is contained in:
andy
2012-11-22 09:58:17 +00:00
parent 23bdab1139
commit c619e12056
2 changed files with 96 additions and 27 deletions

View File

@ -53,12 +53,11 @@ void Foam::wallShearStress::calcShearStress
volVectorField& shearStress
)
{
forAll(shearStress.boundaryField(), patchI)
forAllConstIter(labelHashSet, patchSet_, iter)
{
label patchI = iter.key();
const polyPatch& pp = mesh.boundaryMesh()[patchI];
if (isA<wallPolyPatch>(pp))
{
vectorField& ssp = shearStress.boundaryField()[patchI];
const vectorField& Sfp = mesh.Sf().boundaryField()[patchI];
const scalarField& magSfp = mesh.magSf().boundaryField()[patchI];
@ -83,7 +82,6 @@ void Foam::wallShearStress::calcShearStress
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -101,7 +99,8 @@ Foam::wallShearStress::wallShearStress
obr_(obr),
active_(true),
log_(false),
phiName_("phi")
phiName_("phi"),
patchSet_()
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
@ -138,6 +137,54 @@ void Foam::wallShearStress::read(const dictionary& dict)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
patchSet_ =
mesh.boundaryMesh().patchSet
(
wordReList(dict.lookupOrDefault("patches", wordReList()))
);
Info<< type() << " output:" << nl;
if (patchSet_.empty())
{
forAll(pbm, patchI)
{
if (isA<wallPolyPatch>(pbm[patchI]))
{
patchSet_.insert(patchI);
}
}
Info<< " processing all wall patches" << nl << endl;
}
else
{
Info<< " processing wall patches: " << nl;
labelHashSet filteredPatchSet;
forAllConstIter(labelHashSet, patchSet_, iter)
{
label patchI = iter.key();
if (isA<wallPolyPatch>(pbm[patchI]))
{
filteredPatchSet.insert(patchI);
Info<< " " << pbm[patchI].name() << endl;
}
else
{
WarningIn("void wallShearStress::read(const dictionary&)")
<< "Requested wall shear stress on non-wall boundary "
<< "type patch: " << pbm[patchI].name() << endl;
}
}
Info<< endl;
patchSet_ = filteredPatchSet;
}
}
}

View File

@ -36,15 +36,34 @@ Description
Stress = R \dot n
\f]
The shear stress (symmetrical) tensor field is retrieved from the
turbulence model.
where
\vartable
R | stress tensor
n | patch normal vector (into the domain)
\endvartable
The shear stress (symmetrical) tensor field is retrieved from the
turbulence model. All wall patches are included by default; to restrict
the calculation to certain patches, use the optional 'patches' entry.
Example of function object specification:
\verbatim
wallShearStress1
{
type wallShearStress;
functionObjectLibs ("libutilityFunctionObjects.so");
...
patches (".*Wall");
}
\endverbatim
\heading Function object usage
\table
Property | Description | Required | Default value
type | type name: wallShearStress | yes |
patches | list of patches to process | no | all wall patches
\endtable
SourceFiles
wallShearStress.C
IOwallShearStress.H
@ -97,6 +116,9 @@ protected:
//- Name of mass/volume flux field (optional, default = phi)
word phiName_;
//- Optional list of patches to process
labelHashSet patchSet_;
// Protected Member Functions