added pressure reference

This commit is contained in:
andy
2009-09-02 17:55:42 +01:00
parent 40e22860e9
commit 906a0458da
2 changed files with 12 additions and 3 deletions

View File

@ -190,6 +190,7 @@ Foam::forces::forces
directForceDensity_(false), directForceDensity_(false),
fDName_(""), fDName_(""),
rhoRef_(VGREAT), rhoRef_(VGREAT),
pRef_(0),
CofR_(vector::zero), CofR_(vector::zero),
forcesFilePtr_(NULL) forcesFilePtr_(NULL)
{ {
@ -282,13 +283,15 @@ void Foam::forces::read(const dictionary& dict)
Info<< " or " << rhoName_; Info<< " or " << rhoName_;
} }
Info<< " in database." << nl Info<< " in database." << nl << " De-activating forces."
<< " De-activating forces."
<< endl; << endl;
} }
// Reference density needed for incompressible calculations // Reference density needed for incompressible calculations
rhoRef_ = readScalar(dict.lookup("rhoInf")); rhoRef_ = readScalar(dict.lookup("rhoInf"));
// Reference pressure, 0 by default
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
} }
// Centre of rotation for moment calculations // Centre of rotation for moment calculations
@ -443,13 +446,16 @@ Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const
const volSymmTensorField::GeometricBoundaryField& devRhoReffb const volSymmTensorField::GeometricBoundaryField& devRhoReffb
= tdevRhoReff().boundaryField(); = tdevRhoReff().boundaryField();
// Scale pRef by density for incompressible simulations
scalar pRef = pRef_/rho(p);
forAllConstIter(labelHashSet, patchSet_, iter) forAllConstIter(labelHashSet, patchSet_, iter)
{ {
label patchi = iter.key(); label patchi = iter.key();
vectorField Md = mesh.C().boundaryField()[patchi] - CofR_; vectorField Md = mesh.C().boundaryField()[patchi] - CofR_;
vectorField pf = Sfb[patchi]*p.boundaryField()[patchi]; vectorField pf = Sfb[patchi]*(p.boundaryField()[patchi] - pRef);
fm.first().first() += rho(p)*sum(pf); fm.first().first() += rho(p)*sum(pf);
fm.second().first() += rho(p)*sum(Md ^ pf); fm.second().first() += rho(p)*sum(Md ^ pf);

View File

@ -144,6 +144,9 @@ protected:
//- Reference density needed for incompressible calculations //- Reference density needed for incompressible calculations
scalar rhoRef_; scalar rhoRef_;
//- Reference pressure
scalar pRef_;
//- Centre of rotation //- Centre of rotation
vector CofR_; vector CofR_;