From 503eefc3256b38986864e8e067de2b2a55473ff7 Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Wed, 21 Mar 2012 17:34:41 +0000
Subject: [PATCH] MRF: new function to add Coriolis contribution to the given
 field

---
 .../cfdTools/general/MRF/MRFZone.C            | 25 +++++++++++++++++++
 .../cfdTools/general/MRF/MRFZone.H            |  3 +++
 .../cfdTools/general/MRF/MRFZones.C           | 13 ++++++++++
 .../cfdTools/general/MRF/MRFZones.H           |  3 +++
 4 files changed, 44 insertions(+)

diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C
index 4e3cd2354a5..a909154ee11 100644
--- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C
+++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C
@@ -292,6 +292,31 @@ Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+void Foam::MRFZone::addCoriolis
+(
+    const volVectorField& U,
+    volVectorField& ddtU
+) const
+{
+    if (cellZoneID_ == -1)
+    {
+        return;
+    }
+
+    const labelList& cells = mesh_.cellZones()[cellZoneID_];
+    const scalarField& V = mesh_.V();
+    vectorField& ddtUc = ddtU.internalField();
+    const vectorField& Uc = U.internalField();
+    const vector& Omega = Omega_.value();
+
+    forAll(cells, i)
+    {
+        label celli = cells[i];
+        ddtUc[celli] += V[celli]*(Omega ^ Uc[celli]);
+    }
+}
+
+
 void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
 {
     if (cellZoneID_ == -1)
diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H
index c110eb44008..d9f2fa979aa 100644
--- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H
+++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H
@@ -166,6 +166,9 @@ public:
             setMRFFaces();
         }
 
+        //- Add the Coriolis force contribution to the acceleration field
+        void addCoriolis(const volVectorField& U, volVectorField& ddtU) const;
+
         //- Add the Coriolis force contribution to the momentum equation
         void addCoriolis(fvVectorMatrix& UEqn) const;
 
diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C b/src/finiteVolume/cfdTools/general/MRF/MRFZones.C
index 52d26b31083..b915c9c65bb 100644
--- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C
+++ b/src/finiteVolume/cfdTools/general/MRF/MRFZones.C
@@ -55,6 +55,19 @@ Foam::MRFZones::MRFZones(const fvMesh& mesh)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+void Foam::MRFZones::addCoriolis
+(
+    const volVectorField& U,
+    volVectorField& ddtU
+) const
+{
+    forAll(*this, i)
+    {
+        operator[](i).addCoriolis(U, ddtU);
+    }
+}
+
+
 void Foam::MRFZones::addCoriolis(fvVectorMatrix& UEqn) const
 {
     forAll(*this, i)
diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H b/src/finiteVolume/cfdTools/general/MRF/MRFZones.H
index 139d45d2561..db973dcc807 100644
--- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H
+++ b/src/finiteVolume/cfdTools/general/MRF/MRFZones.H
@@ -72,6 +72,9 @@ public:
 
     // Member Functions
 
+        //- Add the Coriolis force contribution to the acceleration field
+        void addCoriolis(const volVectorField& U, volVectorField& ddtU) const;
+
         //- Add the Coriolis force contribution to the momentum equation
         void addCoriolis(fvVectorMatrix& UEqn) const;
 
-- 
GitLab