From 0b95bb008c5ad81afd325242fc6046df0471a8c9 Mon Sep 17 00:00:00 2001
From: Andrew Heather <>
Date: Mon, 17 Sep 2018 13:40:21 +0100
Subject: [PATCH] ENH: Refactored simpleReactingParcelFoam and added new
 simpleSprayFoam

---
 .../simpleReactingParcelFoam/createClouds.H   |  6 +--
 .../createFieldRefs.H                         |  3 ++
 .../simpleReactingParcelFoam.C                | 13 ++++-
 .../sprayFoam/simpleSprayFoam/Make/files      |  3 ++
 .../sprayFoam/simpleSprayFoam/Make/options    | 49 +++++++++++++++++++
 .../simpleSprayFoam/simpleSprayFoam.C         | 42 ++++++++++++++++
 .../intermediate/include/cloudMacros.H        | 45 +++++++++++++++++
 7 files changed, 156 insertions(+), 5 deletions(-)
 create mode 100644 applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFieldRefs.H
 create mode 100644 applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/files
 create mode 100644 applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/options
 create mode 100644 applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/simpleSprayFoam.C
 create mode 100644 src/lagrangian/intermediate/include/cloudMacros.H

diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createClouds.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createClouds.H
index 954b74e069f..26852f0b75c 100644
--- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createClouds.H
+++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createClouds.H
@@ -1,7 +1,7 @@
-Info<< "\nConstructing reacting cloud" << endl;
-basicReactingMultiphaseCloud parcels
+Info<< "\nConstructing " << CLOUD_BASE_TYPE_NAME << " cloud" << endl;
+basicReactingTypeCloud parcels
 (
-    "reactingCloud1",
+    word(CLOUD_BASE_TYPE_NAME) + "1",
     rho,
     U,
     g,
diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFieldRefs.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFieldRefs.H
new file mode 100644
index 00000000000..fdc479bc232
--- /dev/null
+++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFieldRefs.H
@@ -0,0 +1,3 @@
+const volScalarField& psi = thermo.psi();
+const volScalarField& T = thermo.T();
+const label inertIndex(composition.species()[inertSpecie]);
diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C
index fd5c373be82..00cdee6b1c1 100644
--- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C
+++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2013-2017 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -32,7 +32,6 @@ Description
 
 #include "fvCFD.H"
 #include "turbulentFluidThermoModel.H"
-#include "basicReactingMultiphaseCloud.H"
 #include "rhoReactionThermo.H"
 #include "CombustionModel.H"
 #include "radiationModel.H"
@@ -40,6 +39,16 @@ Description
 #include "fvOptions.H"
 #include "SLGThermo.H"
 #include "simpleControl.H"
+#include "cloudMacros.H"
+
+#ifndef CLOUD_BASE_TYPE
+    #define CLOUD_BASE_TYPE ReactingMultiphase
+    //#define CLOUD_BASE_TYPE_NAME "reactingMultiphase" Backwards compat
+    #define CLOUD_BASE_TYPE_NAME "reacting"
+#endif
+
+#include CLOUD_INCLUDE_FILE(CLOUD_BASE_TYPE)
+#define basicReactingTypeCloud CLOUD_TYPE(CLOUD_BASE_TYPE)
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/files b/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/files
new file mode 100644
index 00000000000..da2d204e29c
--- /dev/null
+++ b/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/files
@@ -0,0 +1,3 @@
+simpleSprayFoam.C
+
+EXE = $(FOAM_APPBIN)/simpleSprayFoam
diff --git a/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/options
new file mode 100644
index 00000000000..53e421d646f
--- /dev/null
+++ b/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/options
@@ -0,0 +1,49 @@
+EXE_INC = \
+    -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam/simpleReactingParcelFoam \
+    -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I${LIB_SRC}/meshTools/lnInclude \
+    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
+    -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
+    -I$(LIB_SRC)/lagrangian/basic/lnInclude \
+    -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
+    -I$(LIB_SRC)/lagrangian/spray/lnInclude \
+    -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
+    -I$(LIB_SRC)/transportModels/compressible/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
+    -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
+    -I$(LIB_SRC)/ODE/lnInclude \
+    -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
+    -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
+    -I$(LIB_SRC)/combustionModels/lnInclude \
+    -I$(LIB_SRC)/sampling/lnInclude
+
+
+EXE_LIBS = \
+    -lfiniteVolume \
+    -lmeshTools \
+    -lturbulenceModels \
+    -lcompressibleTurbulenceModels \
+    -llagrangian \
+    -llagrangianIntermediate \
+    -llagrangianSpray \
+    -llagrangianTurbulence \
+    -lspecie \
+    -lcompressibleTransportModels \
+    -lfluidThermophysicalModels \
+    -lthermophysicalProperties \
+    -lreactionThermophysicalModels \
+    -lSLGThermo \
+    -lchemistryModel \
+    -lradiationModels \
+    -lODE \
+    -lregionModels \
+    -lsurfaceFilmModels \
+    -lcombustionModels \
+    -lfvOptions \
+    -lsampling
diff --git a/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/simpleSprayFoam.C b/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/simpleSprayFoam.C
new file mode 100644
index 00000000000..ad901b0e40e
--- /dev/null
+++ b/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/simpleSprayFoam.C
@@ -0,0 +1,42 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011-2017 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Application
+    sprayFoam
+
+Group
+    grpLagrangianSolvers
+
+Description
+    Steady state solver for compressible, turbulent flow with a spray particle
+    cloud and optional sources/constraints.
+
+\*---------------------------------------------------------------------------*/
+
+#define CLOUD_BASE_TYPE Spray
+#define CLOUD_BASE_TYPE_NAME "spray"
+
+#include "simpleReactingParcelFoam.C"
+
+
+// ************************************************************************* //
diff --git a/src/lagrangian/intermediate/include/cloudMacros.H b/src/lagrangian/intermediate/include/cloudMacros.H
new file mode 100644
index 00000000000..380b6883333
--- /dev/null
+++ b/src/lagrangian/intermediate/include/cloudMacros.H
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2018 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Description
+    C-preprocessor cloud macros
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cloud_macros_H
+#define cloud_macros_H
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "macros.H"
+
+#define CLOUD_TYPE(x)  CAT3(basic, x, Cloud)
+
+#define CLOUD_INCLUDE_FILE2(x) STRINGIFY(basic ## x ## Cloud.H)
+#define CLOUD_INCLUDE_FILE(x) CLOUD_INCLUDE_FILE2(x)
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
-- 
GitLab