From 876df237047cbb56d2d5f434123a2aeb420e4302 Mon Sep 17 00:00:00 2001
From: sergio <sergio>
Date: Mon, 19 May 2014 11:23:41 +0100
Subject: [PATCH] BUG: Fixing non-Isotropic treatment for kappa at boundary

---
 .../temperatureCoupledBase.C                  | 27 ++++++++++---------
 .../temperatureCoupledBase.H                  |  8 ++++--
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
index 81528a07ded..623ca181083 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -63,7 +63,8 @@ Foam::temperatureCoupledBase::temperatureCoupledBase
 :
     patch_(patch),
     method_(KMethodTypeNames_[calculationType]),
-    kappaName_(kappaName)
+    kappaName_(kappaName),
+    alphaAniName_(alphaAniName_)
 {}
 
 
@@ -75,7 +76,8 @@ Foam::temperatureCoupledBase::temperatureCoupledBase
 :
     patch_(patch),
     method_(KMethodTypeNames_.read(dict.lookup("kappa"))),
-    kappaName_(dict.lookup("kappaName"))
+    kappaName_(dict.lookup("kappaName")),
+    alphaAniName_(dict.lookupOrDefault<word>("alphaAniName","Anialpha"))
 {}
 
 
@@ -136,17 +138,18 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
             const solidThermo& thermo =
                 mesh.lookupObject<solidThermo>("thermophysicalProperties");
 
-            const vectorField kappa(thermo.Kappa(patch_.index()));
+            const symmTensorField& Anialpha =
+                patch_.lookupPatchField<volSymmTensorField, scalar>
+                (
+                    alphaAniName_
+                );
 
-            tmp<scalarField> tmeanKappa(Tp);
-            scalarField& meanKappa = tmeanKappa();
-            forAll(meanKappa, i)
-            {
-                meanKappa[i] = (kappa[i].x() + kappa[i].y() + kappa[i].z())/3.0;
-            }
+            const symmTensorField kappa =
+                Anialpha*thermo.Cp()().boundaryField()[patch_.index()];
 
-            return meanKappa;
-            break;
+            const vectorField n(patch_.nf());
+
+            return n & kappa & n;
         }
 
         case mtLookup:
diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H
index 575d6bc1ed2..cfd156dedda 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H
+++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -34,7 +34,8 @@ Description
     - 'fluidThermo' : use fluidThermo and default compressible::turbulenceModel
        to calculate kappa
     - 'solidThermo' : use solidThermo kappa()
-    - 'directionalSolidThermo' directionalKappa()
+    - 'directionalSolidThermo': uses look up for volSymmTensorField for
+       transformed kappa vector. Named 'Anialpha' in solid solver
 
 SourceFiles
     temperatureCoupledBase.C
@@ -88,6 +89,9 @@ private:
         //- Name of thermal conductivity field (if looked up from database)
         const word kappaName_;
 
+        //- Name of the non-Isotropic alpha (default: Anialpha)
+        const word alphaAniName_;
+
 
 public:
 
-- 
GitLab