From c5dece6a095799e56b7f9b2efc8fe59c87e0d783 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 18 Dec 2020 09:21:18 +0100
Subject: [PATCH] STYLE: use IOError to report bad lookup of volumeUpdateMethod

- adjust comments for '-world' option
---
 src/OpenFOAM/global/argList/argList.C         | 10 ++--
 .../ReactingParcel/ReactingParcelI.H          | 54 +++++++++----------
 2 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C
index 615d395f9f1..edb9fc92a96 100644
--- a/src/OpenFOAM/global/argList/argList.C
+++ b/src/OpenFOAM/global/argList/argList.C
@@ -75,7 +75,7 @@ Foam::argList::initValidTables::initValidTables()
     (
         "case",
         "dir",
-        "Specify case directory to use (instead of the cwd)"
+        "Specify case directory to use (instead of cwd)"
     );
     argList::addOption
     (
@@ -169,14 +169,14 @@ Foam::argList::initValidTables::initValidTables()
     argList::addOption
     (
         "world",
-        "Name",
-        "Name of local world",
-        true
+        "name",
+        "Name of the local world for parallel communication",
+        true  // advanced option
     );
     validParOptions.set
     (
         "world",
-        "Name of local world"
+        "name"
     );
 
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H
index 9db0b41e81b..9c833a9f93e 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H
+++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H
@@ -63,47 +63,43 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
     constantVolume_(this->dict_, "constantVolume", false),
     volUpdateType_(this->dict_, "volumeUpdateMethod")
 {
+    word updateName;
+
     // If constantVolume found use it
     if (this->dict_.found("constantVolume"))
     {
         volUpdateType_.setValue(mUndefined);
     }
-    else
+    else if (this->dict_.readIfPresent("volumeUpdateMethod", updateName))
     {
-        if (this->dict_.found("volumeUpdateMethod"))
+        // Manual version of Enum<volumeUpdateType>
+        if (updateName == "constantRho")
+        {
+            volUpdateType_.setValue(mConstRho);
+        }
+        else if (updateName == "constantVolume")
+        {
+            volUpdateType_.setValue(mConstVol);
+        }
+        else if (updateName == "updateRhoAndVol")
         {
-            const word volumeUpdateMethod
-            (
-                this->dict_.getWord("volumeUpdateMethod")
-            );
-
-            if (volumeUpdateMethod == "constantRho")
-            {
-                volUpdateType_.setValue(mConstRho);
-            }
-            else if (volumeUpdateMethod == "constantVolume")
-            {
-                volUpdateType_.setValue(mConstVol);
-            }
-            else if (volumeUpdateMethod == "updateRhoAndVol")
-            {
-                volUpdateType_.setValue(mUpdateRhoAndVol);
-            }
-            else
-            {
-                
-                FatalErrorInFunction
-                    << "The method provided is not correct " << nl
-                    << " Available methods are  : " << nl
-                    << " constantRho, constantVolume or updateRhoAndVol. " << nl
-                    << nl << exit(FatalError);
-            }
+            volUpdateType_.setValue(mUpdateRhoAndVol);
         }
         else
         {
-            constantVolume_.setValue(false);
+            // FatalIOErrorInLookup
+
+            FatalIOErrorInFunction(this->dict_)
+                << "Unknown volumeUpdateMethod type " << updateName
+                << "\n\nValid volumeUpdateMethod types :\n"
+                << "(constantRho constantVolume updateRhoAndVol)" << nl
+                << exit(FatalIOError);
         }
     }
+    else
+    {
+        constantVolume_.setValue(false);
+    }
 }
 
 
-- 
GitLab