From 48872ed9df56504a8b3a60eff752ff758cc75049 Mon Sep 17 00:00:00 2001
From: Armin Wehrfritz <armin.wehrfritz@aalto.fi>
Date: Wed, 4 Sep 2013 22:26:42 +0300
Subject: [PATCH] Enhance TAB coefficient reading and add
 enableOscillationEq()

---
 .../BreakupModel/BreakupModel/BreakupModel.C       |   54 ++++++++++++++++----
 .../BreakupModel/BreakupModel/BreakupModel.H       |   10 ++++
 2 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C
index 9439fc4..f5fa020 100644
--- a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C
+++ b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C
@@ -25,6 +25,30 @@ License
 
 #include "BreakupModel.H"
 
+// * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
+
+template<class CloudType>
+void Foam::BreakupModel<CloudType>::readTABCoeffs(const bool printMsg)
+{
+    const dictionary TABcoeffsDict(this->dict().subDict("TABCoeffs"));
+    bool def = TABcoeffsDict.lookupOrDefault<bool>("defaultCoeffs", false);
+    if (!def)
+    {
+        TABcoeffsDict.lookup("y0") >> y0_;
+        TABcoeffsDict.lookup("yDot0") >> yDot0_;
+        TABcoeffsDict.lookup("Comega") >> TABComega_;
+        TABcoeffsDict.lookup("Cmu") >> TABCmu_;
+        TABcoeffsDict.lookup("WeCrit") >> TABWeCrit_;
+    }
+    if (printMsg && def)
+    {
+        Info<< incrIndent;
+        Info<< indent << "Employing default TAB coefficients" << endl;
+        Info<< decrIndent;
+    }
+}
+
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class CloudType>
@@ -90,16 +114,7 @@ Foam::BreakupModel<CloudType>::BreakupModel
     // Check for non-default TAB coefficients
     if (solveOscillationEq_)
     {
-        const dictionary TABcoeffsDict(dict.subDict("TABCoeffs"));
-        Switch defaultCoeffs = TABcoeffsDict.lookup("defaultCoeffs");
-        if (!defaultCoeffs)
-        {
-            TABcoeffsDict.lookup("y0") >> y0_;
-            TABcoeffsDict.lookup("yDot0") >> yDot0_;
-            TABcoeffsDict.lookup("Comega") >> TABComega_;
-            TABcoeffsDict.lookup("Cmu") >> TABCmu_;
-            TABcoeffsDict.lookup("WeCrit") >> TABWeCrit_;
-        }
+        readTABCoeffs(true);
     }
 }
 
@@ -114,6 +129,25 @@ Foam::BreakupModel<CloudType>::~BreakupModel()
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class CloudType>
+void Foam::BreakupModel<CloudType>::enableOscillationEq(const bool printMsg)
+{
+    if (!solveOscillationEq_)
+    {
+        solveOscillationEq_ = true;
+
+        if (printMsg)
+        {
+            Info<< incrIndent;
+            Info<< indent << "Enable oscillation equation solution" << endl;
+            Info<< decrIndent;
+        }
+
+        readTABCoeffs(printMsg);
+    }
+}
+
+
+template<class CloudType>
 bool Foam::BreakupModel<CloudType>::update
 (
     const scalar dt,
diff --git a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H
index 09cbe36..ac54b73 100644
--- a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H
+++ b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.H
@@ -55,6 +55,12 @@ class BreakupModel
     public SubModelBase<CloudType>
 {
 
+    // Private Member Functions
+
+        //- Read TAB coefficients
+        void readTABCoeffs(const bool printMsg);
+
+
 protected:
 
     // Protected data
@@ -161,6 +167,10 @@ public:
 
     // Member Functions
 
+        //- Enable the solution of the oscillation equation and check that the 
+        //  TAB coefficients are set correctly
+        void enableOscillationEq(const bool printMsg);
+
         //- Update the parcel properties and return true if a child parcel
         //  should be added
         virtual bool update
-- 
1.7.10.4

