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,34 +53,32 @@ void Foam::wallShearStress::calcShearStress
volVectorField& shearStress volVectorField& shearStress
) )
{ {
forAll(shearStress.boundaryField(), patchI) forAllConstIter(labelHashSet, patchSet_, iter)
{ {
label patchI = iter.key();
const polyPatch& pp = mesh.boundaryMesh()[patchI]; 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];
const symmTensorField& Reffp = Reff.boundaryField()[patchI];
ssp = (-Sfp/magSfp) & Reffp;
vector minSsp = gMin(ssp);
vector maxSsp = gMax(ssp);
if (Pstream::master())
{ {
vectorField& ssp = shearStress.boundaryField()[patchI]; file() << mesh.time().timeName() << token::TAB
const vectorField& Sfp = mesh.Sf().boundaryField()[patchI]; << pp.name() << token::TAB << minSsp
const scalarField& magSfp = mesh.magSf().boundaryField()[patchI]; << token::TAB << maxSsp << endl;
const symmTensorField& Reffp = Reff.boundaryField()[patchI]; }
ssp = (-Sfp/magSfp) & Reffp; if (log_)
{
vector minSsp = gMin(ssp); Info<< " min/max(" << pp.name() << ") = "
vector maxSsp = gMax(ssp); << minSsp << ", " << maxSsp << endl;
if (Pstream::master())
{
file() << mesh.time().timeName() << token::TAB
<< pp.name() << token::TAB << minSsp
<< token::TAB << maxSsp << endl;
}
if (log_)
{
Info<< " min/max(" << pp.name() << ") = "
<< minSsp << ", " << maxSsp << endl;
}
} }
} }
} }
@ -101,7 +99,8 @@ Foam::wallShearStress::wallShearStress
obr_(obr), obr_(obr),
active_(true), active_(true),
log_(false), log_(false),
phiName_("phi") phiName_("phi"),
patchSet_()
{ {
// Check if the available mesh is an fvMesh, otherwise deactivate // Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_)) if (!isA<fvMesh>(obr_))
@ -138,6 +137,54 @@ void Foam::wallShearStress::read(const dictionary& dict)
{ {
log_ = dict.lookupOrDefault<Switch>("log", false); log_ = dict.lookupOrDefault<Switch>("log", false);
phiName_ = dict.lookupOrDefault<word>("phiName", "phi"); 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 Stress = R \dot n
\f] \f]
The shear stress (symmetrical) tensor field is retrieved from the
turbulence model.
where where
\vartable \vartable
R | stress tensor R | stress tensor
n | patch normal vector (into the domain) n | patch normal vector (into the domain)
\endvartable \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 SourceFiles
wallShearStress.C wallShearStress.C
IOwallShearStress.H IOwallShearStress.H
@ -97,6 +116,9 @@ protected:
//- Name of mass/volume flux field (optional, default = phi) //- Name of mass/volume flux field (optional, default = phi)
word phiName_; word phiName_;
//- Optional list of patches to process
labelHashSet patchSet_;
// Protected Member Functions // Protected Member Functions