From a8dcee259a95a75a053b849b9a44e7a5fbe9789b Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Mon, 18 Feb 2013 15:23:16 +0000
Subject: [PATCH] fvOptions heatExchangerSource renamed to
 effectivenessHeatExchangerSource

Changed internal variable names to improve readability
---
 src/fvOptions/Make/files                      |  2 +-
 .../effectivenessHeatExchangerSource.C}       | 66 ++++++++-----------
 .../effectivenessHeatExchangerSource.H}       | 50 ++++++--------
 3 files changed, 47 insertions(+), 71 deletions(-)
 rename src/fvOptions/sources/derived/{heatExchangerSource/heatExchangerSource.C => effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C} (84%)
 rename src/fvOptions/sources/derived/{heatExchangerSource/heatExchangerSource.H => effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H} (84%)

diff --git a/src/fvOptions/Make/files b/src/fvOptions/Make/files
index 1cae70c312d..d45448f27ae 100644
--- a/src/fvOptions/Make/files
+++ b/src/fvOptions/Make/files
@@ -27,7 +27,7 @@ $(derivedSources)/rotorDiskSource/trimModel/trimModel/trimModel.C
 $(derivedSources)/rotorDiskSource/trimModel/trimModel/trimModelNew.C
 $(derivedSources)/rotorDiskSource/trimModel/fixed/fixedTrim.C
 $(derivedSources)/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C
-$(derivedSources)/heatExchangerSource/heatExchangerSource.C
+$(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
 
 interRegion = sources/interRegion
 $(interRegion)/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C
diff --git a/src/fvOptions/sources/derived/heatExchangerSource/heatExchangerSource.C b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
similarity index 84%
rename from src/fvOptions/sources/derived/heatExchangerSource/heatExchangerSource.C
rename to src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
index 7c4c0720675..9abfe9bd447 100644
--- a/src/fvOptions/sources/derived/heatExchangerSource/heatExchangerSource.C
+++ b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,7 +24,7 @@ License
 
 \*----------------------------------------------------------------------------*/
 
-#include "heatExchangerSource.H"
+#include "effectivenessHeatExchangerSource.H"
 #include "fvMesh.H"
 #include "fvMatrix.H"
 #include "addToRunTimeSelectionTable.H"
@@ -38,11 +38,11 @@ namespace Foam
 {
 namespace fv
 {
-    defineTypeNameAndDebug(heatExchangerSource, 0);
+    defineTypeNameAndDebug(effectivenessHeatExchangerSource, 0);
     addToRunTimeSelectionTable
     (
         option,
-        heatExchangerSource,
+        effectivenessHeatExchangerSource,
         dictionary
     );
 }
@@ -51,7 +51,7 @@ namespace fv
 
 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-void Foam::fv::heatExchangerSource::init()
+void Foam::fv::effectivenessHeatExchangerSource::init()
 {
     const faceZone& fZone = mesh_.faceZones()[zoneID_];
 
@@ -119,26 +119,7 @@ void Foam::fv::heatExchangerSource::init()
 }
 
 
-void Foam::fv::heatExchangerSource::addHeatSource
-(
-    scalarField& heSource,
-    const labelList& cells,
-    const scalarField& Vcells,
-    const vectorField& U,
-    const scalar Qt,
-    const scalarField& deltaTCells,
-    const scalar totHeat
-) const
-{
-    forAll(cells, i)
-    {
-        heSource[cells[i]] -=
-            Qt*Vcells[cells[i]]*mag(U[cells[i]])*deltaTCells[i]/totHeat;
-    }
-}
-
-
-void Foam::fv::heatExchangerSource::calculateTotalArea(scalar& var)
+void Foam::fv::effectivenessHeatExchangerSource::calculateTotalArea(scalar& var)
 {
     var = 0;
     forAll(faceId_, i)
@@ -157,9 +138,10 @@ void Foam::fv::heatExchangerSource::calculateTotalArea(scalar& var)
     reduce(var, sumOp<scalar>());
 }
 
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::fv::heatExchangerSource::heatExchangerSource
+Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
 (
     const word& name,
     const word& modelType,
@@ -187,7 +169,7 @@ Foam::fv::heatExchangerSource::heatExchangerSource
     {
         FatalErrorIn
         (
-            "heatExchangerSource::heatExchangerSource"
+            "effectivenessHeatExchangerSource::effectivenessHeatExchangerSource"
             "("
             "   const word& name,"
             "   const word& modelType,"
@@ -208,14 +190,14 @@ Foam::fv::heatExchangerSource::heatExchangerSource
 
     init();
 
-    Info<< "    - creating heatExchangerSource: "
+    Info<< "    - creating effectivenessHeatExchangerSource: "
         << this->name() << endl;
 }
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-void Foam::fv::heatExchangerSource::addSup
+void Foam::fv::effectivenessHeatExchangerSource::addSup
 (
     fvMatrix<scalar>& eqn,
     const label
@@ -224,7 +206,7 @@ void Foam::fv::heatExchangerSource::addSup
     const basicThermo& thermo =
         mesh_.lookupObject<basicThermo>("thermophysicalProperties");
 
-    const surfaceScalarField Cpf = fvc::interpolate(thermo.Cp());
+    const surfaceScalarField Cpf(fvc::interpolate(thermo.Cp()));
 
     const surfaceScalarField& phi =
         mesh_.lookupObject<surfaceScalarField>(phiName_);
@@ -285,19 +267,23 @@ void Foam::fv::heatExchangerSource::addSup
     }
 
     const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
-    const scalarField& cellsV = mesh_.V();
-    scalar totHeat = 0;
+    const scalarField& V = mesh_.V();
+    scalar sumWeight = 0;
     forAll(cells_, i)
     {
-        totHeat += cellsV[cells_[i]]*mag(U[cells_[i]])*deltaTCells[i];
+        sumWeight += V[cells_[i]]*mag(U[cells_[i]])*deltaTCells[i];
     }
-    reduce(totHeat, sumOp<scalar>());
-
-    scalarField& heSource = eqn.source();
+    reduce(sumWeight, sumOp<scalar>());
 
-    if (V() > VSMALL && mag(Qt) > VSMALL)
+    if (this->V() > VSMALL && mag(Qt) > VSMALL)
     {
-        addHeatSource(heSource, cells_, cellsV, U, Qt, deltaTCells, totHeat);
+        scalarField& heSource = eqn.source();
+
+        forAll(cells_, i)
+        {
+            heSource[cells_[i]] -=
+                Qt*V[cells_[i]]*mag(U[cells_[i]])*deltaTCells[i]/sumWeight;
+        }
     }
 
     if (debug && Pstream::master())
@@ -311,14 +297,14 @@ void Foam::fv::heatExchangerSource::addSup
 }
 
 
-void Foam::fv::heatExchangerSource::writeData(Ostream& os) const
+void Foam::fv::effectivenessHeatExchangerSource::writeData(Ostream& os) const
 {
     os  << indent << name_ << endl;
     dict_.write(os);
 }
 
 
-bool Foam::fv::heatExchangerSource::read(const dictionary& dict)
+bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict)
 {
     if (option::read(dict))
     {
diff --git a/src/fvOptions/sources/derived/heatExchangerSource/heatExchangerSource.H b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H
similarity index 84%
rename from src/fvOptions/sources/derived/heatExchangerSource/heatExchangerSource.H
rename to src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H
index 6194bdfb621..15b66786eb0 100644
--- a/src/fvOptions/sources/derived/heatExchangerSource/heatExchangerSource.H
+++ b/src/fvOptions/sources/derived/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -23,7 +23,7 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Class
-    Foam::fv::heatExchangerSource
+    Foam::fv::effectivenessHeatExchangerSource
 
 Description
     Heat exchanger source model.
@@ -40,25 +40,25 @@ Description
 
     Then the distribution inside the hear exchanger is given by:
 
-    Qcell = V*Ucell*(Tcell - Tref)/sum(V*Ucell*(Tcell - Tref));
+    Qcell = Vcell*|Ucell|*(Tcell - Tref)/sum(Vcell*|Ucell|*(Tcell - Tref));
 
     where:
         Qcell is the source for cell
-        V is the volume of the cell
+        Vcell is the volume of the cell
         Ucell is the local cell velocity
         Tcell is the local call temperature
         Tref : min(T) or max(T) in the cell zone depending on the sign of Qt
 
     Example :
 
-    heatExchangerSource1
+    effectivenessHeatExchangerSource1
     {
-        type            heatExchangerSource;
+        type            effectivenessHeatExchangerSource;
         active          true;
         selectionMode   cellZone;
         cellZone        porosity;
 
-        heatExchangerSourceCoeffs
+        effectivenessHeatExchangerSourceCoeffs
         {
             fieldNames              (e);
             secondaryMassFlowRate   1.0;
@@ -79,12 +79,12 @@ Description
 
 
 SourceFiles
-    heatExchangerSource.C
+    effectivenessHeatExchangerSource.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef heatExchangerSource_H
-#define heatExchangerSource_H
+#ifndef effectivenessHeatExchangerSource_H
+#define effectivenessHeatExchangerSource_H
 
 #include "fvOption.H"
 #include "autoPtr.H"
@@ -98,10 +98,10 @@ namespace fv
 {
 
 /*---------------------------------------------------------------------------*\
-                     Class heatExchangerSource Declaration
+                     Class effectivenessHeatExchangerSource Declaration
 \*---------------------------------------------------------------------------*/
 
-class heatExchangerSource
+class effectivenessHeatExchangerSource
 :
     public option
 {
@@ -158,22 +158,13 @@ private:
 
 
         //- Disallow default bitwise copy construct
-        heatExchangerSource(const heatExchangerSource&);
+        effectivenessHeatExchangerSource
+        (
+            const effectivenessHeatExchangerSource&
+        );
 
         //- Disallow default bitwise assignment
-        void operator=(const heatExchangerSource&);
-
-        //- Add heat source
-        void addHeatSource
-        (
-            scalarField& Tsource,
-            const labelList& cells,
-            const scalarField& V,
-            const vectorField& U,
-            const scalar Qt,
-            const scalarField& deltaTref,
-            const scalar totalHeat
-        ) const;
+        void operator=(const effectivenessHeatExchangerSource&);
 
         //- Init heat exchanger source model
         void init();
@@ -182,17 +173,16 @@ private:
         void calculateTotalArea(scalar& var);
 
 
-
 public:
 
     //- Runtime type information
-    TypeName("heatExchangerSource");
+    TypeName("effectivenessHeatExchangerSource");
 
 
     // Constructors
 
         //- Construct from components
-        heatExchangerSource
+        effectivenessHeatExchangerSource
         (
             const word& name,
             const word& modelType,
@@ -202,7 +192,7 @@ public:
 
 
     //- Destructor
-    virtual ~heatExchangerSource()
+    virtual ~effectivenessHeatExchangerSource()
     {}
 
 
-- 
GitLab