ENH: wallShearStress function object - store result on mesh database

This commit is contained in:
andy
2013-09-19 15:15:53 +01:00
parent ec66f480c7
commit 500315b17b

View File

@ -121,6 +121,35 @@ Foam::wallShearStress::wallShearStress
<< endl; << endl;
} }
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volVectorField* wallShearStressPtr
(
new volVectorField
(
IOobject
(
type(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedVector
(
"0",
sqr(dimLength)/sqr(dimTime),
vector::zero
)
)
);
mesh.objectRegistry::store(wallShearStressPtr);
}
read(dict); read(dict);
} }
@ -219,18 +248,11 @@ void Foam::wallShearStress::write()
const fvMesh& mesh = refCast<const fvMesh>(obr_); const fvMesh& mesh = refCast<const fvMesh>(obr_);
volVectorField wallShearStress volVectorField& wallShearStress =
( const_cast<volVectorField&>
IOobject
( (
"wallShearStress", mesh.lookupObject<volVectorField>(type())
mesh.time().timeName(), );
mesh,
IOobject::NO_READ
),
mesh,
dimensionedVector("0", sqr(dimLength)/sqr(dimTime), vector::zero)
);
if (log_) if (log_)
{ {
@ -256,7 +278,7 @@ void Foam::wallShearStress::write()
else else
{ {
FatalErrorIn("void Foam::wallShearStress::write()") FatalErrorIn("void Foam::wallShearStress::write()")
<< "Unable to find incompressible turbulence model in the " << "Unable to find turbulence model in the "
<< "database" << exit(FatalError); << "database" << exit(FatalError);
} }
@ -265,7 +287,8 @@ void Foam::wallShearStress::write()
if (log_) if (log_)
{ {
Info<< " writing field " << wallShearStress.name() << nl Info<< type() << " " << name_ << " output:" << nl
<< " writing field " << wallShearStress.name() << nl
<< endl; << endl;
} }