From e4968c6bead597b814b4435ef562e96124917899 Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Wed, 6 Feb 2013 10:56:03 +0000
Subject: [PATCH] Thermo BCs: Update to use patch-based thermo access functions

---
 .../energyRegionCoupledFvPatchScalarField.C   |  4 +--
 .../temperatureCoupledBase.C                  |  4 +--
 .../thermalBaffle1DFvPatchScalarField.C       | 29 +++++++------------
 .../porousBafflePressureFvPatchFields.C       |  8 ++---
 4 files changed, 18 insertions(+), 27 deletions(-)

diff --git a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C
index c54293f22b2..9aeaa4f4868 100644
--- a/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C
+++ b/src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C
@@ -105,13 +105,13 @@ kappa() const
     {
         case FLUID:
         {
-            const compressible::turbulenceModel& model =
+            const compressible::turbulenceModel& turbModel =
                 this->db().lookupObject<compressible::turbulenceModel>
                 (
                     "turbulenceModel"
                 );
 
-            return model.kappaEff(patch().index());
+            return turbModel.kappaEff(patch().index());
         }
         break;
 
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
index 14448ca71c8..4daa0454f7e 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
@@ -92,13 +92,13 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
     {
         case BASICTHERMO:
         {
-            const compressible::turbulenceModel& model =
+            const compressible::turbulenceModel& turbModel =
                 mesh.lookupObject<compressible::turbulenceModel>
                 (
                     "turbulenceModel"
                 );
 
-            return model.kappaEff(patch_.index());
+            return turbModel.kappaEff(patch_.index());
             break;
         }
 
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C
index f05919061ed..e966e729542 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C
@@ -200,23 +200,23 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
     const mappedPatchBase& mpp =
         refCast<const mappedPatchBase>(patch().patch());
 
-    const label patchI = patch().index();
+    const label patchi = patch().index();
 
-    const label nbrPatchI = mpp.samplePolyPatch().index();
+    const label nbrPatchi = mpp.samplePolyPatch().index();
 
     if (baffleActivated_)
     {
-        const fvPatch& nbrPatch = patch().boundaryMesh()[nbrPatchI];
+        const fvPatch& nbrPatch = patch().boundaryMesh()[nbrPatchi];
 
-        const compressible::turbulenceModel& model =
+        const compressible::turbulenceModel& turbModel =
             db().template lookupObject<compressible::turbulenceModel>
             (
                 "turbulenceModel"
             );
 
-
         // local properties
-        const scalarField kappaw = model.kappaEff()().boundaryField()[patchI];
+
+        const scalarField kappaw(turbModel.kappaEff(patchi));
 
         const fvPatchScalarField& Tp =
             patch().template lookupPatchField<volScalarField, scalar>(TName_);
@@ -229,17 +229,12 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
 
         // nbr properties
 
-        scalarField nbrKappaw =
-            model.kappaEff()().boundaryField()[nbrPatchI];
-        mpp.map().distribute(nbrKappaw);
+        const scalarField nbrKappaw(turbModel.kappaEff(nbrPatchi));
 
         const fvPatchScalarField& nbrTw =
-            model.thermo().T().boundaryField()[nbrPatchI];
+            turbModel.thermo().T().boundaryField()[nbrPatchi];
 
-        scalarField nbrQDot
-        (
-            model.kappaEff()().boundaryField()[nbrPatchI]*nbrTw.snGrad()
-        );
+        scalarField nbrQDot(nbrKappaw*nbrTw.snGrad());
         mpp.map().distribute(nbrQDot);
 
         const thermalBaffle1DFvPatchScalarField& nbrField =
@@ -255,11 +250,7 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
            nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_);
         mpp.map().distribute(nbrTp);
 
-        scalarField nbrh
-        (
-            nbrPatch.deltaCoeffs()
-           *model.kappaEff()().boundaryField()[nbrPatchI]
-        );
+        scalarField nbrh(nbrPatch.deltaCoeffs()*nbrKappaw);
         mpp.map().distribute(nbrh);
 
 
diff --git a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C
index 7207e3d7ac0..fe041be3e07 100644
--- a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C
+++ b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchFields.C
@@ -70,25 +70,25 @@ void Foam::porousBafflePressureFvPatchField<Foam::scalar>::updateCoeffs()
 
     if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
     {
-        const incompressible::turbulenceModel& model =
+        const incompressible::turbulenceModel& turbModel =
             db().lookupObject<incompressible::turbulenceModel>
             (
                 "turbulenceModel"
             );
 
-        const scalarField nuEffw = model.nuEff()().boundaryField()[patchI];
+        const scalarField nuEffw = turbModel.nuEff()().boundaryField()[patchI];
 
         jump_ = -sign(Un)*(I_*nuEffw + D_*0.5*magUn*length_)*magUn;
     }
     else
     {
-        const compressible::turbulenceModel& model =
+        const compressible::turbulenceModel& turbModel =
             db().lookupObject<compressible::turbulenceModel>
             (
                 "turbulenceModel"
             );
 
-        const scalarField muEffw = model.muEff()().boundaryField()[patchI];
+        const scalarField muEffw = turbModel.muEff()().boundaryField()[patchI];
 
         const scalarField rhow =
             patch().lookupPatchField<volScalarField, scalar>("rho");
-- 
GitLab