Skip to content
Snippets Groups Projects
Commit 5af8f4e6 authored by henry's avatar henry
Browse files

MRFZone: Added function to convert between absolute and relative velocities.

parent 48feefd1
Branches
Tags
No related merge requests found
......@@ -375,6 +375,45 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const
}
void Foam::MRFZone::absoluteVelocity(volVectorField& U) const
{
const volVectorField& C = mesh_.C();
const vector& origin = origin_.value();
const vector& Omega = Omega_.value();
const labelList& cells = mesh_.cellZones()[cellZoneID_];
forAll(cells, i)
{
label celli = cells[i];
U[celli] += (Omega ^ (C[celli] - origin));
}
// Included patches
forAll(includedFaces_, patchi)
{
forAll(includedFaces_[patchi], i)
{
label patchFacei = includedFaces_[patchi][i];
U.boundaryField()[patchi][patchFacei] =
(Omega ^ (C.boundaryField()[patchi][patchFacei] - origin));
}
}
// Excluded patches
forAll(excludedFaces_, patchi)
{
forAll(excludedFaces_[patchi], i)
{
label patchFacei = excludedFaces_[patchi][i];
U.boundaryField()[patchi][patchFacei] +=
(Omega ^ (C.boundaryField()[patchi][patchFacei] - origin));
}
}
}
void Foam::MRFZone::relativeFlux(surfaceScalarField& phi) const
{
relativeRhoFlux(geometricOneField(), phi);
......
......@@ -175,6 +175,9 @@ public:
//- Make the given absolute velocity relative within the MRF region
void relativeVelocity(volVectorField& U) const;
//- Make the given relative velocity absolute within the MRF region
void absoluteVelocity(volVectorField& U) const;
//- Make the given absolute flux relative within the MRF region
void relativeFlux(surfaceScalarField& phi) const;
......
......@@ -86,6 +86,15 @@ void Foam::MRFZones::relativeVelocity(volVectorField& U) const
}
void Foam::MRFZones::absoluteVelocity(volVectorField& U) const
{
forAll(*this, i)
{
operator[](i).absoluteVelocity(U);
}
}
void Foam::MRFZones::relativeFlux(surfaceScalarField& phi) const
{
forAll(*this, i)
......
......@@ -81,6 +81,9 @@ public:
//- Make the given absolute velocity relative within the MRF region
void relativeVelocity(volVectorField& U) const;
//- Make the given relative velocity absolute within the MRF region
void absoluteVelocity(volVectorField& U) const;
//- Make the given absolute flux relative within the MRF region
void relativeFlux(surfaceScalarField& phi) const;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment