From 0ff953411b2408a91569bb3b6c22469f7fac9330 Mon Sep 17 00:00:00 2001
From: sergio <s.ferraris@opencfd.co.uk>
Date: Thu, 2 Jan 2020 12:34:45 -0800
Subject: [PATCH] BUG: Fix issue 1535 in turbulentTemperatureRadCoupledMixed.

When a contact resistance is used the T field on each coupled
patch is different due to the thermal resistance. Thus, instead
of solving for a unique Tw at the wall, we solve for Tw1 at one side
then, the Tnbr internal becomes Tw2, which is the T of the nbr patch.
---
 ...lentTemperatureRadCoupledMixedFvPatchScalarField.C | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
index a372f9e45b8..5d121d4d387 100644
--- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
+++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2017-2019 OpenCFD Ltd.
+    Copyright (C) 2017-2020 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -210,22 +210,21 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
                 nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_)
             );
 
-    // Swap to obtain full local values of neighbour internal field
-    scalarField TcNbr(nbrField.patchInternalField());
-    mpp.distribute(TcNbr);
-
-
     // Swap to obtain full local values of neighbour K*delta
     scalarField KDeltaNbr;
+    tmp<scalarField> TcNbr(new scalarField(nbrField.size(), Zero));
     if (contactRes_ == 0.0)
     {
+        TcNbr.ref() = nbrField.patchInternalField();
         KDeltaNbr = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
     }
     else
     {
+        TcNbr.ref() = nbrField;
         KDeltaNbr.setSize(nbrField.size(), contactRes_);
     }
     mpp.distribute(KDeltaNbr);
+    mpp.distribute(TcNbr.ref());
 
     scalarField KDelta(kappa(Tp)*patch().deltaCoeffs());
 
-- 
GitLab