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/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/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/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options index 11303fd0e8..0dfd48454a 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options +++ b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options @@ -21,7 +21,6 @@ EXE_LIBS = \ -ledgeMesh \ -lengine \ -lerrorEstimation \ - -lEulerianInterfacialModels \ -lextrudeModel \ -lfieldFunctionObjects \ -lfileFormats \ diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt index 93dc9f702e..701b09d359 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt @@ -18,6 +18,7 @@ LINK_DIRECTORIES( ) INCLUDE_DIRECTORIES( + $ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE} $ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude $ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude ${PROJECT_SOURCE_DIR}/../vtkPV3Foam 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/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<. +# +# 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/foamClearPolyMesh b/bin/foamClearPolyMesh index 312e39f305..1d6d8a3df1 100755 --- a/bin/foamClearPolyMesh +++ b/bin/foamClearPolyMesh @@ -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 @@ -31,8 +31,9 @@ # #------------------------------------------------------------------------------ usage() { - while [ "$#" -ge 1 ]; do echo "$1" 1>&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/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/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 - -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 +47,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..36614ab781 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 ;; @@ -54,11 +54,15 @@ 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: - -o specify alternative output directory + -b, -bzip2 use bzip2 instead of gzip compression + -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 +74,9 @@ USAGE } -unset prefix outputDir +unset archOptions outputDir +packExt=tgz + # parse options while [ "$#" -gt 0 ] do @@ -78,6 +84,14 @@ do -h | -help) usage ;; + -b | -bzip2) + 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%%/} @@ -92,14 +106,17 @@ 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) -packExt=tgz packBase=${packDir}.${archOptions}_${timeStamp} # add optional output directory @@ -126,11 +143,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 new file mode 100755 index 0000000000..0f4d040fff --- /dev/null +++ b/bin/foamPackDeps @@ -0,0 +1,156 @@ +#!/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" + packDir=$WM_PROJECT-$WM_PROJECT_VERSION + ;; +esac + + +usage() { + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < specify alternative output directory + +* Pack and compress *.dep files from $codeBase + +USAGE + exit 1 +} + + +unset archOptions outputDir +packExt=tgz + +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -b | -bzip2) + 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%%/} + 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) +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 + + +# 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 $tarOpt $packFile -T - + +if [ $? -eq 0 ] +then + 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 +fi + +#------------------------------------------------------------------------------ diff --git a/bin/foamPackDoxygen b/bin/foamPackDoxygen index c9337e972f..e78cbcced6 100755 --- a/bin/foamPackDoxygen +++ b/bin/foamPackDoxygen @@ -33,12 +33,14 @@ packDir=$WM_PROJECT-$WM_PROJECT_VERSION htmlDir=doc/Doxygen/html 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 < use alternative prefix - -o specify alternative output directory + -b, -bzip2 use bzip2 instead of gzip compression + -o, -output specify alternative output directory + -prefix use alternative prefix * Pack and compress the OpenFOAM doxygen html for release @@ -46,7 +48,10 @@ USAGE exit 1 } + unset prefix outputDir +packExt=tgz + # parse options while [ "$#" -gt 0 ] do @@ -54,16 +59,20 @@ do -h | -help) usage ;; - -prefix | --prefix) - [ "$#" -ge 2 ] || usage "'$1' option requires an argument" - prefix=${2%%/} - shift 2 + -b | -bzip2) + packExt=tbz + shift ;; -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: '$*'" ;; @@ -87,7 +96,6 @@ then fi #------------------------------------------------------------------------------ -packExt=tgz packName=${packDir}_Doxygen # add optional output directory @@ -107,22 +115,32 @@ 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 ] 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 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 new file mode 100755 index 0000000000..c4b6841301 --- /dev/null +++ b/bin/foamPackMake @@ -0,0 +1,164 @@ +#!/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" + packDir=$WM_PROJECT-$WM_PROJECT_VERSION + ;; +esac + + +usage() { + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < + ${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 + +* 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 archOptions outputDir +packExt=tgz + +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -b | -bzip2) + 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%%/} + shift 2 + ;; + -*) + usage "unknown option: '$*'" + ;; + *) + break + ;; + esac +done + +if [ -n "$archOptions" ] +then + [ $# -eq 0 ] || usage "Error: cannot specify both -current and architecture" +else + archOptions="$1" + [ $# -eq 1 ] || usage "Error: specify architecture" +fi + + +#------------------------------------------------------------------------------ +timeStamp=$(date +%Y-%m-%d) +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 + + +# 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 $tarOpt $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/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/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 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<. # # Script -# foamListBinDirs +# foamListBinDirs [archOptions] # # Description # Lists directories containing binary files of OpenFOAM @@ -33,9 +33,9 @@ #------------------------------------------------------------------------------ toolsDir="${0%/*}" # this script is already located in the tools/ directory -[ $# -eq 2 ] || { +[ $# -eq 1 -o $# -eq 2 ] || { cat <&2 -Usage : ${0##*/} +Usage : ${0##*/} [archOptions] * Lists directories containing binary files for OpenFOAM @@ -49,8 +49,13 @@ USAGE #------------------------------------------------------------------------------ packDir="$1" -# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' -archOptions="$2" +# default to same as $WM_OPTIONS - eg, 'linux64GccDPOpt' +archOptions="${2:-$WM_OPTIONS}" + +[ -n "$archOptions" ] || { + echo "Error: no archOptions specified" 1>&2 + exit 1 +} # base arch (w/o precision, optimization, etc) # same as "$WM_ARCH$WM_COMPILER" @@ -65,42 +70,18 @@ arch3264=$(echo "$archOS" | sed -e 's@64@-64@') #------------------------------------------------------------------------------ - # check for essential directories -[ -d $packDir ] || { - echo "Error: directory $packDir does not exist" 1>&2 - exit 1 -} - - -# -# check places for libraries - same as $FOAM_LIBBIN -# this has moved around a bit in the recent past -# -[ -d $packDir/lib/$archOptions ] || \ -[ -d $packDir/platforms/$archOptions/lib ] || { -cat <&2 -Error: no directory for libraries exists: - $packDir/lib/$archOptions - $packDir/platforms/$archOptions/lib -LIB_CHECK - exit 1 -} - -# -# check places for executables - same as $FOAM_APPBIN -# this has moved around a bit in the recent past -# -[ -d $packDir/applications/bin/$archOptions ] || \ -[ -d $packDir/platforms/$archOptions/bin ] || { -cat <&2 -Error: no directory for executables exists: - $packDir/platforms/$archOptions/bin - $packDir/applications/bin/$archOptions -BIN_CHECK - exit 1 -} - +for dir in \ + $packDir \ + $packDir/platforms/$archOptions/bin \ + $packDir/platforms/$archOptions/lib \ + ; +do + [ -d $dir ] || { + echo "Error: directory $dir does not exist" 1>&2 + exit 1 + } +done #------------------------------------------------------------------------------ # list of directories @@ -108,13 +89,11 @@ dirList=$( for dir in \ $packDir/platforms/$archOptions/bin \ $packDir/platforms/$archOptions/lib \ - $packDir/wmake/bin/$archCompiler \ - $packDir/wmake/bin/$archOS \ + $packDir/wmake/platforms/$archCompiler \ + $packDir/wmake/platforms/$archOS \ $packDir/wmake/rules/General \ $packDir/wmake/rules/$archCompiler \ $packDir/wmake/rules/$archOS \ - $packDir/applications/bin/$archOptions \ - $packDir/lib/$archOptions \ ; do [ -d $dir ] && echo $dir diff --git a/bin/tools/foamListSourceFiles b/bin/tools/foamListSourceFiles index a8d4d59091..ef6c166e4c 100755 --- a/bin/tools/foamListSourceFiles +++ b/bin/tools/foamListSourceFiles @@ -46,7 +46,7 @@ USAGE packDir=$(echo "$1" | sed -e 's@//*@/@g' -e 's@/$@@') # check for essential directories -[ -d $packDir ] || { +[ -d "$packDir" ] || { echo "Error: directory $packDir does not exist" 1>&2 exit 1 } @@ -71,16 +71,15 @@ 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*" \ | sed \ - -e "\@$packDir/lib/@d" \ -e '\@/\.git/@d' \ -e '\@/\.tags/@d' \ -e '\@/README\.org@d' \ - -e '\@/bin/[^/]*/@{ \@/bin/tools/@!d }' \ - -e '\@/lib/@d' \ -e '\@/platforms/@d' \ -e '\@/t/@d' \ -e '\@/Make[.A-Za-z]*/[^/]*/@d' \ diff --git a/bin/tools/foamListThirdPartyBinDirs b/bin/tools/foamListThirdPartyBinDirs index 872049628e..c97fefede7 100755 --- a/bin/tools/foamListThirdPartyBinDirs +++ b/bin/tools/foamListThirdPartyBinDirs @@ -23,7 +23,7 @@ # along with OpenFOAM. If not, see . # # Script -# foamListThirdPartyBinDirs +# foamListThirdPartyBinDirs [archOptions] # # Description # Lists directories containing binary files for OpenFOAM ThirdParty @@ -33,9 +33,9 @@ #------------------------------------------------------------------------------ toolsDir="${0%/*}" # this script is already located in the tools/ directory -[ $# -eq 2 ] || { +[ $# -eq 1 -o $# -eq 2 ] || { cat <&2 -Usage : ${0##*/} +Usage : ${0##*/} [archOptions] * List directories containing binary files for OpenFOAM ThirdParty @@ -49,8 +49,13 @@ USAGE #------------------------------------------------------------------------------ packDir="$1" -# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' -archOptions="$2" +# default to same as $WM_OPTIONS - eg, 'linux64GccDPOpt' +archOptions="${2:-$WM_OPTIONS}" + +[ -n "$archOptions" ] || { + echo "Error: no archOptions specified" 1>&2 + exit 1 +} # base arch (w/o precision, optimization, etc) # same as "$WM_ARCH$WM_COMPILER" @@ -66,7 +71,10 @@ arch3264=$(echo "$archOS" | sed -e 's@64@-64@') #------------------------------------------------------------------------------ # check for essential directories -for dir in $packDir $packDir/platforms/$archOptions/lib +for dir in \ + $packDir \ + $packDir/platforms/$archOptions/lib \ + ; do [ -d $dir ] || { echo "Error: directory $dir does not exist" 1>&2 diff --git a/bin/tools/foamPackSource b/bin/tools/foamPackSource index 55a7b3bbee..83fe64391f 100755 --- a/bin/tools/foamPackSource +++ b/bin/tools/foamPackSource @@ -78,15 +78,25 @@ 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 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 diff --git a/bin/tools/org-batch b/bin/tools/org-batch index ae97370dbd..c5d8ac60c2 100755 --- a/bin/tools/org-batch +++ b/bin/tools/org-batch @@ -3,7 +3,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 @@ -32,10 +32,11 @@ Script=${0##*/} 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<. +# +# 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 diff --git a/src/Allwmake b/src/Allwmake index 00bbf8e5e6..128d4a9845 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -39,6 +39,7 @@ parallel/decompose/AllwmakeLnInclude dummyThirdParty/Allwmake $* wmake $makeOption lagrangian/basic +wmake $makeOption lagrangian/distributionModels wmake $makeOption finiteVolume wmake $makeOption genericPatchFields 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/Make/files b/src/OpenFOAM/Make/files index bf4c345bec..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 @@ -164,11 +165,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 diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C index 2f1b3383f5..6b34384df0 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.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 @@ -137,7 +137,7 @@ Foam::IOdictionary::IOdictionary(const IOobject& io) } // Everyone check or just master - bool masterOnly = + bool masterOnly = regIOobject::fileModificationChecking == timeStampMaster || regIOobject::fileModificationChecking == inotifyMaster; @@ -195,7 +195,7 @@ Foam::IOdictionary::IOdictionary(const IOobject& io, const dictionary& dict) } // Everyone check or just master - bool masterOnly = + bool masterOnly = regIOobject::fileModificationChecking == timeStampMaster || regIOobject::fileModificationChecking == inotifyMaster; @@ -239,6 +239,15 @@ Foam::IOdictionary::IOdictionary(const IOobject& io, const dictionary& dict) } +Foam::IOdictionary::IOdictionary(const IOobject& io, Istream& is) +: + regIOobject(io), + dictionary(is) +{ + dictionary::name() = IOobject::objectPath(); +} + + // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * // Foam::IOdictionary::~IOdictionary() diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H index cb66efd46f..581d9bec72 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.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 @@ -75,6 +75,9 @@ public: //- Construct given an IOobject and dictionary IOdictionary(const IOobject&, const dictionary&); + //- Construct given an IOobject and Istream + IOdictionary(const IOobject&, Istream&); + //- Destructor virtual ~IOdictionary(); diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index edcc2ca19d..46795873da 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..e113535624 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -368,7 +368,11 @@ 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; 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/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index ee411f7e15..cecce00eae 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.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 @@ -95,17 +95,22 @@ Foam::tmp > Foam::GeometricField::readField(Istream& is) { - if (is.version() < 2.0) - { - FatalIOErrorIn + return readField + ( + IOdictionary ( - "GeometricField::readField(Istream&)", + IOobject + ( + this->name(), + this->time().timeName(), + this->db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), is - ) << "IO versions < 2.0 are not supported." - << exit(FatalIOError); - } - - return readField(dictionary(is)); + ) + ); } @@ -384,45 +389,6 @@ Foam::GeometricField::GeometricField } -template class PatchField, class GeoMesh> -Foam::GeometricField::GeometricField -( - const IOobject& io, - const Mesh& mesh, - Istream& is -) -: - DimensionedField(io, mesh, dimless, false), - timeIndex_(this->time().timeIndex()), - field0Ptr_(NULL), - fieldPrevIterPtr_(NULL), - boundaryField_(*this, readField(is)) -{ - // Check compatibility between field and mesh - - if (this->size() != GeoMesh::size(this->mesh())) - { - FatalIOErrorIn - ( - "GeometricField::GeometricField" - "(const IOobject&, const Mesh&, Istream&)", - is - ) << " number of field elements = " << this->size() - << " number of mesh elements = " << GeoMesh::size(this->mesh()) - << exit(FatalIOError); - } - - readOldTimeIfPresent(); - - if (debug) - { - Info<< "Finishing read-construct of " - "GeometricField" - << endl << this->info() << endl; - } -} - - template class PatchField, class GeoMesh> Foam::GeometricField::GeometricField ( diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index d276ebfcae..9c04299593 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.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 @@ -325,14 +325,6 @@ public: const Mesh& ); - //- Construct and read from given stream - GeometricField - ( - const IOobject&, - const Mesh&, - Istream& - ); - //- Construct from dictionary GeometricField ( 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/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/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C index 6eeafc583b..4aac7b1aa9 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H index c1d00b118a..3002d3b336 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C b/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C index eca4a677a2..1d65ef2d9f 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C index 825d8c8400..590dd7c99a 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H index 405b8889a4..2107e7b2ec 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryIO.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryIO.C index 99a781a937..cc7ad439c7 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C index fac7d6c4de..3f8f75fc0c 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C index 71212250ff..54852a5d35 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H index 6f7c10e1e0..35ec60d0be 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C index b312469b6b..33416011af 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C index 114658753a..203f5a1b9e 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License 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/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/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C b/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C index 93a23c94cb..e497c361b2 100644 --- a/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C +++ b/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.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.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/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..66612e2e12 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 @@ -26,8 +26,8 @@ License #include "coalParcel.H" // Kinematic +#include "makeThermoParcelForces.H" // thermo variant #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -52,8 +52,8 @@ License namespace Foam { // Kinematic sub-models + makeThermoParcelForces(coalParcel); makeParcelDispersionModels(coalParcel); - makeParcelDragModels(coalParcel); makeReactingMultiphaseParcelInjectionModels(coalParcel); makeParcelCollisionModels(coalParcel); makeParcelPatchInteractionModels(coalParcel); diff --git a/src/lagrangian/intermediate/IntegrationScheme/Analytical/Analytical.C b/src/lagrangian/intermediate/IntegrationScheme/Analytical/Analytical.C index d7cd068730..fb237b0d04 100644 --- a/src/lagrangian/intermediate/IntegrationScheme/Analytical/Analytical.C +++ b/src/lagrangian/intermediate/IntegrationScheme/Analytical/Analytical.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/IntegrationScheme/Analytical/Analytical.H b/src/lagrangian/intermediate/IntegrationScheme/Analytical/Analytical.H index 50d4e50a81..d84e44bbba 100644 --- a/src/lagrangian/intermediate/IntegrationScheme/Analytical/Analytical.H +++ b/src/lagrangian/intermediate/IntegrationScheme/Analytical/Analytical.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/IntegrationScheme/Euler/Euler.C b/src/lagrangian/intermediate/IntegrationScheme/Euler/Euler.C index ecf0afcd34..8e7e1aea2b 100644 --- a/src/lagrangian/intermediate/IntegrationScheme/Euler/Euler.C +++ b/src/lagrangian/intermediate/IntegrationScheme/Euler/Euler.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/IntegrationScheme/Euler/Euler.H b/src/lagrangian/intermediate/IntegrationScheme/Euler/Euler.H index 8731a11807..1140713b13 100644 --- a/src/lagrangian/intermediate/IntegrationScheme/Euler/Euler.H +++ b/src/lagrangian/intermediate/IntegrationScheme/Euler/Euler.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.C b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.C index a0bc74ad33..a91e45d90e 100644 --- a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.C +++ b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.H b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.H index 1a4070c3ec..1cefd5ef59 100644 --- a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.H +++ b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationScheme.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationSchemeNew.C b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationSchemeNew.C index 0773e1d418..121ad0cf9d 100644 --- a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationSchemeNew.C +++ b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationSchemeNew.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationSchemesFwd.H b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationSchemesFwd.H index c0e0b7ed04..d6638b127e 100644 --- a/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationSchemesFwd.H +++ b/src/lagrangian/intermediate/IntegrationScheme/IntegrationScheme/IntegrationSchemesFwd.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/IntegrationScheme/makeIntegrationSchemes.C b/src/lagrangian/intermediate/IntegrationScheme/makeIntegrationSchemes.C index 28f828460f..c31058f237 100644 --- a/src/lagrangian/intermediate/IntegrationScheme/makeIntegrationSchemes.C +++ b/src/lagrangian/intermediate/IntegrationScheme/makeIntegrationSchemes.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index 63fa90db0d..2a1ea126f0 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -78,10 +78,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..d48136443d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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,14 +478,15 @@ void Foam::KinematicCloud::cloudReset(KinematicCloud& c) rndGen_ = c.rndGen_; - collisionModel_ = c.collisionModel_->clone(); - dispersionModel_= c.dispersionModel_->clone(); - dragModel_ = c.dragModel_->clone(); - injectionModel_ = c.injectionModel_->clone(); - patchInteractionModel_ = c.patchInteractionModel_->clone(); - postProcessingModel_ = c.postProcessingModel_->clone(); + forces_.transfer(c.forces_); - UIntegrator_ = c.UIntegrator_->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_.reset(c.UIntegrator_.ptr()); } @@ -529,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), @@ -540,10 +534,19 @@ Foam::KinematicCloud::KinematicCloud U_(U), mu_(mu), g_(g), - forces_(mesh_, particleProperties_, g_.value(), solution_.active()), + forces_ + ( + *this, + mesh_, + subModelProperties_.subOrEmptyDict + ( + "particleForces", + solution_.active() + ), + solution_.active() + ), collisionModel_(NULL), dispersionModel_(NULL), - dragModel_(NULL), injectionModel_(NULL), patchInteractionModel_(NULL), postProcessingModel_(NULL), @@ -606,7 +609,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 +626,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 +663,6 @@ Foam::KinematicCloud::KinematicCloud c.UCoeff_() ) ) - {} @@ -698,10 +699,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), @@ -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 b1020c1e20..50e8d182aa 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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; @@ -558,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 457e39abae..4c710fa797 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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 @@ -320,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/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index a8bb92cb5a..fdbf524781 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H index 1ffbff55de..9db309ff09 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H index 5fb203910d..9d32a24134 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License 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..1bd69843b7 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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_; } diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H index b2dc16dd67..a9daf9c22d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H index 7b0dcac9df..f0d08a8216 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.C b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.C index c5d142e1b5..be818774f5 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H index 6422dc8dc9..688018db72 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/baseClasses/reactingCloud/reactingCloud.C b/src/lagrangian/intermediate/clouds/baseClasses/reactingCloud/reactingCloud.C index a5931f029d..e6654070ae 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/reactingCloud/reactingCloud.C +++ b/src/lagrangian/intermediate/clouds/baseClasses/reactingCloud/reactingCloud.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/baseClasses/reactingCloud/reactingCloud.H b/src/lagrangian/intermediate/clouds/baseClasses/reactingCloud/reactingCloud.H index 74374cde98..de6e8e0e4e 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/reactingCloud/reactingCloud.H +++ b/src/lagrangian/intermediate/clouds/baseClasses/reactingCloud/reactingCloud.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/baseClasses/thermoCloud/thermoCloud.C b/src/lagrangian/intermediate/clouds/baseClasses/thermoCloud/thermoCloud.C index ff11e19ce0..4ad84c2ef9 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/thermoCloud/thermoCloud.C +++ b/src/lagrangian/intermediate/clouds/baseClasses/thermoCloud/thermoCloud.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/baseClasses/thermoCloud/thermoCloud.H b/src/lagrangian/intermediate/clouds/baseClasses/thermoCloud/thermoCloud.H index 26a5d361c2..7b85edc90f 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/thermoCloud/thermoCloud.H +++ b/src/lagrangian/intermediate/clouds/baseClasses/thermoCloud/thermoCloud.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.H b/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.H index f8b68f60f6..7770dbb68d 100644 --- a/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/derived/basicReactingCloud/basicReactingCloud.H b/src/lagrangian/intermediate/clouds/derived/basicReactingCloud/basicReactingCloud.H index 9a0f448b48..b93b0eda05 100644 --- a/src/lagrangian/intermediate/clouds/derived/basicReactingCloud/basicReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/basicReactingCloud/basicReactingCloud.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H index d1c1cd7cce..df00dc82cb 100644 --- a/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index c2310d3453..1fe4aa29d0 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,16 +42,19 @@ void Foam::KinematicParcel::setCellValues if (rhoc_ < td.cloud().constProps().rhoMin()) { - WarningIn - ( - "void Foam::KinematicParcel::setCellValues" - "(" - "TrackData&, " - "const scalar, " - "const label" - ")" - ) << "Limiting observed density in cell " << cellI << " to " - << td.cloud().constProps().rhoMin() << nl << endl; + if (debug) + { + WarningIn + ( + "void Foam::KinematicParcel::setCellValues" + "(" + "TrackData&, " + "const scalar, " + "const label" + ")" + ) << "Limiting observed density in cell " << cellI << " to " + << td.cloud().constProps().rhoMin() << nl << endl; + } rhoc_ = td.cloud().constProps().rhoMin(); } @@ -176,46 +179,21 @@ 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, mass, Re, mu); + const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, mu); + const forceSuSp Feff = Fcp + Fncp; // New particle velocity //~~~~~~~~~~~~~~~~~~~~~~ // 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_ + (Feff.Su() + Su)/(Feff.Sp() + ROOTVSMALL); + const scalar bp = Feff.Sp()/mass; Cud = bp; @@ -224,9 +202,10 @@ const Foam::vector Foam::KinematicParcel::calcVelocity vector Unew = Ures.value(); - dUTrans += dt*(utc*As*(Ures.average() - Uc_) - Fcp); + 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(); 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..838c8bf9d6 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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..c4cd31b5d3 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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/KinematicParcel/KinematicParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C index a443be57cc..b2b4dd822d 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 968b1cedf6..c8e625b919 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index 3b1769bb40..c6caeaa2bd 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H index e941681892..beee351820 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C index 5ed5fad185..cea9098238 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C index 153ac45fa6..06b6f45cd4 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index e455c1773e..ff74006c10 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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..8a7d37d9ca 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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/Templates/ThermoParcel/ThermoParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C index 8ee98bf04b..d052abebae 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/basicKinematicParcel.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/basicKinematicParcel.C index 08354f921d..b24d5b8cf3 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/basicKinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/basicKinematicParcel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/basicKinematicParcel.H b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/basicKinematicParcel.H index 0b1ee82718..38c1a2fbf7 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/basicKinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/basicKinematicParcel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/defineBasicKinematicParcel.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/defineBasicKinematicParcel.C index 6690d56071..6fbffda440 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/defineBasicKinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/defineBasicKinematicParcel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C index 27c54abfd2..c869ceeac0 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 @@ -26,8 +26,8 @@ License #include "basicKinematicParcel.H" // Kinematic +#include "makeParcelForces.H" #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -39,8 +39,8 @@ License namespace Foam { // Kinematic sub-models + makeParcelForces(basicKinematicParcel); makeParcelDispersionModels(basicKinematicParcel); - makeParcelDragModels(basicKinematicParcel); makeParcelInjectionModels(basicKinematicParcel); makeParcelCollisionModels(basicKinematicParcel); makeParcelPatchInteractionModels(basicKinematicParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C index fa38f8a5e2..d7c2c70054 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 @@ -26,8 +26,8 @@ License #include "basicReactingMultiphaseParcel.H" // Kinematic +#include "makeThermoParcelForces.H" // thermo variant #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -50,8 +50,8 @@ License namespace Foam { // Kinematic sub-models + makeThermoParcelForces(basicReactingMultiphaseParcel); makeParcelDispersionModels(basicReactingMultiphaseParcel); - makeParcelDragModels(basicReactingMultiphaseParcel); makeReactingMultiphaseParcelInjectionModels(basicReactingMultiphaseParcel); makeParcelCollisionModels(basicReactingMultiphaseParcel); makeParcelPatchInteractionModels(basicReactingMultiphaseParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/basicReactingParcel.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/basicReactingParcel.C index e0e92c019d..d5b6285842 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/basicReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/basicReactingParcel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/basicReactingParcel.H b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/basicReactingParcel.H index fdf25bf369..3302aa5150 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/basicReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/basicReactingParcel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/defineBasicReactingParcel.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/defineBasicReactingParcel.C index dabe1f9c45..98bab313c4 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/defineBasicReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/defineBasicReactingParcel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C index b1e3978011..cad82ff4c4 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 @@ -26,8 +26,8 @@ License #include "basicReactingParcel.H" // Kinematic +#include "makeThermoParcelForces.H" // thermo variant #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeReactingParcelInjectionModels.H" // Reacting variant #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -46,8 +46,8 @@ License namespace Foam { // Kinematic sub-models + makeThermoParcelForces(basicReactingParcel); makeParcelDispersionModels(basicReactingParcel); - makeParcelDragModels(basicReactingParcel); makeReactingParcelInjectionModels(basicReactingParcel); makeParcelCollisionModels(basicReactingParcel); makeParcelPatchInteractionModels(basicReactingParcel); diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.C index a8b739141a..2c26932342 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H index 1d8c9e5cc7..f48a1b3256 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C index 289e6d38cd..91a2c975d4 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 @@ -26,8 +26,8 @@ License #include "basicThermoParcel.H" // Kinematic +#include "makeThermoParcelForces.H" // thermo variant #include "makeParcelDispersionModels.H" -#include "makeParcelDragModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" @@ -42,8 +42,8 @@ License namespace Foam { // Kinematic sub-models + makeThermoParcelForces(basicThermoParcel); 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..452ef6690d --- /dev/null +++ b/src/lagrangian/intermediate/submodels/ForceTypes/ParticleForceList/ParticleForceList.C @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 activeForces(dict.lookup("activeForces")); + + wordHashSet models; + models.insert(activeForces); + + Info<< "Constructing particle forces" << endl; + if (models.size() > 0) + { + this->setSize(models.size()); + + label i = 0; + forAllConstIter(wordHashSet, models, iter) + { + const word& model = iter.key(); + set(i, ParticleForce::New(owner, mesh, dict, model)); + 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 mass, + const scalar Re, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + forAll(*this, i) + { + value += this->operator[](i).calcCoupled(p, dt, mass, Re, muc); + } + + return value; +} + + +template +Foam::forceSuSp Foam::ParticleForceList::calcNonCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar mass, + const scalar Re, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + forAll(*this, i) + { + 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 new file mode 100644 index 0000000000..0542216427 --- /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 mass, + const scalar Re, + const scalar muc + ) const; + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar mass, + const scalar Re, + 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/DispersionModel/DispersionModel/DispersionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModel.C index 3b09e6c6bf..6dd5c123e3 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModel.H index f2d968d51a..d5b80000c3 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModelNew.C b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModelNew.C index 898a195486..75e1b5c9f6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModelNew.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionModel/DispersionModelNew.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.C b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.C index 745dc5d281..5473886f5d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.H b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.H index 0e0f1aef88..2f337915dd 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/DispersionRASModel/DispersionRASModel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.C b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.C index 013a5c5c4f..d2657adaad 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.H b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.H index 9f63babd87..4b741bb41f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/GradientDispersionRAS/GradientDispersionRAS.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/NoDispersion/NoDispersion.C b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/NoDispersion/NoDispersion.C index d72d4a1c7f..11629331e6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/NoDispersion/NoDispersion.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/NoDispersion/NoDispersion.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/NoDispersion/NoDispersion.H b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/NoDispersion/NoDispersion.H index 959bdfbd85..55659ff40e 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/NoDispersion/NoDispersion.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/NoDispersion/NoDispersion.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/StochasticDispersionRAS/StochasticDispersionRAS.C b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/StochasticDispersionRAS/StochasticDispersionRAS.C index 0f98090718..9b710da3f2 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/StochasticDispersionRAS/StochasticDispersionRAS.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/StochasticDispersionRAS/StochasticDispersionRAS.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/StochasticDispersionRAS/StochasticDispersionRAS.H b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/StochasticDispersionRAS/StochasticDispersionRAS.H index 0c78efa3b1..5ac6cdb1a5 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/StochasticDispersionRAS/StochasticDispersionRAS.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/DispersionModel/StochasticDispersionRAS/StochasticDispersionRAS.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License 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/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 3879f09fb8..adfdd991a2 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H index 1b883632bf..3bbf913d5c 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelI.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelI.H index 6489a84cf7..c94520925f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelI.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelI.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelNew.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelNew.C index 9027f6e999..189704dca3 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelNew.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelNew.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C index f5255106fd..daf844e770 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H index 4bfeaaf7a1..c741179e1d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.C index e3d4929c75..9bb6a21cee 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.H index 88a3fcc7de..f736f31ad1 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/NoInjection/NoInjection.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) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License 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 64% 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..5ee4d8c0b6 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*(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,45 @@ 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 mass, + const scalar Re, + 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); + + 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/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..ce886f133b 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 mass, + const scalar Re, + 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/DragModel/DragModel.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C similarity index 61% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/DragForce/SphereDrag/SphereDragForce.C index 9be9e23bb3..da37d5131b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/DragModel/DragModel.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,73 +23,75 @@ License \*---------------------------------------------------------------------------*/ -#include "DragModel.H" +#include "SphereDragForce.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +Foam::scalar Foam::SphereDragForce::Cd(const scalar Re) const +{ + if (Re > 1000.0) + { + return 0.424; + } + else + { + return 24.0/Re*(1.0 + 1.0/6.0*pow(Re, 2.0/3.0)); + } +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::DragModel::DragModel(CloudType& owner) -: - SubModelBase(owner) -{} - - -template -Foam::DragModel::DragModel +Foam::SphereDragForce::SphereDragForce ( - 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) {} template -Foam::DragModel::DragModel(const DragModel& dm) +Foam::SphereDragForce::SphereDragForce +( + const SphereDragForce& df +) : - SubModelBase(dm) + ParticleForce(df) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -Foam::DragModel::~DragModel() +Foam::SphereDragForce::~SphereDragForce() {} // * * * * * * * * * * * * * * * 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::SphereDragForce::calcNonCoupled ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar mass, const scalar Re, - const scalar d, - const scalar mu + const scalar muc ) const { - const scalar Cd = this->Cd(Re); + forceSuSp value(vector::zero, 0.0); - return Cd*Re/d*mu/8.0; + const scalar ReCorr = max(Re, 1e-6); + value.Sp() = mass*0.75*muc*Cd(ReCorr)*ReCorr/(p.rho()*sqr(p.d())); + + return value; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "DragModelNew.C" - // ************************************************************************* // - 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..f9e2cca78e 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 mass, + const scalar Re, + 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/SphereDrag/SphereDrag.C b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C similarity index 63% rename from src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.C rename to src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Gravity/GravityForce.C index 7d0c0727cf..6af29abb1b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/DragModel/SphereDrag/SphereDrag.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,55 +23,56 @@ License \*---------------------------------------------------------------------------*/ -#include "SphereDrag.H" +#include "GravityForce.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::SphereDrag::SphereDrag +Foam::GravityForce::GravityForce ( - const dictionary&, - CloudType& owner + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict, + const word& forceType ) : - DragModel(owner) + ParticleForce(owner, mesh, dict), + g_(owner.g().value()) {} template -Foam::SphereDrag::SphereDrag(const SphereDrag& dm) +Foam::GravityForce::GravityForce(const GravityForce& gf) : - DragModel(dm) + ParticleForce(gf), + g_(gf.g_) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // template -Foam::SphereDrag::~SphereDrag() +Foam::GravityForce::~GravityForce() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::scalar Foam::SphereDrag::Cd(const scalar Re) const +Foam::forceSuSp Foam::GravityForce::calcNonCoupled +( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar mass, + const scalar Re, + const scalar muc +) const { - scalar Cd; - if (Re < SMALL) - { - Cd = GREAT; - } - else if (Re > 1000.0) - { - Cd = 0.424; - } - else - { - Cd = 24.0/Re*(1.0 + 1.0/6.0*pow(Re, 2.0/3.0)); - } + forceSuSp value(vector::zero, 0.0); - return Cd; + 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 new file mode 100644 index 0000000000..a215d0ef66 --- /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 mass, + const scalar Re, + 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..24e294e039 --- /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 mass, + const scalar Re, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + + const interpolation& HdotGradHInterp = *HdotGradHInterpPtr_; + + value.Su()= + mass*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..f849556f2e --- /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 mass, + const scalar Re, + 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..6b6f53aca3 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 +) +: + owner_(owner), + mesh_(mesh), + dict_(dict), + coeffs_(dictionary::null) +{} + + +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 mass, + const scalar Re, + 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 mass, + const scalar Re, + 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..e06646ca03 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/ParticleForce/ParticleForce.H @@ -0,0 +1,223 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 null + ParticleForce + ( + CloudType& owner, + const fvMesh& mesh, + const dictionary& dict + ); + + //- 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 mass, + const scalar Re, + const scalar muc + ) const; + + //- Calculate the non-coupled force + virtual forceSuSp calcNonCoupled + ( + const typename CloudType::parcelType& p, + const scalar dt, + const scalar mass, + const scalar Re, + 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..a113b44e13 --- /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 mass, + const scalar Re, + const scalar muc +) const +{ + forceSuSp value(vector::zero, 0.0); + + const volTensorField& gradU = *gradUPtr_; + 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 new file mode 100644 index 0000000000..4e1f08cc98 --- /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 mass, + const scalar Re, + 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..2f9ca986b4 --- /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), + 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 mass, + const scalar Re, + 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() = mass*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..2e646a37d7 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 mass, + const scalar Re, + 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..7bf439fa03 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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. + + F = Sp(U - Up) + Su + + Explicit contribution, Su specified as a force + Implicit coefficient, Sp specified as force/velocity + +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: + + // Constructors + + //- Construct null + inline forceSuSp(); + + //- Construct given Tuple2 + 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 [kg.m/s2] + inline const vector& Su() const; + + //- Return const access to the implicit coefficient [kg/s] + inline scalar Sp() const; + + + // Edit + + //- Return reference to the explicit contribution + inline vector& Su(); + + //- Return reference to the implicit coefficient + 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/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