From 161991032ef3822fed883759406ccdc82d8cd3b9 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 1 Feb 2011 18:23:08 +0100 Subject: [PATCH 01/39] STYLE: deactivate coco-cpp until its future is clearer --- src/OpenFOAM/Make/files | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index bf4c345bec..7e293fc7eb 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -164,11 +164,16 @@ $(functionEntries)/includeIfPresentEntry/includeIfPresentEntry.C $(functionEntries)/inputModeEntry/inputModeEntry.C $(functionEntries)/removeEntry/removeEntry.C -calcEntry = $(functionEntries)/calcEntry -$(calcEntry)/calcEntryParser.atg -$(calcEntry)/calcEntryInternal.C -$(calcEntry)/calcEntry.C - +/* + * Requires customized coco-cpp + * could be dropped or activated in the future + */ +/* + calcEntry = $(functionEntries)/calcEntry + $(calcEntry)/calcEntryParser.atg + $(calcEntry)/calcEntryInternal.C + $(calcEntry)/calcEntry.C +*/ IOdictionary = db/IOobjects/IOdictionary $(IOdictionary)/IOdictionary.C From 1129edaf53da3fd313d894d4317ed1a5df0f9ad0 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 1 Feb 2011 18:34:19 +0100 Subject: [PATCH 02/39] STYLE: apps/paraview3/bashrc-EXAMPLE to guide people with non-standard paraview --- etc/apps/paraview3/bashrc-EXAMPLE | 46 +++++++++++++++++++++++++++++++ etc/bashrc | 12 ++++---- 2 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 etc/apps/paraview3/bashrc-EXAMPLE diff --git a/etc/apps/paraview3/bashrc-EXAMPLE b/etc/apps/paraview3/bashrc-EXAMPLE new file mode 100644 index 0000000000..8db47a9ec7 --- /dev/null +++ b/etc/apps/paraview3/bashrc-EXAMPLE @@ -0,0 +1,46 @@ +#----------------------------------*-sh-*-------------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2011 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 . +# +# File +# paraview3/bashrc-EXAMPLE +# +# Description +# Example of chaining to the standard paraview3/bashrc with a +# different ParaView_VERSION +# +# Note +# This file could be copied to a user or site location, but should never +# replace the default shipped version as this will cause an infinite loop +# +#------------------------------------------------------------------------------ + +# +# Use other (shipped) bashrc with a different ParaView_VERSION +# + +foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o apps/paraview3/bashrc 2>/dev/null) +[ $? -eq 0 ] && . $foamFile ParaView_VERSION=3.9.0 + +unset foamFile + +# ----------------------------------------------------------------------------- diff --git a/etc/bashrc b/etc/bashrc index 95c83e82f8..310d5fe00d 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -122,12 +122,12 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION # Source files, possibly with some verbosity _foamSource() { - while [ $# -ge 1 ] - do - [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1" - . $1 - shift - done + while [ $# -ge 1 ] + do + [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1" + . $1 + shift + done } # Evaluate command-line parameters From 1a03d43b57f3ec5788d16e79269e1227abe0d039 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 1 Feb 2011 18:50:19 +0100 Subject: [PATCH 03/39] STYLE: remove comments referring to '' or ' ' --- .../manipulation/insideCells/insideCells.C | 30 +++++++++++-------- .../writers/dx/dxSurfaceWriter.H | 10 +++---- .../writers/ensight/ensightSurfaceWriter.H | 10 +++---- .../writers/foamFile/foamFileSurfaceWriter.H | 10 +++---- .../writers/raw/rawSurfaceWriter.H | 10 +++---- .../writers/starcd/starcdSurfaceWriter.H | 6 ++-- .../sampledSurface/writers/surfaceWriter.H | 12 ++++---- .../writers/vtk/vtkSurfaceWriter.H | 10 +++---- 8 files changed, 52 insertions(+), 46 deletions(-) diff --git a/applications/utilities/mesh/manipulation/insideCells/insideCells.C b/applications/utilities/mesh/manipulation/insideCells/insideCells.C index 967240701e..16a37594d8 100644 --- a/applications/utilities/mesh/manipulation/insideCells/insideCells.C +++ b/applications/utilities/mesh/manipulation/insideCells/insideCells.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,8 +22,8 @@ License along with OpenFOAM. If not, see . Description - Picks up cells with cell centre 'inside' of surface. Requires surface - to be closed and singly connected. + Picks up cells with cell centre 'inside' of surface. + Requires surface to be closed and singly connected. \*---------------------------------------------------------------------------*/ @@ -42,9 +42,16 @@ using namespace Foam; int main(int argc, char *argv[]) { + argList::addNote + ( + "Create a cellSet for cells with their centres inside the defined " + "surface.\n" + "Surface must be closed and singly connected." + ); + argList::noParallel(); - argList::validArgs.append("surface file"); - argList::validArgs.append("destination cellSet"); + argList::validArgs.append("surfaceFile"); + argList::validArgs.append("cellSet"); # include "setRootCase.H" # include "createTime.H" @@ -75,14 +82,13 @@ int main(int argc, char *argv[]) } - Info<< "Selected " << insideCells.size() - << " cells out of " << mesh.nCells() << endl - << endl + Info<< "Selected " << insideCells.size() << " of " << mesh.nCells() + << " cells" << nl << nl << "Writing selected cells to cellSet " << insideCells.name() - << endl << endl - << "Use this cellSet e.g. with subsetMesh : " << endl << endl - << " subsetMesh " << insideCells.name() - << endl << endl; + << nl << nl + << "Use this cellSet e.g. with subsetMesh : " << nl << nl + << " subsetMesh " << insideCells.name() + << nl << endl; insideCells.write(); diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H index e4e3af67e6..6ff54c775f 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H @@ -96,7 +96,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -110,7 +110,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -124,7 +124,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -138,7 +138,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -152,7 +152,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H index 628c178d4e..ca42fa8f08 100644 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H @@ -117,7 +117,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -131,7 +131,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -145,7 +145,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -159,7 +159,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -173,7 +173,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H index ce19c21455..7912a65acf 100644 --- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H @@ -107,7 +107,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -121,7 +121,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -135,7 +135,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -149,7 +149,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -163,7 +163,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H index 5ec4d1ac30..c08b0eee5e 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H @@ -128,7 +128,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -142,7 +142,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -156,7 +156,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -170,7 +170,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -184,7 +184,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H index bf0a0eb824..be537abed0 100644 --- a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H @@ -129,7 +129,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -143,7 +143,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -157,7 +157,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H index be26517849..f9d0587164 100644 --- a/src/sampling/sampledSurface/writers/surfaceWriter.H +++ b/src/sampling/sampledSurface/writers/surfaceWriter.H @@ -119,7 +119,7 @@ public: //- Write single surface geometry to file. virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -132,7 +132,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -147,7 +147,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -162,7 +162,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -177,7 +177,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -192,7 +192,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H index 322159094b..75af4a347e 100644 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H @@ -105,7 +105,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -119,7 +119,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -133,7 +133,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -147,7 +147,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -161,7 +161,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, From ffd20770ddf3a9e236d2217ad62b41c6430edc34 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 4 Feb 2011 18:59:45 +0100 Subject: [PATCH 04/39] ENH: add (non-templated) polynomialFunction STYLE: integrateLimits() -> integrate() for consistency with DataEntry/polynomial. Rename old 'integrate', 'integrateMinus1' methods to 'integral', 'integralMinus1' (ie, substantive instead of verb for clarity). --- .../test/Polynomial/Test-Polynomial.C | 65 ++- src/OpenFOAM/Make/files | 1 + .../functions/Polynomial/Polynomial.C | 109 +++-- .../functions/Polynomial/Polynomial.H | 47 +- .../functions/Polynomial/polynomialFunction.C | 415 ++++++++++++++++++ .../functions/Polynomial/polynomialFunction.H | 246 +++++++++++ .../thermo/hPolynomial/hPolynomialThermo.C | 8 +- 7 files changed, 809 insertions(+), 82 deletions(-) create mode 100644 src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C create mode 100644 src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.H diff --git a/applications/test/Polynomial/Test-Polynomial.C b/applications/test/Polynomial/Test-Polynomial.C index fbfbcc2000..c251bade74 100644 --- a/applications/test/Polynomial/Test-Polynomial.C +++ b/applications/test/Polynomial/Test-Polynomial.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,7 @@ Description #include "IStringStream.H" #include "Polynomial.H" +#include "polynomialFunction.H" #include "Random.H" #include "cpuTime.H" @@ -38,7 +39,7 @@ using namespace Foam; const int PolySize = 8; const scalar coeff[] = { 0.11, 0.45, -0.94, 1.58, -2.58, 0.08, 3.15, -4.78 }; -const char* polyDef = "testPoly (0.11 0.45 -0.94 1.58 -2.58 0.08 3.15 -4.78)"; +const char* polyDef = "(0.11 0.45 -0.94 1.58 -2.58 0.08 3.15 -4.78)"; scalar polyValue(const scalar x) @@ -58,7 +59,7 @@ scalar polyValue(const scalar x) scalar intPolyValue(const scalar x) { - // Hard-coded integrated form of above polynomial + // Hard-coded integral form of above polynomial return coeff[0]*x + coeff[1]/2.0*sqr(x) @@ -109,27 +110,44 @@ int main(int argc, char *argv[]) const label nIters = 1000; scalar sum = 0.0; - Info<< "null poly = " << (Polynomial<8>()) << nl << endl; + Info<< "null poly = " << (Polynomial<8>()) << nl + << "null poly = " << (polynomialFunction(8)) << nl + << endl; - // Polynomial<8> poly("testPoly", IStringStream(polyDef)()); Polynomial<8> poly(coeff); - Polynomial<9> intPoly(poly.integrate(0.0)); + Polynomial<9> intPoly(poly.integral(0.0)); - Info<< "poly = " << poly << endl; - Info<< "intPoly = " << intPoly << nl << endl; + IStringStream is(polyDef); + polynomialFunction polyfunc(is); - Info<< "2*poly = " << 2*poly << endl; - Info<< "poly+poly = " << poly + poly << nl << endl; + Info<< "poly = " << poly << nl + << "intPoly = " << intPoly << nl + << endl; - Info<< "3*poly = " << 3*poly << endl; - Info<< "poly+poly+poly = " << poly + poly + poly << nl << endl; + Info<< "2*poly = " << 2*poly << nl + << "poly+poly = " << poly + poly << nl + << "3*poly = " << 3*poly << nl + << "poly+poly+poly = " << poly + poly + poly << nl + << "3*poly - 2*poly = " << 3*poly - 2*poly << nl + << endl; + + Info<< nl << "--- as polynomialFunction" << nl << endl; + Info<< "polyf = " << polyfunc << nl + << "intPoly = " << poly.integral(0.0) << nl + << endl; + + Info<< "2*polyf = " << 2*polyfunc << nl + << "polyf+polyf = " << polyfunc + polyfunc << nl + << "3*polyf = " << 3*polyfunc << nl + << "polyf+polyf+polyf = " << polyfunc + polyfunc + polyfunc << nl + << "3*polyf - 2*polyf = " << 3*polyfunc - 2*polyfunc << nl + << endl; - Info<< "3*poly - 2*poly = " << 3*poly - 2*poly << nl << endl; Polynomial<8> polyCopy = poly; Info<< "poly, polyCopy = " << poly << ", " << polyCopy << nl << endl; polyCopy = 2.5*poly; - Info<< "2.5*polyCopy = " << polyCopy << nl << endl; + Info<< "2.5*poly = " << polyCopy << nl << endl; Random rnd(123456); for (int i=0; i<10; i++) @@ -139,8 +157,8 @@ int main(int argc, char *argv[]) scalar px = polyValue(x); scalar ipx = intPolyValue(x); - scalar pxTest = poly.evaluate(x); - scalar ipxTest = intPoly.evaluate(x); + scalar pxTest = poly.value(x); + scalar ipxTest = intPoly.value(x); Info<<"\nx = " << x << endl; Info<< " px, pxTest = " << px << ", " << pxTest << endl; @@ -173,10 +191,21 @@ int main(int argc, char *argv[]) sum = 0.0; for (label iter = 0; iter < nIters; ++iter) { - sum += poly.evaluate(loop+iter); + sum += poly.value(loop+iter); } } - Info<< "evaluate: " << sum + Info<< "value: " << sum + << " in " << timer.cpuTimeIncrement() << " s\n"; + + for (int loop = 0; loop < n; ++loop) + { + sum = 0.0; + for (label iter = 0; iter < nIters; ++iter) + { + sum += polyfunc.value(loop+iter); + } + } + Info<< "via function: " << sum << " in " << timer.cpuTimeIncrement() << " s\n"; diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 7e293fc7eb..ba3c157b10 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -66,6 +66,7 @@ primitives/functions/DataEntry/makeDataEntries.C primitives/functions/DataEntry/polynomial/polynomial.C primitives/functions/DataEntry/polynomial/polynomialIO.C +primitives/functions/Polynomial/polynomialFunction.C strings = primitives/strings $(strings)/string/string.C diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C index 7f9ae731f6..3c642de2d3 100644 --- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C +++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C @@ -41,6 +41,18 @@ Foam::Polynomial::Polynomial() } +template +Foam::Polynomial::Polynomial +( + const Polynomial& poly +) +: + VectorSpace, scalar, PolySize>(poly), + logActive_(poly.logActive_), + logCoeff_(poly.logCoeff_) +{} + + template Foam::Polynomial::Polynomial(const scalar coeffs[PolySize]) : @@ -68,7 +80,7 @@ Foam::Polynomial::Polynomial(const UList& coeffs) ( "Polynomial::Polynomial(const UList&)" ) << "Size mismatch: Needed " << PolySize - << " but got " << coeffs.size() + << " but given " << coeffs.size() << nl << exit(FatalError); } @@ -79,6 +91,39 @@ Foam::Polynomial::Polynomial(const UList& coeffs) } +// template +// Foam::Polynomial::Polynomial(const polynomialFunction& poly) +// : +// VectorSpace, scalar, PolySize>(), +// logActive_(poly.logActive()), +// logCoeff_(poly.logCoeff()) +// { +// if (poly.size() != PolySize) +// { +// FatalErrorIn +// ( +// "Polynomial::Polynomial(const polynomialFunction&)" +// ) << "Size mismatch: Needed " << PolySize +// << " but given " << poly.size() +// << nl << exit(FatalError); +// } +// +// for (int i = 0; i < PolySize; ++i) +// { +// this->v_[i] = poly[i]; +// } +// } + + +template +Foam::Polynomial::Polynomial(Istream& is) +: + VectorSpace, scalar, PolySize>(is), + logActive_(false), + logCoeff_(0.0) +{} + + template Foam::Polynomial::Polynomial(const word& name, Istream& is) : @@ -111,38 +156,17 @@ Foam::Polynomial::Polynomial(const word& name, Istream& is) } -template -Foam::Polynomial::Polynomial(Istream& is) -: - VectorSpace, scalar, PolySize>(is), - logActive_(false), - logCoeff_(0.0) -{} - - -template -Foam::Polynomial::Polynomial -( - const Polynomial& poly -) -: - VectorSpace, scalar, PolySize>(poly), - logActive_(poly.logActive_), - logCoeff_(poly.logCoeff_) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -bool& Foam::Polynomial::logActive() +bool Foam::Polynomial::logActive() const { return logActive_; } template -Foam::scalar& Foam::Polynomial::logCoeff() +Foam::scalar Foam::Polynomial::logCoeff() const { return logCoeff_; } @@ -151,27 +175,27 @@ Foam::scalar& Foam::Polynomial::logCoeff() template Foam::scalar Foam::Polynomial::value(const scalar x) const { - scalar y = this->v_[0]; + scalar val = this->v_[0]; // avoid costly pow() in calculation scalar powX = x; for (label i=1; iv_[i]*powX; + val += this->v_[i]*powX; powX *= x; } if (logActive_) { - y += logCoeff_*log(x); + val += logCoeff_*log(x); } - return y; + return val; } template -Foam::scalar Foam::Polynomial::integrateLimits +Foam::scalar Foam::Polynomial::integrate ( const scalar x1, const scalar x2 @@ -181,7 +205,7 @@ Foam::scalar Foam::Polynomial::integrateLimits { FatalErrorIn ( - "scalar Polynomial::integrateLimits" + "scalar Polynomial::integrate" "(" "const scalar, " "const scalar" @@ -190,22 +214,33 @@ Foam::scalar Foam::Polynomial::integrateLimits << nl << abort(FatalError); } - intPolyType poly = this->integrate(); - return poly.value(x2) - poly.value(x1); + // avoid costly pow() in calculation + scalar powX1 = x1; + scalar powX2 = x2; + + scalar val = this->v_[0]*(powX2 - powX1); + for (label i=1; iv_[i]/(i + 1) * (powX2 - powX1); + powX1 *= x1; + powX2 *= x2; + } + + return val; } template typename Foam::Polynomial::intPolyType -Foam::Polynomial::integrate(const scalar intConstant) +Foam::Polynomial::integral(const scalar intConstant) const { intPolyType newCoeffs; newCoeffs[0] = intConstant; forAll(*this, i) { - newCoeffs[i + 1] = this->v_[i]/(i + 1); + newCoeffs[i+1] = this->v_[i]/(i + 1); } return newCoeffs; @@ -214,14 +249,14 @@ Foam::Polynomial::integrate(const scalar intConstant) template typename Foam::Polynomial::polyType -Foam::Polynomial::integrateMinus1(const scalar intConstant) +Foam::Polynomial::integralMinus1(const scalar intConstant) const { polyType newCoeffs; if (this->v_[0] > VSMALL) { - newCoeffs.logActive() = true; - newCoeffs.logCoeff() = this->v_[0]; + newCoeffs.logActive_ = true; + newCoeffs.logCoeff_ = this->v_[0]; } newCoeffs[0] = intConstant; diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H index 06511b0003..5dfa271c8d 100644 --- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H +++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H @@ -29,14 +29,14 @@ Description poly = logCoeff*log(x) + sum(coeff_[i]*x^i) - where 0 \<= i \<= n + where 0 \<= i \<= N - integer powers, starting at zero - value(x) to evaluate the poly for a given value - integrate(x1, x2) between two scalar values - - integrate() to return a new, intergated coeff polynomial + - integral() to return a new, integral coeff polynomial - increases the size (order) - - integrateMinus1() to return a new, integrated coeff polynomial where + - integralMinus1() to return a new, integral coeff polynomial where the base poly starts at order -1 SourceFiles @@ -85,10 +85,10 @@ class Polynomial // Private data - //- Include the log term? - only activated using integrateMinus1() + //- Include the log term? - only activated using integralMinus1() bool logActive_; - //- Log coefficient - only activated using integrateMinus1() + //- Log coefficient - only activated using integralMinus1() scalar logCoeff_; @@ -104,6 +104,9 @@ public: //- Construct null, with all coefficients = 0.0 Polynomial(); + //- Copy constructor + Polynomial(const Polynomial&); + //- Construct from C-array of coefficients explicit Polynomial(const scalar coeffs[PolySize]); @@ -111,24 +114,21 @@ public: explicit Polynomial(const UList& coeffs); //- Construct from Istream - Polynomial(Istream& is); + Polynomial(Istream&); //- Construct from name and Istream - Polynomial(const word& name, Istream& is); - - //- Copy constructor - Polynomial(const Polynomial& poly); + Polynomial(const word& name, Istream&); // Member Functions // Access - //- Return access to the log term active flag - bool& logActive(); + //- Return true if the log term is active + bool logActive() const; - //- Return access to the log coefficient - scalar& logCoeff(); + //- Return the log coefficient + scalar logCoeff() const; // Evaluation @@ -136,16 +136,17 @@ public: //- Return polynomial value scalar value(const scalar x) const; - //- Return integrated polynomial coefficients - // argument becomes zeroth element (constant of integration) - intPolyType integrate(const scalar intConstant = 0.0); - - //- Return integrated polynomial coefficients when lowest order - // is -1. Argument added to zeroth element - polyType integrateMinus1(const scalar intConstant = 0.0); - //- Integrate between two values - scalar integrateLimits(const scalar x1, const scalar x2) const; + scalar integrate(const scalar x1, const scalar x2) const; + + + //- Return integral coefficients. + // Argument becomes zeroth element (constant of integration) + intPolyType integral(const scalar intConstant = 0.0) const; + + //- Return integral coefficients when lowest order is -1. + // Argument becomes zeroth element (constant of integration) + polyType integralMinus1(const scalar intConstant = 0.0) const; //- Ostream Operator diff --git a/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C b/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C new file mode 100644 index 0000000000..44e82ac26d --- /dev/null +++ b/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C @@ -0,0 +1,415 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "polynomialFunction.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(polynomialFunction, 0); +} + + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + + +Foam::polynomialFunction Foam::polynomialFunction::cloneIntegral +( + const polynomialFunction& poly, + const scalar intConstant +) +{ + polynomialFunction newPoly(poly.size()+1); + + newPoly[0] = intConstant; + forAll(poly, i) + { + newPoly[i+1] = poly[i]/(i + 1); + } + + return newPoly; +} + + +Foam::polynomialFunction Foam::polynomialFunction::cloneIntegralMinus1 +( + const polynomialFunction& poly, + const scalar intConstant +) +{ + polynomialFunction newPoly(poly.size()+1); + + if (poly[0] > VSMALL) + { + newPoly.logActive_ = true; + newPoly.logCoeff_ = poly[0]; + } + + newPoly[0] = intConstant; + for (label i=1; i < poly.size(); ++i) + { + newPoly[i] = poly[i]/i; + } + + return newPoly; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::polynomialFunction::polynomialFunction(const label order) +: + scalarList(order, 0.0), + logActive_(false), + logCoeff_(0.0) +{ + if (this->empty()) + { + FatalErrorIn + ( + "polynomialFunction::polynomialFunction(const label order)" + ) << "polynomialFunction coefficients are invalid (empty)" + << nl << exit(FatalError); + } +} + + +Foam::polynomialFunction::polynomialFunction(const polynomialFunction& poly) +: + scalarList(poly), + logActive_(poly.logActive_), + logCoeff_(poly.logCoeff_) +{} + + +Foam::polynomialFunction::polynomialFunction(const UList& coeffs) +: + scalarList(coeffs), + logActive_(false), + logCoeff_(0.0) +{ + if (this->empty()) + { + FatalErrorIn + ( + "polynomialFunction::polynomialFunction(const UList&)" + ) << "polynomialFunction coefficients are invalid (empty)" + << nl << exit(FatalError); + } +} + + +Foam::polynomialFunction::polynomialFunction(Istream& is) +: + scalarList(is), + logActive_(false), + logCoeff_(0.0) +{ + if (this->empty()) + { + FatalErrorIn + ( + "polynomialFunction::polynomialFunction(Istream&)" + ) << "polynomialFunction coefficients are invalid (empty)" + << nl << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::polynomialFunction::~polynomialFunction() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::polynomialFunction::logActive() const +{ + return logActive_; +} + + +Foam::scalar Foam::polynomialFunction::logCoeff() const +{ + return logCoeff_; +} + + +Foam::scalar Foam::polynomialFunction::value(const scalar x) const +{ + const scalarList& coeffs = *this; + scalar val = coeffs[0]; + + // avoid costly pow() in calculation + scalar powX = x; + for (label i=1; ilogCoeff_*log(x); + } + + return val; +} + + +Foam::scalar Foam::polynomialFunction::integrate +( + const scalar x1, + const scalar x2 +) const +{ + const scalarList& coeffs = *this; + + if (logActive_) + { + FatalErrorIn + ( + "scalar polynomialFunction::integrate" + "(" + "const scalar, " + "const scalar" + ") const" + ) << "Cannot integrate polynomial with logarithmic coefficients" + << nl << abort(FatalError); + } + + // avoid costly pow() in calculation + scalar powX1 = x1; + scalar powX2 = x2; + + scalar val = coeffs[0]*(powX2 - powX1); + for (label i=1; i poly.size()) + { + forAll(poly, i) + { + coeffs[i] += poly[i]; + } + } + else + { + coeffs.setSize(poly.size(), 0.0); + + forAll(coeffs, i) + { + coeffs[i] += poly[i]; + } + } + + return *this; +} + + +Foam::polynomialFunction& +Foam::polynomialFunction::operator-=(const polynomialFunction& poly) +{ + scalarList& coeffs = *this; + + if (coeffs.size() > poly.size()) + { + forAll(poly, i) + { + coeffs[i] -= poly[i]; + } + } + else + { + coeffs.setSize(poly.size(), 0.0); + + forAll(coeffs, i) + { + coeffs[i] -= poly[i]; + } + } + + return *this; +} + + +Foam::polynomialFunction& +Foam::polynomialFunction::operator*=(const scalar s) +{ + scalarList& coeffs = *this; + forAll(coeffs, i) + { + coeffs[i] *= s; + } + + return *this; +} + + +Foam::polynomialFunction& +Foam::polynomialFunction::operator/=(const scalar s) +{ + scalarList& coeffs = *this; + forAll(coeffs, i) + { + coeffs[i] /= s; + } + + return *this; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const polynomialFunction& poly) +{ + // output like VectorSpace + os << token::BEGIN_LIST; + + if (!poly.empty()) + { + for (int i=0; i. + +Class + Foam::polynomialFunction + +Description + Polynomial function representation + + poly = logCoeff*log(x) + sum(coeff_[i]*x^i) + + where 0 \<= i \<= N + + - integer powers, starting at zero + - value(x) to evaluate the poly for a given value + - integrate(x1, x2) between two scalar values + - integral() to return a new, integral coeff polynomial + - increases the size (order) + - integralMinus1() to return a new, integral coeff polynomial where + the base poly starts at order -1 + +SeeAlso + Foam::Polynomial for a templated implementation + +SourceFiles + polynomialFunction.C + +\*---------------------------------------------------------------------------*/ + +#ifndef polynomialFunction_H +#define polynomialFunction_H + +#include "scalarList.H" +#include "Ostream.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class polynomialFunction; + +// Forward declaration of friend functions +Ostream& operator<<(Ostream&, const polynomialFunction&); + + +/*---------------------------------------------------------------------------*\ + Class polynomialFunction Declaration +\*---------------------------------------------------------------------------*/ + +class polynomialFunction +: + private scalarList +{ + // Private data + + //- Include the log term? - only activated using integralMinus1() + bool logActive_; + + //- Log coefficient - only activated using integralMinus1() + scalar logCoeff_; + + + // Private Member Functions + + //- Return integral coefficients. + // Argument becomes zeroth element (constant of integration) + static polynomialFunction cloneIntegral + ( + const polynomialFunction&, + const scalar intConstant = 0.0 + ); + + //- Return integral coefficients when lowest order is -1. + // Argument becomes zeroth element (constant of integration) + static polynomialFunction cloneIntegralMinus1 + ( + const polynomialFunction&, + const scalar intConstant = 0.0 + ); + + + //- Disallow default bitwise assignment + void operator=(const polynomialFunction&); + + + +public: + + //- Runtime type information + TypeName("polynomialFunction"); + + + // Constructors + + //- Construct a particular size, with all coefficients = 0.0 + explicit polynomialFunction(const label); + + //- Copy constructor + polynomialFunction(const polynomialFunction&); + + //- Construct from a list of coefficients + explicit polynomialFunction(const UList& coeffs); + + //- Construct from Istream + polynomialFunction(Istream&); + + + //- Destructor + virtual ~polynomialFunction(); + + + // Member Functions + + //- Return the number of coefficients + using scalarList::size; + + //- Return coefficient + using scalarList::operator[]; + + + // Access + + + //- Return true if the log term is active + bool logActive() const; + + //- Return the log coefficient + scalar logCoeff() const; + + + // Evaluation + + //- Return polynomial value + scalar value(const scalar x) const; + + //- Integrate between two values + scalar integrate(const scalar x1, const scalar x2) const; + + + //- Return integral coefficients. + // Argument becomes zeroth element (constant of integration) + polynomialFunction integral + ( + const scalar intConstant = 0.0 + ) const; + + //- Return integral coefficients when lowest order is -1. + // Argument becomes zeroth element (constant of integration) + polynomialFunction integralMinus1 + ( + const scalar intConstant = 0.0 + ) const; + + + // Member Operators + + polynomialFunction& operator+=(const polynomialFunction&); + polynomialFunction& operator-=(const polynomialFunction&); + + polynomialFunction& operator*=(const scalar); + polynomialFunction& operator/=(const scalar); + + + //- Ostream Operator + friend Ostream& operator<<(Ostream&, const polynomialFunction&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + +polynomialFunction operator+ +( + const polynomialFunction&, + const polynomialFunction& +); + + +polynomialFunction operator- +( + const polynomialFunction&, + const polynomialFunction& +); + + +polynomialFunction operator* +( + const scalar, + const polynomialFunction& +); + + +polynomialFunction operator/ +( + const scalar, + const polynomialFunction& +); + + +polynomialFunction operator* +( + const polynomialFunction&, + const scalar +); + + +polynomialFunction operator/ +( + const polynomialFunction&, + const scalar +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C index 15269f6ce2..c86db56ae7 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C @@ -45,8 +45,8 @@ Foam::hPolynomialThermo::hPolynomialThermo Sf_ *= this->W(); CpCoeffs_ *= this->W(); - hCoeffs_ = CpCoeffs_.integrate(); - sCoeffs_ = CpCoeffs_.integrateMinus1(); + hCoeffs_ = CpCoeffs_.integral(); + sCoeffs_ = CpCoeffs_.integralMinus1(); // Offset h poly so that it is relative to the enthalpy at Tstd hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd); @@ -73,8 +73,8 @@ Foam::hPolynomialThermo::hPolynomialThermo Sf_ *= this->W(); CpCoeffs_ *= this->W(); - hCoeffs_ = CpCoeffs_.integrate(); - sCoeffs_ = CpCoeffs_.integrateMinus1(); + hCoeffs_ = CpCoeffs_.integral(); + sCoeffs_ = CpCoeffs_.integralMinus1(); // Offset h poly so that it is relative to the enthalpy at Tstd hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd); From 96edf6f32dde45b388279598c67674c0239680ac Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 8 Feb 2011 13:48:01 +0100 Subject: [PATCH 05/39] STYLE: pass wordReList instead of wordList to polyBoundaryMesh::patchSet() - make warning optional and reuse in cellDistFuncs::getPatchIDs --- .../polyBoundaryMesh/polyBoundaryMesh.C | 20 ++++--- .../polyBoundaryMesh/polyBoundaryMesh.H | 11 ++-- .../inverseDistanceDiffusivity.C | 2 +- .../inverseDistanceDiffusivity.H | 10 ++-- src/meshTools/cellDist/cellDistFuncs.C | 53 +++++-------------- src/meshTools/cellDist/cellDistFuncs.H | 8 +-- .../field/nearWallFields/nearWallFields.C | 5 +- .../functionObjects/forces/forces/forces.C | 3 +- 8 files changed, 47 insertions(+), 65 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index e26c665c63..897e290b43 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -550,11 +550,12 @@ Foam::label Foam::polyBoundaryMesh::whichPatch(const label faceIndex) const Foam::labelHashSet Foam::polyBoundaryMesh::patchSet ( - const wordList& patchNames + const wordReList& patchNames, + const bool warnNotFound ) const { - wordList allPatchNames = names(); - labelHashSet ps(size()); + const wordList allPatchNames(this->names()); + labelHashSet ids(size()); forAll(patchNames, i) { @@ -562,20 +563,23 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet // of all patch names for matches labelList patchIDs = findStrings(patchNames[i], allPatchNames); - if (patchIDs.empty()) + if (patchIDs.empty() && warnNotFound) { - WarningIn("polyBoundaryMesh::patchSet(const wordList&)") - << "Cannot find any patch names matching " << patchNames[i] + WarningIn + ( + "polyBoundaryMesh::patchSet" + "(const wordReList&, const bool) const" + ) << "Cannot find any patch names matching " << patchNames[i] << endl; } forAll(patchIDs, j) { - ps.insert(patchIDs[j]); + ids.insert(patchIDs[j]); } } - return ps; + return ids; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index 0e94bb89b3..39fb527368 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -38,6 +38,7 @@ SourceFiles #include "polyPatchList.H" #include "regIOobject.H" #include "labelPair.H" +#include "wordReList.H" #include "HashSet.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -166,9 +167,13 @@ public: //- Per boundary face label the patch index const labelList& patchID() const; - //- Return the set of patch IDs corresponding to the given list of names - // Wild cards are expanded. - labelHashSet patchSet(const wordList&) const; + //- Return the set of patch IDs corresponding to the given names + // By default warns if given names are not found. + labelHashSet patchSet + ( + const wordReList& patchNames, + const bool warnNotFound = true + ) const; //- Check whether all procs have all patches and in same order. Return // true if in error. diff --git a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C index 0cc744e7dd..bbaae54007 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H index 5e1025d1f7..dc88204bd6 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H +++ b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ SourceFiles #define inverseDistanceDiffusivity_H #include "uniformDiffusivity.H" +#include "wordReList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class inverseDistanceDiffusivity Declaration + Class inverseDistanceDiffusivity Declaration \*---------------------------------------------------------------------------*/ class inverseDistanceDiffusivity @@ -53,9 +54,8 @@ class inverseDistanceDiffusivity // Private data //- Patches selected to base the distance on - // These can contain regular expressions and the actual patch names - // will be searched for. - wordList patchNames_; + // These can contain patch names or regular expressions to search for. + wordReList patchNames_; // Private Member Functions diff --git a/src/meshTools/cellDist/cellDistFuncs.C b/src/meshTools/cellDist/cellDistFuncs.C index 493ee6b666..123ea628d8 100644 --- a/src/meshTools/cellDist/cellDistFuncs.C +++ b/src/meshTools/cellDist/cellDistFuncs.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,14 +28,9 @@ License #include "wallPolyPatch.H" #include "polyBoundaryMesh.H" -namespace Foam -{ +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -defineTypeNameAndDebug(cellDistFuncs, 0); - -} +defineTypeNameAndDebug(Foam::cellDistFuncs, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -61,7 +56,6 @@ Foam::label Foam::cellDistFuncs::findIndex // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from mesh Foam::cellDistFuncs::cellDistFuncs(const polyMesh& mesh) : mesh_(mesh) @@ -70,36 +64,12 @@ Foam::cellDistFuncs::cellDistFuncs(const polyMesh& mesh) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Get patch ids of named patches Foam::labelHashSet Foam::cellDistFuncs::getPatchIDs ( - const wordList& patchNames + const wordReList& patchNames ) const { - const polyBoundaryMesh& bMesh = mesh().boundaryMesh(); - - // Construct Set of patchNames for easy checking if included - HashSet patchNamesHash(patchNames.size()); - - forAll(patchNames, patchI) - { - patchNamesHash.insert(patchNames[patchI]); - } - - // Loop over all patches and check if patch name in hashset - - labelHashSet patchIDs(bMesh.size()); - - forAll(bMesh, patchI) - { - const polyPatch& patch = bMesh[patchI]; - - if (patchNamesHash.found(patch.name())) - { - patchIDs.insert(patchI); - } - } - return patchIDs; + return mesh().boundaryMesh().patchSet(patchNames, false); } @@ -252,8 +222,10 @@ Foam::label Foam::cellDistFuncs::getPointNeighbours // size of largest patch (out of supplied subset of patches) -Foam::label Foam::cellDistFuncs::maxPatchSize(const labelHashSet& patchIDs) - const +Foam::label Foam::cellDistFuncs::maxPatchSize +( + const labelHashSet& patchIDs +) const { label maxSize = 0; @@ -271,8 +243,11 @@ Foam::label Foam::cellDistFuncs::maxPatchSize(const labelHashSet& patchIDs) // sum of patch sizes (out of supplied subset of patches) -Foam::label Foam::cellDistFuncs::sumPatchSize(const labelHashSet& patchIDs) - const +Foam::label Foam::cellDistFuncs::sumPatchSize +( + const labelHashSet& patchIDs +) +const { label sum = 0; diff --git a/src/meshTools/cellDist/cellDistFuncs.H b/src/meshTools/cellDist/cellDistFuncs.H index 7392e18f2d..3ef0c5e6e8 100644 --- a/src/meshTools/cellDist/cellDistFuncs.H +++ b/src/meshTools/cellDist/cellDistFuncs.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ SourceFiles #include "scalarField.H" #include "HashSet.H" #include "Map.H" -#include "wordList.H" +#include "wordReList.H" #include "scalarField.H" #include "point.H" #include "primitivePatch.H" @@ -98,8 +98,8 @@ public: return mesh_; } - //- Get patchIDs of named patches - labelHashSet getPatchIDs(const wordList&) const; + //- Return the set of patch IDs corresponding to the given names + labelHashSet getPatchIDs(const wordReList& patchNames) const; //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch') // Uses isA, not isType diff --git a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C index 228fa5ad32..2774396e4f 100644 --- a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -87,8 +87,7 @@ void Foam::nearWallFields::read(const dictionary& dict) const fvMesh& mesh = refCast(obr_); dict.lookup("fields") >> fieldSet_; - patchSet_ = - mesh.boundaryMesh().patchSet(wordList(dict.lookup("patches"))); + patchSet_ = mesh.boundaryMesh().patchSet(dict.lookup("patches")); distance_ = readScalar(dict.lookup("distance")); diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 412794795b..aacc6b1947 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -229,8 +229,7 @@ void Foam::forces::read(const dictionary& dict) const fvMesh& mesh = refCast(obr_); - patchSet_ = - mesh.boundaryMesh().patchSet(wordList(dict.lookup("patches"))); + patchSet_ = mesh.boundaryMesh().patchSet(dict.lookup("patches")); if (directForceDensity_) { From 10f5e8080328ce7307f4f352a563311cd482e326 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 11 Feb 2011 09:21:08 +0100 Subject: [PATCH 06/39] ENH: add -make option to touchdep, toucho - restricts selection to Make/$WM_OPTIONS* subdirectories, which is useful when multiple compilers are in use --- bin/touchdep | 70 +++++++++++++++++++++++++++++++++++++++++++--------- bin/toucho | 67 ++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 113 insertions(+), 24 deletions(-) diff --git a/bin/touchdep b/bin/touchdep index cfc8cebc20..48c19081ca 100755 --- a/bin/touchdep +++ b/bin/touchdep @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -28,25 +28,71 @@ # Description # touch all .dep files #------------------------------------------------------------------------------ +usage() { + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat< Date: Fri, 11 Feb 2011 16:45:36 +0100 Subject: [PATCH 07/39] STYLE: remove editing junk --- src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H b/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H index cad33330cc..39b1654623 100644 --- a/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H +++ b/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,7 +28,7 @@ Description Provide a means of reading/writing the single-file OpenFOAM surface format. Note - This class provides more methods than the regular surface format interface.x + This class provides more methods than the regular surface format interface. SourceFiles OFSsurfaceFormat.C From 0c2eb36ed20f835b889cf8607772d949a658c67e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 11 Feb 2011 16:52:36 +0100 Subject: [PATCH 08/39] STYLE: allow spaces in pkg name (again) --- wmake/wmakePrintBuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild index 3812bece3e..103e65cb07 100755 --- a/wmake/wmakePrintBuild +++ b/wmake/wmakePrintBuild @@ -76,8 +76,8 @@ do ;; -pkg | -package) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" - # mark empty as 'none', disallow '!' and spaces in string - package=$(echo "${2:-none}" | sed -e 's/!//g' -e 's/ //g') + # mark empty as 'none', disallow '!' in string + package=$(echo "${2:-none}" | sed -e 's/!//g') shift 2 ;; -v | -version) From 56e07de724a455ee4058eb7ad89bb505325a3d6f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 14 Feb 2011 10:00:48 +0100 Subject: [PATCH 09/39] STYLE: changed some missed doxygen '@' to '\' --- .../mesh/conversion/foamToStarMesh/foamToStarMesh.C | 2 +- .../preProcessing/changeDictionary/changeDictionary.C | 2 +- bin/foamEtcFile | 6 +++--- src/OSspecific/POSIX/regExp.H | 2 +- .../includeIfPresentEntry/includeIfPresentEntry.H | 2 +- src/OpenFOAM/global/foamDoc.H | 10 +++++----- src/conversion/meshWriter/meshWriter.H | 2 +- .../coordinateRotation/coordinateRotation.H | 2 +- .../surfaceFormats/stl/STLsurfaceFormatASCII.L | 10 +++++----- .../chemistryReaders/chemkinReader/chemkinLexer.L | 10 +++++----- .../triSurface/interfaces/STL/readSTLASCII.L | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C index b154a3816d..af4985dd43 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C +++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C @@ -40,7 +40,7 @@ Usage Note The cellTable information available in the files - \c constant/cellTable and @c constant/polyMesh/cellTableId + \c constant/cellTable and \c constant/polyMesh/cellTableId will be used if available. Otherwise the cellZones are used when creating the cellTable information. diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index b580a27e71..083107efb9 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -29,7 +29,7 @@ Description type in the field and polyMesh/boundary files. Reads dictionaries (fields) and entries to change from a dictionary. - E.g. to make the \em movingWall a \em fixedValue for @em p but all other + E.g. to make the \em movingWall a \em fixedValue for \em p but all other \em Walls a zeroGradient boundary condition, the \c system/changeDictionaryDict would contain the following: \verbatim diff --git a/bin/foamEtcFile b/bin/foamEtcFile index 5bae566b55..20b5be0fed 100755 --- a/bin/foamEtcFile +++ b/bin/foamEtcFile @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -33,10 +33,10 @@ # personal settings to site-wide settings. # # For example, within the user ~/.OpenFOAM//prefs.sh: -# @verbatim +# \code # foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile -m go prefs.sh` \ # && _foamSource $foamPrefs -# @endverbatim +# \endcode # #------------------------------------------------------------------------------- usage() { diff --git a/src/OSspecific/POSIX/regExp.H b/src/OSspecific/POSIX/regExp.H index 7144d5723f..9106264ac8 100644 --- a/src/OSspecific/POSIX/regExp.H +++ b/src/OSspecific/POSIX/regExp.H @@ -29,7 +29,7 @@ Description SeeAlso The manpage regex(7) for more information about POSIX regular expressions. - These differ somewhat from \c Perl and @c sed regular expressions. + These differ somewhat from \c Perl and \c sed regular expressions. SourceFiles regExp.C diff --git a/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H b/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H index 98df647af7..f723f5ee98 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H +++ b/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H @@ -27,7 +27,7 @@ Class Description Specify a file to include if it exists. Expects a single string to follow. - The \c \#includeIfPresent directive is similar to the @c \#include + The \c \#includeIfPresent directive is similar to the \c \#include directive, but does not generate an error if the file does not exist. See Also diff --git a/src/OpenFOAM/global/foamDoc.H b/src/OpenFOAM/global/foamDoc.H index c44819062d..04af83ae1b 100644 --- a/src/OpenFOAM/global/foamDoc.H +++ b/src/OpenFOAM/global/foamDoc.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,9 +21,9 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -@mainpage OpenFOAM®: open source CFD +\mainpage OpenFOAM®: open source CFD -@section about About OpenFOAM +\section about About OpenFOAM OpenFOAM is a free, open source CFD software package produced by a commercial company, @@ -35,7 +35,7 @@ License heat transfer, to solid dynamics and electromagnetics. More ... -@section users Our commitment to the users +\section users Our commitment to the users OpenFOAM comes with full commercial support from OpenCFD, including @@ -48,7 +48,7 @@ License These activities fund the development, maintenance and release of OpenFOAM to make it an extremely viable commercial open source product. -@section opensource Our commitment to open source +\section opensource Our commitment to open source OpenCFD is committed to open source software, continually developing and maintaining OpenFOAM under the diff --git a/src/conversion/meshWriter/meshWriter.H b/src/conversion/meshWriter/meshWriter.H index 4aace111bc..431b565be2 100644 --- a/src/conversion/meshWriter/meshWriter.H +++ b/src/conversion/meshWriter/meshWriter.H @@ -35,7 +35,7 @@ Description write OpenFOAM meshes and/or results to another CFD format - currently just STAR-CD -@par Files +\par Files "constant/boundaryRegion" is an IOMap that contains the boundary type and names. eg, diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H index f7a44de396..8ae67e952c 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H @@ -32,7 +32,7 @@ Description or (e3/e1). Any nonorthogonality will be absorbed into the second vector. For convenience, the dictionary constructor forms allow a few shortcuts: - - if the \c type is not otherwise specified, the type @c axes + - if the \c type is not otherwise specified, the type \c axes is implicit - if an axes specification (eg, e3/e1) is used, the coordinateRotation sub-dictionary can be dropped. diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L index 5ba1363297..6145df61ca 100644 --- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L +++ b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,7 @@ License using namespace Foam; // Dummy yyFlexLexer::yylex() to keep the linker happy. It is not called -//! @cond dummy +//! \cond dummy int yyFlexLexer::yylex() { FatalErrorIn("yyFlexLexer::yylex()") @@ -44,12 +44,12 @@ int yyFlexLexer::yylex() << abort(FatalError); return 0; } -//! @endcond +//! \endcond // Dummy yywrap to keep yylex happy at compile time. // It is called by yylex but is not used as the mechanism to change file. // See <> -//! @cond dummy +//! \cond dummy #if YY_FLEX_SUBMINOR_VERSION < 34 extern "C" int yywrap() #else @@ -58,7 +58,7 @@ int yyFlexLexer::yywrap() { return 1; } -//! @endcond +//! \endcond //- A lexer for parsing STL ASCII files. diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L index 58987ae82e..9cdded54d9 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,7 @@ License int Foam::chemkinReader::yyBufSize = YY_BUF_SIZE; // Dummy yyFlexLexer::yylex() to keep the linker happy. It is not called -//! @cond dummy +//! \cond dummy int yyFlexLexer::yylex() { FatalErrorIn("yyFlexLexer::yylex()") @@ -47,13 +47,13 @@ int yyFlexLexer::yylex() return 0; } -//! @endcond +//! \endcond // Dummy yywrap to keep yylex happy at compile time. // It is called by yylex but is not used as the mechanism to change file. // See <> -//! @cond dummy +//! \cond dummy #if YY_FLEX_SUBMINOR_VERSION < 34 extern "C" int yywrap() #else @@ -62,7 +62,7 @@ int yyFlexLexer::yywrap() { return 1; } -//! @endcond +//! \endcond Foam::string foamSpecieString(const char* YYText) diff --git a/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L b/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L index 9cb9f1d3d1..20c63997c7 100644 --- a/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L +++ b/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L @@ -39,7 +39,7 @@ License using namespace Foam; // Dummy yyFlexLexer::yylex() to keep the linker happy. It is not called -//! @cond dummy +//! \cond dummy int yyFlexLexer::yylex() { FatalErrorIn("yyFlexLexer::yylex()") @@ -47,12 +47,12 @@ int yyFlexLexer::yylex() << abort(FatalError); return 0; } -//! @endcond +//! \endcond // Dummy yywrap to keep yylex happy at compile time. // It is called by yylex but is not used as the mechanism to change file. // See <> -//! @cond dummy +//! \cond dummy #if YY_FLEX_SUBMINOR_VERSION < 34 extern "C" int yywrap() #else @@ -61,7 +61,7 @@ int yyFlexLexer::yywrap() { return 1; } -//! @endcond +//! \endcond class STLLexer From d6155f802d62643f92a63553d62adfd9fa32baa4 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 14 Feb 2011 15:49:46 +0000 Subject: [PATCH 10/39] ENH: Initial check-in of re-worked particle forces --- src/lagrangian/intermediate/Make/files | 8 +- .../Templates/KinematicCloud/KinematicCloud.C | 35 +- .../Templates/KinematicCloud/KinematicCloud.H | 33 +- .../KinematicCloud/KinematicCloudI.H | 10 +- .../KinematicParcel/KinematicParcel.C | 41 +- .../KinematicParcel/KinematicParcel.H | 15 + .../KinematicParcel/KinematicParcelI.H | 21 + .../Templates/ThermoParcel/ThermoParcel.H | 6 + .../Templates/ThermoParcel/ThermoParcelI.H | 14 + .../makeBasicKinematicParcelForces.C | 40 ++ .../makeBasicKinematicParcelSubmodels.C | 4 +- .../makeBasicReactingMultiphaseParcelForces.C | 40 ++ ...keBasicReactingMultiphaseParcelSubmodels.C | 4 +- .../makeBasicReactingParcelForces.C | 40 ++ .../makeBasicReactingParcelSubmodels.C | 4 +- .../makeBasicThermoParcelForces.C | 40 ++ .../makeBasicThermoParcelSubmodels.C | 4 +- .../parcels/include/makeParcelForces.H | 89 +++++ .../parcels/include/makeThermoParcelForces.H | 96 +++++ .../particleForces/particleForces.C | 362 ------------------ .../particleForces/particleForces.H | 229 ----------- .../ParticleForceList/ParticleForceList.C | 155 ++++++++ .../ParticleForceList/ParticleForceList.H | 152 ++++++++ .../ParticleForceList/ParticleForceListI.H} | 46 ++- .../Kinematic/DragModel/DragModel/DragModel.H | 157 -------- .../NonSphereDrag/NonSphereDragForce.C} | 56 ++- .../NonSphereDrag/NonSphereDragForce.H} | 58 ++- .../DragForce/SphereDrag/SphereDragForce.C} | 87 +++-- .../DragForce/SphereDrag/SphereDragForce.H} | 59 ++- .../Gravity/GravityForce.C} | 60 ++- .../ParticleForces/Gravity/GravityForce.H | 135 +++++++ .../ParticleForces/Gravity/GravityForceI.H | 35 ++ .../Paramagnetic/ParamagneticForce.C | 120 ++++++ .../Paramagnetic/ParamagneticForce.H | 148 +++++++ .../Paramagnetic/ParamagneticForceI.H | 44 +++ .../ParticleForce/ParticleForce.C | 110 ++++++ .../ParticleForce/ParticleForce.H | 215 +++++++++++ .../ParticleForce/ParticleForceI.H} | 58 ++- .../ParticleForce/ParticleForceNew.C} | 46 ++- .../PressureGradient/PressureGradientForce.C | 106 +++++ .../PressureGradient/PressureGradientForce.H | 140 +++++++ .../PressureGradient/PressureGradientForceI.H | 49 +++ .../Kinematic/ParticleForces/SRF/SRFForce.C | 106 +++++ .../SRF/SRFForce.H} | 73 ++-- .../ParticleForces/forceSuSp/forceSuSp.H | 146 +++++++ .../ParticleForces/forceSuSp/forceSuSpI.H | 129 +++++++ .../BrownianMotion/BrownianMotionForce.C | 210 ++++++++++ .../BrownianMotion/BrownianMotionForce.H | 162 ++++++++ .../BrownianMotion/BrownianMotionForceI.H | 42 ++ .../constant/coalCloud1Properties | 11 +- .../constant/limestoneCloud1Properties | 11 +- .../filter/constant/reactingCloud1Properties | 11 +- .../constant/reactingCloud1Properties | 13 +- .../constant/reactingCloud1Properties | 13 +- .../constant/reactingCloud1Properties | 11 +- .../constant/kinematicCloud1Properties | 11 +- .../constant/thermoCloud1Properties | 11 +- .../constant/reactingCloud1Properties | 75 ---- .../constant/reactingCloud1Properties | 14 +- 59 files changed, 3029 insertions(+), 1191 deletions(-) create mode 100644 src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C create mode 100644 src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C create mode 100644 src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C create mode 100644 src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C create mode 100644 src/lagrangian/intermediate/parcels/include/makeParcelForces.H create mode 100644 src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H delete mode 100644 src/lagrangian/intermediate/particleForces/particleForces.C delete mode 100644 src/lagrangian/intermediate/particleForces/particleForces.H create mode 100644 src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C create mode 100644 src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H rename src/lagrangian/intermediate/{parcels/include/makeParcelDragModels.H => submodels/ForceTypes/ParticleForceList/ParticleForceListI.H} (57%) delete mode 100644 src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.H rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/NonSphereDrag/NonSphereDrag.C => ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C} (67%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/NonSphereDrag/NonSphereDrag.H => ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H} (74%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/SphereDrag/SphereDrag.C => ParticleForces/DragForce/SphereDrag/SphereDragForce.C} (64%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/SphereDrag/SphereDrag.H => ParticleForces/DragForce/SphereDrag/SphereDragForce.H} (63%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/DragModel/DragModel.C => ParticleForces/Gravity/GravityForce.C} (61%) create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForceI.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForceI.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/NoDrag/NoDrag.C => ParticleForces/ParticleForce/ParticleForceI.H} (65%) rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/DragModel/DragModelNew.C => ParticleForces/ParticleForce/ParticleForceNew.C} (61%) create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C rename src/lagrangian/intermediate/submodels/Kinematic/{DragModel/NoDrag/NoDrag.H => ParticleForces/SRF/SRFForce.H} (59%) create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H create mode 100644 src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C create mode 100644 src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H create mode 100644 src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForceI.H diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index 63fa90db0d..ad96a400fd 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -23,6 +23,7 @@ KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel $(KINEMATICPARCEL)/basicKinematicParcel.C $(KINEMATICPARCEL)/defineBasicKinematicParcel.C $(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C +$(KINEMATICPARCEL)/makeBasicKinematicParcelForces.C /* thermo parcel sub-models */ @@ -30,6 +31,7 @@ THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel $(THERMOPARCEL)/basicThermoParcel.C $(THERMOPARCEL)/defineBasicThermoParcel.C $(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C +$(THERMOPARCEL)/makeBasicThermoParcelForces.C /* reacting parcel sub-models */ @@ -37,6 +39,7 @@ REACTINGPARCEL=$(DERIVEDPARCELS)/basicReactingParcel $(REACTINGPARCEL)/basicReactingParcel.C $(REACTINGPARCEL)/defineBasicReactingParcel.C $(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C +$(REACTINGPARCEL)/makeBasicReactingParcelForces.C /* reacting multiphase parcel sub-models */ @@ -44,6 +47,7 @@ REACTINGMPPARCEL=$(DERIVEDPARCELS)/basicReactingMultiphaseParcel $(REACTINGMPPARCEL)/basicReactingMultiphaseParcel.C $(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C +$(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelForces.C /* bolt-on models */ @@ -78,10 +82,6 @@ $(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphase IntegrationScheme/makeIntegrationSchemes.C -/* particle forces */ -particleForces/particleForces.C - - /* phase properties */ phaseProperties/phaseProperties/phaseProperties.C phaseProperties/phaseProperties/phasePropertiesIO.C diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index fc589f5388..1c43f9e025 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -30,7 +30,6 @@ License #include "CollisionModel.H" #include "DispersionModel.H" -#include "DragModel.H" #include "InjectionModel.H" #include "PatchInteractionModel.H" #include "PostProcessingModel.H" @@ -209,15 +208,6 @@ void Foam::KinematicCloud::setModels() ).ptr() ); - dragModel_.reset - ( - DragModel >::New - ( - subModelProperties_, - *this - ).ptr() - ); - injectionModel_.reset ( InjectionModel >::New @@ -306,7 +296,7 @@ void Foam::KinematicCloud::preEvolve() Info<< "\nSolving cloud " << this->name() << endl; this->dispersion().cacheFields(true); - forces_.cacheFields(true, solution_.interpolationSchemes()); + forces_.cacheFields(true); updateCellOccupancy(); } @@ -390,7 +380,7 @@ void Foam::KinematicCloud::evolveCloud } else { -// this->surfaceFilm().injectStreadyState(td); +// this->surfaceFilm().injectSteadyState(td); this->injection().injectSteadyState(td, solution_.deltaT()); @@ -473,7 +463,7 @@ void Foam::KinematicCloud::postEvolve() } this->dispersion().cacheFields(false); - forces_.cacheFields(false, solution_.interpolationSchemes()); + forces_.cacheFields(false); this->postProcessing().post(); @@ -488,9 +478,10 @@ void Foam::KinematicCloud::cloudReset(KinematicCloud& c) rndGen_ = c.rndGen_; + forces_.transfer(c.forces_); + collisionModel_ = c.collisionModel_->clone(); dispersionModel_= c.dispersionModel_->clone(); - dragModel_ = c.dragModel_->clone(); injectionModel_ = c.injectionModel_->clone(); patchInteractionModel_ = c.patchInteractionModel_->clone(); postProcessingModel_ = c.postProcessingModel_->clone(); @@ -540,10 +531,15 @@ Foam::KinematicCloud::KinematicCloud U_(U), mu_(mu), g_(g), - forces_(mesh_, particleProperties_, g_.value(), solution_.active()), + forces_ + ( + *this, + mesh_, + particleProperties_.subOrEmptyDict("particleForces"), + solution_.active() + ), collisionModel_(NULL), dispersionModel_(NULL), - dragModel_(NULL), injectionModel_(NULL), patchInteractionModel_(NULL), postProcessingModel_(NULL), @@ -606,7 +602,7 @@ Foam::KinematicCloud::KinematicCloud const word& name ) : - Cloud(c.mesh(), name, c), + Cloud(c.mesh_, name, c), kinematicCloud(), cloudCopyPtr_(NULL), mesh_(c.mesh_), @@ -623,7 +619,6 @@ Foam::KinematicCloud::KinematicCloud forces_(c.forces_), collisionModel_(c.collisionModel_->clone()), dispersionModel_(c.dispersionModel_->clone()), - dragModel_(c.dragModel_->clone()), injectionModel_(c.injectionModel_->clone()), patchInteractionModel_(c.patchInteractionModel_->clone()), postProcessingModel_(c.postProcessingModel_->clone()), @@ -661,7 +656,6 @@ Foam::KinematicCloud::KinematicCloud c.UCoeff_() ) ) - {} @@ -698,10 +692,9 @@ Foam::KinematicCloud::KinematicCloud U_(c.U_), mu_(c.mu_), g_(c.g_), - forces_(mesh), + forces_(*this, mesh), collisionModel_(NULL), dispersionModel_(NULL), - dragModel_(NULL), injectionModel_(NULL), patchInteractionModel_(NULL), postProcessingModel_(NULL), diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index b1020c1e20..a9244fa020 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -29,10 +29,14 @@ Description - holds a 'cloudSolution' class that stores all relevant solution info + - particle forces + - buoyancy + - drag + - pressure gradient + - sub-models: - Collision model - Dispersion model - - Drag model - Injection model - Patch interaction model - Post-processing model @@ -55,7 +59,6 @@ SourceFiles #include "fvMesh.H" #include "volFields.H" #include "fvMatrices.H" -#include "particleForces.H" #include "IntegrationSchemesFwd.H" @@ -72,9 +75,6 @@ class CollisionModel; template class DispersionModel; -template -class DragModel; - template class InjectionModel; @@ -98,6 +98,14 @@ class KinematicCloud public Cloud, public kinematicCloud { +public: + + //- Type of parcel the cloud was instantiated for + typedef ParcelType parcelType; + + +private: + // Private data //- Cloud copy pointer @@ -316,7 +324,7 @@ protected: //- Optional particle forces - particleForces forces_; + typename ParcelType::forceType forces_; // References to the cloud sub-models @@ -329,9 +337,6 @@ protected: autoPtr > > dispersionModel_; - //- Drag transfer model - autoPtr > > dragModel_; - //- Injector model autoPtr > > injectionModel_; @@ -450,10 +455,6 @@ public: virtual ~KinematicCloud(); - //- Type of parcel the cloud was instantiated for - typedef ParcelType parcelType; - - // Member Functions // Access @@ -521,7 +522,7 @@ public: //- Optional particle forces - inline const particleForces& forces() const; + inline const typename ParcelType::forceType& forces() const; // Sub-models @@ -542,10 +543,6 @@ public: inline DispersionModel >& dispersion(); - //- Return const-access to the drag model - inline const DragModel >& - drag() const; - //- Return const access to the injection model inline const InjectionModel >& injection() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 457e39abae..62128ef7ed 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -257,7 +257,7 @@ Foam::KinematicCloud::g() const template -inline const Foam::particleForces& +inline const typename ParcelType::forceType& Foam::KinematicCloud::forces() const { return forces_; @@ -296,14 +296,6 @@ Foam::KinematicCloud::dispersion() } -template -inline const Foam::DragModel >& -Foam::KinematicCloud::drag() const -{ - return dragModel_; -} - - template inline const Foam::InjectionModel >& Foam::KinematicCloud::injection() const diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index c2310d3453..54bde90c77 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -176,37 +176,13 @@ const Foam::vector Foam::KinematicParcel::calcVelocity scalar& Cud ) const { - const polyMesh& mesh = this->cloud().pMesh(); - - // Momentum transfer coefficient - const scalar utc = td.cloud().drag().utc(Re, d, mu) + ROOTVSMALL; - - tetIndices tetIs = this->currentTetIndices(); + const typename ParcelType::forceType& forces = td.cloud().forces(); // Momentum source due to particle forces - const vector Fcp = mass*td.cloud().forces().calcCoupled - ( - this->position(), - tetIs, - dt, - rhoc_, - rho, - Uc_, - U, - d - ); - - const vector Fncp = mass*td.cloud().forces().calcNonCoupled - ( - this->position(), - tetIs, - dt, - rhoc_, - rho, - Uc_, - U, - d - ); + const ParcelType& p = static_cast(*this); + const forceSuSp Fcp = forces.calcCoupled(p, dt, Re, rho, mu); + const forceSuSp Fncp = forces.calcNonCoupled(p, dt, Re, rho, mu); + const forceSuSp Feff = Fcp + Fncp; // New particle velocity @@ -214,8 +190,8 @@ const Foam::vector Foam::KinematicParcel::calcVelocity // Update velocity - treat as 3-D const scalar As = this->areaS(d); - const vector ap = Uc_ + (Fcp + Fncp + Su)/(utc*As); - const scalar bp = 6.0*utc/(rho*d); + const vector ap = Uc_ + (mass*Feff.Su() + Su)/(As*Feff.Sp()); + const scalar bp = 6.0*Feff.Sp()/(rho*d); Cud = bp; @@ -224,9 +200,10 @@ const Foam::vector Foam::KinematicParcel::calcVelocity vector Unew = Ures.value(); - dUTrans += dt*(utc*As*(Ures.average() - Uc_) - Fcp); + dUTrans += dt*(Fncp.Sp()*As*(Ures.average() - Uc_) - mass*Fcp.Su()); // Apply correction to velocity and dUTrans for reduced-D cases + const polyMesh& mesh = this->cloud().pMesh(); meshTools::constrainDirection(mesh, mesh.solutionD(), Unew); meshTools::constrainDirection(mesh, mesh.solutionD(), dUTrans); diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index 003e07ee46..327c3e82f0 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -56,6 +56,8 @@ SourceFiles #include "labelFieldIOField.H" #include "vectorFieldIOField.H" +#include "ParticleForceList.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -88,6 +90,10 @@ class KinematicParcel { public: + //- Type of force to be used by this parcel type + typedef ParticleForceList > forceType; + + //- Class to hold kinematic particle constant properties class constantProperties { @@ -456,6 +462,15 @@ public: //- Return const access to turbulent velocity fluctuation inline const vector& UTurb() const; + //- Return const access to carrier density [kg/m3] + inline scalar rhoc() const; + + //- Return const access to carrier velocity [m/s] + inline const vector& Uc() const; + + //- Return const access to carrier viscosity [Pa.s] + inline scalar muc() const; + //- Return const access to the collision records inline const collisionRecordList& collisionRecords() const; diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H index bdf143cbe5..c1d61003f8 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H @@ -409,6 +409,27 @@ inline const Foam::vector& Foam::KinematicParcel::UTurb() const } +template +inline Foam::scalar Foam::KinematicParcel::rhoc() const +{ + return rhoc_; +} + + +template +inline const Foam::vector& Foam::KinematicParcel::Uc() const +{ + return Uc_; +} + + +template +inline Foam::scalar Foam::KinematicParcel::muc() const +{ + return muc_; +} + + template inline bool& Foam::KinematicParcel::active() { diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index e455c1773e..e3e20063c6 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -344,6 +344,12 @@ public: //- Return the parcel sensible enthalpy inline scalar hs() const; + //- Return const access to carrier temperature + inline scalar Tc() const; + + //- Return const access to carrier specific heat capacity + inline scalar Cpc() const; + // Edit diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H index ada4b93a10..0ebff1def9 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H @@ -321,6 +321,20 @@ inline Foam::scalar Foam::ThermoParcel::hs() const } +template +inline Foam::scalar Foam::ThermoParcel::Tc() const +{ + return Tc_; +} + + +template +inline Foam::scalar Foam::ThermoParcel::Cpc() const +{ + return Cpc_; +} + + template inline Foam::scalar& Foam::ThermoParcel::T() { diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C new file mode 100644 index 0000000000..5d7f1b57bf --- /dev/null +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C @@ -0,0 +1,40 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "basicKinematicParcel.H" + +// Kinematic +#include "makeParcelForces.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // Kinematic sub-models + makeParcelForces(basicKinematicParcel); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C index 27c54abfd2..a401d40b20 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // Kinematic #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -40,7 +39,6 @@ namespace Foam { // Kinematic sub-models makeParcelDispersionModels(basicKinematicParcel); - makeParcelDragModels(basicKinematicParcel); makeParcelInjectionModels(basicKinematicParcel); makeParcelCollisionModels(basicKinematicParcel); makeParcelPatchInteractionModels(basicKinematicParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C new file mode 100644 index 0000000000..3122dc2fb8 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C @@ -0,0 +1,40 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "basicReactingMultiphaseParcel.H" + +// Using thermodynamic variant +#include "makeThermoParcelForces.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // Kinematic sub-models + makeThermoParcelForces(basicReactingMultiphaseParcel); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C index fa38f8a5e2..aa272e23d4 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // Kinematic #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -51,7 +50,6 @@ namespace Foam { // Kinematic sub-models makeParcelDispersionModels(basicReactingMultiphaseParcel); - makeParcelDragModels(basicReactingMultiphaseParcel); makeReactingMultiphaseParcelInjectionModels(basicReactingMultiphaseParcel); makeParcelCollisionModels(basicReactingMultiphaseParcel); makeParcelPatchInteractionModels(basicReactingMultiphaseParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C new file mode 100644 index 0000000000..094f1a37de --- /dev/null +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C @@ -0,0 +1,40 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "basicReactingParcel.H" + +// Using thermodynamic variant +#include "makeThermoParcelForces.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // Kinematic sub-models + makeThermoParcelForces(basicReactingParcel); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C index b1e3978011..9f708827bf 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // Kinematic #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeReactingParcelInjectionModels.H" // Reacting variant #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -47,7 +46,6 @@ namespace Foam { // Kinematic sub-models makeParcelDispersionModels(basicReactingParcel); - makeParcelDragModels(basicReactingParcel); makeReactingParcelInjectionModels(basicReactingParcel); makeParcelCollisionModels(basicReactingParcel); makeParcelPatchInteractionModels(basicReactingParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C new file mode 100644 index 0000000000..3ada6d849d --- /dev/null +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C @@ -0,0 +1,40 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "basicThermoParcel.H" + +// Using thermodynamic variant +#include "makeThermoParcelForces.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // Kinematic sub-models + makeThermoParcelForces(basicThermoParcel); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C index 289e6d38cd..91be53b9df 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // Kinematic #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -43,7 +42,6 @@ namespace Foam { // Kinematic sub-models makeParcelDispersionModels(basicThermoParcel); - makeParcelDragModels(basicThermoParcel); makeParcelInjectionModels(basicThermoParcel); makeParcelCollisionModels(basicThermoParcel); makeParcelPatchInteractionModels(basicThermoParcel); diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelForces.H b/src/lagrangian/intermediate/parcels/include/makeParcelForces.H new file mode 100644 index 0000000000..bc04078abd --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeParcelForces.H @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeParcelForces_H +#define makeParcelForces_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "KinematicCloud.H" + +#include "SphereDragForce.H" +#include "NonSphereDragForce.H" + +#include "GravityForce.H" +#include "ParamagneticForce.H" +#include "PressureGradientForce.H" +#include "SRFForce.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeParcelForces(ParcelType) \ + \ + makeParticleForceModel(KinematicCloud); \ + \ + makeParticleForceModelType \ + ( \ + SphereDragForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + NonSphereDragForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + GravityForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + ParamagneticForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + PressureGradientForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + SRFForce, \ + KinematicCloud, \ + ParcelType \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H b/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H new file mode 100644 index 0000000000..a39f748559 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeThermoParcelForces.H @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeThermoParcelForces_H +#define makeThermoParcelForces_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "KinematicCloud.H" + +#include "SphereDragForce.H" +#include "NonSphereDragForce.H" + +#include "BrownianMotionForce.H" +#include "GravityForce.H" +#include "ParamagneticForce.H" +#include "PressureGradientForce.H" +#include "SRFForce.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeThermoParcelForces(ParcelType) \ + \ + makeParticleForceModel(KinematicCloud); \ + \ + makeParticleForceModelType \ + ( \ + SphereDragForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + NonSphereDragForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + BrownianMotionForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + GravityForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + ParamagneticForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + PressureGradientForce, \ + KinematicCloud, \ + ParcelType \ + ); \ + makeParticleForceModelType \ + ( \ + SRFForce, \ + KinematicCloud, \ + ParcelType \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/particleForces/particleForces.C b/src/lagrangian/intermediate/particleForces/particleForces.C deleted file mode 100644 index 124b21c2e1..0000000000 --- a/src/lagrangian/intermediate/particleForces/particleForces.C +++ /dev/null @@ -1,362 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011 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 . - -\*---------------------------------------------------------------------------*/ - -#include "particleForces.H" -#include "fvMesh.H" -#include "volFields.H" -#include "fvcGrad.H" -#include "mathematicalConstants.H" -#include "electromagneticConstants.H" -#include "SRFModel.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::particleForces::deleteFields() -{ - if (gradUPtr_) - { - delete gradUPtr_; - gradUPtr_ = NULL; - } - - if (HdotGradHInterPtr_) - { - delete HdotGradHInterPtr_; - HdotGradHInterPtr_ = NULL; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::particleForces::particleForces(const fvMesh& mesh) -: - mesh_(mesh), - dict_(dictionary::null), - g_(vector::zero), - gradUPtr_(NULL), - HdotGradHInterPtr_(NULL), - gravity_(false), - virtualMass_(false), - Cvm_(0.0), - pressureGradient_(false), - paramagnetic_(false), - magneticSusceptibility_(0.0), - refFrame_(rfInertial), - UName_("undefined_UName"), - HdotGradHName_("undefined_HdotGradHName") -{} - - -Foam::particleForces::particleForces -( - const fvMesh& mesh, - const dictionary& dict, - const vector& g, - const bool readFields -) -: - mesh_(mesh), - dict_(dict.subOrEmptyDict("particleForces")), - g_(g), - gradUPtr_(NULL), - HdotGradHInterPtr_(NULL), - gravity_(false), - virtualMass_(false), - Cvm_(0.0), - pressureGradient_(false), - paramagnetic_(false), - magneticSusceptibility_(0.0), - refFrame_(rfInertial), - UName_(dict_.lookupOrDefault("UName", "U")), - HdotGradHName_(dict_.lookupOrDefault("HdotGradHName", "HdotGradH")) -{ - if (readFields) - { - dict_.lookup("gravity") >> gravity_; - dict_.lookup("virtualMass") >> virtualMass_; - dict_.lookup("pressureGradient") >> pressureGradient_; - dict_.lookup("paramagnetic") >> paramagnetic_; - - if (virtualMass_) - { - dict_.lookup("Cvm") >> Cvm_; - } - - if (paramagnetic_) - { - dict_.lookup("magneticSusceptibility") >> magneticSusceptibility_; - } - } - - if (dict_.found("referenceFrame")) - { - word rf(dict_.lookup("referenceFrame")); - - if (rf == "SRF") - { - refFrame_ = rfSRF; - } - else if (rf != "inertial") - { - FatalErrorIn - ( - "Foam::particleForces::particleForces" - "(" - "const fvMesh&, " - "const dictionary&, " - "const vector&, " - "const bool" - ")" - ) - << "Unknown referenceFrame, options are inertial and SRF." - << abort(FatalError); - } - } -} - - -Foam::particleForces::particleForces(const particleForces& f) -: - mesh_(f.mesh_), - dict_(f.dict_), - g_(f.g_), - gradUPtr_(f.gradUPtr_), - HdotGradHInterPtr_(f.HdotGradHInterPtr_), - gravity_(f.gravity_), - virtualMass_(f.virtualMass_), - Cvm_(f.Cvm_), - pressureGradient_(f.pressureGradient_), - paramagnetic_(f.paramagnetic_), - magneticSusceptibility_(f.magneticSusceptibility_), - refFrame_(f.refFrame_), - UName_(f.UName_), - HdotGradHName_(f.HdotGradHName_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::particleForces::~particleForces() -{ - deleteFields(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const Foam::dictionary& Foam::particleForces::dict() const -{ - return dict_; -} - - -const Foam::vector& Foam::particleForces::g() const -{ - return g_; -} - - -Foam::Switch Foam::particleForces::gravity() const -{ - return gravity_; -} - - -Foam::Switch Foam::particleForces::virtualMass() const -{ - return virtualMass_; -} - - -Foam::scalar Foam::particleForces::Cvm() const -{ - return Cvm_; -} - - -Foam::Switch Foam::particleForces::pressureGradient() const -{ - return pressureGradient_; -} - - -Foam::Switch Foam::particleForces::paramagnetic() const -{ - return paramagnetic_; -} - - -Foam::scalar Foam::particleForces::magneticSusceptibility() const -{ - return magneticSusceptibility_; -} - - -const Foam::word& Foam::particleForces::UName() const -{ - return UName_; -} - - -const Foam::word& Foam::particleForces::HdotGradHName() const -{ - return HdotGradHName_; -} - - -void Foam::particleForces::cacheFields -( - const bool store, - const dictionary& interpolationSchemes -) -{ - if (store) - { - if (pressureGradient_) - { - const volVectorField& U = - mesh_.lookupObject(UName_); - - gradUPtr_ = fvc::grad(U).ptr(); - } - - if (paramagnetic_) - { - const volVectorField& HdotGradH = - mesh_.lookupObject(HdotGradHName_); - - HdotGradHInterPtr_ = interpolation::New - ( - interpolationSchemes, - HdotGradH - ).ptr(); - } - } - else - { - deleteFields(); - } -} - - -Foam::vector Foam::particleForces::calcCoupled -( - const vector& position, - const tetIndices& tetIs, - const scalar dt, - const scalar rhoc, - const scalar rho, - const vector& Uc, - const vector& U, - const scalar d -) const -{ - vector accelTot = vector::zero; - - // Virtual mass force - if (virtualMass_) - { - notImplemented - ( - "Foam::particleForces::calcCoupled(...) - virtual mass force" - ); -// accelTot += Cvm_*rhoc/rho*d(Uc - U)/dt; - } - - // Pressure gradient force - if (pressureGradient_) - { - const volTensorField& gradU = *gradUPtr_; - accelTot += rhoc/rho*(U & gradU[tetIs.cell()]); - } - - return accelTot; -} - - -Foam::vector Foam::particleForces::calcNonCoupled -( - const vector& position, - const tetIndices& tetIs, - const scalar dt, - const scalar rhoc, - const scalar rho, - const vector& Uc, - const vector& U, - const scalar d -) const -{ - vector accelTot = vector::zero; - - // Gravity force - if (gravity_) - { - accelTot += g_*(1.0 - rhoc/rho); - } - - // Magnetic field force - - if (paramagnetic_) - { - const interpolation& HdotGradHInter = *HdotGradHInterPtr_; - - accelTot += - 3.0*constant::electromagnetic::mu0.value()/rho - *magneticSusceptibility_/(magneticSusceptibility_ + 3) - *HdotGradHInter.interpolate(position, tetIs); - - // force is: - - // 4.0 - // *constant::mathematical::pi - // *constant::electromagnetic::mu0.value() - // *pow3(d/2) - // *magneticSusceptibility_/(magneticSusceptibility_ + 3) - // *HdotGradH[cellI]; - - // which is divided by mass (pi*d^3*rho/6) to produce - // acceleration - } - - if (refFrame_ == rfSRF) - { - const SRF::SRFModel& srf = - mesh_.lookupObject("SRFProperties"); - - const vector& omega = srf.omega().value(); - const vector& axis = srf.axis(); - - vector r = position - axis*(axis & position); - - // Coriolis and centrifugal acceleration terms - accelTot += 2*(U ^ omega) + (omega ^ (r ^ omega)); - } - - return accelTot; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/particleForces/particleForces.H b/src/lagrangian/intermediate/particleForces/particleForces.H deleted file mode 100644 index 0f655be004..0000000000 --- a/src/lagrangian/intermediate/particleForces/particleForces.H +++ /dev/null @@ -1,229 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011 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 . - -Class - Foam::particleForces - -Description - Provides a mechanism to calculate particle forces - Note: forces are force per unit mass (accelerations) - -SourceFiles - particleForces.C - -\*---------------------------------------------------------------------------*/ - -#ifndef particleForces_H -#define particleForces_H - -#include "dictionary.H" -#include "Switch.H" -#include "vector.H" -#include "volFieldsFwd.H" -#include "interpolation.H" -#include "tetIndices.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward class declarations -class fvMesh; - -/*---------------------------------------------------------------------------*\ - Class particleForces Declaration -\*---------------------------------------------------------------------------*/ - -class particleForces -{ - // Private data - - //- Reference frame type - enum refFrame - { - rfInertial, - rfSRF - }; - - //- Reference to the mesh database - const fvMesh& mesh_; - - //- The particleForces dictionary - const dictionary dict_; - - //- Gravity - const vector g_; - - //- Velocity gradient field - const volTensorField* gradUPtr_; - - //- HdotGradH interpolator - const interpolation* HdotGradHInterPtr_; - - - // Forces to include in particle motion evaluation - - //- Gravity - Switch gravity_; - - //- Virtual mass - Switch virtualMass_; - - //- Virtual mass force coefficient - scalar Cvm_; - - //- Pressure gradient - Switch pressureGradient_; - - //- Paramagnetic force - Switch paramagnetic_; - - //- Magnetic susceptibility of particle - scalar magneticSusceptibility_; - - //- Reference frame accelerations - refFrame refFrame_; - - - // Additional info - - //- Name of velocity field - default = "U" - const word UName_; - - //- Name of paramagnetic field strength field - default = - // "HdotGradH" - const word HdotGradHName_; - - - // Private Member Functions - - //- Delete cached carrier fields - void deleteFields(); - - -public: - - // Constructors - - //- Construct null from mesh reference - particleForces(const fvMesh& mesh); - - //- Construct from mesh, dictionary and gravity - particleForces - ( - const fvMesh& mesh, - const dictionary& dict, - const vector& g, - const bool readFields = true - ); - - //- Construct copy - particleForces(const particleForces& f); - - - //- Destructor - ~particleForces(); - - - // Member Functions - - // Access - - //- Return the particleForces dictionary - const dictionary& dict() const; - - //- Return the gravity vector - const vector& g() const; - - //- Return gravity force activate switch - Switch gravity() const; - - //- Return virtual mass force activate switch - Switch virtualMass() const; - - //- Return virtual mass force coefficient - scalar Cvm() const; - - //- Return pressure gradient force activate switch - Switch pressureGradient() const; - - //- Return name of velocity field - const word& UName() const; - - //- Return paramagnetic force activate switch - Switch paramagnetic() const; - - //- Return magnetic susceptibility - scalar magneticSusceptibility() const; - - //- Return name of paramagnetic field strength field - const word& HdotGradHName() const; - - - // Evaluation - - //- Cache carrier fields - void cacheFields - ( - const bool store, - const dictionary& interpolationSchemes - ); - - //- Calculate action/reaction forces between carrier and particles - vector calcCoupled - ( - const vector& position, - const tetIndices& tetIs, - const scalar dt, - const scalar rhoc, - const scalar rho, - const vector& Uc, - const vector& U, - const scalar d - ) const; - - //- Calculate external forces applied to the particles - vector calcNonCoupled - ( - const vector& position, - const tetIndices& tetIs, - const scalar dt, - const scalar rhoc, - const scalar rho, - const vector& Uc, - const vector& U, - const scalar d - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C new file mode 100644 index 0000000000..9d7426824c --- /dev/null +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "ParticleForceList.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ParticleForceList::ParticleForceList +( + CloudType& owner, + const fvMesh& mesh +) +: + PtrList >(), + owner_(owner), + mesh_(mesh), + dict_(dictionary::null) +{} + + +template +Foam::ParticleForceList::ParticleForceList +( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const bool readFields +) +: + PtrList >(), + owner_(owner), + mesh_(mesh), + dict_(dict) +{ + if (readFields) + { + const wordList models(dict.lookup("activeForces")); + + Info<< "Constructing particle forces" << endl; + if (models.size() > 0) + { + this->setSize(models.size()); + forAll(models, i) + { + set + ( + i, + ParticleForce::New(owner, mesh, dict, models[i]) + ); + } + } + else + { + Info<< " none" << endl; + } + } +} + + +template +Foam::ParticleForceList::ParticleForceList +( + const ParticleForceList& pf +) +: + PtrList >(pf), + owner_(pf.owner_), + mesh_(pf.mesh_), + dict_(pf.dict_) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +template +Foam::ParticleForceList::~ParticleForceList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::ParticleForceList::cacheFields(const bool store) +{ + forAll(*this, i) + { + this->operator[](i).cacheFields(store); + } +} + + +template +Foam::forceSuSp Foam::ParticleForceList::calcCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + forAll(*this, i) + { + value += this->operator[](i).calcCoupled(p, dt, Re, rhoc, muc); + } + + return value; +} + + +template +Foam::forceSuSp Foam::ParticleForceList::calcNonCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + forAll(*this, i) + { + value += this->operator[](i).calcNonCoupled(p, dt, Re, rhoc, muc); + } + + return value; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H new file mode 100644 index 0000000000..dc9f3811a0 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +Class + Foam::ParticleForceList + +Description + List of particle forces + +SourceFiles + ParticleForceListI.H + ParticleForceList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ParticleForceList_H +#define ParticleForceList_H + +#include "ParticleForce.H" +#include "forceSuSp.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ParticleForceList Declaration +\*---------------------------------------------------------------------------*/ + +template +class ParticleForceList +: + public PtrList > +{ + // Private data + + //- Reference to the owner cloud + CloudType& owner_; + + //- Reference to the mesh database + const fvMesh& mesh_; + + //- Forces dictionary + const dictionary dict_; + + +public: + + // Constructors + + //- Null constructor + ParticleForceList(CloudType& owner, const fvMesh& mesh); + + //- Construct from mesh + ParticleForceList + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const bool readFields + ); + + //- Construct copy + ParticleForceList(const ParticleForceList& pfl); + + + //- Destructor + virtual ~ParticleForceList(); + + + // Member Functions + + // Access + + //- Return const access to the cloud owner + inline const CloudType& owner() const; + + //- Return refernce to the cloud owner + inline CloudType& owner(); + + //- Return the mesh database + inline const fvMesh& mesh() const; + + //- Return the forces dictionary + inline const dictionary& dict() const; + + + // Evaluation + + //- Cache fields + virtual void cacheFields(const bool store); + + //- Calculate the coupled force + virtual forceSuSp calcCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "ParticleForceListI.H" + +#ifdef NoRepository + #include "ParticleForceList.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelDragModels.H b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceListI.H similarity index 57% rename from src/lagrangian/intermediate/parcels/include/makeParcelDragModels.H rename to src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceListI.H index d849b7833e..e358dbc3d3 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelDragModels.H +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceListI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,30 +23,34 @@ License \*---------------------------------------------------------------------------*/ -#ifndef makeParcelDragModels_H -#define makeParcelDragModels_H - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "KinematicCloud.H" - -#include "NoDrag.H" -#include "NonSphereDrag.H" -#include "SphereDrag.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define makeParcelDragModels(ParcelType) \ - \ - makeDragModel(KinematicCloud); \ - \ - makeDragModelType(NoDrag, KinematicCloud, ParcelType); \ - makeDragModelType(NonSphereDrag, KinematicCloud, ParcelType); \ - makeDragModelType(SphereDrag, KinematicCloud, ParcelType); +template +inline const CloudType& Foam::ParticleForceList::owner() const +{ + return owner_; +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template +inline CloudType& Foam::ParticleForceList::owner() +{ + return owner_; +} + + +template +inline const Foam::fvMesh& Foam::ParticleForceList::mesh() const +{ + return mesh_; +} + + +template +inline const Foam::dictionary& Foam::ParticleForceList::dict() const +{ + return dict_; +} -#endif // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.H b/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.H deleted file mode 100644 index f52111545d..0000000000 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.H +++ /dev/null @@ -1,157 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 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 . - -Class - Foam::DragModel - -Description - Templated drag model class - -SourceFiles - DragModel.C - DragModelNew.C - -\*---------------------------------------------------------------------------*/ - -#ifndef DragModel_H -#define DragModel_H - -#include "IOdictionary.H" -#include "autoPtr.H" -#include "runTimeSelectionTables.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class DragModel Declaration -\*---------------------------------------------------------------------------*/ - -template -class DragModel -: - public SubModelBase -{ -public: - - //- Runtime type information - TypeName("DragModel"); - - //- Declare runtime constructor selection table - declareRunTimeSelectionTable - ( - autoPtr, - DragModel, - dictionary, - ( - const dictionary& dict, - CloudType& owner - ), - (dict, owner) - ); - - - // Constructors - - //- Construct null from owner - DragModel(CloudType& owner); - - //- Construct from components - DragModel - ( - const dictionary& dict, - CloudType& owner, - const word& type - ); - - //- Construct copy - DragModel(const DragModel& dm); - - //- Construct and return a clone - virtual autoPtr > clone() const - { - return autoPtr > - ( - new DragModel(*this) - ); - } - - - //- Destructor - virtual ~DragModel(); - - - //- Selector - static autoPtr > New - ( - const dictionary& dict, - CloudType& cloud - ); - - - // Member Functions - - //- Return drag coefficient - virtual scalar Cd(const scalar Re) const; - - //- Return momentum transfer coefficient - // Drag force per unit particle surface area = utc(U - Up) - scalar utc(const scalar Re, const scalar d, const scalar mu) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define makeDragModel(CloudType) \ - \ - defineNamedTemplateTypeNameAndDebug(DragModel, 0); \ - \ - defineTemplateRunTimeSelectionTable(DragModel, dictionary); - - -#define makeDragModelType(SS, CloudType, ParcelType) \ - \ - defineNamedTemplateTypeNameAndDebug(SS >, 0); \ - \ - DragModel >:: \ - adddictionaryConstructorToTable > > \ - add##SS##CloudType##ParcelType##ConstructorToTable_; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "DragModel.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C similarity index 67% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C index 822592e2aa..b6f54ea92a 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,19 +23,30 @@ License \*---------------------------------------------------------------------------*/ -#include "NonSphereDrag.H" +#include "NonSphereDragForce.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +Foam::scalar Foam::NonSphereDragForce::Cd(const scalar Re) const +{ + return 24.0/(Re + ROOTVSMALL)*(1.0 + a_*pow(Re, b_)) + Re*c_/(Re + d_); +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::NonSphereDrag::NonSphereDrag +Foam::NonSphereDragForce::NonSphereDragForce ( + CloudType& owner, + const fvMesh& mesh, const dictionary& dict, - CloudType& owner + const word& forceType ) : - DragModel(dict, owner, typeName), - phi_(readScalar(this->coeffDict().lookup("phi"))), + ParticleForce(owner, mesh, dict, forceType), + phi_(readScalar(this->coeffs().lookup("phi"))), a_(exp(2.3288 - 6.4581*phi_ + 2.4486*sqr(phi_))), b_(0.0964 + 0.5565*phi_), c_(exp(4.9050 - 13.8944*phi_ + 18.4222*sqr(phi_) - 10.2599*pow3(phi_))), @@ -58,33 +69,44 @@ Foam::NonSphereDrag::NonSphereDrag template -Foam::NonSphereDrag::NonSphereDrag +Foam::NonSphereDragForce::NonSphereDragForce ( - const NonSphereDrag& dm + const NonSphereDragForce& df ) : - DragModel(dm), - phi_(dm.phi_), - a_(dm.a_), - b_(dm.b_), - c_(dm.c_), - d_(dm.d_) + ParticleForce(df), + phi_(df.phi_), + a_(df.a_), + b_(df.b_), + c_(df.c_), + d_(df.d_) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -Foam::NonSphereDrag::~NonSphereDrag() +Foam::NonSphereDragForce::~NonSphereDragForce() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::scalar Foam::NonSphereDrag::Cd(const scalar Re) const +Foam::forceSuSp Foam::NonSphereDragForce::calcNonCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const { - return 24.0/(Re + ROOTVSMALL)*(1.0 + a_*pow(Re, b_)) + Re*c_/(Re + d_); + forceSuSp value(vector::zero, 0.0); + + value.Sp() = Cd(Re)*Re/p.d()*muc/8.0 + ROOTVSMALL; + + return value; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H similarity index 74% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.H rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H index 1d6fc02b00..d6d2712c8a 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NonSphereDrag/NonSphereDrag.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H @@ -57,31 +57,28 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef NonSphereDrag_H -#define NonSphereDrag_H +#ifndef NonSphereDragForce_H +#define NonSphereDragForce_H -#include "DragModel.H" +#include "ParticleForce.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class NonSphereDrag Declaration + Class NonSphereDragForce Declaration \*---------------------------------------------------------------------------*/ template -class NonSphereDrag +class NonSphereDragForce : - public DragModel + public ParticleForce { protected: // Protected Data - //- Flag to indicate `Simple model' - bool simpleModel_; - //- Ratio of surface of sphere having same volume as particle to // actual surface area of particle (0 < phi <= 1) scalar phi_; @@ -98,38 +95,59 @@ protected: scalar d_; + // Private Member Functions + + //- Drag coefficient + scalar Cd(const scalar Re) const; + + public: //- Runtime type information - TypeName("NonSphereDrag"); + TypeName("nonSphereDrag"); // Constructors - //- Construct from dictionary - NonSphereDrag(const dictionary& dict, CloudType& owner); + //- Construct from mesh + NonSphereDragForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); //- Construct copy - NonSphereDrag(const NonSphereDrag& dm); + NonSphereDragForce(const NonSphereDragForce& df); //- Construct and return a clone - virtual autoPtr > clone() const + virtual autoPtr > clone() const { - return autoPtr > + return autoPtr > ( - new NonSphereDrag(*this) + new NonSphereDragForce(*this) ); } //- Destructor - virtual ~NonSphereDrag(); + virtual ~NonSphereDragForce(); // Member Functions - //- Return drag coefficient - scalar Cd(const scalar Re) const; + // Evaluation + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; }; @@ -140,7 +158,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "NonSphereDrag.C" +# include "NonSphereDragForce.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C similarity index 64% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C index 7d0c0727cf..64955508c9 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,39 +23,12 @@ License \*---------------------------------------------------------------------------*/ -#include "SphereDrag.H" +#include "SphereDragForce.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template -Foam::SphereDrag::SphereDrag -( - const dictionary&, - CloudType& owner -) -: - DragModel(owner) -{} - - -template -Foam::SphereDrag::SphereDrag(const SphereDrag& dm) -: - DragModel(dm) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::SphereDrag::~SphereDrag() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -Foam::scalar Foam::SphereDrag::Cd(const scalar Re) const +Foam::scalar Foam::SphereDragForce::Cd(const scalar Re) const { scalar Cd; if (Re < SMALL) @@ -75,4 +48,56 @@ Foam::scalar Foam::SphereDrag::Cd(const scalar Re) const } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::SphereDragForce::SphereDragForce +( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType +) +: + ParticleForce(owner, mesh, dict, forceType) +{} + + +template +Foam::SphereDragForce::SphereDragForce +( + const SphereDragForce& df +) +: + ParticleForce(df) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::SphereDragForce::~SphereDragForce() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::forceSuSp Foam::SphereDragForce::calcNonCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + + value.Sp() = Cd(Re)*Re/p.d()*muc/8.0 + ROOTVSMALL; + + return value; +} + + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H similarity index 63% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.H rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H index 643d421e09..af1efe0c01 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,63 +22,84 @@ License along with OpenFOAM. If not, see . Class - Foam::SphereDrag + Foam::SphereDragForce Description Drag model based on assumption of solid spheres \*---------------------------------------------------------------------------*/ -#ifndef SphereDrag_H -#define SphereDrag_H +#ifndef SphereDragForce_H +#define SphereDragForce_H -#include "DragModel.H" +#include "ParticleForce.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class SphereDrag Declaration + Class SphereDragForce Declaration \*---------------------------------------------------------------------------*/ template -class SphereDrag +class SphereDragForce : - public DragModel + public ParticleForce { + // Private Member Functions + + //- Drag coefficient + scalar Cd(const scalar Re) const; + + public: //- Runtime type information - TypeName("SphereDrag"); + TypeName("sphereDrag"); // Constructors - //- Construct from dictionary - SphereDrag(const dictionary& dict, CloudType& owner); + //- Construct from mesh + SphereDragForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); //- Construct copy - SphereDrag(const SphereDrag& dm); + SphereDragForce(const SphereDragForce& df); //- Construct and return a clone - virtual autoPtr > clone() const + virtual autoPtr > clone() const { - return autoPtr > + return autoPtr > ( - new SphereDrag(*this) + new SphereDragForce(*this) ); } //- Destructor - virtual ~SphereDrag(); + virtual ~SphereDragForce(); // Member Functions - //- Return drag coefficient - scalar Cd(const scalar Re) const; + // Evaluation + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; }; @@ -89,7 +110,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "SphereDrag.C" +# include "SphereDragForce.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C similarity index 61% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C index 9be9e23bb3..cabb623111 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,73 +23,57 @@ License \*---------------------------------------------------------------------------*/ -#include "DragModel.H" +#include "GravityForce.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::DragModel::DragModel(CloudType& owner) -: - SubModelBase(owner) -{} - - -template -Foam::DragModel::DragModel +Foam::GravityForce::GravityForce ( - const dictionary& dict, CloudType& owner, - const word& type + const fvMesh& mesh, + const dictionary& dict, + const word& forceType ) : - SubModelBase(owner, dict, type) + ParticleForce(owner, mesh, dict, forceType), + g_(owner.g().value()) {} template -Foam::DragModel::DragModel(const DragModel& dm) +Foam::GravityForce::GravityForce(const GravityForce& gf) : - SubModelBase(dm) + ParticleForce(gf), + g_(gf.g_) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // template -Foam::DragModel::~DragModel() +Foam::GravityForce::~GravityForce() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::scalar Foam::DragModel::Cd(const scalar) const -{ - notImplemented - ( - "Foam::scalar Foam::DragModel::Cd(const scalar) const" - ); - return 0.0; -} - - -template -Foam::scalar Foam::DragModel::utc +Foam::forceSuSp Foam::GravityForce::calcNonCoupled ( + const typename CloudType::parcelType& p, + const scalar dt, const scalar Re, - const scalar d, - const scalar mu + const scalar rhoc, + const scalar muc ) const { - const scalar Cd = this->Cd(Re); + forceSuSp value(vector::zero, 0.0); - return Cd*Re/d*mu/8.0; + value.Su() = g_*(1.0 - rhoc/p.rho()); + + return value; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "DragModelNew.C" - // ************************************************************************* // - diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H new file mode 100644 index 0000000000..db57228f55 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +Class + Foam::GravityForce + +Description + Calculates particle gravity force + +SourceFiles + GravityForceI.H + GravityForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GravityForce_H +#define GravityForce_H + +#include "ParticleForce.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class GravityForce Declaration +\*---------------------------------------------------------------------------*/ + +template +class GravityForce +: + public ParticleForce +{ + // Private data + + //- Reference to the acceleration due to gravity + const vector& g_; + + +public: + + //- Runtime type information + TypeName("gravity"); + + + // Constructors + + //- Construct from mesh + GravityForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); + + //- Construct copy + GravityForce(const GravityForce& gf); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new GravityForce(*this) + ); + } + + + //- Destructor + virtual ~GravityForce(); + + + // Member Functions + + // Access + + //- Return the the acceleration due to gravity + inline const vector& g() const; + + + // Evaluation + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "GravityForceI.H" + +#ifdef NoRepository + #include "GravityForce.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForceI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForceI.H new file mode 100644 index 0000000000..b34b82a669 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForceI.H @@ -0,0 +1,35 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +inline const Foam::vector& Foam::GravityForce::g() const +{ + return g_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C new file mode 100644 index 0000000000..82cf9933f6 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "ParamagneticForce.H" +#include "demandDrivenData.H" +#include "electromagneticConstants.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ParamagneticForce::ParamagneticForce +( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType +) +: + ParticleForce(owner, mesh, dict, forceType), + HdotGradHName_ + ( + this->coeffs().template lookupOrDefault("HdotGradH", "HdotGradH") + ), + HdotGradHInterpPtr_(NULL), + magneticSusceptibility_ + ( + readScalar(this->coeffs().lookup("magneticSusceptibility")) + ) +{} + + +template +Foam::ParamagneticForce::ParamagneticForce +( + const ParamagneticForce& pf +) +: + ParticleForce(pf), + HdotGradHName_(pf.HdotGradHName_), + HdotGradHInterpPtr_(pf.HdotGradHInterpPtr_), + magneticSusceptibility_(pf.magneticSusceptibility_) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +template +Foam::ParamagneticForce::~ParamagneticForce() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::ParamagneticForce::cacheFields(const bool store) +{ + if (store) + { + const volVectorField& HdotGradH = + this->mesh().template lookupObject(HdotGradHName_); + + HdotGradHInterpPtr_ = interpolation::New + ( + this->owner().solution().interpolationSchemes(), + HdotGradH + ).ptr(); + } + else + { + deleteDemandDrivenData(HdotGradHInterpPtr_); + } +} + + +template +Foam::forceSuSp Foam::ParamagneticForce::calcNonCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + + const interpolation& HdotGradHInterp = *HdotGradHInterpPtr_; + + value.Su()= + 3.0*constant::electromagnetic::mu0.value()/p.rho() + *magneticSusceptibility_/(magneticSusceptibility_ + 3) + *HdotGradHInterp.interpolate(p.position(), p.currentTetIndices()); + + return value; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H new file mode 100644 index 0000000000..69b51d85c7 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +Class + Foam::ParamagneticForce + +Description + Calculates particle paramagnetic (magnetic field) force + +SourceFiles + ParamagneticForceI.H + ParamagneticForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ParamagneticForce_H +#define ParamagneticForce_H + +#include "ParticleForce.H" +#include "interpolation.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class ParamagneticForce Declaration +\*---------------------------------------------------------------------------*/ + +template +class ParamagneticForce +: + public ParticleForce +{ + // Private data + + //- Name of paramagnetic field strength field - default = "HdotGradH" + const word HdotGradHName_; + + //- HdotGradH interpolator + const interpolation* HdotGradHInterpPtr_; + + //- Magnetic susceptibility of particle + const scalar magneticSusceptibility_; + + +public: + + //- Runtime type information + TypeName("paramagnetic"); + + + // Constructors + + //- Construct from mesh + ParamagneticForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); + + //- Construct copy + ParamagneticForce(const ParamagneticForce& gf); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new ParamagneticForce(*this) + ); + } + + + //- Destructor + virtual ~ParamagneticForce(); + + + // Member Functions + + // Access + + //- Return the name of paramagnetic field strength field + const word& HdotGradHName() const; + + //- Return the magnetic susceptibility of particle + scalar magneticSusceptibility() const; + + + // Evaluation + + //- Cache fields + virtual void cacheFields(const bool store); + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "ParamagneticForceI.H" + +#ifdef NoRepository + #include "ParamagneticForce.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForceI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForceI.H new file mode 100644 index 0000000000..34be6491bb --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForceI.H @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +inline const Foam::word& +Foam::ParamagneticForce::HdotGradHName() const +{ + return HdotGradHName_; +} + + +template +inline Foam::scalar +Foam::ParamagneticForce::magneticSusceptibility() const +{ + return magneticSusceptibility_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C new file mode 100644 index 0000000000..1716b7055b --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "ParticleForce.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ParticleForce::ParticleForce +( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType +) +: + owner_(owner), + mesh_(mesh), + dict_(dict), + coeffs_(dict.subOrEmptyDict(forceType + "Coeffs")) +{} + + +template +Foam::ParticleForce::ParticleForce(const ParticleForce& pf) +: + owner_(pf.owner_), + mesh_(pf.mesh_), + dict_(pf.dict_), + coeffs_(pf.coeffs_) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +template +Foam::ParticleForce::~ParticleForce() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::ParticleForce::cacheFields(const bool store) +{} + + +template +Foam::forceSuSp Foam::ParticleForce::calcCoupled +( + const typename CloudType::parcelType&, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const +{ + forceSuSp value; + value.Su() = vector::zero; + value.Sp() = 0.0; + + return value; +} + + +template +Foam::forceSuSp Foam::ParticleForce::calcNonCoupled +( + const typename CloudType::parcelType&, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const +{ + forceSuSp value; + value.Su() = vector::zero; + value.Sp() = 0.0; + + return value; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "ParticleForceNew.C" + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H new file mode 100644 index 0000000000..45c29b4dc3 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H @@ -0,0 +1,215 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +Class + Foam::ParticleForce + +Description + Abstract base class for particle forces + +SourceFiles + ParticleForceI.H + ParticleForce.C + ParticleForceNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ParticleForce_H +#define ParticleForce_H + +#include "dictionary.H" +#include "forceSuSp.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ParticleForce Declaration +\*---------------------------------------------------------------------------*/ + +template +class ParticleForce +{ + // Private data + + //- Reference to the owner cloud + CloudType& owner_; + + //- Reference to the mesh database + const fvMesh& mesh_; + + //- Forces dictionary + const dictionary dict_; + + //- Force coefficients dictaionary + const dictionary coeffs_; + + +public: + + //- Runtime type information + TypeName("particleForce"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + ParticleForce, + dictionary, + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ), + (owner, mesh, dict, forceType) + ); + + + //- Convenience typedef for return type + typedef VectorSpace, vector, 2> returnType; + + + // Constructors + + //- Construct from mesh + ParticleForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); + + //- Construct copy + ParticleForce(const ParticleForce& pf); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new ParticleForce(*this) + ); + } + + + //- Destructor + virtual ~ParticleForce(); + + + //- Selector + static autoPtr > New + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); + + + // Member Functions + + // Access + + //- Return const access to the cloud owner + inline const CloudType& owner() const; + + //- Return refernce to the cloud owner + inline CloudType& owner(); + + //- Return the mesh database + inline const fvMesh& mesh() const; + + //- Return the forces dictionary + inline const dictionary& dict() const; + + //- Return the force coefficients dictionary + inline const dictionary& coeffs() const; + + + // Evaluation + + //- Cache fields + virtual void cacheFields(const bool store); + + //- Calculate the coupled force + virtual forceSuSp calcCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "ParticleForceI.H" + +#ifdef NoRepository + #include "ParticleForce.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeParticleForceModel(CloudType) \ + \ + defineNamedTemplateTypeNameAndDebug(ParticleForce, 0); \ + defineTemplateRunTimeSelectionTable(ParticleForce, dictionary); + + +#define makeParticleForceModelType(SS, CloudType, ParcelType) \ + \ + defineNamedTemplateTypeNameAndDebug(SS >, 0); \ + \ + ParticleForce >:: \ + adddictionaryConstructorToTable > > \ + add##SS##CloudType##ParcelType##ConstructorToTable_; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceI.H similarity index 65% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceI.H index be46f9946a..24aa098e59 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,44 +23,40 @@ License \*---------------------------------------------------------------------------*/ -#include "NoDrag.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template -Foam::NoDrag::NoDrag(const dictionary& dict, CloudType& owner) -: - DragModel(owner) -{} - - -template -Foam::NoDrag::NoDrag(const NoDrag& dm) -: - DragModel(dm.owner_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::NoDrag::~NoDrag() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -bool Foam::NoDrag::active() const +inline const CloudType& Foam::ParticleForce::owner() const { - return false; + return owner_; } template -Foam::scalar Foam::NoDrag::Cd(const scalar) const +inline CloudType& Foam::ParticleForce::owner() { - return 0.0; + return owner_; +} + + +template +inline const Foam::fvMesh& Foam::ParticleForce::mesh() const +{ + return mesh_; +} + + +template +inline const Foam::dictionary& Foam::ParticleForce::dict() const +{ + return dict_; +} + + +template +inline const Foam::dictionary& Foam::ParticleForce::coeffs() const +{ + return coeffs_; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModelNew.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceNew.C similarity index 61% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModelNew.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceNew.C index 054c0bd805..9c282054c9 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModelNew.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForceNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,41 +23,55 @@ License \*---------------------------------------------------------------------------*/ -#include "DragModel.H" +#include "ParticleForce.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::autoPtr > Foam::DragModel::New +Foam::autoPtr > +Foam::ParticleForce::New ( + CloudType& owner, + const fvMesh& mesh, const dictionary& dict, - CloudType& owner + const word& forceType ) { - const word modelType(dict.lookup("DragModel")); - - Info<< "Selecting DragModel " << modelType << endl; + Info<< " Selecting particle force " << forceType << endl; typename dictionaryConstructorTable::iterator cstrIter = - dictionaryConstructorTablePtr_->find(modelType); + dictionaryConstructorTablePtr_->find(forceType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { FatalErrorIn ( - "DragModel::New" + "ParticleForce::New" "(" - "const dictionary&," - "CloudType&" + "CloudType&, " + "const fvMesh&, " + "const dictionary&, " + "const word&" ")" - ) << "Unknown DragModel type " - << modelType << nl << nl - << "Valid DragModel types are:" << nl + ) << "Unknown particle force type " + << forceType + << ", constructor not in hash table" << nl << nl + << " Valid particle force types are:" << nl << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } - return autoPtr >(cstrIter()(dict, owner)); + return autoPtr > + ( + cstrIter() + ( + owner, + mesh, + dict, + forceType + ) + ); + } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C new file mode 100644 index 0000000000..a4c9332329 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "PressureGradientForce.H" +#include "fvcGrad.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::PressureGradientForce::PressureGradientForce +( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType +) +: + ParticleForce(owner, mesh, dict, forceType), + UName_(this->coeffs().lookup("U")), + gradUPtr_(NULL) +{} + + +template +Foam::PressureGradientForce::PressureGradientForce +( + const PressureGradientForce& pgf +) +: + ParticleForce(pgf), + UName_(pgf.UName_), + gradUPtr_(NULL) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +template +Foam::PressureGradientForce::~PressureGradientForce() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::PressureGradientForce::cacheFields(const bool store) +{ + if (store) + { + const volVectorField& U = this->mesh().template + lookupObject(UName_); + gradUPtr_ = fvc::grad(U).ptr(); + } + else + { + if (gradUPtr_) + { + delete gradUPtr_; + gradUPtr_ = NULL; + } + } +} + + +template +Foam::forceSuSp Foam::PressureGradientForce::calcCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + + const volTensorField& gradU = *gradUPtr_; + value.Su() = rhoc/p.rho()*(p.U() & gradU[p.cell()]); + + return value; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H new file mode 100644 index 0000000000..a1fe759caf --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +Class + Foam::PressureGradientForce + +Description + Calculates particle pressure gradient force + +SourceFiles + PressureGradientForceI.H + PressureGradientForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef PressureGradientForce_H +#define PressureGradientForce_H + +#include "ParticleForce.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class PressureGradientForce Declaration +\*---------------------------------------------------------------------------*/ + +template +class PressureGradientForce +: + public ParticleForce +{ + // Private data + + //- Name of velocity field + const word UName_; + + //- Velocity gradient field + const volTensorField* gradUPtr_; + + +public: + + //- Runtime type information + TypeName("pressureGradient"); + + + // Constructors + + //- Construct from mesh + PressureGradientForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); + + //- Construct copy + PressureGradientForce(const PressureGradientForce& pgf); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new PressureGradientForce(*this) + ); + } + + + //- Destructor + virtual ~PressureGradientForce(); + + + // Member Functions + + // Access + + //- Return const access to the velocity gradient field + inline const volTensorField& gradU() const; + + + // Evaluation + + //- Cache fields + virtual void cacheFields(const bool store); + + //- Calculate the non-coupled force + virtual forceSuSp calcCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "PressureGradientForceI.H" + +#ifdef NoRepository + #include "PressureGradientForce.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H new file mode 100644 index 0000000000..ac81740903 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForceI.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +const Foam::volTensorField& Foam::PressureGradientForce::gradU() +const +{ + if (gradUPtr_) + { + return *gradUPtr_; + } + else + { + FatalErrorIn + ( + "const volTensorField& PressureGradientForce::gradU()" + "const" + ) << "gradU field not allocated" << abort(FatalError); + + return reinterpret_cast(0); + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C new file mode 100644 index 0000000000..3cf383a996 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "SRFForce.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::SRFForce::SRFForce +( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType +) +: + ParticleForce(owner, mesh, dict, forceType), + srfPtr_(NULL) +{} + + +template +Foam::SRFForce::SRFForce +( + const SRFForce& srff +) +: + ParticleForce(srff), + srfPtr_(NULL) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +template +Foam::SRFForce::~SRFForce() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::SRFForce::cacheFields(const bool store) +{ + if (store) + { + const typename SRF::SRFModel& model = this->mesh().template + lookupObject("SRFProperties"); + srfPtr_ = &model; + } + else + { + srfPtr_ = NULL; + } +} + + +template +Foam::forceSuSp Foam::SRFForce::calcNonCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + + const typename SRF::SRFModel& srf = *srfPtr_; + + const vector& omega = srf.omega().value(); + const vector& axis = srf.axis(); + + const vector r = p.position() - axis*(axis & p.position()); + + // Coriolis and centrifugal acceleration terms + value.Su() = 2.0*(p.U() ^ omega) + (omega ^ (r ^ omega)); + + return value; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H similarity index 59% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.H rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H index 742bb0d301..ce28b8e288 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/NoDrag/NoDrag.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,66 +22,95 @@ License along with OpenFOAM. If not, see . Class - Foam::NoDrag + Foam::SRFForce Description - Dummy drag model for 'none' + Calculates particle SRF reference frame force + +SourceFiles + SRFForceI.H + SRFForce.C \*---------------------------------------------------------------------------*/ -#ifndef NoDrag_H -#define NoDrag_H +#ifndef SRFForce_H +#define SRFForce_H -#include "DragModel.H" +#include "ParticleForce.H" +#include "SRFModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { + +class fvMesh; + /*---------------------------------------------------------------------------*\ - Class NoDrag Declaration + Class SRFForce Declaration \*---------------------------------------------------------------------------*/ template -class NoDrag +class SRFForce : - public DragModel + public ParticleForce { + // Private data + + //- Pointer to the SRF model + const typename SRF::SRFModel* srfPtr_; + + public: //- Runtime type information - TypeName("none"); + TypeName("SRF"); // Constructors - //- Construct from dictionary - NoDrag(const dictionary&, CloudType&); + //- Construct from mesh + SRFForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); //- Construct copy - NoDrag(const NoDrag& dm); + SRFForce(const SRFForce& srff); //- Construct and return a clone - virtual autoPtr > clone() const + virtual autoPtr > clone() const { - return autoPtr > + return autoPtr > ( - new NoDrag(*this) + new ParticleForce(*this) ); } //- Destructor - virtual ~NoDrag(); + virtual ~SRFForce(); // Member Functions - //- Flag to indicate whether model activates drag model - bool active() const; + // Evaluation - //- Return drag coefficient - scalar Cd(const scalar) const; + //- Cache fields + virtual void cacheFields(const bool store); + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; }; @@ -92,7 +121,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "NoDrag.C" + #include "SRFForce.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H new file mode 100644 index 0000000000..76f378ed90 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +Class + Foam::forceSuSp + +Description + Helper container for force Su and Sp terms + +SourceFiles + forceSuSpI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef forceSuSp_H +#define forceSuSp_H + +#include "Tuple2.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions +class forceSuSp; +inline forceSuSp operator+(const forceSuSp& susp1, const forceSuSp& susp2); +inline forceSuSp operator*(const forceSuSp& susp, const scalar s); + +/*---------------------------------------------------------------------------*\ + Class forceSuSp Declaration +\*---------------------------------------------------------------------------*/ + +class forceSuSp +: + public Tuple2 +{ + +public: + + //- Component labeling enumeration + enum components + { + SU = 0, + SP = 1 + }; + + + // Constructors + + //- Construct null + inline forceSuSp(); + + //- Construct given VectorSpace + inline forceSuSp(const Tuple2& susp); + + //- Construct given two components + inline forceSuSp(const vector& Su, const scalar Sp); + + //- Construct from Istream + inline forceSuSp(Istream&); + + + // Member Functions + + // Access + + //- Return const access to the explicit contribution + inline const vector& Su() const; + + //- Return const access to the implicit contribution + inline scalar Sp() const; + + + // Edit + + //- Return reference to the explicit contribution + inline vector& Su(); + + //- Return reference to the explicit contribution + inline scalar& Sp(); + + + // Operators + + //- Assignment + inline void operator=(const forceSuSp& susp); + + //- Addition + inline void operator+=(const forceSuSp& susp); + + //- Subtraction + inline void operator-=(const forceSuSp& susp); + + + // Friend operators + + //- Addition + friend inline forceSuSp operator* + ( + const forceSuSp& susp1, + const forceSuSp& susp2 + ); + + //- Multiplication + friend inline forceSuSp operator* + ( + const scalar s, + const forceSuSp& susp + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "forceSuSpI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H new file mode 100644 index 0000000000..2b945cfb19 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * // + +inline Foam::forceSuSp::forceSuSp() +{} + + +inline Foam::forceSuSp::forceSuSp +( + const Tuple2& fs +) +: + Tuple2(fs) +{} + + +inline Foam::forceSuSp::forceSuSp(const vector& Su, const scalar Sp) +{ + first() = Su; + second() = Sp; +} + + +inline Foam::forceSuSp::forceSuSp(Istream& is) +: + Tuple2(is) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline const Foam::vector& Foam::forceSuSp::Su() const +{ + return first(); +} + + +inline Foam::scalar Foam::forceSuSp::Sp() const +{ + return second(); +} + + +inline Foam::vector& Foam::forceSuSp::Su() +{ + return first(); +} + + +inline Foam::scalar& Foam::forceSuSp::Sp() +{ + return second(); +} + + +// * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * * // + +inline void Foam::forceSuSp::operator=(const forceSuSp& susp) +{ + first() = susp.first(); + second() = susp.second(); +} + + +inline void Foam::forceSuSp::operator+=(const forceSuSp& susp) +{ + first() += susp.first(); + second() += susp.second(); +} + + +inline void Foam::forceSuSp::operator-=(const forceSuSp& susp) +{ + first() -= susp.first(); + second() -= susp.second(); +} + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +inline Foam::forceSuSp Foam::operator+ +( + const forceSuSp& susp1, + const forceSuSp& susp2 +) +{ + return forceSuSp + ( + susp1.first() + susp2.first(), + susp1.second() + susp2.second() + ); +} + + +inline Foam::forceSuSp Foam::operator* +( + const scalar s, + const forceSuSp& susp +) +{ + return forceSuSp(susp.first()*s, susp.second()*s); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C new file mode 100644 index 0000000000..7032b6311a --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "BrownianMotionForce.H" +#include "mathematicalConstants.H" +#include "demandDrivenData.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template +Foam::scalar Foam::BrownianMotionForce::erfInv(const scalar y) const +{ + const scalar a = 0.147; + scalar k = 2.0/(mathematical::pi*a) + 0.5*log(1.0 - y*y); + scalar h = log(1.0 - y*y)/a; + scalar x = sqrt(-k + sqrt(k*k - h)); + + if (y < 0.0) + { + return -x; + } + else + { + return x; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::BrownianMotionForce::BrownianMotionForce +( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType +) +: + ParticleForce(owner, mesh, dict, forceType), + rndGen_(owner.rndGen()), + lambda_(readScalar(this->coeffs().lookup("lambda"))), + turbulence_(readBool(this->coeffs().lookup("turbulence"))), + turbulenceModelPtr_(NULL), + kPtr_(NULL), + ownK_(false) +{ + if (turbulence_) + { + HashTable models = + this->mesh().objectRegistry::lookupClass + < + compressible::turbulenceModel + >(); + + if (models.size() == 1) + { + turbulenceModelPtr_ = models.begin()(); + } + else + { + FatalErrorIn + ( + "Foam::BrownianMotionForce::BrownianMotionForce" + "(" + "CloudType&, " + "const fvMesh&, " + "const dictionary&" + ")" + ) << "Unable to find a valid turbulence model in mesh database" + << exit(FatalError); + } + } +} + + +template +Foam::BrownianMotionForce::BrownianMotionForce +( + const BrownianMotionForce& bmf +) +: + ParticleForce(bmf), + rndGen_(bmf.rndGen_), + lambda_(bmf.lambda_), + turbulence_(bmf.turbulence_), + turbulenceModelPtr_(NULL), + kPtr_(NULL), + ownK_(false) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +template +Foam::BrownianMotionForce::~BrownianMotionForce() +{ + turbulenceModelPtr_ = NULL; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::BrownianMotionForce::cacheFields(const bool store) +{ + if (turbulence_) + { + if (store) + { + tmp tk = turbulenceModelPtr_->k(); + if (tk.isTmp()) + { + kPtr_ = tk.ptr(); + ownK_ = true; + } + else + { + kPtr_ = tk.operator->(); + ownK_ = false; + } + } + else + { + if (ownK_ && kPtr_) + { + deleteDemandDrivenData(kPtr_); + ownK_ = false; + } + } + } +} + + +template +Foam::forceSuSp Foam::BrownianMotionForce::calcCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + + const scalar dp = p.d(); + const scalar Tc = p.Tc(); + + const scalar eta = rndGen_.sample01(); + const scalar alpha = 2.0*lambda_/dp; + const scalar cc = 1.0 + alpha*(1.257 + 0.4*exp(-1.1/alpha)); + + const scalar sigma = physicoChemical::sigma.value(); + + scalar f = 0.0; + if (turbulence_) + { + const scalar mp = p.mass(); + const label cellI = p.cell(); + const volScalarField& k = *kPtr_; + const scalar kc = k[cellI]; + const scalar Dp = sigma*Tc*cc/(3*mathematical::pi*muc*dp); + f = eta/mp*sqrt(2.0*sqr(kc)*sqr(Tc)/(Dp*dt)); + } + else + { + const scalar rhop = p.rho(); + const scalar s0 = + 216*muc*sigma*Tc/(sqr(mathematical::pi)*pow5(dp)*(rhop/rhoc)*cc); + f = eta*sqrt(mathematical::pi*s0/dt); + } + + const scalar sqrt2 = sqrt(2.0); + for (label i = 0; i < 3; i++) + { + const scalar x = rndGen_.sample01(); + const scalar eta = sqrt2*erfInv(2*x - 1.0); + value.Su()[i] = f*eta; + } + + return value; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H new file mode 100644 index 0000000000..32f23b2b2b --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +Class + Foam::BrownianMotionForce + +Description + Calculates particle Brownian motion force + +SourceFiles + BrownianMotionForceI.H + BrownianMotionForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef BrownianMotionForce_H +#define BrownianMotionForce_H + +#include "ParticleForce.H" +#include "cachedRandom.H" +#include "turbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class BrownianMotionForce Declaration +\*---------------------------------------------------------------------------*/ + +template +class BrownianMotionForce +: + public ParticleForce +{ + // Private data + + //- Reference to the cloud random number generator + cachedRandom& rndGen_; + + //- Molecular free path length [m] + const scalar lambda_; + + //- Turbulence flag + bool turbulence_; + + //- Reference to a compressible turbulence model + const compressible::turbulenceModel* turbulenceModelPtr_; + + //- Pointer to the turbulence kinetic energy field + const volScalarField* kPtr_; + + //- Flag that indicates ownership of turbulence k field + bool ownK_; + + + // Private Member Functions + + //- Inverse erf for Gaussian distribution + scalar erfInv(const scalar y) const; + + +public: + + //- Runtime type information + TypeName("BrownianMotion"); + + + // Constructors + + //- Construct from mesh + BrownianMotionForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType + ); + + //- Construct copy + BrownianMotionForce(const BrownianMotionForce& bmf); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new BrownianMotionForce(*this) + ); + } + + + //- Destructor + virtual ~BrownianMotionForce(); + + + // Member Functions + + // Access + + //- Return const access to the molecular free path length [m] + inline scalar lambda() const; + + //- Return const access to the turbulence flag + inline bool turbulence() const; + + + // Evaluation + + //- Cache fields + virtual void cacheFields(const bool store); + + //- Calculate the non-coupled force + virtual forceSuSp calcCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar Re, + const scalar rhoc, + const scalar muc + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "BrownianMotionForceI.H" + +#ifdef NoRepository + #include "BrownianMotionForce.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForceI.H b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForceI.H new file mode 100644 index 0000000000..8bc3da87eb --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForceI.H @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::BrownianMotionForce::lambda() const +{ + return lambda_; +} + + +template +inline bool Foam::BrownianMotionForce::turbulence() const +{ + return turbulence_; +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties index cd5f105401..9c86605535 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties @@ -90,18 +90,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties index 699ce6d46b..dc7a66b075 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties @@ -74,18 +74,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties index 599aa8567d..166d7ff81c 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties @@ -89,18 +89,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ReactingMultiphaseLookupTableInjection; - DragModel SphereDrag; - DispersionModel none; PatchInteractionModel LocalInteraction; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties index 60b93e7d13..1220745bf2 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties @@ -89,18 +89,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel none; PatchInteractionModel StandardWallInteraction; @@ -132,7 +131,7 @@ subModels U0 (0 0 0); sizeDistribution { - pdfType uniform; + distributionModelType uniform; uniformDistribution { minValue 100e-06; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index e28b21992b..f63b8aede5 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -89,18 +89,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel PatchInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; @@ -135,7 +134,7 @@ subModels flowRateProfile constant 1; sizeDistribution { - pdfType general; + distributionModelType general; generalDistribution { distribution diff --git a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties index 823e4111ab..b3dd3291e5 100644 --- a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties @@ -86,18 +86,17 @@ constantProperties particleForces { - gravity off; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel none; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties index 4896ab3e80..2e461cec12 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties @@ -58,18 +58,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties index 451e2419c7..5be7a02a51 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties @@ -73,18 +73,17 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } subModels { InjectionModel ManualInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; diff --git a/tutorials/lagrangian/steadyReactingParcelFoam/counterFlowFlame2D/constant/reactingCloud1Properties b/tutorials/lagrangian/steadyReactingParcelFoam/counterFlowFlame2D/constant/reactingCloud1Properties index 95c7bb4f9e..be708f1baf 100644 --- a/tutorials/lagrangian/steadyReactingParcelFoam/counterFlowFlame2D/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/steadyReactingParcelFoam/counterFlowFlame2D/constant/reactingCloud1Properties @@ -18,81 +18,6 @@ FoamFile solution { active no; - - integrationSchemes - { - U Euler; - T Analytical; - } -} - - -constantProperties -{ - parcelTypeId 1; - - rhoMin 1e-15; - minParticleMass 1e-15; - TMin 200; - pMin 1000; - minParticleMass 1e-15; - - rho0 1400; - T0 313; - Cp0 1680; - - youngsModulus 2e9; - poissonsRatio 0.35; - - epsilon0 0.8; - f0 0.3; - - Tvap 400; - Tbp 400; - Pr 0.7; - LDevol 0; - hRetentionCoeff 1; - - constantVolume true; -} - - -particleForces -{ - gravity off; - virtualMass off; - pressureGradient off; - paramagnetic off; -} - - -subModels -{ - InjectionModel none; - - CollisionModel none; - - DragModel none; - - DispersionModel none; - - PatchInteractionModel none; - - HeatTransferModel none; - - CompositionModel none; - - PhaseChangeModel none; - - DevolatilisationModel none; - - SurfaceReactionModel none; - - PostProcessingModel none; - - SurfaceFilmModel none; - - radiation off; } diff --git a/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index 1201e96908..92c9d0c25c 100644 --- a/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -22,6 +22,7 @@ solution transient no; // yes; calcFrequency 10; maxTrackTime 5.0; + maxCo 0.3; coupled true; cellValueSourceCorrection off; @@ -99,10 +100,11 @@ constantProperties particleForces { - gravity on; - virtualMass off; - pressureGradient off; - paramagnetic off; + activeForces + ( + sphereDrag + gravity + ); } @@ -110,8 +112,6 @@ subModels { InjectionModel PatchInjection; - DragModel SphereDrag; - DispersionModel StochasticDispersionRAS; PatchInteractionModel StandardWallInteraction; @@ -146,7 +146,7 @@ subModels flowRateProfile constant 1; sizeDistribution { - pdfType general; + distributionModelType general; generalDistribution { distribution From cf65eebcd55707625684832ced9d9a8be1a96ad6 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 09:29:33 +0100 Subject: [PATCH 11/39] ENH: add foamPackDeps, foamPackMake to help transferring between machines --- bin/foamPackDeps | 132 ++++++++++++++++++++++++++++++++++++ bin/foamPackDoxygen | 2 +- bin/foamPackMake | 135 +++++++++++++++++++++++++++++++++++++ bin/foamPackThirdPartyDeps | 1 + bin/foamPackThirdPartyMake | 1 + 5 files changed, 270 insertions(+), 1 deletion(-) create mode 100755 bin/foamPackDeps create mode 100755 bin/foamPackMake create mode 120000 bin/foamPackThirdPartyDeps create mode 120000 bin/foamPackThirdPartyMake diff --git a/bin/foamPackDeps b/bin/foamPackDeps new file mode 100755 index 0000000000..198c3a3b19 --- /dev/null +++ b/bin/foamPackDeps @@ -0,0 +1,132 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2011 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 . +# +# Script +# foamPackDeps [OPTION] +# +# Description +# Pack and compress *.dep files from OpenFOAM +# +# Script +# foamPackDeps [OPTION] +# +# Description +# Pack and compress *.dep files from OpenFOAM ThirdParty +# +#------------------------------------------------------------------------------ +toolsDir="${0%/*}/tools" # this script is located in the tools/ parent dir + +case "${0##*/}" in +*ThirdParty*) + # for ThirdParty + codeBase="OpenFOAM ThirdParty" + packDir=ThirdParty-$WM_PROJECT_VERSION + ;; +*) + # regular + codeBase="OpenFOAM ThirdParty" + packDir=$WM_PROJECT-$WM_PROJECT_VERSION + ;; +esac + + +usage() { + while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done +cat <&2 +Usage: ${0##*/} [OPTION] +options: + -o specify alternative output directory + +* Pack and compress *.dep files from $codeBase + +USAGE + exit 1 +} + + +unset outputDir +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -o | -output) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + outputDir=${2%%/} + shift 2 + ;; + -*) + usage "unknown option: '$*'" + ;; + *) + break + ;; + esac +done + +# check for essential directories +[ -d $packDir ] || { + echo "Error: directory $packDir does not exist" 1>&2 + exit 1 +} + + +#------------------------------------------------------------------------------ +timeStamp=$(date +%Y-%m-%d) +packExt=tgz +packBase=${packDir}.deps_${timeStamp} + +# add optional output directory +[ -d "$outputDir" ] && packBase="$outputDir/$packBase" +packFile=$packBase.$packExt + +# avoid overwriting old pack file +if [ -f $packFile ] +then + echo "Error: $packFile already exists" 1>&2 + exit 1 +fi + +cat <&2 +------------------------------------------------------------------------------- +Packing *.dep files into $packFile + +INFO + +# Clean up on Ctrl-C +trap 'rm -f $packFile 2>/dev/null' INT + +find -H $packDir -name '*.dep' -type f -print | tar cpzf $packFile -T - + +if [ $? -eq 0 ] +then + echo "Finished packing *.dep files into file $packFile" 1>&2 +else + echo "Error: failure packing *.dep files into $packFile" 1>&2 + rm -f $packFile 2>/dev/null +fi + +#------------------------------------------------------------------------------ diff --git a/bin/foamPackDoxygen b/bin/foamPackDoxygen index c9337e972f..464a5d523f 100755 --- a/bin/foamPackDoxygen +++ b/bin/foamPackDoxygen @@ -122,7 +122,7 @@ if [ $? -eq 0 ] then echo "Finished packing doxygen html into file $packFile" 1>&2 else - echo "Error: failure packing doxygen html file $packFile" 1>&2 + echo "Error: failure packing doxygen html into file $packFile" 1>&2 rm -f $packFile 2>/dev/null fi diff --git a/bin/foamPackMake b/bin/foamPackMake new file mode 100755 index 0000000000..a3370867d0 --- /dev/null +++ b/bin/foamPackMake @@ -0,0 +1,135 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2011 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 . +# +# Script +# foamPackMake [OPTION] +# +# Description +# Pack and compress OpenFOAM Make/ directories +# +# Script +# foamPackThirdPartyMake [OPTION] +# +# Description +# Pack and compress OpenFOAM ThirdParty Make/ directories +# +#------------------------------------------------------------------------------ +toolsDir="${0%/*}/tools" # this script is located in the tools/ parent dir + +case "${0##*/}" in +*ThirdParty*) + # for ThirdParty + codeBase="OpenFOAM ThirdParty" + packDir=ThirdParty-$WM_PROJECT_VERSION + ;; +*) + # regular + codeBase="OpenFOAM ThirdParty" + packDir=$WM_PROJECT-$WM_PROJECT_VERSION + ;; +esac + + +usage() { + while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done +cat <&2 +Usage: ${0##*/} [OPTION] +options: + -o specify alternative output directory + +* Pack and compress $codeBase Make/ directories + + The value of 'archOptions' normally corresponds to \$WM_OPTIONS + The current value of \$WM_OPTIONS = $WM_OPTIONS + +USAGE + exit 1 +} + + +unset outputDir +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -o | -output) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + outputDir=${2%%/} + shift 2 + ;; + -*) + usage "unknown option: '$*'" + ;; + *) + break + ;; + esac +done + +[ $# -eq 1 ] || usage "Error: specify architecture" + +# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' +archOptions="$1" + +#------------------------------------------------------------------------------ +timeStamp=$(date +%Y-%m-%d) +packExt=tgz +packBase=${packDir}.Make-${archOptions}_${timeStamp} + +# add optional output directory +[ -d "$outputDir" ] && packBase="$outputDir/$packBase" +packFile=$packBase.$packExt + +# avoid overwriting old pack file +if [ -f $packFile ] +then + echo "Error: $packFile already exists" 1>&2 + exit 1 +fi + +cat <&2 +------------------------------------------------------------------------------- +Pack and compress Make/$archOptions* directories into $packFile + +INFO + +# Clean up on Ctrl-C +trap 'rm -f $packFile 2>/dev/null' INT + +find -H $packDir -depth -name Make -type d -print | \ + xargs -i find '{}' -depth -name "$archOptions*" -type d -print | \ + tar cpzf $packFile -T - + +if [ $? -eq 0 ] +then + echo "Finished packing Make/$archOptions directories into $packFile" 1>&2 +else + echo "Error: failure packing Make/$archOptions directories into $packFile" 1>&2 + rm -f $packFile 2>/dev/null +fi + +#------------------------------------------------------------------------------ diff --git a/bin/foamPackThirdPartyDeps b/bin/foamPackThirdPartyDeps new file mode 120000 index 0000000000..331c2569c8 --- /dev/null +++ b/bin/foamPackThirdPartyDeps @@ -0,0 +1 @@ +foamPackDeps \ No newline at end of file diff --git a/bin/foamPackThirdPartyMake b/bin/foamPackThirdPartyMake new file mode 120000 index 0000000000..56bc81cf73 --- /dev/null +++ b/bin/foamPackThirdPartyMake @@ -0,0 +1 @@ +foamPackMake \ No newline at end of file From 449a0e253dfb72f33e444fff19f141ccbf49c689 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 10:08:46 +0100 Subject: [PATCH 12/39] ENH: add -current option to foamPackBin, foamPackMake - reduces typing --- bin/foamPack | 6 +++--- bin/foamPackBin | 21 ++++++++++++++++----- bin/foamPackDeps | 4 ++-- bin/foamPackDoxygen | 18 +++++++++--------- bin/foamPackMake | 21 ++++++++++++++++----- bin/tools/foamPackSource | 4 ++-- 6 files changed, 48 insertions(+), 26 deletions(-) diff --git a/bin/foamPack b/bin/foamPack index 3faa48cfdf..5c22d5849a 100755 --- a/bin/foamPack +++ b/bin/foamPack @@ -37,8 +37,8 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: - -o specify alternative output directory - -nogit bypass using 'git archive' + -o, -output specify alternative output directory + -nogit bypass using 'git archive' * Pack and compress OpenFOAM directory for release @@ -46,7 +46,7 @@ USAGE exit 1 } -unset prefix outputDir nogit +unset outputDir nogit # parse options while [ "$#" -gt 0 ] do diff --git a/bin/foamPackBin b/bin/foamPackBin index 2cd739b818..67738d1ea8 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -57,8 +57,10 @@ usage() { while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done cat <&2 Usage: ${0##*/} [OPTION] + ${0##*/} [OPTION] -current options: - -o specify alternative output directory + -c, -current use current value of \$WM_OPTIONS + -o, -output specify alternative output directory * Pack and compress binary version of $codeBase for release @@ -70,7 +72,8 @@ USAGE } -unset prefix outputDir +unset archOptions outputDir + # parse options while [ "$#" -gt 0 ] do @@ -78,6 +81,10 @@ do -h | -help) usage ;; + -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' + archOptions="$WM_OPTIONS" + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -92,10 +99,14 @@ do esac done -[ $# -eq 1 ] || usage "Error: specify architecture" +if [ -n "$archOptions" ] +then + [ $# -eq 0 ] || usage "Error: cannot specify both -current and architecture" +else + archOptions="$1" + [ $# -eq 1 ] || usage "Error: specify architecture" +fi -# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' -archOptions="$1" #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) diff --git a/bin/foamPackDeps b/bin/foamPackDeps index 198c3a3b19..67a885b900 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -56,7 +56,7 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: - -o specify alternative output directory + -o, -output specify alternative output directory * Pack and compress *.dep files from $codeBase @@ -123,7 +123,7 @@ find -H $packDir -name '*.dep' -type f -print | tar cpzf $packFile -T - if [ $? -eq 0 ] then - echo "Finished packing *.dep files into file $packFile" 1>&2 + echo "Finished packing *.dep files into $packFile" 1>&2 else echo "Error: failure packing *.dep files into $packFile" 1>&2 rm -f $packFile 2>/dev/null diff --git a/bin/foamPackDoxygen b/bin/foamPackDoxygen index 464a5d523f..6f1b17ca27 100755 --- a/bin/foamPackDoxygen +++ b/bin/foamPackDoxygen @@ -37,8 +37,8 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: - -prefix use alternative prefix - -o specify alternative output directory + -o, -output specify alternative output directory + -prefix use alternative prefix * Pack and compress the OpenFOAM doxygen html for release @@ -54,16 +54,16 @@ do -h | -help) usage ;; - -prefix | --prefix) - [ "$#" -ge 2 ] || usage "'$1' option requires an argument" - prefix=${2%%/} - shift 2 - ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} shift 2 ;; + -prefix | --prefix) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + prefix=${2%%/} + shift 2 + ;; -*) usage "unknown option: '$*'" ;; @@ -120,9 +120,9 @@ fi if [ $? -eq 0 ] then - echo "Finished packing doxygen html into file $packFile" 1>&2 + echo "Finished packing doxygen html into $packFile" 1>&2 else - echo "Error: failure packing doxygen html into file $packFile" 1>&2 + echo "Error: failure packing doxygen html into $packFile" 1>&2 rm -f $packFile 2>/dev/null fi diff --git a/bin/foamPackMake b/bin/foamPackMake index a3370867d0..c4325723e3 100755 --- a/bin/foamPackMake +++ b/bin/foamPackMake @@ -55,8 +55,10 @@ usage() { while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done cat <&2 Usage: ${0##*/} [OPTION] + ${0##*/} [OPTION] -current options: - -o specify alternative output directory + -c, -current use current value of \$WM_OPTIONS + -o, -output specify alternative output directory * Pack and compress $codeBase Make/ directories @@ -68,7 +70,8 @@ USAGE } -unset outputDir +unset archOptions outputDir + # parse options while [ "$#" -gt 0 ] do @@ -76,6 +79,10 @@ do -h | -help) usage ;; + -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' + archOptions="$WM_OPTIONS" + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -90,10 +97,14 @@ do esac done -[ $# -eq 1 ] || usage "Error: specify architecture" +if [ -n "$archOptions" ] +then + [ $# -eq 0 ] || usage "Error: cannot specify both -current and architecture" +else + archOptions="$1" + [ $# -eq 1 ] || usage "Error: specify architecture" +fi -# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' -archOptions="$1" #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) diff --git a/bin/tools/foamPackSource b/bin/tools/foamPackSource index 55a7b3bbee..a4d014cfcf 100755 --- a/bin/tools/foamPackSource +++ b/bin/tools/foamPackSource @@ -84,9 +84,9 @@ trap 'rm -f $packFile $tmpFile 2>/dev/null' INT tar cpzf $packFile --files-from $tmpFile if [ $? -eq 0 ] then - echo "Finished packing $packDir into file $packFile" 1>&2 + echo "Finished packing $packDir into $packFile" 1>&2 else - echo "Error: failure packing $packDir into file $packFile" 1>&2 + echo "Error: failure packing $packDir into $packFile" 1>&2 rm -f $packFile 2>/dev/null fi From d21657c064af8503a1743818dae81c8ad3be82fc Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 15 Feb 2011 09:51:40 +0000 Subject: [PATCH 13/39] ENH: Updated cloud reset functions --- .../clouds/Templates/KinematicCloud/KinematicCloud.C | 12 ++++++------ .../clouds/Templates/ReactingCloud/ReactingCloud.C | 4 ++-- .../ReactingMultiphaseCloud.C | 4 ++-- .../clouds/Templates/ThermoCloud/ThermoCloud.C | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 1c43f9e025..bc45544ad8 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -480,13 +480,13 @@ void Foam::KinematicCloud::cloudReset(KinematicCloud& c) forces_.transfer(c.forces_); - collisionModel_ = c.collisionModel_->clone(); - dispersionModel_= c.dispersionModel_->clone(); - injectionModel_ = c.injectionModel_->clone(); - patchInteractionModel_ = c.patchInteractionModel_->clone(); - postProcessingModel_ = c.postProcessingModel_->clone(); + collisionModel_.reset(c.collisionModel_.ptr()); + dispersionModel_.reset(c.dispersionModel_.ptr()); + injectionModel_.reset(c.injectionModel_.ptr()); + patchInteractionModel_.reset(c.patchInteractionModel_.ptr()); + postProcessingModel_.reset(c.postProcessingModel_.ptr()); - UIntegrator_ = c.UIntegrator_->clone(); + UIntegrator_.reset(c.UIntegrator_.ptr()); } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index a8bb92cb5a..e2d0d96fe2 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -85,8 +85,8 @@ void Foam::ReactingCloud::cloudReset(ReactingCloud& c) { ThermoCloud::cloudReset(c); - compositionModel_ = c.compositionModel_->clone(); - phaseChangeModel_ = c.phaseChangeModel_->clone(); + compositionModel_.reset(c.compositionModel_.ptr()); + phaseChangeModel_.reset(c.phaseChangeModel_.ptr()); dMassPhaseChange_ = c.dMassPhaseChange_; } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index 06dc0c339b..7cd42b7355 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -61,8 +61,8 @@ void Foam::ReactingMultiphaseCloud::cloudReset { ReactingCloud::cloudReset(c); - devolatilisationModel_ = c.devolatilisationModel_->clone(); - surfaceReactionModel_ = c.surfaceReactionModel_->clone(); + devolatilisationModel_.reset(c.devolatilisationModel_.ptr()); + surfaceReactionModel_.reset(c.surfaceReactionModel_.ptr()); dMassDevolatilisation_ = c.dMassDevolatilisation_; dMassSurfaceReaction_ = c.dMassSurfaceReaction_; diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index ae26e7999d..3224a8797c 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -60,8 +60,8 @@ void Foam::ThermoCloud::cloudReset(ThermoCloud& c) { KinematicCloud::cloudReset(c); - heatTransferModel_ = c.heatTransferModel_->clone(); - TIntegrator_ = c.TIntegrator_->clone(); + heatTransferModel_.reset(c.heatTransferModel_.ptr()); + TIntegrator_.reset(c.TIntegrator_.ptr()); radiation_ = c.radiation_; } From 93b195f6d82e233102c4abe4a8a8f63802235832 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 15 Feb 2011 10:03:11 +0000 Subject: [PATCH 14/39] ENH: Added mustRead option (defaults to false) for subOrEmptyDict --- src/OpenFOAM/db/dictionary/dictionary.C | 19 +++++++++++++++++-- src/OpenFOAM/db/dictionary/dictionary.H | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 7539f6d7de..f080c5b43b 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -486,14 +486,29 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword) Foam::dictionary Foam::dictionary::subOrEmptyDict ( - const word& keyword + const word& keyword, + const bool mustRead ) const { const entry* entryPtr = lookupEntryPtr(keyword, false, true); if (entryPtr == NULL) { - return dictionary(*this, dictionary(name() + "::" + keyword)); + if (mustRead) + { + FatalIOErrorIn + ( + "dictionary::subOrEmptyDict(const word& keyword, const bool)", + *this + ) << "keyword " << keyword << " is undefined in dictionary " + << name() + << exit(FatalIOError); + return entryPtr->dict(); + } + else + { + return dictionary(*this, dictionary(name() + "::" + keyword)); + } } else { diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index ebd0dc9ea1..e243e64df0 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -368,7 +368,7 @@ public: //- Find and return a sub-dictionary as a copy, or // return an empty dictionary if the sub-dictionary does not exist - dictionary subOrEmptyDict(const word&) const; + dictionary subOrEmptyDict(const word&, const bool mustRead = false) const; //- Return the table of contents wordList toc() const; From dd22de68d4c8f71fea57f80180ed821c4e68f942 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 11:04:08 +0100 Subject: [PATCH 15/39] ENH: support bzip2 compression for foamPack* --- bin/foamPackBin | 18 ++++++++++++++++-- bin/foamPackDeps | 22 ++++++++++++++++++++-- bin/foamPackDoxygen | 23 ++++++++++++++++++++--- bin/foamPackMake | 21 +++++++++++++++++++-- bin/tools/foamListSourceFiles | 2 ++ bin/tools/foamPackSource | 12 +++++++++++- 6 files changed, 88 insertions(+), 10 deletions(-) diff --git a/bin/foamPackBin b/bin/foamPackBin index 67738d1ea8..3ee4641383 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -59,6 +59,7 @@ cat <&2 Usage: ${0##*/} [OPTION] ${0##*/} [OPTION] -current options: + -b, -bzip2 use bzip2 instead of gzip compression -c, -current use current value of \$WM_OPTIONS -o, -output specify alternative output directory @@ -73,6 +74,7 @@ USAGE unset archOptions outputDir +packExt=tgz # parse options while [ "$#" -gt 0 ] @@ -81,6 +83,10 @@ do -h | -help) usage ;; + -b | -bzip2) + packExt=tbz + shift + ;; -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' archOptions="$WM_OPTIONS" shift @@ -110,7 +116,6 @@ fi #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) -packExt=tgz packBase=${packDir}.${archOptions}_${timeStamp} # add optional output directory @@ -137,11 +142,20 @@ else exit 1 fi +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac # Clean up on Ctrl-C trap 'rm -f $packFile 2>/dev/null' INT -tar cpzf $packFile $dirList +tar $tarOpt $packFile $dirList if [ $? -eq 0 ] then echo "Finished packing file $packFile" 1>&2 diff --git a/bin/foamPackDeps b/bin/foamPackDeps index 67a885b900..1de69167df 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -56,6 +56,7 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: + -b, -bzip2 use bzip2 instead of gzip compression -o, -output specify alternative output directory * Pack and compress *.dep files from $codeBase @@ -66,6 +67,8 @@ USAGE unset outputDir +packExt=tgz + # parse options while [ "$#" -gt 0 ] do @@ -73,6 +76,10 @@ do -h | -help) usage ;; + -b | -bzip2) + packExt=tbz + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -96,7 +103,6 @@ done #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) -packExt=tgz packBase=${packDir}.deps_${timeStamp} # add optional output directory @@ -116,10 +122,22 @@ Packing *.dep files into $packFile INFO + +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac + + # Clean up on Ctrl-C trap 'rm -f $packFile 2>/dev/null' INT -find -H $packDir -name '*.dep' -type f -print | tar cpzf $packFile -T - +find -H $packDir -name '*.dep' -type f -print | tar $tarOpt $packFile -T - if [ $? -eq 0 ] then diff --git a/bin/foamPackDoxygen b/bin/foamPackDoxygen index 6f1b17ca27..a5104e39b9 100755 --- a/bin/foamPackDoxygen +++ b/bin/foamPackDoxygen @@ -37,6 +37,7 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: + -b, -bzip2 use bzip2 instead of gzip compression -o, -output specify alternative output directory -prefix use alternative prefix @@ -46,7 +47,10 @@ USAGE exit 1 } + unset prefix outputDir +packExt=tgz + # parse options while [ "$#" -gt 0 ] do @@ -54,6 +58,10 @@ do -h | -help) usage ;; + -b | -bzip2) + packExt=tbz + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -87,7 +95,6 @@ then fi #------------------------------------------------------------------------------ -packExt=tgz packName=${packDir}_Doxygen # add optional output directory @@ -107,15 +114,25 @@ Packing doxygen html into $packFile INFO +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac + # Clean up on Ctrl-C trap 'rm -f $packFile 2>/dev/null' INT if [ -n "$prefix" ] then # requires GNU tar - tar cpzf $packFile --transform="s@^@$prefix/@" $htmlDir + tar $tarOpt $packFile --transform="s@^@$prefix/@" $htmlDir else - tar cpzf $packFile $packDir/$htmlDir + tar $tarOpt $packFile $packDir/$htmlDir fi if [ $? -eq 0 ] diff --git a/bin/foamPackMake b/bin/foamPackMake index c4325723e3..f930e633c7 100755 --- a/bin/foamPackMake +++ b/bin/foamPackMake @@ -57,6 +57,7 @@ cat <&2 Usage: ${0##*/} [OPTION] ${0##*/} [OPTION] -current options: + -b, -bzip2 use bzip2 instead of gzip compression -c, -current use current value of \$WM_OPTIONS -o, -output specify alternative output directory @@ -71,6 +72,7 @@ USAGE unset archOptions outputDir +packExt=tgz # parse options while [ "$#" -gt 0 ] @@ -79,6 +81,10 @@ do -h | -help) usage ;; + -b | -bzip2) + packExt=tbz + shift + ;; -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' archOptions="$WM_OPTIONS" shift @@ -108,7 +114,6 @@ fi #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) -packExt=tgz packBase=${packDir}.Make-${archOptions}_${timeStamp} # add optional output directory @@ -128,12 +133,24 @@ Pack and compress Make/$archOptions* directories into $packFile INFO + +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac + + # Clean up on Ctrl-C trap 'rm -f $packFile 2>/dev/null' INT find -H $packDir -depth -name Make -type d -print | \ xargs -i find '{}' -depth -name "$archOptions*" -type d -print | \ - tar cpzf $packFile -T - + tar $tarOpt $packFile -T - if [ $? -eq 0 ] then diff --git a/bin/tools/foamListSourceFiles b/bin/tools/foamListSourceFiles index a8d4d59091..2deedeac8c 100755 --- a/bin/tools/foamListSourceFiles +++ b/bin/tools/foamListSourceFiles @@ -71,6 +71,8 @@ find -H $packDir \ -a ! -name "*.tar" \ -a ! -name "*.tar.gz" \ -a ! -name "*.tgz" \ + -a ! -name "*.tar.bz2" \ + -a ! -name "*.tbz" \ -a ! -name "core" \ -a ! -name "core.[1-9]*" \ -a ! -name "libccmio*" \ diff --git a/bin/tools/foamPackSource b/bin/tools/foamPackSource index a4d014cfcf..83fe64391f 100755 --- a/bin/tools/foamPackSource +++ b/bin/tools/foamPackSource @@ -78,10 +78,20 @@ INFO wc $tmpFile | awk '{print "Packing",$1,"files - this could take some time ..."}' 1>&2 +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac + # Clean up on Ctrl-C trap 'rm -f $packFile $tmpFile 2>/dev/null' INT -tar cpzf $packFile --files-from $tmpFile +tar $tarOpt $packFile --files-from $tmpFile if [ $? -eq 0 ] then echo "Finished packing $packDir into $packFile" 1>&2 From bdcd70f93d4afc5e6d6ca7511b9e99429275aec2 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 15 Feb 2011 10:58:50 +0000 Subject: [PATCH 16/39] ENH: Using mustRead option on subOrEmptyDict --- .../clouds/Templates/KinematicCloud/KinematicCloud.C | 11 +++++++++-- .../ParticleForces/ParticleForce/ParticleForce.C | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index bc45544ad8..fd6fbfcdc7 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -520,7 +520,10 @@ Foam::KinematicCloud::KinematicCloud ), solution_(mesh_, particleProperties_.subDict("solution")), constProps_(particleProperties_, solution_.active()), - subModelProperties_(particleProperties_.subOrEmptyDict("subModels")), + subModelProperties_ + ( + particleProperties_.subOrEmptyDict("subModels", solution_.active()) + ), rndGen_ ( label(0), @@ -535,7 +538,11 @@ Foam::KinematicCloud::KinematicCloud ( *this, mesh_, - particleProperties_.subOrEmptyDict("particleForces"), + subModelProperties_.subOrEmptyDict + ( + "particleForces", + solution_.active() + ), solution_.active() ), collisionModel_(NULL), diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C index 1716b7055b..07a4e3697f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C @@ -39,7 +39,14 @@ Foam::ParticleForce::ParticleForce owner_(owner), mesh_(mesh), dict_(dict), - coeffs_(dict.subOrEmptyDict(forceType + "Coeffs")) + coeffs_ + ( + dict.subOrEmptyDict + ( + forceType + "Coeffs", + owner.solution().active() + ) + ) {} From 5e6992199cc2553b22b866c66f0c1a526edcb89e Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 15 Feb 2011 11:00:11 +0000 Subject: [PATCH 17/39] ENH: wordHastSet instead of wordList ofr forces specification --- .../ParticleForceList/ParticleForceList.C | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C index 9d7426824c..d3f4d69524 100644 --- a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C @@ -57,19 +57,22 @@ Foam::ParticleForceList::ParticleForceList { if (readFields) { - const wordList models(dict.lookup("activeForces")); + const wordList activeForces(dict.lookup("activeForces")); + + wordHashSet models; + models.insert(activeForces); Info<< "Constructing particle forces" << endl; if (models.size() > 0) { this->setSize(models.size()); - forAll(models, i) + + label i = 0; + forAllConstIter(wordHashSet, models, iter) { - set - ( - i, - ParticleForce::New(owner, mesh, dict, models[i]) - ); + const word& model = iter.key(); + set(i, ParticleForce::New(owner, mesh, dict, model)); + i++; } } else From 27d128f9365d956ecd5d1555e61852a492fac76c Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 15 Feb 2011 11:00:47 +0000 Subject: [PATCH 18/39] ENH: Updated coalCombustion lib re: particle forces --- src/lagrangian/coalCombustion/Make/files | 1 + .../coalParcel/makeCoalParcelForces.C | 40 +++++++++++++++++++ .../coalParcel/makeCoalParcelSubmodels.C | 4 +- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 src/lagrangian/coalCombustion/coalParcel/makeCoalParcelForces.C diff --git a/src/lagrangian/coalCombustion/Make/files b/src/lagrangian/coalCombustion/Make/files index 7f710449cf..53d75f43b4 100644 --- a/src/lagrangian/coalCombustion/Make/files +++ b/src/lagrangian/coalCombustion/Make/files @@ -2,5 +2,6 @@ coalParcel/coalParcel.C coalParcel/defineCoalParcel.C coalParcel/makeCoalParcelSubmodels.C +coalParcel/makeCoalParcelForces.C LIB = $(FOAM_LIBBIN)/libcoalCombustion diff --git a/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelForces.C b/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelForces.C new file mode 100644 index 0000000000..57c6806a62 --- /dev/null +++ b/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelForces.C @@ -0,0 +1,40 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +\*---------------------------------------------------------------------------*/ + +#include "coalParcel.H" + +// Using thermodynamic variant +#include "makeThermoParcelForces.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + // Kinematic sub-models + makeThermoParcelForces(coalParcel); +}; + + +// ************************************************************************* // diff --git a/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelSubmodels.C b/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelSubmodels.C index 2bbd6777a2..f12784d62a 100644 --- a/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelSubmodels.C +++ b/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,6 @@ License // Kinematic #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -53,7 +52,6 @@ namespace Foam { // Kinematic sub-models makeParcelDispersionModels(coalParcel); - makeParcelDragModels(coalParcel); makeReactingMultiphaseParcelInjectionModels(coalParcel); makeParcelCollisionModels(coalParcel); makeParcelPatchInteractionModels(coalParcel); From feda5b95208d2dc59707485c2c35bc9ba21cfebd Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 15 Feb 2011 11:01:48 +0000 Subject: [PATCH 19/39] ENH: Updated particle tutorials re: particle forces --- .../constant/coalCloud1Properties | 18 +++++++++--------- .../constant/limestoneCloud1Properties | 18 +++++++++--------- .../filter/constant/reactingCloud1Properties | 18 +++++++++--------- .../constant/reactingCloud1Properties | 18 +++++++++--------- .../constant/reactingCloud1Properties | 18 +++++++++--------- .../constant/reactingCloud1Properties | 18 +++++++++--------- .../constant/kinematicCloud1Properties | 18 +++++++++--------- .../constant/thermoCloud1Properties | 18 +++++++++--------- .../constant/reactingCloud1Properties | 19 +++++++++---------- 9 files changed, 81 insertions(+), 82 deletions(-) diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties index 9c86605535..c3fb62ce4a 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties @@ -88,17 +88,17 @@ constantProperties constantVolume true; } -particleForces -{ - activeForces - ( - sphereDrag - gravity - ); -} - subModels { + particleForces + { + activeForces + ( + sphereDrag + gravity + ); + } + InjectionModel ManualInjection; DispersionModel StochasticDispersionRAS; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties index dc7a66b075..cdec67c7f1 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties @@ -72,17 +72,17 @@ constantProperties Pr 0.7; } -particleForces -{ - activeForces - ( - sphereDrag - gravity - ); -} - subModels { + particleForces + { + activeForces + ( + sphereDrag + gravity + ); + } + InjectionModel ManualInjection; DispersionModel StochasticDispersionRAS; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties index 166d7ff81c..3da7874bf9 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/constant/reactingCloud1Properties @@ -87,17 +87,17 @@ constantProperties constantVolume false; } -particleForces -{ - activeForces - ( - sphereDrag - gravity - ); -} - subModels { + particleForces + { + activeForces + ( + sphereDrag + gravity + ); + } + InjectionModel ReactingMultiphaseLookupTableInjection; DispersionModel none; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties index 1220745bf2..644a5dacd5 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/reactingCloud1Properties @@ -87,17 +87,17 @@ constantProperties constantVolume false; } -particleForces -{ - activeForces - ( - sphereDrag - gravity - ); -} - subModels { + particleForces + { + activeForces + ( + sphereDrag + gravity + ); + } + InjectionModel ManualInjection; DispersionModel none; diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index f63b8aede5..be83c13df0 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -87,17 +87,17 @@ constantProperties constantVolume false; } -particleForces -{ - activeForces - ( - sphereDrag - gravity - ); -} - subModels { + particleForces + { + activeForces + ( + sphereDrag + gravity + ); + } + InjectionModel PatchInjection; DispersionModel StochasticDispersionRAS; diff --git a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties index b3dd3291e5..313f51e9be 100644 --- a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/constant/reactingCloud1Properties @@ -84,17 +84,17 @@ constantProperties constantVolume false; } -particleForces -{ - activeForces - ( - sphereDrag - gravity - ); -} - subModels { + particleForces + { + activeForces + ( + sphereDrag + gravity + ); + } + InjectionModel ManualInjection; DispersionModel none; diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties index 2e461cec12..eb5945f5d2 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/kinematicCloud1Properties @@ -56,17 +56,17 @@ constantProperties poissonsRatio 0.35; } -particleForces -{ - activeForces - ( - sphereDrag - gravity - ); -} - subModels { + particleForces + { + activeForces + ( + sphereDrag + gravity + ); + } + InjectionModel ManualInjection; DispersionModel StochasticDispersionRAS; diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties index 5be7a02a51..713b1977a6 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/constant/thermoCloud1Properties @@ -71,17 +71,17 @@ constantProperties Pr 0.7; } -particleForces -{ - activeForces - ( - sphereDrag - gravity - ); -} - subModels { + particleForces + { + activeForces + ( + sphereDrag + gravity + ); + } + InjectionModel ManualInjection; DispersionModel StochasticDispersionRAS; diff --git a/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index 92c9d0c25c..45a6113ef3 100644 --- a/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/steadyReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -98,18 +98,17 @@ constantProperties } -particleForces -{ - activeForces - ( - sphereDrag - gravity - ); -} - - subModels { + particleForces + { + activeForces + ( + sphereDrag + gravity + ); + } + InjectionModel PatchInjection; DispersionModel StochasticDispersionRAS; From 4086eb71a6b7b92cc091cca5e5e5ffec4caf5552 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 15 Feb 2011 11:18:05 +0000 Subject: [PATCH 20/39] ENH: combined particle forces into sub model template instantiations --- src/lagrangian/coalCombustion/Make/files | 1 - .../coalParcel/makeCoalParcelSubmodels.C | 2 + src/lagrangian/intermediate/Make/files | 4 -- .../makeBasicKinematicParcelForces.C | 40 ------------------- .../makeBasicKinematicParcelSubmodels.C | 2 + .../makeBasicReactingMultiphaseParcelForces.C | 40 ------------------- ...keBasicReactingMultiphaseParcelSubmodels.C | 2 + .../makeBasicReactingParcelForces.C | 40 ------------------- .../makeBasicReactingParcelSubmodels.C | 2 + .../makeBasicThermoParcelForces.C | 40 ------------------- .../makeBasicThermoParcelSubmodels.C | 2 + 11 files changed, 10 insertions(+), 165 deletions(-) delete mode 100644 src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C delete mode 100644 src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C delete mode 100644 src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C delete mode 100644 src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C diff --git a/src/lagrangian/coalCombustion/Make/files b/src/lagrangian/coalCombustion/Make/files index 53d75f43b4..7f710449cf 100644 --- a/src/lagrangian/coalCombustion/Make/files +++ b/src/lagrangian/coalCombustion/Make/files @@ -2,6 +2,5 @@ coalParcel/coalParcel.C coalParcel/defineCoalParcel.C coalParcel/makeCoalParcelSubmodels.C -coalParcel/makeCoalParcelForces.C LIB = $(FOAM_LIBBIN)/libcoalCombustion diff --git a/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelSubmodels.C b/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelSubmodels.C index f12784d62a..66612e2e12 100644 --- a/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelSubmodels.C +++ b/src/lagrangian/coalCombustion/coalParcel/makeCoalParcelSubmodels.C @@ -26,6 +26,7 @@ License #include "coalParcel.H" // Kinematic +#include "makeThermoParcelForces.H" // thermo variant #include "makeParcelDispersionModels.H" #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeParcelCollisionModels.H" @@ -51,6 +52,7 @@ License namespace Foam { // Kinematic sub-models + makeThermoParcelForces(coalParcel); makeParcelDispersionModels(coalParcel); makeReactingMultiphaseParcelInjectionModels(coalParcel); makeParcelCollisionModels(coalParcel); diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index ad96a400fd..2a1ea126f0 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -23,7 +23,6 @@ KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel $(KINEMATICPARCEL)/basicKinematicParcel.C $(KINEMATICPARCEL)/defineBasicKinematicParcel.C $(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C -$(KINEMATICPARCEL)/makeBasicKinematicParcelForces.C /* thermo parcel sub-models */ @@ -31,7 +30,6 @@ THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel $(THERMOPARCEL)/basicThermoParcel.C $(THERMOPARCEL)/defineBasicThermoParcel.C $(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C -$(THERMOPARCEL)/makeBasicThermoParcelForces.C /* reacting parcel sub-models */ @@ -39,7 +37,6 @@ REACTINGPARCEL=$(DERIVEDPARCELS)/basicReactingParcel $(REACTINGPARCEL)/basicReactingParcel.C $(REACTINGPARCEL)/defineBasicReactingParcel.C $(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C -$(REACTINGPARCEL)/makeBasicReactingParcelForces.C /* reacting multiphase parcel sub-models */ @@ -47,7 +44,6 @@ REACTINGMPPARCEL=$(DERIVEDPARCELS)/basicReactingMultiphaseParcel $(REACTINGMPPARCEL)/basicReactingMultiphaseParcel.C $(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C -$(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelForces.C /* bolt-on models */ diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C deleted file mode 100644 index 5d7f1b57bf..0000000000 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelForces.C +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2011 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 . - -\*---------------------------------------------------------------------------*/ - -#include "basicKinematicParcel.H" - -// Kinematic -#include "makeParcelForces.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // Kinematic sub-models - makeParcelForces(basicKinematicParcel); -}; - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C index a401d40b20..c869ceeac0 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C @@ -26,6 +26,7 @@ License #include "basicKinematicParcel.H" // Kinematic +#include "makeParcelForces.H" #include "makeParcelDispersionModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" @@ -38,6 +39,7 @@ License namespace Foam { // Kinematic sub-models + makeParcelForces(basicKinematicParcel); makeParcelDispersionModels(basicKinematicParcel); makeParcelInjectionModels(basicKinematicParcel); makeParcelCollisionModels(basicKinematicParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C deleted file mode 100644 index 3122dc2fb8..0000000000 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelForces.C +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2011 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 . - -\*---------------------------------------------------------------------------*/ - -#include "basicReactingMultiphaseParcel.H" - -// Using thermodynamic variant -#include "makeThermoParcelForces.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // Kinematic sub-models - makeThermoParcelForces(basicReactingMultiphaseParcel); -}; - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C index aa272e23d4..d7c2c70054 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C @@ -26,6 +26,7 @@ License #include "basicReactingMultiphaseParcel.H" // Kinematic +#include "makeThermoParcelForces.H" // thermo variant #include "makeParcelDispersionModels.H" #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeParcelCollisionModels.H" @@ -49,6 +50,7 @@ License namespace Foam { // Kinematic sub-models + makeThermoParcelForces(basicReactingMultiphaseParcel); makeParcelDispersionModels(basicReactingMultiphaseParcel); makeReactingMultiphaseParcelInjectionModels(basicReactingMultiphaseParcel); makeParcelCollisionModels(basicReactingMultiphaseParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C deleted file mode 100644 index 094f1a37de..0000000000 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelForces.C +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2011 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 . - -\*---------------------------------------------------------------------------*/ - -#include "basicReactingParcel.H" - -// Using thermodynamic variant -#include "makeThermoParcelForces.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // Kinematic sub-models - makeThermoParcelForces(basicReactingParcel); -}; - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C index 9f708827bf..cad82ff4c4 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C @@ -26,6 +26,7 @@ License #include "basicReactingParcel.H" // Kinematic +#include "makeThermoParcelForces.H" // thermo variant #include "makeParcelDispersionModels.H" #include "makeReactingParcelInjectionModels.H" // Reacting variant #include "makeParcelCollisionModels.H" @@ -45,6 +46,7 @@ License namespace Foam { // Kinematic sub-models + makeThermoParcelForces(basicReactingParcel); makeParcelDispersionModels(basicReactingParcel); makeReactingParcelInjectionModels(basicReactingParcel); makeParcelCollisionModels(basicReactingParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C deleted file mode 100644 index 3ada6d849d..0000000000 --- a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelForces.C +++ /dev/null @@ -1,40 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2011 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 . - -\*---------------------------------------------------------------------------*/ - -#include "basicThermoParcel.H" - -// Using thermodynamic variant -#include "makeThermoParcelForces.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // Kinematic sub-models - makeThermoParcelForces(basicThermoParcel); -}; - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C index 91be53b9df..91a2c975d4 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C @@ -26,6 +26,7 @@ License #include "basicThermoParcel.H" // Kinematic +#include "makeThermoParcelForces.H" // thermo variant #include "makeParcelDispersionModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" @@ -41,6 +42,7 @@ License namespace Foam { // Kinematic sub-models + makeThermoParcelForces(basicThermoParcel); makeParcelDispersionModels(basicThermoParcel); makeParcelInjectionModels(basicThermoParcel); makeParcelCollisionModels(basicThermoParcel); From 4c13528ff4a3c4e66e927b04ecf2bdb0b003f431 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 15 Feb 2011 14:20:20 +0000 Subject: [PATCH 21/39] ENH: further updates to particle forces --- .../KinematicParcel/KinematicParcel.C | 11 ++++---- .../ParticleForceList/ParticleForceList.C | 8 +++--- .../ParticleForceList/ParticleForceList.H | 4 +-- .../NonSphereDrag/NonSphereDragForce.C | 7 +++-- .../NonSphereDrag/NonSphereDragForce.H | 2 +- .../DragForce/SphereDrag/SphereDragForce.C | 20 +++++-------- .../DragForce/SphereDrag/SphereDragForce.H | 2 +- .../ParticleForces/Gravity/GravityForce.C | 6 ++-- .../ParticleForces/Gravity/GravityForce.H | 2 +- .../Paramagnetic/ParamagneticForce.C | 4 +-- .../Paramagnetic/ParamagneticForce.H | 2 +- .../ParticleForce/ParticleForce.C | 28 ++++++++++++------- .../ParticleForce/ParticleForce.H | 12 ++++++-- .../PressureGradient/PressureGradientForce.C | 4 +-- .../PressureGradient/PressureGradientForce.H | 2 +- .../Kinematic/ParticleForces/SRF/SRFForce.C | 6 ++-- .../Kinematic/ParticleForces/SRF/SRFForce.H | 2 +- .../ParticleForces/forceSuSp/forceSuSp.H | 23 +++++++-------- .../BrownianMotion/BrownianMotionForce.C | 11 ++++---- .../BrownianMotion/BrownianMotionForce.H | 2 +- 20 files changed, 82 insertions(+), 76 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 54bde90c77..ddd7239b66 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -180,8 +180,8 @@ const Foam::vector Foam::KinematicParcel::calcVelocity // Momentum source due to particle forces const ParcelType& p = static_cast(*this); - const forceSuSp Fcp = forces.calcCoupled(p, dt, Re, rho, mu); - const forceSuSp Fncp = forces.calcNonCoupled(p, dt, Re, rho, mu); + const forceSuSp Fcp = forces.calcCoupled(p, dt, mass, Re, mu); + const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, mu); const forceSuSp Feff = Fcp + Fncp; @@ -189,9 +189,8 @@ const Foam::vector Foam::KinematicParcel::calcVelocity //~~~~~~~~~~~~~~~~~~~~~~ // Update velocity - treat as 3-D - const scalar As = this->areaS(d); - const vector ap = Uc_ + (mass*Feff.Su() + Su)/(As*Feff.Sp()); - const scalar bp = 6.0*Feff.Sp()/(rho*d); + const vector ap = Uc_ + (Feff.Su() + Su)/(Feff.Sp() + ROOTVSMALL); + const scalar bp = Feff.Sp()/mass; Cud = bp; @@ -200,7 +199,7 @@ const Foam::vector Foam::KinematicParcel::calcVelocity vector Unew = Ures.value(); - dUTrans += dt*(Fncp.Sp()*As*(Ures.average() - Uc_) - mass*Fcp.Su()); + dUTrans += dt*(Feff.Sp()*(Ures.average() - Uc_) - Fcp.Su()); // Apply correction to velocity and dUTrans for reduced-D cases const polyMesh& mesh = this->cloud().pMesh(); diff --git a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C index d3f4d69524..452ef6690d 100644 --- a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C @@ -120,15 +120,15 @@ Foam::forceSuSp Foam::ParticleForceList::calcCoupled ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { forceSuSp value(vector::zero, 0.0); forAll(*this, i) { - value += this->operator[](i).calcCoupled(p, dt, Re, rhoc, muc); + value += this->operator[](i).calcCoupled(p, dt, mass, Re, muc); } return value; @@ -140,15 +140,15 @@ Foam::forceSuSp Foam::ParticleForceList::calcNonCoupled ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { forceSuSp value(vector::zero, 0.0); forAll(*this, i) { - value += this->operator[](i).calcNonCoupled(p, dt, Re, rhoc, muc); + value += this->operator[](i).calcNonCoupled(p, dt, mass, Re, muc); } return value; diff --git a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H index dc9f3811a0..0542216427 100644 --- a/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.H @@ -116,8 +116,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; @@ -126,8 +126,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C index b6f54ea92a..5ee4d8c0b6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.C @@ -30,7 +30,7 @@ License template Foam::scalar Foam::NonSphereDragForce::Cd(const scalar Re) const { - return 24.0/(Re + ROOTVSMALL)*(1.0 + a_*pow(Re, b_)) + Re*c_/(Re + d_); + return 24.0/Re*(1.0 + a_*pow(Re, b_)) + Re*c_/(Re + d_); } @@ -97,14 +97,15 @@ Foam::forceSuSp Foam::NonSphereDragForce::calcNonCoupled ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { forceSuSp value(vector::zero, 0.0); - value.Sp() = Cd(Re)*Re/p.d()*muc/8.0 + ROOTVSMALL; + const scalar ReCorr = max(Re, 1e-6); + value.Sp() = mass*0.75*muc*Cd(ReCorr)*ReCorr/(p.rho()*sqr(p.d())); return value; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H index d6d2712c8a..ce886f133b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/NonSphereDrag/NonSphereDragForce.H @@ -144,8 +144,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C index 64955508c9..da37d5131b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C @@ -30,21 +30,14 @@ License template Foam::scalar Foam::SphereDragForce::Cd(const scalar Re) const { - scalar Cd; - if (Re < SMALL) + if (Re > 1000.0) { - Cd = GREAT; - } - else if (Re > 1000.0) - { - Cd = 0.424; + return 0.424; } else { - Cd = 24.0/Re*(1.0 + 1.0/6.0*pow(Re, 2.0/3.0)); + return 24.0/Re*(1.0 + 1.0/6.0*pow(Re, 2.0/3.0)); } - - return Cd; } @@ -59,7 +52,7 @@ Foam::SphereDragForce::SphereDragForce const word& forceType ) : - ParticleForce(owner, mesh, dict, forceType) + ParticleForce(owner, mesh, dict) {} @@ -87,14 +80,15 @@ Foam::forceSuSp Foam::SphereDragForce::calcNonCoupled ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { forceSuSp value(vector::zero, 0.0); - value.Sp() = Cd(Re)*Re/p.d()*muc/8.0 + ROOTVSMALL; + const scalar ReCorr = max(Re, 1e-6); + value.Sp() = mass*0.75*muc*Cd(ReCorr)*ReCorr/(p.rho()*sqr(p.d())); return value; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H index af1efe0c01..f9e2cca78e 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.H @@ -96,8 +96,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C index cabb623111..6af29abb1b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C @@ -36,7 +36,7 @@ Foam::GravityForce::GravityForce const word& forceType ) : - ParticleForce(owner, mesh, dict, forceType), + ParticleForce(owner, mesh, dict), g_(owner.g().value()) {} @@ -63,14 +63,14 @@ Foam::forceSuSp Foam::GravityForce::calcNonCoupled ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { forceSuSp value(vector::zero, 0.0); - value.Su() = g_*(1.0 - rhoc/p.rho()); + value.Su() = mass*g_*(1.0 - p.rhoc()/p.rho()); return value; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H index db57228f55..a215d0ef66 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.H @@ -109,8 +109,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C index 82cf9933f6..24e294e039 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.C @@ -99,8 +99,8 @@ Foam::forceSuSp Foam::ParamagneticForce::calcNonCoupled ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { @@ -109,7 +109,7 @@ Foam::forceSuSp Foam::ParamagneticForce::calcNonCoupled const interpolation& HdotGradHInterp = *HdotGradHInterpPtr_; value.Su()= - 3.0*constant::electromagnetic::mu0.value()/p.rho() + mass*3.0*constant::electromagnetic::mu0.value()/p.rho() *magneticSusceptibility_/(magneticSusceptibility_ + 3) *HdotGradHInterp.interpolate(p.position(), p.currentTetIndices()); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H index 69b51d85c7..f849556f2e 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Paramagnetic/ParamagneticForce.H @@ -122,8 +122,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C index 07a4e3697f..6b6f53aca3 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C @@ -27,6 +27,21 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +template +Foam::ParticleForce::ParticleForce +( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict +) +: + owner_(owner), + mesh_(mesh), + dict_(dict), + coeffs_(dictionary::null) +{} + + template Foam::ParticleForce::ParticleForce ( @@ -39,14 +54,7 @@ Foam::ParticleForce::ParticleForce owner_(owner), mesh_(mesh), dict_(dict), - coeffs_ - ( - dict.subOrEmptyDict - ( - forceType + "Coeffs", - owner.solution().active() - ) - ) + coeffs_(dict.subOrEmptyDict(forceType + "Coeffs")) {} @@ -79,8 +87,8 @@ Foam::forceSuSp Foam::ParticleForce::calcCoupled ( const typename CloudType::parcelType&, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { @@ -97,8 +105,8 @@ Foam::forceSuSp Foam::ParticleForce::calcNonCoupled ( const typename CloudType::parcelType&, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H index 45c29b4dc3..e06646ca03 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H @@ -95,6 +95,14 @@ public: // Constructors + //- Construct null + ParticleForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict + ); + //- Construct from mesh ParticleForce ( @@ -161,8 +169,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; @@ -171,8 +179,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C index a4c9332329..a113b44e13 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.C @@ -89,15 +89,15 @@ Foam::forceSuSp Foam::PressureGradientForce::calcCoupled ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { forceSuSp value(vector::zero, 0.0); const volTensorField& gradU = *gradUPtr_; - value.Su() = rhoc/p.rho()*(p.U() & gradU[p.cell()]); + value.Su() = mass*p.rhoc()/p.rho()*(p.U() & gradU[p.cell()]); return value; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H index a1fe759caf..4e1f08cc98 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/PressureGradient/PressureGradientForce.H @@ -114,8 +114,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C index 3cf383a996..2f9ca986b4 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.C @@ -36,7 +36,7 @@ Foam::SRFForce::SRFForce const word& forceType ) : - ParticleForce(owner, mesh, dict, forceType), + ParticleForce(owner, mesh, dict), srfPtr_(NULL) {} @@ -82,8 +82,8 @@ Foam::forceSuSp Foam::SRFForce::calcNonCoupled ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { @@ -97,7 +97,7 @@ Foam::forceSuSp Foam::SRFForce::calcNonCoupled const vector r = p.position() - axis*(axis & p.position()); // Coriolis and centrifugal acceleration terms - value.Su() = 2.0*(p.U() ^ omega) + (omega ^ (r ^ omega)); + value.Su() = mass*2.0*(p.U() ^ omega) + (omega ^ (r ^ omega)); return value; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H index ce28b8e288..2e646a37d7 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/SRF/SRFForce.H @@ -107,8 +107,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H index 76f378ed90..7bf439fa03 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H @@ -25,7 +25,12 @@ Class Foam::forceSuSp Description - Helper container for force Su and Sp terms + Helper container for force Su and Sp terms. + + F = Sp(U - Up) + Su + + Explicit contribution, Su specified as a force + Implicit coefficient, Sp specified as force/velocity SourceFiles forceSuSpI.H @@ -58,20 +63,12 @@ class forceSuSp public: - //- Component labeling enumeration - enum components - { - SU = 0, - SP = 1 - }; - - // Constructors //- Construct null inline forceSuSp(); - //- Construct given VectorSpace + //- Construct given Tuple2 inline forceSuSp(const Tuple2& susp); //- Construct given two components @@ -85,10 +82,10 @@ public: // Access - //- Return const access to the explicit contribution + //- Return const access to the explicit contribution [kg.m/s2] inline const vector& Su() const; - //- Return const access to the implicit contribution + //- Return const access to the implicit coefficient [kg/s] inline scalar Sp() const; @@ -97,7 +94,7 @@ public: //- Return reference to the explicit contribution inline vector& Su(); - //- Return reference to the explicit contribution + //- Return reference to the implicit coefficient inline scalar& Sp(); diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C index 7032b6311a..5d2c759b94 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.C @@ -161,8 +161,8 @@ Foam::forceSuSp Foam::BrownianMotionForce::calcCoupled ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const { @@ -180,18 +180,17 @@ Foam::forceSuSp Foam::BrownianMotionForce::calcCoupled scalar f = 0.0; if (turbulence_) { - const scalar mp = p.mass(); const label cellI = p.cell(); const volScalarField& k = *kPtr_; const scalar kc = k[cellI]; const scalar Dp = sigma*Tc*cc/(3*mathematical::pi*muc*dp); - f = eta/mp*sqrt(2.0*sqr(kc)*sqr(Tc)/(Dp*dt)); + f = eta/mass*sqrt(2.0*sqr(kc)*sqr(Tc)/(Dp*dt)); } else { - const scalar rhop = p.rho(); + const scalar rhoRatio = p.rho()/p.rhoc(); const scalar s0 = - 216*muc*sigma*Tc/(sqr(mathematical::pi)*pow5(dp)*(rhop/rhoc)*cc); + 216*muc*sigma*Tc/(sqr(mathematical::pi)*pow5(dp)*(rhoRatio)*cc); f = eta*sqrt(mathematical::pi*s0/dt); } @@ -200,7 +199,7 @@ Foam::forceSuSp Foam::BrownianMotionForce::calcCoupled { const scalar x = rndGen_.sample01(); const scalar eta = sqrt2*erfInv(2*x - 1.0); - value.Su()[i] = f*eta; + value.Su()[i] = mass*f*eta; } return value; diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H index 32f23b2b2b..03fed149c9 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/ParticleForces/BrownianMotion/BrownianMotionForce.H @@ -136,8 +136,8 @@ public: ( const typename CloudType::parcelType& p, const scalar dt, + const scalar mass, const scalar Re, - const scalar rhoc, const scalar muc ) const; }; From 9926d5f2a4142103906b1d628b3e64cef3a5df17 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 16:12:12 +0100 Subject: [PATCH 22/39] BUG: dir names missed in toucho, touchdep - forgot in 10f5e8080328ce7307f4f352a563311cd482e326 --- bin/touchdep | 2 +- bin/toucho | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/touchdep b/bin/touchdep index 48c19081ca..fd22f4db23 100755 --- a/bin/touchdep +++ b/bin/touchdep @@ -85,7 +85,7 @@ do if [ "$restrictOpt" = true ] then echo "touching all .dep files under Make/$WM_OPTIONS* : $i" - find -depth -name Make -type d -print | \ + find $i -depth -name Make -type d -print | \ xargs -i find '{}' -depth -name "$WM_OPTIONS*" -type d -print | \ xargs -i find '{}' -name '*.dep' -type f -print | \ xargs -t touch diff --git a/bin/toucho b/bin/toucho index 71093cc49c..7d6bbc98b6 100755 --- a/bin/toucho +++ b/bin/toucho @@ -81,7 +81,7 @@ do if [ "$restrictOpt" = true ] then echo "touching all .o files under Make/$WM_OPTIONS* : $i" - find -depth -name Make -type d -print | \ + find $i -depth -name Make -type d -print | \ xargs -i find '{}' -depth -name "$WM_OPTIONS*" -type d -print | \ xargs -i find '{}' -name '*.o' -type f -print | \ xargs -t touch From 2873f9fc8dfbbb6df95f7ca951b1b64b3878d608 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 16:26:59 +0100 Subject: [PATCH 23/39] ENH: add findEmptyMake for detecting rogue Make/ directories --- bin/findEmptyMake | 82 +++++++++++++++++++++++++++++++++++++++++++++++ bin/finddep | 4 +-- bin/foamPackBin | 2 +- bin/foamPackDeps | 2 +- bin/foamPackMake | 2 +- 5 files changed, 87 insertions(+), 5 deletions(-) create mode 100755 bin/findEmptyMake diff --git a/bin/findEmptyMake b/bin/findEmptyMake new file mode 100755 index 0000000000..37125c97e7 --- /dev/null +++ b/bin/findEmptyMake @@ -0,0 +1,82 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2011 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 . +# +# Script +# findEmptyMake +# +# Description +# Usage: findEmptyMake [dir1 .. dirN] +# +# Find Make/ directories without a 'files' or 'options' file. +# This can occur when a directory has been moved. +#------------------------------------------------------------------------------ +usage() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat<&2 + else + echo "skipping non-dir: $checkDir" 1>&2 + continue + fi + + find $checkDir -depth -name Make -type d -print | while read makeDir + do + [ -r "$makeDir/files" -a -r "$makeDir/options" ] || echo "$makeDir" + done + +done +# ----------------------------------------------------------------------------- diff --git a/bin/finddep b/bin/finddep index 331983cba1..0ef6401f4c 100755 --- a/bin/finddep +++ b/bin/finddep @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -30,9 +30,9 @@ # #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< ... * find all .dep files referring to any of ... diff --git a/bin/foamPackBin b/bin/foamPackBin index 3ee4641383..1aee24cadf 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -46,7 +46,7 @@ case "${0##*/}" in ;; *) # regular - codeBase="OpenFOAM ThirdParty" + codeBase="OpenFOAM" packDir=$WM_PROJECT-$WM_PROJECT_VERSION listBinDirs=$toolsDir/foamListBinDirs ;; diff --git a/bin/foamPackDeps b/bin/foamPackDeps index 1de69167df..d0c6552122 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -45,7 +45,7 @@ case "${0##*/}" in ;; *) # regular - codeBase="OpenFOAM ThirdParty" + codeBase="OpenFOAM" packDir=$WM_PROJECT-$WM_PROJECT_VERSION ;; esac diff --git a/bin/foamPackMake b/bin/foamPackMake index f930e633c7..08d2b69504 100755 --- a/bin/foamPackMake +++ b/bin/foamPackMake @@ -45,7 +45,7 @@ case "${0##*/}" in ;; *) # regular - codeBase="OpenFOAM ThirdParty" + codeBase="OpenFOAM" packDir=$WM_PROJECT-$WM_PROJECT_VERSION ;; esac From f691fe7896aff38a6160f3a885fe005d357fd329 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 16:48:26 +0100 Subject: [PATCH 24/39] STYLE: more consistent use of stderr for script usage --- bin/engridFoam | 3 ++- bin/foamClearPolyMesh | 7 ++++--- bin/foamCopySettings | 7 ++++--- bin/foamEndJob | 3 ++- bin/foamExec | 1 + bin/foamJob | 3 ++- bin/foamLog | 3 ++- bin/foamNew | 3 ++- bin/foamNewCase | 3 ++- bin/foamPack | 5 +++-- bin/foamPackBin | 5 +++-- bin/foamPackDeps | 5 +++-- bin/foamPackDoxygen | 5 +++-- bin/foamPackMake | 5 +++-- bin/foamPackThirdParty | 5 +++-- bin/foamUpdateCaseFileHeader | 3 ++- bin/paraFoam | 3 ++- bin/rmdepall | 5 +++-- bin/rmdepold | 5 +++-- bin/tools/foamConfigurePaths | 3 ++- bin/tools/org-batch | 5 +++-- bin/touchdep | 1 + bin/toucho | 1 + 23 files changed, 56 insertions(+), 33 deletions(-) diff --git a/bin/engridFoam b/bin/engridFoam index 076f34ddee..6384c365e2 100755 --- a/bin/engridFoam +++ b/bin/engridFoam @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -30,6 +30,7 @@ # #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2; shift; done - cat <&2 + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat <&2; shift; done - cat <&2 + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat <&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< diff --git a/bin/foamExec b/bin/foamExec index 47a2428ccd..26ad311349 100755 --- a/bin/foamExec +++ b/bin/foamExec @@ -39,6 +39,7 @@ # foamEtcFile #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat <&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< {args} diff --git a/bin/foamNewCase b/bin/foamNewCase index 52cd516bb6..fda86b4bdd 100755 --- a/bin/foamNewCase +++ b/bin/foamNewCase @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -37,6 +37,7 @@ templateDir="appTemplates" #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < specify alternative output directory diff --git a/bin/foamPackBin b/bin/foamPackBin index 1aee24cadf..36614ab781 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -54,8 +54,9 @@ esac usage() { - while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < ${0##*/} [OPTION] -current options: diff --git a/bin/foamPackDeps b/bin/foamPackDeps index d0c6552122..ab663a04c4 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -52,8 +52,9 @@ esac usage() { - while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat <&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat <&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < ${0##*/} [OPTION] -current options: diff --git a/bin/foamPackThirdParty b/bin/foamPackThirdParty index 37625b42cd..bb7c0f6d78 100755 --- a/bin/foamPackThirdParty +++ b/bin/foamPackThirdParty @@ -33,8 +33,9 @@ packDir=ThirdParty-$WM_PROJECT_VERSION toolsDir="${0%/*}/tools" # this script is located in the tools/ parent dir usage() { - while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < specify alternative output directory diff --git a/bin/foamUpdateCaseFileHeader b/bin/foamUpdateCaseFileHeader index 92d856f749..afc32cf151 100755 --- a/bin/foamUpdateCaseFileHeader +++ b/bin/foamUpdateCaseFileHeader @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -33,6 +33,7 @@ # #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat<&2 + cat< diff --git a/bin/rmdepold b/bin/rmdepold index 01197eb04f..bb83bbd9b6 100755 --- a/bin/rmdepold +++ b/bin/rmdepold @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -34,8 +34,9 @@ # - optionally remove empty directories #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat<&2 + cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< Date: Tue, 15 Feb 2011 17:09:51 +0100 Subject: [PATCH 25/39] STYLE: minor cleanup in wmakePrintBuild --- wmake/wmakePrintBuild | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild index 71ff327fe3..5461601d4f 100755 --- a/wmake/wmakePrintBuild +++ b/wmake/wmakePrintBuild @@ -29,6 +29,9 @@ # Print the version used when building the project # #------------------------------------------------------------------------------ +# persistent build tag +build="$WM_PROJECT_DIR/.build" + usage() { exec 1>&2 @@ -41,6 +44,7 @@ options: -major report \$WM_PROJECT_VERSION only and exit -update update \$WM_PROJECT_DIR/.build from the git information -pkg TAG specify packager/release tag ('none' marks an empty packager) + -short report short version information (ie, without pkg tag) -version VER specify an alternative version Print the version used when building the project, in this order of precedence: @@ -53,7 +57,7 @@ USAGE } #------------------------------------------------------------------------------ -unset checkOnly update package version oldPackage oldVersion +unset checkOnly update package version shortOpt # parse options while [ "$#" -gt 0 ] @@ -80,6 +84,10 @@ do package=$(echo "${2:-none}" | sed -e 's/!//g') shift 2 ;; + -short) + shortOpt=true + shift + ;; -v | -version) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" version="$2" @@ -93,17 +101,11 @@ done #------------------------------------------------------------------------------ -# -# persistent build tag -# -build="$WM_PROJECT_DIR/.build" - -unset oldVersion oldPackage - # # retrieve old values from the $WM_PROJECT_DIR/.build cache, stored as # version [packager] # +unset oldPackage oldVersion getOldValues() { set -- $(tail -1 $build 2>/dev/null) @@ -157,6 +159,11 @@ fi # retrieve old values getOldValues +if [ "$shortOpt" = true ] +then + unset package oldPackage +fi + # # update persistent build tag if possible # @@ -171,6 +178,14 @@ then fi fi +# cat<< DEBUG 1>&2 +# Debug information +# version='$version' +# package='$package' +# oldVersion='$oldVersion' +# oldPackage='$oldPackage' +# DEBUG + # check git vs. persistent build tag if [ -n "$checkOnly" ] From 28e63891739effb586a30b2f00303ad8418cfb69 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 17:24:39 +0100 Subject: [PATCH 26/39] STYLE: accept and silently ignore -current option in foamPackDeps - may be useful in the future. For now it keeps consistency with foamPackMake, foamPackBins --- bin/foamPackDeps | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/foamPackDeps b/bin/foamPackDeps index ab663a04c4..0f4d040fff 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -58,6 +58,7 @@ cat < specify alternative output directory * Pack and compress *.dep files from $codeBase @@ -67,7 +68,7 @@ USAGE } -unset outputDir +unset archOptions outputDir packExt=tgz # parse options @@ -81,6 +82,10 @@ do packExt=tbz shift ;; + -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' + archOptions="$WM_OPTIONS" + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} From 0e1945268e3c7a26ae585a28fb99a3b68a40b4a2 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 15 Feb 2011 17:32:25 +0000 Subject: [PATCH 27/39] ENH: Added particle local interaction output stats --- .../Templates/KinematicCloud/KinematicCloud.C | 2 + .../Templates/KinematicCloud/KinematicCloud.H | 4 + .../KinematicCloud/KinematicCloudI.H | 8 ++ .../LocalInteraction/LocalInteraction.C | 125 +++++++++++++++++- .../LocalInteraction/LocalInteraction.H | 51 ++++++- .../NoInteraction/NoInteraction.C | 4 +- .../NoInteraction/NoInteraction.H | 4 +- .../PatchInteractionModel.C | 11 +- .../PatchInteractionModel.H | 10 +- .../PatchInteractionModel/Rebound/Rebound.C | 4 +- .../PatchInteractionModel/Rebound/Rebound.H | 4 +- .../StandardWallInteraction.C | 4 +- .../StandardWallInteraction.H | 4 +- 13 files changed, 213 insertions(+), 22 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index fd6fbfcdc7..abdaeb1c35 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -830,8 +830,10 @@ void Foam::KinematicCloud::info() const << linearKineticEnergy << nl << " Rotational kinetic energy = " << rotationalKineticEnergy << nl; + this->injection().info(Info); this->surfaceFilm().info(Info); + this->patchInteraction().info(Info); } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index a9244fa020..02d5320447 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -555,6 +555,10 @@ public: inline const PatchInteractionModel >& patchInteraction() const; + //- Return reference to the patch interaction model + inline PatchInteractionModel >& + patchInteraction(); + //- Return reference to post-processing model inline PostProcessingModel >& postProcessing(); diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 62128ef7ed..133f7ee1d4 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -312,6 +312,14 @@ Foam::KinematicCloud::patchInteraction() const } +template +inline Foam::PatchInteractionModel >& +Foam::KinematicCloud::patchInteraction() +{ + return patchInteractionModel_(); +} + + template inline Foam::InjectionModel >& Foam::KinematicCloud::injection() diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index 7348c146c7..465dd9b04f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,6 +45,67 @@ Foam::label Foam::LocalInteraction::applyToPatch } +template +void Foam::LocalInteraction::readProps() +{ + IOobject propsDictHeader + ( + "localInteractionProperties", + this->owner().db().time().timeName(), + "uniform"/cloud::prefix/this->owner().name(), + this->owner().db(), + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); + + if (propsDictHeader.headerOk()) + { + const IOdictionary propsDict(propsDictHeader); + + propsDict.readIfPresent("nEscape", nEscape0_); + propsDict.readIfPresent("massEscape", massEscape0_); + propsDict.readIfPresent("nStick", nStick0_); + propsDict.readIfPresent("massStick", massStick0_); + } +} + + +template +void Foam::LocalInteraction::writeProps +( + const labelList& nEscape, + const scalarList& massEscape, + const labelList& nStick, + const scalarList& massStick +) const +{ + if (this->owner().db().time().outputTime()) + { + IOdictionary propsDict + ( + IOobject + ( + "localInteractionProperties", + this->owner().db().time().timeName(), + "uniform"/cloud::prefix/this->owner().name(), + this->owner().db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ) + ); + + propsDict.add("nEscape", nEscape); + propsDict.add("massEscape", massEscape); + propsDict.add("nStick", nStick); + propsDict.add("massStick", massStick); + + propsDict.regIOobject::write(); + } +} + + // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // template @@ -56,7 +117,15 @@ Foam::LocalInteraction::LocalInteraction : PatchInteractionModel(dict, cloud, typeName), patchData_(this->coeffDict().lookup("patches")), - patchIds_(patchData_.size()) + patchIds_(patchData_.size()), + nEscape0_(patchData_.size(), 0), + massEscape0_(patchData_.size(), 0.0), + nStick0_(patchData_.size(), 0), + massStick0_(patchData_.size(), 0.0), + nEscape_(patchData_.size(), 0), + massEscape_(patchData_.size(), 0.0), + nStick_(patchData_.size(), 0), + massStick_(patchData_.size(), 0.0) { const polyMesh& mesh = cloud.mesh(); const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); @@ -115,6 +184,8 @@ Foam::LocalInteraction::LocalInteraction << nl << exit(FatalError); } } + + readProps(); } @@ -126,7 +197,15 @@ Foam::LocalInteraction::LocalInteraction : PatchInteractionModel(pim), patchData_(pim.patchData_), - patchIds_(pim.patchIds_) + patchIds_(pim.patchIds_), + nEscape0_(pim.nEscape0_), + massEscape0_(pim.massEscape0_), + nStick0_(pim.nStick0_), + massStick0_(pim.massStick0_), + nEscape_(pim.nEscape_), + massEscape_(pim.massEscape_), + nStick_(pim.nStick_), + massStick_(pim.massStick_) {} @@ -147,7 +226,7 @@ bool Foam::LocalInteraction::correct bool& keepParticle, const scalar trackFraction, const tetIndices& tetIs -) const +) { vector& U = p.U(); @@ -170,6 +249,8 @@ bool Foam::LocalInteraction::correct keepParticle = false; active = false; U = vector::zero; + nEscape_[patchI]++; + massEscape_[patchI] += p.mass()*p.nParticle(); break; } case PatchInteractionModel::itStick: @@ -177,6 +258,8 @@ bool Foam::LocalInteraction::correct keepParticle = true; active = false; U = vector::zero; + nStick_[patchI]++; + massStick_[patchI] += p.mass()*p.nParticle(); break; } case PatchInteractionModel::itRebound: @@ -235,4 +318,38 @@ bool Foam::LocalInteraction::correct } +template +void Foam::LocalInteraction::info(Ostream& os) const +{ + labelList npe(nEscape_); + Pstream::listCombineGather(npe, plusEqOp