From 2b954ab543e738a0a9538736e4f5efdd24d1dc87 Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 22 Apr 2010 15:16:39 +0100 Subject: [PATCH] MRFZone: Added function to convert between absolute and relative velocities. --- src/finiteVolume/cfdTools/general/MRF/MRFZone.C | 39 ++++++++++++++++++++++++ src/finiteVolume/cfdTools/general/MRF/MRFZone.H | 3 ++ src/finiteVolume/cfdTools/general/MRF/MRFZones.C | 9 ++++++ src/finiteVolume/cfdTools/general/MRF/MRFZones.H | 3 ++ 4 files changed, 54 insertions(+) diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index 3ed30360..23aef4b3 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -376,6 +376,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); diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H index f36a8350..57797cb2 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H @@ -176,6 +176,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; diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C b/src/finiteVolume/cfdTools/general/MRF/MRFZones.C index 6bfafcca..1e80ea46 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZones.C @@ -87,6 +87,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) diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H b/src/finiteVolume/cfdTools/general/MRF/MRFZones.H index b074cd5f..66bc52d9 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZones.H @@ -82,6 +82,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; -- 2.11.4.GIT