From f147cba2450f7d6fb7580845ce3fc30e8283db5f Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Mon, 23 Nov 2015 14:22:36 +0000
Subject: [PATCH] alphatFixedDmdtWallBoilingWallFunction: Added relaxation
 Patch provided by Juho Peltola

---
 ...xedDmdtWallBoilingWallFunctionFvPatchScalarField.C | 11 ++++++++---
 ...xedDmdtWallBoilingWallFunctionFvPatchScalarField.H |  5 ++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C
index 76b5879ac1d..e19f05b7abb 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C
+++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C
@@ -27,12 +27,11 @@ License
 #include "compressibleTurbulenceModel.H"
 #include "fvPatchFieldMapper.H"
 #include "volFields.H"
-#include "addToRunTimeSelectionTable.H"
 #include "twoPhaseSystem.H"
-#include "phaseSystem.H"
 #include "ThermalPhaseChangePhaseSystem.H"
 #include "MomentumTransferPhaseSystem.H"
 #include "wallFvPatch.H"
+#include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -131,6 +130,7 @@ alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
     Cmu_(0.09),
     kappa_(0.41),
     E_(9.8),
+    dmdtRelax_(1.0),
     fixedDmdt_(0.0)
 {
     checkType();
@@ -150,6 +150,7 @@ alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
     Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
     kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
     E_(dict.lookupOrDefault<scalar>("E", 9.8)),
+    dmdtRelax_(dict.lookupOrDefault<scalar>("dmdtRelax", 1.0)),
     fixedDmdt_(dict.lookupOrDefault<scalar>("fixedDmdt", 0.0))
 {}
 
@@ -168,6 +169,7 @@ alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
     Cmu_(ptf.Cmu_),
     kappa_(ptf.kappa_),
     E_(ptf.E_),
+    dmdtRelax_(ptf.dmdtRelax_),
     fixedDmdt_(ptf.fixedDmdt_)
 {}
 
@@ -183,6 +185,7 @@ alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
     Cmu_(awfpsf.Cmu_),
     kappa_(awfpsf.kappa_),
     E_(awfpsf.E_),
+    dmdtRelax_(awfpsf.dmdtRelax_),
     fixedDmdt_(awfpsf.fixedDmdt_)
 {}
 
@@ -199,6 +202,7 @@ alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
     Cmu_(awfpsf.Cmu_),
     kappa_(awfpsf.kappa_),
     E_(awfpsf.E_),
+    dmdtRelax_(awfpsf.dmdtRelax_),
     fixedDmdt_(awfpsf.fixedDmdt_)
 {}
 
@@ -328,7 +332,7 @@ void alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
         alphatConv[faceI] = max(0.0, alphaEff - alphaw[faceI]);
     }
 
-    dmdt_ = fixedDmdt_;
+    dmdt_ = (1 - dmdtRelax_)*dmdt_ + dmdtRelax_*fixedDmdt_;
 
     operator==(alphatConv);
 
@@ -346,6 +350,7 @@ void alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::write
     os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
     os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
     os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
+    os.writeKeyword("dmdtRelax") << dmdtRelax_ << token::END_STATEMENT << nl;
     os.writeKeyword("fixedDmdt") << fixedDmdt_ << token::END_STATEMENT << nl;
     dmdt_.writeEntry("dmdt", os);
     writeEntry("value", os);
diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H
index bd9426fdb6b..1d34ff1b08c 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H
+++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H
@@ -73,7 +73,10 @@ class alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
         //- E coefficient
         scalar E_;
 
-        //- E coefficient
+        //- dmdt relaxationFactor
+        scalar dmdtRelax_;
+
+        //- Reference dmdt
         scalar fixedDmdt_;
 
 
-- 
GitLab