MRFZone: Add makeRelative and relative functions which operate on the boundary field only

This commit is contained in:
Henry
2013-08-21 12:09:11 +01:00
parent a95284c281
commit e7491f63d5
5 changed files with 101 additions and 20 deletions

View File

@ -35,7 +35,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(MRFZone, 0);
defineTypeNameAndDebug(MRFZone, 0);
}
@ -423,7 +423,7 @@ void Foam::MRFZone::addCoriolis
}
void Foam::MRFZone::relativeVelocity(volVectorField& U) const
void Foam::MRFZone::makeRelative(volVectorField& U) const
{
const volVectorField& C = mesh_.C();
@ -461,7 +461,7 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const
}
void Foam::MRFZone::absoluteVelocity(volVectorField& U) const
void Foam::MRFZone::makeAbsolute(volVectorField& U) const
{
const volVectorField& C = mesh_.C();
@ -501,7 +501,13 @@ void Foam::MRFZone::absoluteVelocity(volVectorField& U) const
void Foam::MRFZone::makeRelative(surfaceScalarField& phi) const
{
relativeRhoFlux(geometricOneField(), phi);
makeRelativeRhoFlux(geometricOneField(), phi);
}
void Foam::MRFZone::makeRelative(FieldField<fvsPatchField, scalar>& phi) const
{
return makeRelativeRhoFlux(oneFieldField(), phi);
}
@ -511,13 +517,13 @@ void Foam::MRFZone::makeRelative
surfaceScalarField& phi
) const
{
relativeRhoFlux(rho, phi);
makeRelativeRhoFlux(rho, phi);
}
void Foam::MRFZone::makeAbsolute(surfaceScalarField& phi) const
{
absoluteRhoFlux(geometricOneField(), phi);
makeAbsoluteRhoFlux(geometricOneField(), phi);
}
@ -527,7 +533,7 @@ void Foam::MRFZone::makeAbsolute
surfaceScalarField& phi
) const
{
absoluteRhoFlux(rho, phi);
makeAbsoluteRhoFlux(rho, phi);
}

View File

@ -45,7 +45,7 @@ SourceFiles
#include "dimensionedScalar.H"
#include "dimensionedVector.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "surfaceFields.H"
#include "fvMatricesFwd.H"
#include "mapPolyMesh.H"
#include "DataEntry.H"
@ -114,15 +114,23 @@ class MRFZone
//- Make the given absolute mass/vol flux relative within the MRF region
template<class RhoFieldType>
void relativeRhoFlux
void makeRelativeRhoFlux
(
const RhoFieldType& rho,
surfaceScalarField& phi
) const;
//- Make the given absolute mass/vol flux relative within the MRF region
template<class RhoFieldType>
void makeRelativeRhoFlux
(
const RhoFieldType& rho,
FieldField<fvsPatchField, scalar>& phi
) const;
//- Make the given relative mass/vol flux absolute within the MRF region
template<class RhoFieldType>
void absoluteRhoFlux
void makeAbsoluteRhoFlux
(
const RhoFieldType& rho,
surfaceScalarField& phi
@ -208,14 +216,18 @@ public:
) const;
//- Make the given absolute velocity relative within the MRF region
void relativeVelocity(volVectorField& U) const;
void makeRelative(volVectorField& U) const;
//- Make the given relative velocity absolute within the MRF region
void absoluteVelocity(volVectorField& U) const;
void makeAbsolute(volVectorField& U) const;
//- Make the given absolute flux relative within the MRF region
void makeRelative(surfaceScalarField& phi) const;
//- Make the given absolute boundary flux relative
// within the MRF region
void makeRelative(FieldField<fvsPatchField, scalar>& phi) const;
//- Make the given absolute mass-flux relative within the MRF region
void makeRelative
(

View File

@ -160,20 +160,20 @@ void Foam::MRFZoneList::addCoriolis
}
void Foam::MRFZoneList::relativeVelocity(volVectorField& U) const
void Foam::MRFZoneList::makeRelative(volVectorField& U) const
{
forAll(*this, i)
{
operator[](i).relativeVelocity(U);
operator[](i).makeRelative(U);
}
}
void Foam::MRFZoneList::absoluteVelocity(volVectorField& U) const
void Foam::MRFZoneList::makeAbsolute(volVectorField& U) const
{
forAll(*this, i)
{
operator[](i).absoluteVelocity(U);
operator[](i).makeAbsolute(U);
}
}
@ -187,6 +187,23 @@ void Foam::MRFZoneList::makeRelative(surfaceScalarField& phi) const
}
Foam::tmp<Foam::FieldField<Foam::fvsPatchField, Foam::scalar> >
Foam::MRFZoneList::relative
(
const tmp<FieldField<fvsPatchField, scalar> >& phi
) const
{
tmp<FieldField<fvsPatchField, scalar> > rphi(phi);
forAll(*this, i)
{
operator[](i).makeRelative(rphi());
}
return rphi;
}
void Foam::MRFZoneList::makeRelative
(
const surfaceScalarField& rho,

View File

@ -103,14 +103,21 @@ public:
void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const;
//- Make the given absolute velocity relative within the MRF region
void relativeVelocity(volVectorField& U) const;
void makeRelative(volVectorField& U) const;
//- Make the given relative velocity absolute within the MRF region
void absoluteVelocity(volVectorField& U) const;
void makeAbsolute(volVectorField& U) const;
//- Make the given absolute flux relative within the MRF region
void makeRelative(surfaceScalarField& phi) const;
//- Return the given absolute boundary flux relative within
// the MRF region
tmp<FieldField<fvsPatchField, scalar> > relative
(
const tmp<FieldField<fvsPatchField, scalar> >& tphi
) const;
//- Make the given absolute mass-flux relative within the MRF region
void makeRelative
(

View File

@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class RhoFieldType>
void Foam::MRFZone::relativeRhoFlux
void Foam::MRFZone::makeRelativeRhoFlux
(
const RhoFieldType& rho,
surfaceScalarField& phi
@ -82,7 +82,46 @@ void Foam::MRFZone::relativeRhoFlux
template<class RhoFieldType>
void Foam::MRFZone::absoluteRhoFlux
void Foam::MRFZone::makeRelativeRhoFlux
(
const RhoFieldType& rho,
FieldField<fvsPatchField, scalar>& phi
) const
{
const surfaceVectorField& Cf = mesh_.Cf();
const surfaceVectorField& Sf = mesh_.Sf();
const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_;
// Included patches
forAll(includedFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
{
label patchFacei = includedFaces_[patchi][i];
phi[patchi][patchFacei] = 0.0;
}
}
// Excluded patches
forAll(excludedFaces_, patchi)
{
forAll(excludedFaces_[patchi], i)
{
label patchFacei = excludedFaces_[patchi][i];
phi[patchi][patchFacei] -=
rho[patchi][patchFacei]
* (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin_))
& Sf.boundaryField()[patchi][patchFacei];
}
}
}
template<class RhoFieldType>
void Foam::MRFZone::makeAbsoluteRhoFlux
(
const RhoFieldType& rho,
surfaceScalarField& phi