Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2010-03-26 16:27:11 +00:00
103 changed files with 1571 additions and 940 deletions

4
.gitignore vendored
View File

@ -75,4 +75,8 @@ doc/[Dd]oxygen/man
# ignore .tags in the main directory # ignore .tags in the main directory
/.tags /.tags
# ignore eclipse project files in the main directory
/.cproject
/.project
# end-of-file # end-of-file

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -121,9 +121,8 @@ PDRkEpsilon::PDRkEpsilon
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh_ autoCreateK("k", mesh_)
), ),
epsilon_ epsilon_
( (
IOobject IOobject
@ -134,9 +133,8 @@ PDRkEpsilon::PDRkEpsilon
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh_ autoCreateEpsilon("epsilon", mesh_)
), ),
mut_ mut_
( (
IOobject IOobject
@ -147,9 +145,8 @@ PDRkEpsilon::PDRkEpsilon
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_) autoCreateMut("mut", mesh_)
), ),
alphat_ alphat_
( (
IOobject IOobject
@ -163,7 +160,9 @@ PDRkEpsilon::PDRkEpsilon
autoCreateAlphat("alphat", mesh_) autoCreateAlphat("alphat", mesh_)
) )
{ {
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
@ -250,7 +249,7 @@ void PDRkEpsilon::correct()
if (!turbulence_) if (!turbulence_)
{ {
// Re-calculate viscosity // Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity // Re-calculate thermal diffusivity
@ -302,7 +301,7 @@ void PDRkEpsilon::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -320,7 +319,7 @@ void PDRkEpsilon::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_ = rho_*Cmu_*sqr(k_)/epsilon_;

View File

@ -5,8 +5,8 @@ if (turbulence)
y.correct(); y.correct();
} }
dimensionedScalar k0("k0", k.dimensions(), SMALL); dimensionedScalar kMin("kMin", k.dimensions(), SMALL);
dimensionedScalar epsilon0("epsilon0", epsilon.dimensions(), SMALL); dimensionedScalar epsilonMin("epsilonMin", epsilon.dimensions(), SMALL);
volScalarField divU = fvc::div(phi/fvc::interpolate(rho)); volScalarField divU = fvc::div(phi/fvc::interpolate(rho));
@ -15,7 +15,7 @@ if (turbulence)
tgradU.clear(); tgradU.clear();
volScalarField Gcoef = volScalarField Gcoef =
Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilon0); Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilonMin);
#include "wallFunctions.H" #include "wallFunctions.H"
@ -40,7 +40,7 @@ if (turbulence)
epsEqn.relax(); epsEqn.relax();
epsEqn.solve(); epsEqn.solve();
bound(epsilon, epsilon0); bound(epsilon, epsilonMin);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -60,11 +60,13 @@ if (turbulence)
- fvm::Sp(rho*epsilon/k, k) - fvm::Sp(rho*epsilon/k, k)
); );
bound(k, k0); //FIXME: why no kEqn.relax()?
bound(k, kMin);
//- Re-calculate viscosity //- Re-calculate viscosity
mut = rho*Cmu*sqr(k)/(epsilon + epsilon0); mut = rho*Cmu*sqr(k)/(epsilon + epsilonMin);
#include "wallViscosity.H" #include "wallViscosity.H"
} }

View File

@ -327,14 +327,17 @@ meshQualityControls
// Set to 180 to disable. // Set to 180 to disable.
maxConcave 80; maxConcave 80;
//- Minimum projected area v.s. actual area. Set to -1 to disable.
minFlatness 0.5;
//- Minimum pyramid volume. Is absolute volume of cell pyramid. //- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to a sensible fraction of the smallest cell volume expected. // Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable. // Set to very negative number (e.g. -1E30) to disable.
minVol 1e-13; minVol 1e-13;
//- Minimum tet volume. Is absolute volume of the tet formed by the
// face-centre decomposition triangle and the cell centre.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable.
minTetVol 1e-20;
//- Minimum face area. Set to <0 to disable. //- Minimum face area. Set to <0 to disable.
minArea -1; minArea -1;

View File

@ -159,6 +159,25 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
} }
} }
{
faceSet faces(mesh, "wrongOrientedTriangleFaces", mesh.nFaces()/100 + 1);
if (mesh.checkFaceTets(true, 0, &faces))
{
noFailedChecks++;
label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{
Info<< " <<Writing " << nFaces
<< " faces with incorrectly orientated triangles to set "
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
}
{ {
faceSet faces(mesh, "skewFaces", mesh.nFaces()/100 + 1); faceSet faces(mesh, "skewFaces", mesh.nFaces()/100 + 1);
if (mesh.checkFaceSkewness(true, &faces)) if (mesh.checkFaceSkewness(true, &faces))

View File

@ -22,6 +22,9 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
splitMeshRegions
Description Description
Splits mesh into multiple regions. Splits mesh into multiple regions.
@ -32,6 +35,7 @@ Description
- any face inbetween differing cellZones (-cellZones) - any face inbetween differing cellZones (-cellZones)
Output is: Output is:
- volScalarField with regions as different scalars (-detectOnly) or
- mesh with multiple regions or - mesh with multiple regions or
- mesh with cells put into cellZones (-makeCellZones) - mesh with cells put into cellZones (-makeCellZones)
@ -47,7 +51,13 @@ Description
- useCellZonesOnly does not do a walk and uses the cellZones only. Use - useCellZonesOnly does not do a walk and uses the cellZones only. Use
this if you don't mind having disconnected domains in a single region. this if you don't mind having disconnected domains in a single region.
This option requires all cells to be in one (and one only) cellZone. This option requires all cells to be in one (and one only) cellZone.
- writes maps like decomposePar back to original mesh:
- pointRegionAddressing : for every point in this region the point in
the original mesh
- cellRegionAddressing : ,, cell ,, cell ,,
- faceRegionAddressing : ,, face ,, face in
the original mesh + 'turning index'. For a face in the same orientation
this is the original facelabel+1, for a turned face this is -facelabel-1
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "SortableList.H" #include "SortableList.H"

View File

@ -334,6 +334,14 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PtrList<surfaceScalarField> surfaceScalarFields; PtrList<surfaceScalarField> surfaceScalarFields;
readFields(mesh, objects, surfaceScalarFields); readFields(mesh, objects, surfaceScalarFields);
PtrList<surfaceVectorField> surfaceVectorFields;
readFields(mesh, objects, surfaceVectorFields);
PtrList<surfaceSphericalTensorField> surfaceSphericalTensorFields;
readFields(mesh, objects, surfaceSphericalTensorFields);
PtrList<surfaceSymmTensorField> surfaceSymmTensorFields;
readFields(mesh, objects, surfaceSymmTensorFields);
PtrList<surfaceTensorField> surfaceTensorFields;
readFields(mesh, objects, surfaceTensorFields);
// Construct the point fields // Construct the point fields
@ -619,6 +627,10 @@ int main(int argc, char *argv[])
|| volSymmTensorFields.size() || volSymmTensorFields.size()
|| volTensorFields.size() || volTensorFields.size()
|| surfaceScalarFields.size() || surfaceScalarFields.size()
|| surfaceVectorFields.size()
|| surfaceSphericalTensorFields.size()
|| surfaceSymmTensorFields.size()
|| surfaceTensorFields.size()
) )
{ {
labelIOList faceProcAddressing labelIOList faceProcAddressing
@ -650,6 +662,10 @@ int main(int argc, char *argv[])
fieldDecomposer.decomposeFields(volTensorFields); fieldDecomposer.decomposeFields(volTensorFields);
fieldDecomposer.decomposeFields(surfaceScalarFields); fieldDecomposer.decomposeFields(surfaceScalarFields);
fieldDecomposer.decomposeFields(surfaceVectorFields);
fieldDecomposer.decomposeFields(surfaceSphericalTensorFields);
fieldDecomposer.decomposeFields(surfaceSymmTensorFields);
fieldDecomposer.decomposeFields(surfaceTensorFields);
} }

View File

@ -191,6 +191,10 @@ int main(int argc, char *argv[])
|| objects.lookupClass(volSymmTensorField::typeName).size() || objects.lookupClass(volSymmTensorField::typeName).size()
|| objects.lookupClass(volTensorField::typeName).size() || objects.lookupClass(volTensorField::typeName).size()
|| objects.lookupClass(surfaceScalarField::typeName).size() || objects.lookupClass(surfaceScalarField::typeName).size()
|| objects.lookupClass(surfaceVectorField::typeName).size()
|| objects.lookupClass(surfaceSphericalTensorField::typeName).size()
|| objects.lookupClass(surfaceSymmTensorField::typeName).size()
|| objects.lookupClass(surfaceTensorField::typeName).size()
) )
{ {
Info<< "Reconstructing FV fields" << nl << endl; Info<< "Reconstructing FV fields" << nl << endl;
@ -235,6 +239,26 @@ int main(int argc, char *argv[])
objects, objects,
selectedFields selectedFields
); );
fvReconstructor.reconstructFvSurfaceFields<vector>
(
objects,
selectedFields
);
fvReconstructor.reconstructFvSurfaceFields<sphericalTensor>
(
objects,
selectedFields
);
fvReconstructor.reconstructFvSurfaceFields<symmTensor>
(
objects,
selectedFields
);
fvReconstructor.reconstructFvSurfaceFields<tensor>
(
objects,
selectedFields
);
} }
else else
{ {

View File

@ -30,7 +30,7 @@
# Locate user/group/shipped file with semantics similar to the # Locate user/group/shipped file with semantics similar to the
# ~OpenFOAM/fileName expansion. # ~OpenFOAM/fileName expansion.
# #
# The -mode option can be used to allow chaining from # The -mode option can be used to allow chaining from
# personal settings to site-wide settings. # personal settings to site-wide settings.
# #
# For example, within the user ~/.OpenFOAM/<VER>/prefs.sh: # For example, within the user ~/.OpenFOAM/<VER>/prefs.sh:
@ -119,27 +119,27 @@ nArgs=$#
fileName="$1" fileName="$1"
# Define the various places to be searched: # Define the various places to be searched:
files="" unset dirList
case "$mode" in case "$mode" in
*u*) # user *u*) # user
files="$files $HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION" dirList="$dirList $HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION"
files="$files $HOME/.${WM_PROJECT:-OpenFOAM}" dirList="$dirList $HOME/.${WM_PROJECT:-OpenFOAM}"
;; ;;
esac esac
case "$mode" in case "$mode" in
*g*) # group *g*) # group
files="$files $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION" dirList="$dirList $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION"
files="$files $WM_PROJECT_INST_DIR/site" dirList="$dirList $WM_PROJECT_INST_DIR/site"
;; ;;
esac esac
case "$mode" in case "$mode" in
*o*) # other *o*) # other
files="$files $WM_PROJECT_DIR/etc" dirList="$dirList $WM_PROJECT_DIR/etc"
;; ;;
esac esac
set -- $files set -- $dirList
# #

View File

@ -34,72 +34,73 @@
# Base settings # Base settings
FOAM_VERSION=1.6 FOAM_VERSION=1.6
SUPPLIED_VERSION_GCC=4.3.3 SUPPLIED_VERSION_GCC=4.4.3
MIN_VERSION_GCC=4.3.1 MIN_VERSION_GCC=4.3.3
# General # General
WIDTH=20 WIDTH=20
# Global variables # Global variables
FATALERROR=0 fatalError=0
CRITICALERROR=0 criticalError=0
SSHRSHOK=0
# System variables # System variables
HOST_NAME=`uname -n` HOST=`uname -n`
OS=`uname -s` OSTYPE=`uname -s`
USER_NAME=$LOGNAME USER_NAME=$LOGNAME
if [ ! -n $USER_NAME ]; then : ${USER_NAME:=$USER}
USER_NAME=$USER
fi # which OpenFOAM application to test for the Version
foamTestApp=icoFoam
#============================================================================== #==============================================================================
# HELPER FUNCTIONS # HELPER FUNCTIONS
#============================================================================== #==============================================================================
hline () { hline()
{
echo "-------------------------------------------------------------------------------" echo "-------------------------------------------------------------------------------"
} }
expenv () { heading()
eval "echo $1" {
} echo
echo
heading () {
echo ""
echo ""
echo "$1" echo "$1"
} }
lenBase () { lenBase()
{
echo $1 | tr -d " " | wc -m | tr -d " " echo $1 | tr -d " " | wc -m | tr -d " "
} }
length () { length()
{
NOCHAR=`lenBase $1` NOCHAR=`lenBase $1`
NOCHAR=`expr $NOCHAR - 1` NOCHAR=`expr $NOCHAR - 1`
if [ $NOCHAR -eq -1 ]; then [ $NOCHAR -ge 0 ] || NOCHAR=0
NOCHAR=0
fi
echo $NOCHAR echo $NOCHAR
} }
stringLength () { stringLength()
{
echo $1 | wc -m | tr -d " " echo $1 | wc -m | tr -d " "
} }
fixlen () { fixlen()
{
WORD=$1 WORD=$1
ONELEN=`stringLength $1` ONELEN=`stringLength $1`
LDIFF=`expr $ONELEN - $2` LDIFF=`expr $ONELEN - $2`
if [ $LDIFF -le 1 ]; then if [ $LDIFF -le 1 ]
while [ $LDIFF -lt 0 ] ; do then
while [ $LDIFF -lt 0 ]
do
WORD="$WORD " WORD="$WORD "
LDIFF=`expr $LDIFF + 1` LDIFF=`expr $LDIFF + 1`
done done
@ -112,33 +113,34 @@ fixlen () {
} }
reportEnv () { reportEnv()
{
EXP_ENV=`eval "echo $1"` EXP_ENV=`eval "echo $1"`
EXP_PATH=`eval "echo $2"` EXP_PATH=`eval "echo $2"`
CRIT="$3" CRIT="$3"
EXISTS=" no " EXISTS=" no "
ON_PATH="" ON_PATH=""
if [ `length $EXP_ENV` -gt 0 ] ; then if [ `length $EXP_ENV` -gt 0 ]
case $OS in then
case "$OSTYPE" in
SunOS) SunOS)
if /usr/bin/test -e $EXP_ENV ; then if /usr/bin/test -e $EXP_ENV
then
EXISTS=" yes " EXISTS=" yes "
if [ "$2" != noPath ]; then if [ "$2" != noPath ]
then
ON_PATH=" no " ON_PATH=" no "
OLD_IFS=$IFS oldIFS=$IFS
IFS=':' IFS=':'
for e in $EXP_PATH for e in $EXP_PATH
do do
if \ case "$e" in
[ \ "$EXP_ENV" | "$EXP_ENV/bin" | "$EXP_ENV/lib")
"$e" = "$EXP_ENV" \
-o "$e" = "${EXP_ENV}/bin" \
-o "${EXP_ENV}/lib" = "$e" \
] ; then
ON_PATH="yes " ON_PATH="yes "
fi ;;
esac
done done
IFS=$OLD_IFS IFS=$oldIFS
else else
CRIT=" $3" CRIT=" $3"
fi fi
@ -148,24 +150,23 @@ reportEnv () {
echo "`fixlen "$1" 21` `fixlen "$EXP_ENV" 40` $EXISTS $ON_PATH $CRIT" echo "`fixlen "$1" 21` `fixlen "$EXP_ENV" 40` $EXISTS $ON_PATH $CRIT"
;; ;;
*) *)
if [ -e "$EXP_ENV" ] ; then if [ -e "$EXP_ENV" ]
then
EXISTS=" yes " EXISTS=" yes "
if [ "$2" != noPath ]; then if [ "$2" != noPath ]
then
ON_PATH=" no " ON_PATH=" no "
OLD_IFS=$IFS oldIFS=$IFS
IFS=':' IFS=':'
for e in $EXP_PATH for e in $EXP_PATH
do do
if \ case "$e" in
[ \ "$EXP_ENV" | "$EXP_ENV/bin" | "$EXP_ENV/lib")
"$e" = "$EXP_ENV" \
-o "$e" = "${EXP_ENV}/bin" \
-o "${EXP_ENV}/lib" = "$e" \
] ; then
ON_PATH="yes " ON_PATH="yes "
fi ;;
esac
done done
IFS=$OLD_IFS IFS=$oldIFS
else else
CRIT=" $3" CRIT=" $3"
fi fi
@ -180,11 +181,13 @@ reportEnv () {
fi fi
ERROR="false" ERROR="false"
if [ "$EXISTS" = no ] || [ "$ON_PATH" = no ]; then if [ "$EXISTS" = no ] || [ "$ON_PATH" = no ]
then
ERROR="true" ERROR="true"
fi fi
if [ "$3" = yes ] && [ "$ERROR" = true ]; then if [ "$3" = yes ] && [ "$ERROR" = true ]
CRITICALERROR=`expr $CRITICALERROR + 1` then
criticalError=`expr $criticalError + 1`
echo "WARNING: CRITICAL ERROR" echo "WARNING: CRITICAL ERROR"
echo echo
fi fi
@ -192,197 +195,111 @@ reportEnv () {
} }
findExec() { findExec()
OLD_IFS=$IFS {
oldIFS=$IFS
IFS=':' IFS=':'
for d in $1 for d in $1
do do
case $OS in case "$OSTYPE" in
SunOS) SunOS)
if /usr/bin/test ! -d "$d/$2" -a -x "$d/$2" ; then if /usr/bin/test ! -d "$d/$2" -a -x "$d/$2"
IFS=$OLD_IFS then
IFS=$oldIFS
echo "$d/$2" echo "$d/$2"
return 0 return 0
fi fi
;; ;;
*) *)
if [ ! -d "$d/$2" -a -x "$d/$2" ]; then if [ ! -d "$d/$2" -a -x "$d/$2" ]
IFS=$OLD_IFS then
IFS=$oldIFS
echo "$d/$2" echo "$d/$2"
return 0 return 0
fi fi
;; ;;
esac esac
done done
IFS=$OLD_IFS IFS=$oldIFS
return 1 return 1
} }
reportExecutable () { reportExecutable()
{
APP_PATH="" APP_PATH=""
APP_PATH=`findExec $PATH $1` APP_PATH=`findExec $PATH $1`
APP_SPEC="$2" APP_SPEC="$2"
if [ ! -n $APP_PATH ];then if [ ! -n $APP_PATH ]
then
echo "`fixlen "$1" 9`" "*** not installed ***" echo "`fixlen "$1" 9`" "*** not installed ***"
VERSION="" VERSION=""
case $1 in case "$1" in
icoFoam) gcc | $foamTestApp)
echo " CRITICAL ERROR" echo " CRITICAL ERROR"
CRITICALERROR=`expr $CRITICALERROR + 1` criticalError=`expr $criticalError + 1`
;; ;;
gcc)
echo " CRITICAL ERROR"
CRITICALERROR=`expr $CRITICALERROR + 1`
;;
tar) ;;
gtar) ;;
gzip) ;;
dx) ;;
esac esac
echo echo
return 1 return 1
fi fi
case $1 in case "$1" in
icoFoam) $foamTestApp)
VERSION=`$1 2>&1 \ VERSION=`$1 -case /dev/null 2>&1 \
| \grep ' Version:' \ | sed -ne 's/^.*Version: *\([^ ][^ ]*\).*/\1/p'`
| sed -e 's/.*Version:/Version:/' \ ;;
| cut -d" " -f3` gcc)
VERSION=`$1 -v 2>&1 \
| sed -ne 's/^gcc version \([0-9][0-9.]*\).*/\1/p' `
if [ "$VERSION" != "$SUPPLIED_VERSION_GCC" ]
then
echo "WARNING: gcc version does not match gcc supplied" \
"with this release of OpenFOAM"
echo " Supplied version: $SUPPLIED_VERSION_GCC"
echo " User version : $VERSION"
echo " Minimum required: $MIN_VERSION_GCC"
echo ""
fi
;;
gtar)
VERSION=`$APP_PATH --version | head -1`
;;
tar)
VERSION=`$APP_PATH --version | head -1 | cut -d" " -f4`
;;
gzip)
case "$OSTYPE" in
SunOS)
VERSION=`$1 --version 2>&1 | grep gzip | cut -d" " -f2`
;; ;;
gcc) *)
VERSION=`$1 -v 2>&1 \ VERSION=`$1 --version | head -1 | cut -d" " -f2`
| grep 'gcc version' \
| cut -d" " -f3`
if [ ! "$VERSION" = "$SUPPLIED_VERSION_GCC" ]; then
echo "WARNING: gcc version does not match gcc supplied" \
"with this release of OpenFOAM"
echo " Supplied version: $SUPPLIED_VERSION_GCC"
echo " User version : $VERSION"
echo " Minimum required: $MIN_VERSION_GCC"
echo ""
fi
;;
gtar)
VERSION=`$APP_PATH --version | head -1`
;;
tar)
VERSION=`$APP_PATH --version | head -1 | cut -d" " -f4`
;;
gzip)
case $OS in
SunOS)
VERSION=`$1 --version 2>&1 | grep gzip | cut -d" " -f2`
;;
*)
VERSION=`$1 --version | head -1 | cut -d" " -f2`
;;
esac
;; ;;
esac
;;
esac esac
if [ "$APP_PATH" = "$APP_SPEC" ] || [ ! "$2" ]; then if [ "$APP_PATH" = "$APP_SPEC" ] || [ ! "$2" ]
then
echo "`fixlen "$1" 9` `fixlen "$VERSION" 10` `fixlen "$APP_PATH" 58`" echo "`fixlen "$1" 9` `fixlen "$VERSION" 10` `fixlen "$APP_PATH" 58`"
else else
echo "`fixlen "$1" 9` `fixlen "$VERSION" 10`" echo "`fixlen "$1" 9` `fixlen "$VERSION" 10`"
echo "WARNING: Conflicting installations:" echo "WARNING: Conflicting installations:"
echo " OpenFOAM settings : $APP_SPEC" echo " OpenFOAM settings : $APP_SPEC"
echo " current path : $APP_PATH" echo " current path : $APP_PATH"
case $1 in case "$1" in
icoFoam) gcc | $foamTestApp)
echo " CRITICAL ERROR" echo " CRITICAL ERROR"
CRITICALERROR=`expr $CRITICALERROR + 1` criticalError=`expr $criticalError + 1`
;; ;;
gcc)
echo " CRITICAL ERROR"
CRITICALERROR=`expr $CRITICALERROR + 1`
;;
gtar) ;;
gzip) ;;
dx) ;;
esac esac
echo "" echo ""
fi fi
} }
pingTest () { checkOpenFOAMEnvironment()
RESULT="" {
case $OS in
SunOS)
PINGTEST=`/usr/sbin/ping $1 2>&1`
if [ "`echo $PINGTEST | grep alive`" != "" ] ; then
RESULT="Successful"
elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then
RESULT="No_entry_for_\"$1\"_in_/etc/hosts"
else
RESULT="Networking_cannot_reach_$1"
fi
;;
*)
PINGTEST=`/bin/ping -w 3 -c 1 $1 2>&1`
if [ "`echo $PINGTEST | grep '1 received'`" != "" ] ; then
RESULT="Successful"
elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then
RESULT="No_entry_for_\"$1\"_in_/etc/hosts"
else
RESULT="Networking_cannot_reach_$1"
fi
;;
esac
echo "`fixlen "Pinging_$1" 25` `fixlen "$RESULT" 45` `fixlen "$2" 5`"
if [ "$2" = yes ] && [ "$RESULT" != Successful ]; then
CRITICALERROR=`expr $CRITICALERROR + 1`
echo "WARNING: CRITICAL ERROR"
echo
fi
}
telnetPortTest () {
telnet -e A $1 $2 <<EOF
A
quit
EOF
}
checkTelnetPort () {
if [ -x "/usr/bin/telnet" ] || [ -x "/bin/telnet" ] ; then
RESULT=`telnetPortTest $1 $2 2>&1 | egrep "onnect.* [t|r]"`
if [ "`echo $RESULT | grep 'Connected to'`" ] ; then
RESULT='Successful'
elif [ "`echo $RESULT | grep 'Connection refused'`" ] ; then
RESULT='Unsuccessful_connection_refused*'
else
RESULT="Not_active*"
fi
else
RESULT='No_telnet_installed:_cannot_check*'
fi
}
checkRsh () {
checkTelnetPort $HOST_NAME 222
echo "`fixlen "Test_rsh:" 25` `fixlen "$RESULT" 45` "yes""
if [ "$RESULT" != Successful ]; then
SSHRSHOK=`expr $SSHRSHOK + 1`
fi
}
checkSsh () {
checkTelnetPort $HOST_NAME 22
echo "`fixlen "Test_ssh:" 25` `fixlen "$RESULT" 45` "yes""
if [ "$RESULT" != Successful ]; then
SSHRSHOK=`expr $SSHRSHOK + 1`
fi
}
checkOpenFOAMEnvironment() {
[ -d "$WM_PROJECT_INST_DIR" ] && [ -d "$WM_THIRD_PARTY_DIR" ] || { [ -d "$WM_PROJECT_INST_DIR" ] && [ -d "$WM_THIRD_PARTY_DIR" ] || {
echo "" echo ""
echo "FATAL ERROR: OpenFOAM environment not configured." echo "FATAL ERROR: OpenFOAM environment not configured."
@ -396,54 +313,50 @@ checkOpenFOAMEnvironment() {
} }
checkUserShell() { checkUserShell()
{
echo "`fixlen Shell: $WIDTH` ${SHELL##*/}"
case $SHELL in case $SHELL in
*/csh | */tcsh) */csh | */tcsh | */bash | */ksh)
# USER_CONFIG_TYPE="cshrc" ;;
echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}" *)
;; echo "FATAL ERROR: Cannot identify the shell you are running."
*/bash | */ksh) echo " OpenFOAM ${FOAM_VERSION} is compatible with "
# USER_CONFIG_TYPE="bashrc" echo " csh, tcsh, ksh and bash."
echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}" echo
;; fatalError=`expr $fatalError + 1`
*) ;;
# USER_CONFIG_TYPE=""
echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}"
echo "FATAL ERROR: Cannot identify the shell you are running."
echo " OpenFOAM ${FOAM_VERSION} is compatible with "
echo " csh, tcsh, ksh and bash."
echo
FATALERROR=`expr $FATALERROR + 1`;;
esac esac
} }
checkHostName() { checkHostName()
if [ ! "$HOST_NAME" ]; then {
echo "`fixlen "Host:" $WIDTH` ${HOST_NAME}" echo "`fixlen Host: $WIDTH` $HOST"
if [ ! "$HOST" ]
then
echo "FATAL ERROR: Cannot stat hostname." echo "FATAL ERROR: Cannot stat hostname."
echo " Contact your system administrator, " echo " Contact your system administrator, "
echo " OpenFOAM ${FOAM_VERSION} needs a valid " echo " OpenFOAM ${FOAM_VERSION} needs a valid "
echo " hostname to function." echo " hostname to function."
echo echo
FATALERROR=`expr $FATALERROR + 1` fatalError=`expr $fatalError + 1`
else
echo "`fixlen "Host:" $WIDTH` ${HOST_NAME}"
fi fi
} }
checkOS () { checkOS()
case "$OS" in {
case "$OSTYPE" in
Linux | LinuxAMD64 | SunOS ) Linux | LinuxAMD64 | SunOS )
echo "`fixlen "OS:" $WIDTH` ${OS} version $(uname -r)" echo "`fixlen OS: $WIDTH` $OSTYPE version $(uname -r)"
;; ;;
*) *)
echo "FATAL ERROR: Incompatible operating system \"$OS\"." echo "FATAL ERROR: Incompatible operating system \"$OSTYPE\"."
echo " OpenFOAM ${FOAM_VERSION} is currently " echo " OpenFOAM $FOAM_VERSION is currently "
echo " available for Linux and SunOS only." echo " available for Linux and SunOS only."
echo echo
FATALERROR=`expr $FATALERROR + 1` fatalError=`expr $fatalError + 1`
;; ;;
esac esac
} }
@ -466,8 +379,8 @@ hline
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
heading "Checking main OpenFOAM env variables..." heading "Checking main OpenFOAM env variables..."
COL1=`fixlen "Environment_variable" 21` COL1=`fixlen Environment_variable 21`
COL2=`fixlen "Set_to_file_or_directory" 40` COL2=`fixlen Set_to_file_or_directory 40`
COL3="Valid" COL3="Valid"
COL4="Path" COL4="Path"
COL5="Crit" COL5="Crit"
@ -505,20 +418,21 @@ hline
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
heading "Third party software" heading "Third party software"
COL1=`fixlen "Software" 9` COL1=`fixlen Software 9`
COL2=`fixlen "Version" 10` COL2=`fixlen Version 10`
COL3=`fixlen "Location" 10` COL3=`fixlen Location 10`
hline hline
echo "$COL1 $COL2 $COL3" echo "$COL1 $COL2 $COL3"
hline hline
reportExecutable gcc "${WM_COMPILER_DIR}/bin/gcc" reportExecutable gcc
reportExecutable gzip reportExecutable gzip
if [ "$OS" = Linux ] ; then if [ "$OSTYPE" = Linux ]
then
reportExecutable tar reportExecutable tar
else else
reportExecutable gtar reportExecutable gtar
fi fi
reportExecutable icoFoam "${FOAM_APPBIN}/icoFoam" reportExecutable $foamTestApp "$FOAM_APPBIN/$foamTestApp"
hline hline
@ -526,27 +440,28 @@ hline
heading "Summary" heading "Summary"
hline hline
if [ $FATALERROR -gt 0 ] ; then if [ $fatalError -gt 0 ]
echo "The system test has evoked $FATALERROR fatal error(s)." then
echo "The system test has evoked $fatalError fatal error(s)."
else else
echo "Base configuration ok." echo "Base configuration ok."
fi fi
echo "" if [ $criticalError -gt 0 ]
if [ $CRITICALERROR -gt 0 ]; then then
echo "The foam installation contains $CRITICALERROR critical error(s)." echo "The foam installation contains $criticalError critical error(s)."
else else
echo "Critical systems ok." echo "Critical systems ok."
fi fi
echo "" if [ $criticalError -gt 0 ] || [ $fatalError -gt 0 ]
if [ $CRITICALERROR -gt 0 ] || [ $FATALERROR -gt 0 ]; then then
echo "Review the output for warning messages and consult " echo
echo "the installation guide for trouble shooting." echo "Review the output for warning messages and consult"
echo "the installation guide for troubleshooting."
fi fi
echo ""
echo "done." echo
echo Done
echo "" echo
exit 0 exit 0

View File

@ -46,7 +46,7 @@ if [ $# = 0 -a -f "./Allrun" ]
then then
# Specialised script. # Specialised script.
./Allrun ./Allrun
elif [ -d "./system" ] elif [ -d system ]
then then
# Normal case. # Normal case.
parentDir=`dirname $PWD` parentDir=`dirname $PWD`
@ -55,19 +55,19 @@ then
runApplication $application runApplication $application
else else
# Loop over sub-directories and compile any applications # Loop over sub-directories and compile any applications
for case in * for caseName in *
do do
if [ -d $case -a -d "$case/Make" ] if [ -d $caseName -a -d "$caseName/Make" ]
then then
(compileApplication $case) ( compileApplication $caseName )
fi fi
done done
# Recurse to subdirectories # Recurse to subdirectories
for case in * for caseName in *
do do
if [ -d $case ] if [ -d $caseName ]
then then
(cd $case && $thisScript) ( cd $caseName && $thisScript )
fi fi
done done
fi fi

View File

@ -38,31 +38,32 @@ FOAM_VERSION=1.6
HLINE="-----------------------------------------------------------------------" HLINE="-----------------------------------------------------------------------"
WIDTH=16 WIDTH=16
unset FATALERROR unset fatalError
# FUNCTIONS # FUNCTIONS
# ~~~~~~~~~ # ~~~~~~~~~
heading () { heading()
echo "" {
echo
echo "$1" echo "$1"
echo "$HLINE" echo "$HLINE"
} }
lenBase () { lenBase()
{
echo $1 | tr -d " " | wc -m | tr -d " " echo $1 | tr -d " " | wc -m | tr -d " "
} }
length () { length()
{
NOCHAR=$(lenBase $1) NOCHAR=$(lenBase $1)
NOCHAR=$(expr $NOCHAR - 1) NOCHAR=$(expr $NOCHAR - 1)
if [ $NOCHAR -eq -1 ] [ $NOCHAR -ge 0 ] || NOCHAR=0
then
NOCHAR=0
fi
echo $NOCHAR echo $NOCHAR
} }
fixlen () { fixlen()
{
WORD=$1 WORD=$1
ONELEN=$(length "$1") ONELEN=$(length "$1")
LDIFF=$(expr $ONELEN - $2) LDIFF=$(expr $ONELEN - $2)
@ -86,48 +87,43 @@ fixlen () {
heading "Checking basic system..." heading "Checking basic system..."
# check shell # check shell
echo "$(fixlen "Shell:" $WIDTH) $SHELL" echo "$(fixlen Shell: $WIDTH) $SHELL"
case "$SHELL" in case "$SHELL" in
*/csh | */tcsh) */csh | */tcsh | */bash | */ksh)
USER_CONFIG_TYPE=cshrc
;;
*/bash | */ksh)
USER_CONFIG_TYPE=bashrc
;; ;;
*) *)
USER_CONFIG_TYPE="" echo "ERROR: Cannot identify the current shell."
echo "FATALERROR: Cannot identify the current shell." echo " OpenFOAM $FOAM_VERSION is compatible"
echo " OpenFOAM ${FOAM_VERSION} is compatible" echo " with csh, tcsh, ksh and bash."
echo " with csh, tcsh, ksh and bash."
echo echo
FATALERROR=yes fatalError=true
;; ;;
esac esac
# check hostname # check hostname
HOST=$(uname -n) HOST=$(uname -n)
echo "$(fixlen "Host:" $WIDTH) $HOST" echo "$(fixlen Host: $WIDTH) $HOST"
if [ $(length $HOST) -eq 0 ] if [ $(length $HOST) -eq 0 ]
then then
echo "FATALERROR: Cannot stat hostname." echo "ERROR: Cannot stat hostname."
echo " OpenFOAM ${FOAM_VERSION} needs a valid hostname to function." echo " OpenFOAM $FOAM_VERSION needs a valid hostname to function."
echo " Contact your system administrator. " echo " Contact your system administrator. "
echo echo
FATALERROR=yes fatalError=true
fi fi
# check os # check os
OS=$(uname -s) OSTYPE=$(uname -s)
case "$OS" in case "$OSTYPE" in
Linux | LinuxAMD64 | SunOS ) Linux | LinuxAMD64 | SunOS )
echo "$(fixlen "OS:" $WIDTH) ${OS} version $(uname -r)" echo "$(fixlen OS: $WIDTH) $OSTYPE version $(uname -r)"
;; ;;
*) *)
echo "FATALERROR: Incompatible operating system \"$OS\"." echo "ERROR: Incompatible operating system \"$OSTYPE\"."
echo " OpenFOAM ${FOAM_VERSION} is currently available for " echo " OpenFOAM $FOAM_VERSION is currently available for "
echo " Linux, LinuxAMD64 and SunOS only." echo " Linux, LinuxAMD64 and SunOS only."
echo echo
FATALERROR=yes fatalError=true
;; ;;
esac esac
@ -139,20 +135,20 @@ then
USER_NAME=$USER USER_NAME=$USER
fi fi
echo "$(fixlen "User:" $WIDTH) ${USER_NAME}" echo "$(fixlen User: $WIDTH) ${USER_NAME}"
if [ $(length $USER_NAME) -eq 0 ] if [ $(length $USER_NAME) -eq 0 ]
then then
echo "FATALERROR: Cannot stat user name ${USER_NAME}." echo "ERROR: Cannot stat user name $USER_NAME."
echo " OpenFOAM ${FOAM_VERSION} needs a valid user name." echo " OpenFOAM $FOAM_VERSION needs a valid user name."
echo " Contact your system administrator. " echo " Contact your system administrator. "
echo "" echo
FATALERROR=yes fatalError=true
fi fi
echo "" echo
echo "" echo
if [ -n "$FATALERROR" ] if [ "$fatalError" = true ]
then then
echo "System check: FAIL" echo "System check: FAIL"
echo "==================" echo "=================="

View File

@ -45,12 +45,12 @@ for cmd in etags ectags
do do
type $cmd >/dev/null 2>&1 || { type $cmd >/dev/null 2>&1 || {
echo "${0##*/} cannot build tag files: '$cmd' command not found" echo "${0##*/} cannot build tag files: '$cmd' command not found"
exit exit 1
} }
done done
cd $WM_PROJECT_DIR || exit cd $WM_PROJECT_DIR || exit 1
mkdir .tags 2>/dev/null mkdir .tags 2>/dev/null

View File

@ -49,7 +49,7 @@ do
echo "removing all *~ files: $i" echo "removing all *~ files: $i"
find $i \( -name '*~' -o -name '.*~' \) -print | xargs -t rm 2>/dev/null find $i \( -name '*~' -o -name '.*~' \) -print | xargs -t rm 2>/dev/null
else else
echo "no directory: $i" 1>&2 echo "no directory: $i" 1>&2
fi fi
done done

View File

@ -1,31 +1,30 @@
#!/bin/sh #!/bin/sh
# $0 string1 string2 file1 .. filen # $0 oldString newString file1 .. fileN
# #
if [ $# -lt 3 ] if [ $# -lt 3 ]
then then
echo "Usage: ${0##*/} [-f] <string1> <string2> <file1> .. <filen>" echo "Usage: ${0##*/} <oldString> <newString> <file1> [.. fileN]"
echo "" echo ""
echo "Replaces all occurrences of string1 by string2 in files." echo "Replaces all occurrences of oldString by newString in files."
echo "(replacement of sed -i on those systems that don't support it)" echo "(replacement for sed -i on systems that don't support it)"
exit 1 exit 1
fi fi
FROMSTRING=$1 oldString="$1"
shift newString="$2"
TOSTRING=$1 shift 2
shift
for f in $* for f
do do
if grep "$FROMSTRING" "$f" >/dev/null if grep "$oldString" "$f" >/dev/null
then then
cp "$f" "${f}_bak" cp "$f" "${f}_bak"
sed -e "s@$FROMSTRING@$TOSTRING@g" "${f}"_bak > "$f" sed -e "s@$oldString@$newString@g" "${f}_bak" > "$f"
rm -f "${f}"_bak rm -f "${f}_bak"
#else #else
# echo "String $FROMSTRING not present in $f" # echo "String $oldString not present in $f"
#fi fi
done done
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -159,7 +159,7 @@ Linux)
export WM_LDFLAGS='-m64' export WM_LDFLAGS='-m64'
;; ;;
*) *)
echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64 echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
;; ;;
esac esac
;; ;;

View File

@ -149,7 +149,7 @@ case Linux:
breaksw breaksw
default: default:
echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64 echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
breaksw breaksw
endsw endsw
@ -213,12 +213,17 @@ endsw
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
#- prevent local variables from shadowing setenv variables
unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH '' if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH ''
if (! $?MANPATH) setenv MANPATH '' if (! $?MANPATH) setenv MANPATH ''
#- Clean PATH (path) #- Clean PATH (path)
set cleaned=`$foamClean "$PATH" "$foamOldDirs"` set cleaned=`$foamClean "$PATH" "$foamOldDirs"`
if ( $status == 0 ) setenv PATH $cleaned if ( $status == 0 ) then
setenv PATH $cleaned
endif
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`

View File

@ -74,6 +74,11 @@ _foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
# Make sure to pick up dummy versions of external libraries last # Make sure to pick up dummy versions of external libraries last
_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_LIBBIN}/dummy _foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_LIBBIN}/dummy
# Compiler settings
# ~~~~~~~~~~~~~~~~~
unset gcc_version gmp_version mpfr_version
unsetenv MPFR_ARCH_PATH
# Select compiler installation # Select compiler installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -84,40 +89,95 @@ switch ("$compilerInstall")
case OpenFOAM: case OpenFOAM:
switch ("$WM_COMPILER") switch ("$WM_COMPILER")
case Gcc: case Gcc:
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.3 set gcc_version=gcc-4.4.3
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.2/lib set gmp_version=gmp-5.0.1
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-5.0.1/lib set mpfr_version=mpfr-2.4.2
breaksw breaksw
case Gcc442:
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.2
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.1/lib
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-4.2.4/lib
breaksw
case Gcc43:
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.3.3
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.1/lib
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-4.2.4/lib
breaksw
endsw
# Check that the compiler directory can be found case Gcc442:
if ( ! -d "$WM_COMPILER_DIR" ) then set gcc_version=gcc-4.4.2
set gmp_version=gmp-4.2.4
set mpfr_version=mpfr-2.4.1
breaksw
case Gcc44:
set gcc_version=gcc-4.4.2
set gmp_version=gmp-4.2.4
set mpfr_version=mpfr-2.4.1
breaksw
case Gcc43:
set gcc_version=gcc-4.3.3
set gmp_version=gmp-4.2.4
set mpfr_version=mpfr-2.4.1
breaksw
default:
echo echo
echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
echo " Cannot find $WM_COMPILER_DIR installation." echo " Unknown OpenFOAM compiler type '$WM_COMPILER'"
echo " Please install this compiler version or if you wish to use the system compiler," echo " Please check your settings"
echo " change the 'compilerInstall' setting to 'system' in this file"
echo echo
endif breaksw
_foamAddPath ${WM_COMPILER_DIR}/bin endsw
_foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}:${WM_COMPILER_DIR}/lib
_foamAddMan ${WM_COMPILER_DIR}/man if ( $?gcc_version ) then
set gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
set gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
set mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
# Check that the compiler directory can be found
if ( ! -d "$gccDir" ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
echo " Cannot find $gccDir installation."
echo " Please install this compiler version or if you wish to use the system compiler,"
echo " change the 'compilerInstall' setting to 'system' in this file"
echo
endif
_foamAddMan $gccDir/man
_foamAddPath $gccDir/bin
_foamAddLib $gccDir/lib${WM_COMPILER_LIB_ARCH}:$gccDir/lib
# add in gmp/mpfr libraries
_foamAddLib $gmpDir/lib
_foamAddLib $mpfrDir/lib
# used by boost/CGAL:
setenv MPFR_ARCH_PATH $mpfrDir
endif
unset gcc_version gccDir gmp_version gmpDir mpfr_version mpfrDir
breaksw breaksw
endsw endsw
# boost and CGAL
# ~~~~~~~~~~~~~~
set boost_version=boost_1_42_0
set cgal_version=CGAL-3.5.1
setenv BOOST_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
setenv CGAL_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
# enabled if CGAL is available
if ( -d "$CGAL_ARCH_PATH" ) then
if ( -d "$BOOST_ARCH_PATH" ) then
_foamAddLib $BOOST_ARCH_PATH/lib
else
unsetenv BOOST_ARCH_PATH
endif
_foamAddLib $CGAL_ARCH_PATH/lib
else
unsetenv BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH
endif
unset boost_version cgal_version
# Communications library # Communications library
# ~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~
@ -259,17 +319,10 @@ else
endif endif
# CGAL library if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~
if ( $?CGAL_LIB_DIR ) then
_foamAddLib $CGAL_LIB_DIR
endif
# Enable the hoard memory allocator if available # Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if ( -f $FOAM_LIBBIN/libhoard.so ) then #if ( -f $FOAM_LIBBIN/libhoard.so ) then
# setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:${LD_PRELOAD} # setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
#endif #endif

View File

@ -98,10 +98,9 @@ _foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
# Make sure to pick up dummy versions of external libraries last # Make sure to pick up dummy versions of external libraries last
_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_LIBBIN/dummy _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_LIBBIN/dummy
# Compiler settings # Compiler settings
# ~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~
unset compilerBin compilerLib compilerMan unset gcc_version gmp_version mpfr_version MPFR_ARCH_PATH
# Select compiler installation # Select compiler installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -112,52 +111,97 @@ case "${compilerInstall:-OpenFOAM}" in
OpenFOAM) OpenFOAM)
case "$WM_COMPILER" in case "$WM_COMPILER" in
Gcc) Gcc)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.3 gcc_version=gcc-4.4.3
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.2/lib gmp_version=gmp-5.0.1
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-5.0.1/lib mpfr_version=mpfr-2.4.2
;; ;;
Gcc442) Gcc442)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.2 gcc_version=gcc-4.4.2
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.1/lib gmp_version=gmp-4.2.4
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-4.2.4/lib mpfr_version=mpfr-2.4.1
;; ;;
Gcc44) Gcc44)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.2 gcc_version=gcc-4.4.2
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.1/lib gmp_version=gmp-4.2.4
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-4.2.4/lib mpfr_version=mpfr-2.4.1
;; ;;
Gcc43) Gcc43)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.3.3 gcc_version=gcc-4.3.3
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.1/lib gmp_version=gmp-4.2.4
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-4.2.4/lib mpfr_version=mpfr-2.4.1
;;
*)
echo
echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
echo " Unknown OpenFOAM compiler type '$WM_COMPILER'"
echo " Please check your settings"
echo
;; ;;
esac esac
# Check that the compiler directory can be found if [ -n "$gcc_version" ]
if [ ! -d "$WM_COMPILER_DIR" ]
then then
echo gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
echo " Cannot find $WM_COMPILER_DIR installation." mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
echo " Please install this compiler version or if you wish to use the system compiler,"
echo " change the 'compilerInstall' setting to 'system' in this file"
echo
fi
compilerBin=$WM_COMPILER_DIR/bin # Check that the compiler directory can be found
compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib [ -d "$gccDir" ] || {
compilerMan=$WM_COMPILER_DIR/man echo
echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
echo " Cannot find $gccDir installation."
echo " Please install this compiler version or if you wish to use the system compiler,"
echo " change the 'compilerInstall' setting to 'system' in this file"
echo
}
_foamAddMan $gccDir/man
_foamAddPath $gccDir/bin
_foamAddLib $gccDir/lib
# 64-bit needs lib64, but 32-bit needs lib (not lib32)
if [ "$WM_ARCH_OPTION" = 64 ]
then
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
fi
# add in gmp/mpfr libraries
_foamAddLib $gmpDir/lib
_foamAddLib $mpfrDir/lib
# used by boost/CGAL:
export MPFR_ARCH_PATH=$mpfrDir
fi
unset gcc_version gccDir gmp_version gmpDir mpfr_version mpfrDir
;; ;;
esac esac
if [ -d "$compilerBin" ]
# boost and CGAL
# ~~~~~~~~~~~~~~
boost_version=boost_1_42_0
cgal_version=CGAL-3.5.1
export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
# enabled if CGAL is available
if [ -d "$CGAL_ARCH_PATH" ]
then then
_foamAddPath $compilerBin if [ -d "$BOOST_ARCH_PATH" ]
_foamAddLib $compilerLib then
_foamAddMan $compilerMan _foamAddLib $BOOST_ARCH_PATH/lib
else
unset BOOST_ARCH_PATH
fi
_foamAddLib $CGAL_ARCH_PATH/lib
else
unset BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH
fi fi
unset compilerBin compilerLib compilerMan compilerInstall unset boost_version cgal_version
# Communications library # Communications library
# ~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~
@ -301,11 +345,6 @@ fi
export MPI_BUFFER_SIZE export MPI_BUFFER_SIZE
# CGAL library if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~
[ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR
# Enable the hoard memory allocator if available # Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if [ -f $FOAM_LIBBIN/libhoard.so ] #if [ -f $FOAM_LIBBIN/libhoard.so ]
@ -316,6 +355,6 @@ export MPI_BUFFER_SIZE
# cleanup environment: # cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unset _foamAddPath _foamAddLib _foamAddMan minBufferSize unset _foamAddPath _foamAddLib _foamAddMan compilerInstall minBufferSize
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -40,7 +40,7 @@ template <class Type>
const Foam::scalar Foam::FaceCellWave<Type>::geomTol_ = 1e-6; const Foam::scalar Foam::FaceCellWave<Type>::geomTol_ = 1e-6;
template <class Type> template <class Type>
const Foam::scalar Foam::FaceCellWave<Type>::propagationTol_ = 0.01; Foam::scalar Foam::FaceCellWave<Type>::propagationTol_ = 0.01;
// Write to ostream // Write to ostream
template <class Type> template <class Type>

View File

@ -252,7 +252,7 @@ class FaceCellWave
// Private static data // Private static data
static const scalar geomTol_; static const scalar geomTol_;
static const scalar propagationTol_; static scalar propagationTol_;
public: public:

View File

@ -61,8 +61,7 @@ Foam::polyBoundaryMesh::polyBoundaryMesh
: :
polyPatchList(), polyPatchList(),
regIOobject(io), regIOobject(io),
mesh_(mesh), mesh_(mesh)
neighbourEdgesPtr_(NULL)
{ {
if (readOpt() == IOobject::MUST_READ) if (readOpt() == IOobject::MUST_READ)
{ {
@ -110,17 +109,14 @@ Foam::polyBoundaryMesh::polyBoundaryMesh
: :
polyPatchList(size), polyPatchList(size),
regIOobject(io), regIOobject(io),
mesh_(pm), mesh_(pm)
neighbourEdgesPtr_(NULL)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::polyBoundaryMesh::~polyBoundaryMesh() Foam::polyBoundaryMesh::~polyBoundaryMesh()
{ {}
deleteDemandDrivenData(neighbourEdgesPtr_);
}
void Foam::polyBoundaryMesh::clearGeom() void Foam::polyBoundaryMesh::clearGeom()
@ -134,7 +130,8 @@ void Foam::polyBoundaryMesh::clearGeom()
void Foam::polyBoundaryMesh::clearAddressing() void Foam::polyBoundaryMesh::clearAddressing()
{ {
deleteDemandDrivenData(neighbourEdgesPtr_); neighbourEdgesPtr_.clear();
patchIDPtr_.clear();
forAll (*this, patchi) forAll (*this, patchi)
{ {
@ -201,10 +198,10 @@ Foam::polyBoundaryMesh::neighbourEdges() const
<< " boundaries." << endl; << " boundaries." << endl;
} }
if (!neighbourEdgesPtr_) if (!neighbourEdgesPtr_.valid())
{ {
neighbourEdgesPtr_ = new List<labelPairList>(size()); neighbourEdgesPtr_.reset(new List<labelPairList>(size()));
List<labelPairList>& neighbourEdges = *neighbourEdgesPtr_; List<labelPairList>& neighbourEdges = neighbourEdgesPtr_();
// Initialize. // Initialize.
label nEdgePairs = 0; label nEdgePairs = 0;
@ -320,7 +317,36 @@ Foam::polyBoundaryMesh::neighbourEdges() const
} }
} }
return *neighbourEdgesPtr_; return neighbourEdgesPtr_();
}
const Foam::labelList& Foam::polyBoundaryMesh::patchID() const
{
if (!patchIDPtr_.valid())
{
patchIDPtr_.reset
(
new labelList
(
mesh_.nFaces()
- mesh_.nInternalFaces()
)
);
labelList& patchID = patchIDPtr_();
const polyBoundaryMesh& bm = *this;
forAll(bm, patchI)
{
label bFaceI = bm[patchI].start() - mesh_.nInternalFaces();
forAll(bm[patchI], i)
{
patchID[bFaceI++] = patchI;
}
}
}
return patchIDPtr_();
} }
@ -654,7 +680,8 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p)
void Foam::polyBoundaryMesh::updateMesh() void Foam::polyBoundaryMesh::updateMesh()
{ {
deleteDemandDrivenData(neighbourEdgesPtr_); neighbourEdgesPtr_.clear();
patchIDPtr_.clear();
PstreamBuffers pBufs(Pstream::defaultCommsType); PstreamBuffers pBufs(Pstream::defaultCommsType);

View File

@ -67,8 +67,10 @@ class polyBoundaryMesh
//- Reference to mesh //- Reference to mesh
const polyMesh& mesh_; const polyMesh& mesh_;
mutable autoPtr<labelList> patchIDPtr_;
//- Edges of neighbouring patches //- Edges of neighbouring patches
mutable List<labelPairList>* neighbourEdgesPtr_; mutable autoPtr<List<labelPairList> > neighbourEdgesPtr_;
// Private Member Functions // Private Member Functions
@ -157,6 +159,9 @@ public:
//- Return patch index for a given face label //- Return patch index for a given face label
label whichPatch(const label faceIndex) const; label whichPatch(const label faceIndex) const;
//- Per boundary face label the patch index
const labelList& patchID() const;
//- Return the set of patch IDs corresponding to the given list of names //- Return the set of patch IDs corresponding to the given list of names
// Wild cards are expanded. // Wild cards are expanded.
labelHashSet patchSet(const wordList&) const; labelHashSet patchSet(const wordList&) const;

View File

@ -556,7 +556,6 @@ public:
//- Check for negative cell volumes //- Check for negative cell volumes
bool checkCellVolumes bool checkCellVolumes
( (
const bool report = false, const bool report = false,
labelHashSet* setPtr = NULL labelHashSet* setPtr = NULL
) const; ) const;
@ -576,6 +575,14 @@ public:
labelHashSet* setPtr = NULL labelHashSet* setPtr = NULL
) const; ) const;
//- Check face-decomposition tet volume
bool checkFaceTets
(
const bool report = false,
const scalar minTetVol = 0,
labelHashSet* setPtr = NULL
) const;
//- Check face skewness //- Check face skewness
bool checkFaceSkewness bool checkFaceSkewness
( (

View File

@ -26,6 +26,7 @@ License
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "pyramidPointFaceRef.H" #include "pyramidPointFaceRef.H"
#include "tetPointRef.H"
#include "ListOps.H" #include "ListOps.H"
#include "unitConversion.H" #include "unitConversion.H"
#include "SortableList.H" #include "SortableList.H"
@ -401,7 +402,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
<< "checking mesh non-orthogonality" << endl; << "checking mesh non-orthogonality" << endl;
} }
// for all internal faces check theat the d dot S product is positive // for all internal faces check that the d dot S product is positive
const vectorField& centres = cellCentres(); const vectorField& centres = cellCentres();
const vectorField& areas = faceAreas(); const vectorField& areas = faceAreas();
@ -591,6 +592,114 @@ bool Foam::primitiveMesh::checkFacePyramids
} }
bool Foam::primitiveMesh::checkFaceTets
(
const bool report,
const scalar minTetVol,
labelHashSet* setPtr
) const
{
if (debug)
{
Info<< "bool primitiveMesh::checkFaceTets("
<< "const bool, const scalar, labelHashSet*) const: "
<< "checking face orientation" << endl;
}
// check whether face area vector points to the cell with higher label
const vectorField& cc = cellCentres();
const vectorField& fc = faceCentres();
const labelList& own = faceOwner();
const labelList& nei = faceNeighbour();
const faceList& fcs = faces();
const pointField& p = points();
label nErrorPyrs = 0;
forAll (fcs, faceI)
{
// Create the owner tets - they will have negative volume
const face& f = fcs[faceI];
forAll(f, fp)
{
scalar tetVol = tetPointRef
(
p[f[fp]],
p[f.nextLabel(fp)],
fc[faceI],
cc[own[faceI]]
).mag();
if (tetVol > -minTetVol)
{
if (setPtr)
{
setPtr->insert(faceI);
}
nErrorPyrs++;
break; // no need to check other tets
}
}
if (isInternalFace(faceI))
{
// Create the neighbour tet - it will have positive volume
const face& f = fcs[faceI];
forAll(f, fp)
{
scalar tetVol = tetPointRef
(
p[f[fp]],
p[f.nextLabel(fp)],
fc[faceI],
cc[nei[faceI]]
).mag();
if (tetVol < minTetVol)
{
if (setPtr)
{
setPtr->insert(faceI);
}
nErrorPyrs++;
break;
}
}
}
}
reduce(nErrorPyrs, sumOp<label>());
if (nErrorPyrs > 0)
{
if (debug || report)
{
Info<< " ***Error in face tets: "
<< nErrorPyrs << " faces have incorrectly oriented face"
<< " decomposition triangles." << endl;
}
return true;
}
else
{
if (debug || report)
{
Info<< " Face tets OK." << endl;
}
return false;
}
}
bool Foam::primitiveMesh::checkFaceSkewness bool Foam::primitiveMesh::checkFaceSkewness
( (
const bool report, const bool report,

View File

@ -69,6 +69,10 @@ bool Foam::motionSmoother::checkMesh
( (
readScalar(dict.lookup("minVol", true)) readScalar(dict.lookup("minVol", true))
); );
const scalar minTetVol
(
readScalar(dict.lookup("minTetVol", true))
);
const scalar maxConcave const scalar maxConcave
( (
readScalar(dict.lookup("maxConcave", true)) readScalar(dict.lookup("maxConcave", true))
@ -105,7 +109,6 @@ bool Foam::motionSmoother::checkMesh
( (
readScalar(dict.lookup("minDeterminant", true)) readScalar(dict.lookup("minDeterminant", true))
); );
label nWrongFaces = 0; label nWrongFaces = 0;
Info<< "Checking faces in error :" << endl; Info<< "Checking faces in error :" << endl;
@ -158,6 +161,30 @@ bool Foam::motionSmoother::checkMesh
nWrongFaces = nNewWrongFaces; nWrongFaces = nNewWrongFaces;
} }
if (minTetVol > -GREAT)
{
polyMeshGeometry::checkFaceTets
(
report,
minTetVol,
mesh,
mesh.cellCentres(),
mesh.faceCentres(),
mesh.points(),
checkFaces,
baffles,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with face-decomposition tet volume < "
<< setw(5) << minTetVol << " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (maxConcave < 180.0-SMALL) if (maxConcave < 180.0-SMALL)
{ {
polyMeshGeometry::checkFaceAngles polyMeshGeometry::checkFaceAngles
@ -417,6 +444,10 @@ bool Foam::motionSmoother::checkMesh
( (
readScalar(dict.lookup("minVol", true)) readScalar(dict.lookup("minVol", true))
); );
const scalar minTetVol
(
readScalar(dict.lookup("minTetVol", true))
);
const scalar maxConcave const scalar maxConcave
( (
readScalar(dict.lookup("maxConcave", true)) readScalar(dict.lookup("maxConcave", true))
@ -501,6 +532,27 @@ bool Foam::motionSmoother::checkMesh
nWrongFaces = nNewWrongFaces; nWrongFaces = nNewWrongFaces;
} }
if (minTetVol > -GREAT)
{
meshGeom.checkFaceTets
(
report,
minTetVol,
meshGeom.mesh().points(),
checkFaces,
baffles,
&wrongFaces
);
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
Info<< " faces with face-decomposition tet volume < "
<< setw(5) << minTetVol << " : "
<< nNewWrongFaces-nWrongFaces << endl;
nWrongFaces = nNewWrongFaces;
}
if (maxConcave < 180.0-SMALL) if (maxConcave < 180.0-SMALL)
{ {
meshGeom.checkFaceAngles meshGeom.checkFaceAngles

View File

@ -26,6 +26,7 @@ License
#include "polyMeshGeometry.H" #include "polyMeshGeometry.H"
#include "pyramidPointFaceRef.H" #include "pyramidPointFaceRef.H"
#include "tetPointRef.H"
#include "syncTools.H" #include "syncTools.H"
#include "unitConversion.H" #include "unitConversion.H"
@ -308,6 +309,59 @@ Foam::scalar Foam::polyMeshGeometry::calcSkewness
} }
// Create the neighbour pyramid - it will have positive volume
bool Foam::polyMeshGeometry::checkFaceTet
(
const polyMesh& mesh,
const bool report,
const scalar minTetVol,
const pointField& p,
const label faceI,
const point& fc, // face centre
const point& cc, // cell centre
labelHashSet* setPtr
)
{
const face& f = mesh.faces()[faceI];
forAll(f, fp)
{
scalar tetVol = tetPointRef
(
p[f[fp]],
p[f.nextLabel(fp)],
fc,
cc
).mag();
if (tetVol < minTetVol)
{
if (report)
{
Pout<< "bool polyMeshGeometry::checkFaceTets("
<< "const bool, const scalar, const pointField&"
<< ", const pointField&, const labelList&,"
<< " labelHashSet*): "
<< "face " << faceI
<< " has a triangle that points the wrong way."
<< endl
<< "Tet volume: " << tetVol
<< " Face " << faceI
<< endl;
}
if (setPtr)
{
setPtr->insert(faceI);
}
return true;
}
}
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components // Construct from components
@ -719,6 +773,139 @@ bool Foam::polyMeshGeometry::checkFacePyramids
} }
bool Foam::polyMeshGeometry::checkFaceTets
(
const bool report,
const scalar minTetVol,
const polyMesh& mesh,
const vectorField& cellCentres,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
)
{
// check whether face area vector points to the cell with higher label
const labelList& own = mesh.faceOwner();
const labelList& nei = mesh.faceNeighbour();
label nErrorPyrs = 0;
forAll(checkFaces, i)
{
label faceI = checkFaces[i];
// Create the owner pyramid - note: exchange cell and face centre
// to get positive volume.
bool tetError = checkFaceTet
(
mesh,
report,
minTetVol,
p,
faceI,
cellCentres[own[faceI]], // face centre
faceCentres[faceI], // cell centre
setPtr
);
if (tetError)
{
nErrorPyrs++;
}
if (mesh.isInternalFace(faceI))
{
// Create the neighbour pyramid - it will have positive volume
bool tetError = checkFaceTet
(
mesh,
report,
minTetVol,
p,
faceI,
faceCentres[faceI], // face centre
cellCentres[nei[faceI]], // cell centre
setPtr
);
if (tetError)
{
nErrorPyrs++;
}
}
}
forAll(baffles, i)
{
label face0 = baffles[i].first();
label face1 = baffles[i].second();
bool tetError = checkFaceTet
(
mesh,
report,
minTetVol,
p,
face0,
cellCentres[own[face0]], // face centre
faceCentres[face0], // cell centre
setPtr
);
if (tetError)
{
nErrorPyrs++;
}
// Create the neighbour pyramid - it will have positive volume
tetError = checkFaceTet
(
mesh,
report,
minTetVol,
p,
face0,
faceCentres[face0], // face centre
cellCentres[own[face1]], // cell centre
setPtr
);
if (tetError)
{
nErrorPyrs++;
}
}
reduce(nErrorPyrs, sumOp<label>());
if (nErrorPyrs > 0)
{
if (report)
{
SeriousErrorIn
(
"polyMeshGeometry::checkFaceTets("
"const bool, const scalar, const pointField&, const pointField&"
", const labelList&, labelHashSet*)"
) << "Error in face pyramids: faces pointing the wrong way!"
<< endl;
}
return true;
}
else
{
if (report)
{
Info<< "Face tets OK.\n" << endl;
}
return false;
}
}
bool Foam::polyMeshGeometry::checkFaceSkewness bool Foam::polyMeshGeometry::checkFaceSkewness
( (
const bool report, const bool report,
@ -1946,6 +2133,31 @@ bool Foam::polyMeshGeometry::checkFacePyramids
} }
bool Foam::polyMeshGeometry::checkFaceTets
(
const bool report,
const scalar minTetVol,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const
{
return checkFaceTets
(
report,
minTetVol,
mesh_,
cellCentres_,
faceCentres_,
p,
checkFaces,
baffles,
setPtr
);
}
bool Foam::polyMeshGeometry::checkFaceSkewness bool Foam::polyMeshGeometry::checkFaceSkewness
( (
const bool report, const bool report,

View File

@ -109,6 +109,19 @@ class polyMeshGeometry
const point& fc const point& fc
); );
//- Detect&report incorrect face-triangle orientation
static bool checkFaceTet
(
const polyMesh&,
const bool report,
const scalar minTetVol,
const pointField& p,
const label faceI,
const point& fc, // face centre
const point& cc, // cell centre
labelHashSet* setPtr
);
public: public:
ClassName("polyMeshGeometry"); ClassName("polyMeshGeometry");
@ -195,6 +208,20 @@ public:
labelHashSet* labelHashSet*
); );
//- See primitiveMesh
static bool checkFaceTets
(
const bool report,
const scalar minPyrVol,
const polyMesh&,
const vectorField& cellCentres,
const vectorField& faceCentres,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet*
);
//- See primitiveMesh //- See primitiveMesh
static bool checkFaceSkewness static bool checkFaceSkewness
( (
@ -321,6 +348,16 @@ public:
labelHashSet* setPtr labelHashSet* setPtr
) const; ) const;
bool checkFaceTets
(
const bool report,
const scalar minTetVol,
const pointField& p,
const labelList& checkFaces,
const List<labelPair>& baffles,
labelHashSet* setPtr
) const;
bool checkFaceSkewness bool checkFaceSkewness
( (
const bool report, const bool report,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,11 +30,11 @@ License
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
void Foam::bound(volScalarField& vsf, const dimensionedScalar& vsf0) void Foam::bound(volScalarField& vsf, const dimensionedScalar& lowerBound)
{ {
scalar minVsf = min(vsf).value(); const scalar minVsf = min(vsf).value();
if (minVsf < vsf0.value()) if (minVsf < lowerBound.value())
{ {
Info<< "bounding " << vsf.name() Info<< "bounding " << vsf.name()
<< ", min: " << minVsf << ", min: " << minVsf
@ -47,13 +47,13 @@ void Foam::bound(volScalarField& vsf, const dimensionedScalar& vsf0)
max max
( (
vsf.internalField(), vsf.internalField(),
fvc::average(max(vsf, vsf0))().internalField() fvc::average(max(vsf, lowerBound))().internalField()
*pos(-vsf.internalField()) * pos(-vsf.internalField())
), ),
vsf0.value() lowerBound.value()
); );
vsf.boundaryField() = max(vsf.boundaryField(), vsf0.value()); vsf.boundaryField() = max(vsf.boundaryField(), lowerBound.value());
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,11 +23,13 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InNamespace InNamespace
Foam::bound Foam
Description Description
Bound the given scalar field if it has gone unbounded. Used extensively Bound the given scalar field if it has gone unbounded.
in RAS and LES turbulence models.
Used extensively in RAS and LES turbulence models, but also of use
within solvers.
SourceFiles SourceFiles
bound.C bound.C
@ -49,7 +51,7 @@ namespace Foam
//- Bound the given scalar field if it has gone unbounded. //- Bound the given scalar field if it has gone unbounded.
// Used extensively in RAS and LES turbulence models. // Used extensively in RAS and LES turbulence models.
void bound(volScalarField& vsf, const dimensionedScalar& vsf0); void bound(volScalarField&, const dimensionedScalar& lowerBound);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,9 +29,9 @@ Description
Face source variant of field value function object. Values of user- Face source variant of field value function object. Values of user-
specified fields reported for collections of faces. specified fields reported for collections of faces.
cellObj1 // Name also used to identify output folder faceObj1 // Name also used to identify output folder
{ {
type cellSource; type faceSource;
functionObjectLibs ("libfieldValueFunctionObjects.so"); functionObjectLibs ("libfieldValueFunctionObjects.so");
enabled true; enabled true;
outputControl outputTime; outputControl outputTime;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -106,7 +106,7 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
volScalarField K = 0.5*tr(B_); volScalarField K = 0.5*tr(B_);
solve tmp<fvSymmTensorMatrix> BEqn
( (
fvm::ddt(rho(), B_) fvm::ddt(rho(), B_)
+ fvm::div(phi(), B_) + fvm::div(phi(), B_)
@ -118,6 +118,8 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
- (2*ce_ - 0.667*cm_)*I*rho()*epsilon() - (2*ce_ - 0.667*cm_)*I*rho()*epsilon()
); );
BEqn().relax();
BEqn().solve();
// Bounding the component kinetic energies // Bounding the component kinetic energies
@ -132,7 +134,7 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
} }
K = 0.5*tr(B_); K = 0.5*tr(B_);
bound(K, k0()); bound(K, kMin_);
updateSubGridScaleFields(K); updateSubGridScaleFields(K);
} }

View File

@ -108,7 +108,9 @@ GenEddyVisc::GenEddyVisc
), ),
mesh_ mesh_
) )
{} {
bound(k_, kMin_);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -79,11 +79,11 @@ LESModel::LESModel
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subOrEmptyDict(type + "Coeffs")), coeffDict_(subOrEmptyDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL), kMin_("kMin", sqr(dimVelocity), SMALL),
delta_(LESdelta::New("delta", U.mesh(), *this)) delta_(LESdelta::New("delta", U.mesh(), *this))
{ {
readIfPresent("k0", k0_); readIfPresent("kMin", kMin_);
// Force the construction of the mesh deltaCoeffs which may be needed // Force the construction of the mesh deltaCoeffs which may be needed
// for the construction of the derived models and BCs // for the construction of the derived models and BCs
@ -131,8 +131,12 @@ autoPtr<LESModel> LESModel::New
{ {
FatalErrorIn FatalErrorIn
( (
"LESModel::New(const volVectorField& U, const " "LESModel::New"
"surfaceScalarField& phi, const basicThermo&)" "("
"const volVectorField&, "
"const surfaceScalarField&, "
"const basicThermo&"
")"
) << "Unknown LESModel type " << modelName ) << "Unknown LESModel type " << modelName
<< endl << endl << endl << endl
<< "Valid LESModel types are :" << endl << "Valid LESModel types are :" << endl
@ -167,7 +171,7 @@ bool LESModel::read()
coeffDict_ <<= *dictPtr; coeffDict_ <<= *dictPtr;
} }
readIfPresent("k0", k0_); kMin_.readIfPresent(*this);
delta_().read(*this); delta_().read(*this);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -83,7 +83,7 @@ protected:
Switch printCoeffs_; Switch printCoeffs_;
dictionary coeffDict_; dictionary coeffDict_;
dimensionedScalar k0_; dimensionedScalar kMin_;
autoPtr<LESdelta> delta_; autoPtr<LESdelta> delta_;
@ -170,16 +170,16 @@ public:
return coeffDict_; return coeffDict_;
} }
//- Return the value of k0 which k is not allowed to be less than //- Return the lower allowable limit for k (default: SMALL)
const dimensionedScalar& k0() const const dimensionedScalar& kMin() const
{ {
return k0_; return kMin_;
} }
//- Allow k0 to be changed //- Allow kMin to be changed
dimensionedScalar& k0() dimensionedScalar& kMin()
{ {
return k0_; return kMin_;
} }
//- Access function to filter width //- Access function to filter width

View File

@ -302,7 +302,7 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& tgradU)
volScalarField Stilda = volScalarField Stilda =
fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda_); fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda_);
solve tmp<fvScalarMatrix> nuTildaEqn
( (
fvm::ddt(rho(), nuTilda_) fvm::ddt(rho(), nuTilda_)
+ fvm::div(phi(), nuTilda_) + fvm::div(phi(), nuTilda_)
@ -318,6 +318,9 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& tgradU)
- fvm::Sp(rho()*Cw1_*fw(Stilda)*nuTilda_/sqr(dTilda_), nuTilda_) - fvm::Sp(rho()*Cw1_*fw(Stilda)*nuTilda_/sqr(dTilda_), nuTilda_)
); );
nuTildaEqn().relax();
nuTildaEqn().solve();
bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0)); bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0));
nuTilda_.correctBoundaryConditions(); nuTilda_.correctBoundaryConditions();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -74,10 +74,10 @@ dimensionedScalar dynOneEqEddy::ce_(const volSymmTensorField& D) const
pow(KK + filter_(k_), 1.5)/(2*delta()) - filter_(pow(k_, 1.5))/delta(); pow(KK + filter_(k_), 1.5)/(2*delta()) - filter_(pow(k_, 1.5))/delta();
volScalarField ee = volScalarField ee =
2*delta()*ck_(D)* 2*delta()*ck_(D)
( *(
filter_(sqrt(k_)*magSqr(D)) filter_(sqrt(k_)*magSqr(D))
- 2*sqrt(KK + filter_(k_))*magSqr(filter_(D)) - 2*sqrt(KK + filter_(k_))*magSqr(filter_(D))
); );
return average(ee*mm)/average(mm*mm); return average(ee*mm)/average(mm*mm);
@ -118,7 +118,7 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU)
volScalarField divU = fvc::div(phi()/fvc::interpolate(rho())); volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
volScalarField G = 2*muSgs_*(gradU && D); volScalarField G = 2*muSgs_*(gradU && D);
solve tmp<fvScalarMatrix> kEqn
( (
fvm::ddt(rho(), k_) fvm::ddt(rho(), k_)
+ fvm::div(phi(), k_) + fvm::div(phi(), k_)
@ -129,7 +129,10 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU)
- fvm::Sp(ce_(D)*rho()*sqrt(k_)/delta(), k_) - fvm::Sp(ce_(D)*rho()*sqrt(k_)/delta(), k_)
); );
bound(k_, dimensionedScalar("0", k_.dimensions(), 1.0e-10)); kEqn().relax();
kEqn().solve();
bound(k_, kMin_);
updateSubGridScaleFields(D); updateSubGridScaleFields(D);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -106,7 +106,7 @@ void lowReOneEqEddy::correct(const tmp<volTensorField>& tgradU)
volScalarField divU = fvc::div(phi()/fvc::interpolate(rho())); volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU))); volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU)));
solve tmp<fvScalarMatrix> kEqn
( (
fvm::ddt(rho(), k_) fvm::ddt(rho(), k_)
+ fvm::div(phi(), k_) + fvm::div(phi(), k_)
@ -117,7 +117,10 @@ void lowReOneEqEddy::correct(const tmp<volTensorField>& tgradU)
- fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_) - fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_)
); );
bound(k_, k0()); kEqn().relax();
kEqn().solve();
bound(k_, kMin_);
updateSubGridScaleFields(); updateSubGridScaleFields();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -93,7 +93,7 @@ void oneEqEddy::correct(const tmp<volTensorField>& tgradU)
volScalarField divU = fvc::div(phi()/fvc::interpolate(rho())); volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU))); volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU)));
fvScalarMatrix kEqn tmp<fvScalarMatrix> kEqn
( (
fvm::ddt(rho(), k_) fvm::ddt(rho(), k_)
+ fvm::div(phi(), k_) + fvm::div(phi(), k_)
@ -104,10 +104,10 @@ void oneEqEddy::correct(const tmp<volTensorField>& tgradU)
- fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_) - fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_)
); );
kEqn.relax(); kEqn().relax();
kEqn.solve(); kEqn().solve();
bound(k_, k0()); bound(k_, kMin_);
updateSubGridScaleFields(); updateSubGridScaleFields();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -229,7 +229,10 @@ LRR::LRR
<< exit(FatalError); << exit(FatalError);
} }
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
@ -324,7 +327,7 @@ void LRR::correct()
if (!turbulence_) if (!turbulence_)
{ {
// Re-calculate viscosity // Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity // Re-calculate thermal diffusivity
@ -359,7 +362,7 @@ void LRR::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Reynolds stress equation // Reynolds stress equation
@ -406,15 +409,15 @@ void LRR::correct()
R_.dimensions(), R_.dimensions(),
symmTensor symmTensor
( (
k0_.value(), -GREAT, -GREAT, kMin_.value(), -GREAT, -GREAT,
k0_.value(), -GREAT, kMin_.value(), -GREAT,
k0_.value() kMin_.value()
) )
) )
); );
k_ = 0.5*tr(R_); k_ = 0.5*tr(R_);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -258,7 +258,10 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
<< exit(FatalError); << exit(FatalError);
} }
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
@ -357,7 +360,7 @@ void LaunderGibsonRSTM::correct()
if (!turbulence_) if (!turbulence_)
{ {
// Re-calculate viscosity // Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity // Re-calculate thermal diffusivity
@ -397,7 +400,7 @@ void LaunderGibsonRSTM::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Reynolds stress equation // Reynolds stress equation
@ -453,15 +456,15 @@ void LaunderGibsonRSTM::correct()
R_.dimensions(), R_.dimensions(),
symmTensor symmTensor
( (
k0_.value(), -GREAT, -GREAT, kMin_.value(), -GREAT, -GREAT,
k0_.value(), -GREAT, kMin_.value(), -GREAT,
k0_.value() kMin_.value()
) )
) )
); );
k_ == 0.5*tr(R_); k_ == 0.5*tr(R_);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate turbulent viscosity // Re-calculate turbulent viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -187,7 +187,10 @@ LaunderSharmaKE::LaunderSharmaKE
autoCreateAlphat("alphat", mesh_) autoCreateAlphat("alphat", mesh_)
) )
{ {
mut_ = rho_*Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = rho_*Cmu_*fMu()*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
@ -275,7 +278,7 @@ void LaunderSharmaKE::correct()
if (!turbulence_) if (!turbulence_)
{ {
// Re-calculate viscosity // Re-calculate viscosity
mut_ == rho_*Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_); mut_ == rho_*Cmu_*fMu()*sqr(k_)/epsilon_;
// Re-calculate thermal diffusivity // Re-calculate thermal diffusivity
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
@ -320,7 +323,7 @@ void LaunderSharmaKE::correct()
epsEqn().relax(); epsEqn().relax();
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -338,11 +341,11 @@ void LaunderSharmaKE::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity
mut_ == Cmu_*fMu()*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); mut_ == Cmu_*fMu()*rho_*sqr(k_)/epsilon_;
// Re-calculate thermal diffusivity // Re-calculate thermal diffusivity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -81,11 +81,9 @@ RASModel::RASModel
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subOrEmptyDict(type + "Coeffs")), coeffDict_(subOrEmptyDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL), kMin_("kMin", sqr(dimVelocity), SMALL),
epsilon0_("epsilon", k0_.dimensions()/dimTime, SMALL), epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL),
epsilonSmall_("epsilonSmall", epsilon0_.dimensions(), SMALL), omegaMin_("omegaMin", dimless/dimTime, SMALL),
omega0_("omega", dimless/dimTime, SMALL),
omegaSmall_("omegaSmall", omega0_.dimensions(), SMALL),
y_(mesh_) y_(mesh_)
{ {
@ -135,9 +133,13 @@ autoPtr<RASModel> RASModel::New
{ {
FatalErrorIn FatalErrorIn
( (
"RASModel::New(const volScalarField&, " "RASModel::New"
"const volVectorField&, const surfaceScalarField&, " "("
"basicThermo&)" "const volScalarField&, "
"const volVectorField&, "
"const surfaceScalarField&, "
"basicThermo&"
")"
) << "Unknown RASModel type " << modelName ) << "Unknown RASModel type " << modelName
<< endl << endl << endl << endl
<< "Valid RASModel types are :" << endl << "Valid RASModel types are :" << endl
@ -219,11 +221,9 @@ bool RASModel::read()
coeffDict_ <<= *dictPtr; coeffDict_ <<= *dictPtr;
} }
k0_.readIfPresent(*this); kMin_.readIfPresent(*this);
epsilon0_.readIfPresent(*this); epsilonMin_.readIfPresent(*this);
epsilonSmall_.readIfPresent(*this); omegaMin_.readIfPresent(*this);
omega0_.readIfPresent(*this);
omegaSmall_.readIfPresent(*this);
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -93,19 +93,13 @@ protected:
scalar yPlusLam_; scalar yPlusLam_;
//- Lower limit of k //- Lower limit of k
dimensionedScalar k0_; dimensionedScalar kMin_;
//- Lower limit of epsilon //- Lower limit of epsilon
dimensionedScalar epsilon0_; dimensionedScalar epsilonMin_;
//- Small epsilon value used to avoid divide by zero
dimensionedScalar epsilonSmall_;
//- Lower limit for omega //- Lower limit for omega
dimensionedScalar omega0_; dimensionedScalar omegaMin_;
//- Small omega value used to avoid divide by zero
dimensionedScalar omegaSmall_;
//- Near wall distance boundary field //- Near wall distance boundary field
nearWallDist y_; nearWallDist y_;
@ -185,68 +179,40 @@ public:
// Access // Access
//- Return the value of k0 which k is not allowed to be less than //- Return the lower allowable limit for k (default: SMALL)
const dimensionedScalar& k0() const const dimensionedScalar& kMin() const
{ {
return k0_; return kMin_;
} }
//- Return the value of epsilon0 which epsilon is not allowed to be //- Return the lower allowable limit for epsilon (default: SMALL)
// less than const dimensionedScalar& epsilonMin() const
const dimensionedScalar& epsilon0() const
{ {
return epsilon0_; return epsilonMin_;
} }
//- Return the value of epsilonSmall which is added to epsilon when //- Return the lower allowable limit for omega (default: SMALL)
// calculating nut const dimensionedScalar& omegaMin() const
const dimensionedScalar& epsilonSmall() const
{ {
return epsilonSmall_; return omegaMin_;
} }
//- Return the value of omega0 which epsilon is not allowed to be //- Allow kMin to be changed
// less than dimensionedScalar& kMin()
const dimensionedScalar& omega0() const
{ {
return omega0_; return kMin_;
} }
//- Return the value of omegaSmall which is added to epsilon when //- Allow epsilonMin to be changed
// calculating nut dimensionedScalar& epsilonMin()
const dimensionedScalar& omegaSmall() const
{ {
return omegaSmall_; return epsilonMin_;
} }
//- Allow k0 to be changed //- Allow omegaMin to be changed
dimensionedScalar& k0() dimensionedScalar& omegaMin()
{ {
return k0_; return omegaMin_;
}
//- Allow epsilon0 to be changed
dimensionedScalar& epsilon0()
{
return epsilon0_;
}
//- Allow epsilonSmall to be changed
dimensionedScalar& epsilonSmall()
{
return epsilonSmall_;
}
//- Allow omega0 to be changed
dimensionedScalar& omega0()
{
return omega0_;
}
//- Allow omegaSmall to be changed
dimensionedScalar& omegaSmall()
{
return omegaSmall_;
} }
//- Return the near wall distances //- Return the near wall distances

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -186,7 +186,10 @@ RNGkEpsilon::RNGkEpsilon
autoCreateAlphat("alphat", mesh_) autoCreateAlphat("alphat", mesh_)
) )
{ {
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
@ -276,7 +279,7 @@ void RNGkEpsilon::correct()
if (!turbulence_) if (!turbulence_)
{ {
// Re-calculate viscosity // Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity // Re-calculate thermal diffusivity
@ -327,7 +330,7 @@ void RNGkEpsilon::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -339,12 +342,12 @@ void RNGkEpsilon::correct()
- fvm::laplacian(DkEff(), k_) - fvm::laplacian(DkEff(), k_)
== ==
G - fvm::SuSp(2.0/3.0*rho_*divU, k_) G - fvm::SuSp(2.0/3.0*rho_*divU, k_)
- fvm::Sp(rho_*(epsilon_)/k_, k_) - fvm::Sp(rho_*epsilon_/k_, k_)
); );
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -168,7 +168,10 @@ kEpsilon::kEpsilon
autoCreateAlphat("alphat", mesh_) autoCreateAlphat("alphat", mesh_)
) )
{ {
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
@ -257,7 +260,7 @@ void kEpsilon::correct()
if (!turbulence_) if (!turbulence_)
{ {
// Re-calculate viscosity // Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity // Re-calculate thermal diffusivity
@ -300,7 +303,7 @@ void kEpsilon::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -318,7 +321,7 @@ void kEpsilon::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -258,7 +258,18 @@ kOmegaSST::kOmegaSST
autoCreateAlphat("alphat", mesh_) autoCreateAlphat("alphat", mesh_)
) )
{ {
mut_ = a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(magSqr(symm(fvc::grad(U_))))); bound(k_, kMin_);
bound(omega_, omegaMin_);
mut_ =
(
a1_*rho_*k_
/ max
(
a1_*omega_,
F2()*sqrt(magSqr(symm(fvc::grad(U_))))
)
);
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
@ -414,7 +425,7 @@ void kOmegaSST::correct()
omegaEqn().boundaryManipulate(omega_.boundaryField()); omegaEqn().boundaryManipulate(omega_.boundaryField());
solve(omegaEqn); solve(omegaEqn);
bound(omega_, omega0_); bound(omega_, omegaMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
tmp<fvScalarMatrix> kEqn tmp<fvScalarMatrix> kEqn
@ -430,7 +441,7 @@ void kOmegaSST::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -69,7 +69,7 @@ tmp<volScalarField> realizableKE::rCmu
volScalarField As = sqrt(6.0)*cos(phis); volScalarField As = sqrt(6.0)*cos(phis);
volScalarField Us = sqrt(S2/2.0 + magSqr(skew(gradU))); volScalarField Us = sqrt(S2/2.0 + magSqr(skew(gradU)));
return 1.0/(A0_ + As*Us*k_/(epsilon_ + epsilonSmall_)); return 1.0/(A0_ + As*Us*k_/epsilon_);
} }
@ -200,10 +200,10 @@ realizableKE::realizableKE
autoCreateAlphat("alphat", mesh_) autoCreateAlphat("alphat", mesh_)
) )
{ {
bound(k_, k0_); bound(k_, kMin_);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
mut_ = rCmu(fvc::grad(U_))*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); mut_ = rCmu(fvc::grad(U_))*rho_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions(); mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_; alphat_ = mut_/Prt_;
@ -341,7 +341,7 @@ void realizableKE::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -353,12 +353,12 @@ void realizableKE::correct()
- fvm::laplacian(DkEff(), k_) - fvm::laplacian(DkEff(), k_)
== ==
G - fvm::SuSp(2.0/3.0*rho_*divU, k_) G - fvm::SuSp(2.0/3.0*rho_*divU, k_)
- fvm::Sp(rho_*(epsilon_)/k_, k_) - fvm::Sp(rho_*epsilon_/k_, k_)
); );
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity
mut_ = rCmu(gradU, S2, magS)*rho_*sqr(k_)/epsilon_; mut_ = rCmu(gradU, S2, magS)*rho_*sqr(k_)/epsilon_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -102,7 +102,7 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
volScalarField K = 0.5*tr(B_); volScalarField K = 0.5*tr(B_);
volScalarField Epsilon = 2*nuEff()*magSqr(D); volScalarField Epsilon = 2*nuEff()*magSqr(D);
fvSymmTensorMatrix BEqn tmp<fvSymmTensorMatrix> BEqn
( (
fvm::ddt(B_) fvm::ddt(B_)
+ fvm::div(phi(), B_) + fvm::div(phi(), B_)
@ -114,23 +114,23 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
- (2*ce_ - 0.667*cm_)*I*Epsilon - (2*ce_ - 0.667*cm_)*I*Epsilon
); );
BEqn.relax(); BEqn().relax();
BEqn.solve(); BEqn().solve();
// Bounding the component kinetic energies // Bounding the component kinetic energies
forAll(B_, celli) forAll(B_, celli)
{ {
B_[celli].component(symmTensor::XX) = B_[celli].component(symmTensor::XX) =
max(B_[celli].component(symmTensor::XX), k0().value()); max(B_[celli].component(symmTensor::XX), kMin_.value());
B_[celli].component(symmTensor::YY) = B_[celli].component(symmTensor::YY) =
max(B_[celli].component(symmTensor::YY), k0().value()); max(B_[celli].component(symmTensor::YY), kMin_.value());
B_[celli].component(symmTensor::ZZ) = B_[celli].component(symmTensor::ZZ) =
max(B_[celli].component(symmTensor::ZZ), k0().value()); max(B_[celli].component(symmTensor::ZZ), kMin_.value());
} }
K = 0.5*tr(B_); K = 0.5*tr(B_);
bound(K, k0()); bound(K, kMin_);
updateSubGridScaleFields(K); updateSubGridScaleFields(K);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -78,10 +78,10 @@ LESModel::LESModel
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subOrEmptyDict(type + "Coeffs")), coeffDict_(subOrEmptyDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL), kMin_("kMin", sqr(dimVelocity), SMALL),
delta_(LESdelta::New("delta", U.mesh(), *this)) delta_(LESdelta::New("delta", U.mesh(), *this))
{ {
readIfPresent("k0", k0_); readIfPresent("kMin", kMin_);
// Force the construction of the mesh deltaCoeffs which may be needed // Force the construction of the mesh deltaCoeffs which may be needed
// for the construction of the derived models and BCs // for the construction of the derived models and BCs
@ -128,8 +128,12 @@ autoPtr<LESModel> LESModel::New
{ {
FatalErrorIn FatalErrorIn
( (
"LESModel::New(const volVectorField& U, const " "LESModel::New"
"surfaceScalarField& phi, transportModel&)" "("
"const volVectorField&, "
"const surfaceScalarField& ,"
"transportModel&"
")"
) << "Unknown LESModel type " << modelName ) << "Unknown LESModel type " << modelName
<< endl << endl << endl << endl
<< "Valid LESModel types are :" << endl << "Valid LESModel types are :" << endl
@ -167,7 +171,7 @@ bool LESModel::read()
delta_().read(*this); delta_().read(*this);
readIfPresent("k0", k0_); kMin_.readIfPresent(*this);
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -83,7 +83,7 @@ protected:
Switch printCoeffs_; Switch printCoeffs_;
dictionary coeffDict_; dictionary coeffDict_;
dimensionedScalar k0_; dimensionedScalar kMin_;
autoPtr<LESdelta> delta_; autoPtr<LESdelta> delta_;
@ -171,16 +171,16 @@ public:
return delta_(); return delta_();
} }
//- Return the value of k0 which k is not allowed to be less than //- Return the lower allowable limit for k (default: SMALL)
const dimensionedScalar& k0() const const dimensionedScalar& kMin() const
{ {
return k0_; return kMin_;
} }
//- Allow k0 to be changed //- Allow kMin to be changed
dimensionedScalar& k0() dimensionedScalar& kMin()
{ {
return k0_; return kMin_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -90,7 +90,10 @@ LRRDiffStress::LRRDiffStress
) )
) )
{ {
updateSubGridScaleFields(0.5*tr(B_)); volScalarField K = 0.5*tr(B_);
bound(K, kMin_);
updateSubGridScaleFields(K);
printCoeffs(); printCoeffs();
} }
@ -111,7 +114,7 @@ void LRRDiffStress::correct(const tmp<volTensorField>& tgradU)
volScalarField K = 0.5*tr(B_); volScalarField K = 0.5*tr(B_);
volScalarField Epsilon = 2*nuEff()*magSqr(D); volScalarField Epsilon = 2*nuEff()*magSqr(D);
fvSymmTensorMatrix BEqn tmp<fvSymmTensorMatrix> BEqn
( (
fvm::ddt(B_) fvm::ddt(B_)
+ fvm::div(phi(), B_) + fvm::div(phi(), B_)
@ -124,23 +127,23 @@ void LRRDiffStress::correct(const tmp<volTensorField>& tgradU)
- (0.667 - 2*c1_)*I*pow(K, 1.5)/delta() - (0.667 - 2*c1_)*I*pow(K, 1.5)/delta()
); );
BEqn.relax(); BEqn().relax();
BEqn.solve(); BEqn().solve();
// Bounding the component kinetic energies // Bounding the component kinetic energies
forAll(B_, celli) forAll(B_, celli)
{ {
B_[celli].component(symmTensor::XX) = B_[celli].component(symmTensor::XX) =
max(B_[celli].component(symmTensor::XX), k0().value()); max(B_[celli].component(symmTensor::XX), kMin_.value());
B_[celli].component(symmTensor::YY) = B_[celli].component(symmTensor::YY) =
max(B_[celli].component(symmTensor::YY), k0().value()); max(B_[celli].component(symmTensor::YY), kMin_.value());
B_[celli].component(symmTensor::ZZ) = B_[celli].component(symmTensor::ZZ) =
max(B_[celli].component(symmTensor::ZZ), k0().value()); max(B_[celli].component(symmTensor::ZZ), kMin_.value());
} }
K = 0.5*tr(B_); K = 0.5*tr(B_);
bound(K, k0()); bound(K, kMin_);
updateSubGridScaleFields(K); updateSubGridScaleFields(K);
} }

View File

@ -295,7 +295,7 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
const volScalarField dTilda = this->dTilda(S); const volScalarField dTilda = this->dTilda(S);
const volScalarField STilda = this->STilda(S, dTilda); const volScalarField STilda = this->STilda(S, dTilda);
fvScalarMatrix nuTildaEqn tmp<fvScalarMatrix> nuTildaEqn
( (
fvm::ddt(nuTilda_) fvm::ddt(nuTilda_)
+ fvm::div(phi(), nuTilda_) + fvm::div(phi(), nuTilda_)
@ -311,8 +311,8 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
- fvm::Sp(Cw1_*fw(STilda, dTilda)*nuTilda_/sqr(dTilda), nuTilda_) - fvm::Sp(Cw1_*fw(STilda, dTilda)*nuTilda_/sqr(dTilda), nuTilda_)
); );
nuTildaEqn.relax(); nuTildaEqn().relax();
nuTildaEqn.solve(); nuTildaEqn().solve();
bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0)); bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0));
nuTilda_.correctBoundaryConditions(); nuTilda_.correctBoundaryConditions();

View File

@ -176,7 +176,6 @@ SpalartAllmarasIDDES::SpalartAllmarasIDDES
1.63 1.63
) )
) )
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -80,10 +80,10 @@ dimensionedScalar dynOneEqEddy::ce(const volSymmTensorField& D) const
pow(KK + filter_(k_), 1.5)/(2*delta()) - filter_(pow(k_, 1.5))/delta(); pow(KK + filter_(k_), 1.5)/(2*delta()) - filter_(pow(k_, 1.5))/delta();
volScalarField ee = volScalarField ee =
2*delta()*ck(D) 2*delta()*ck(D)
*( *(
filter_(sqrt(k_)*magSqr(D)) filter_(sqrt(k_)*magSqr(D))
- 2*sqrt(KK + filter_(k_))*magSqr(filter_(D)) - 2*sqrt(KK + filter_(k_))*magSqr(filter_(D))
); );
dimensionedScalar mmmm = average(magSqr(mm)); dimensionedScalar mmmm = average(magSqr(mm));
@ -127,6 +127,8 @@ dynOneEqEddy::dynOneEqEddy
filterPtr_(LESfilter::New(U.mesh(), coeffDict())), filterPtr_(LESfilter::New(U.mesh(), coeffDict())),
filter_(filterPtr_()) filter_(filterPtr_())
{ {
bound(k_, kMin_);
updateSubGridScaleFields(symm(fvc::grad(U))); updateSubGridScaleFields(symm(fvc::grad(U)));
printCoeffs(); printCoeffs();
@ -135,15 +137,17 @@ dynOneEqEddy::dynOneEqEddy
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void dynOneEqEddy::correct(const tmp<volTensorField>& gradU) void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU)
{ {
const volTensorField& gradU = tgradU();
GenEddyVisc::correct(gradU); GenEddyVisc::correct(gradU);
volSymmTensorField D = symm(gradU); volSymmTensorField D = symm(gradU);
volScalarField P = 2.0*nuSgs_*magSqr(D); volScalarField P = 2.0*nuSgs_*magSqr(D);
fvScalarMatrix kEqn tmp<fvScalarMatrix> kEqn
( (
fvm::ddt(k_) fvm::ddt(k_)
+ fvm::div(phi(), k_) + fvm::div(phi(), k_)
@ -153,10 +157,10 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& gradU)
- fvm::Sp(ce(D)*sqrt(k_)/delta(), k_) - fvm::Sp(ce(D)*sqrt(k_)/delta(), k_)
); );
kEqn.relax(); kEqn().relax();
kEqn.solve(); kEqn().solve();
bound(k_, k0()); bound(k_, kMin_);
updateSubGridScaleFields(D); updateSubGridScaleFields(D);
} }

View File

@ -118,6 +118,8 @@ dynSmagorinsky::dynSmagorinsky
filterPtr_(LESfilter::New(U.mesh(), coeffDict())), filterPtr_(LESfilter::New(U.mesh(), coeffDict())),
filter_(filterPtr_()) filter_(filterPtr_())
{ {
bound(k_, kMin_);
updateSubGridScaleFields(dev(symm(fvc::grad(U)))); updateSubGridScaleFields(dev(symm(fvc::grad(U))));
printCoeffs(); printCoeffs();
@ -133,6 +135,7 @@ void dynSmagorinsky::correct(const tmp<volTensorField>& gradU)
volSymmTensorField D = dev(symm(gradU)); volSymmTensorField D = dev(symm(gradU));
k_ = cI(D)*sqr(delta())*magSqr(D); k_ = cI(D)*sqr(delta())*magSqr(D);
bound(k_, kMin_);
updateSubGridScaleFields(D); updateSubGridScaleFields(D);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -263,8 +263,7 @@ kOmegaSSTSAS::kOmegaSSTSAS
) )
), ),
omega0_("omega0", dimless/dimTime, SMALL), omegaMin_("omegaMin", dimless/dimTime, SMALL),
omegaSmall_("omegaSmall", dimless/dimTime, SMALL),
y_(mesh_), y_(mesh_),
Cmu_ Cmu_
( (
@ -324,6 +323,9 @@ kOmegaSSTSAS::kOmegaSSTSAS
mesh_ mesh_
) )
{ {
bound(k_, kMin_);
bound(omega_, omegaMin_);
updateSubGridScaleFields(magSqr(symm(fvc::grad(U)))); updateSubGridScaleFields(magSqr(symm(fvc::grad(U))));
printCoeffs(); printCoeffs();
@ -346,9 +348,8 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU)
volVectorField gradK = fvc::grad(k_); volVectorField gradK = fvc::grad(k_);
volVectorField gradOmega = fvc::grad(omega_); volVectorField gradOmega = fvc::grad(omega_);
volScalarField L = sqrt(k_)/(pow025(Cmu_)*(omega_ + omegaSmall_)); volScalarField L = sqrt(k_)/(pow025(Cmu_)*omega_);
volScalarField CDkOmega = volScalarField CDkOmega = (2.0*alphaOmega2_)*(gradK & gradOmega)/omega_;
(2.0*alphaOmega2_)*(gradK & gradOmega)/(omega_ + omegaSmall_);
volScalarField F1 = this->F1(CDkOmega); volScalarField F1 = this->F1(CDkOmega);
volScalarField G = nuSgs_*2.0*S2; volScalarField G = nuSgs_*2.0*S2;
@ -368,14 +369,12 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU)
kEqn.relax(); kEqn.relax();
kEqn.solve(); kEqn.solve();
} }
bound(k_, k0()); bound(k_, kMin_);
volScalarField grad_omega_k = max volScalarField grad_omega_k = max
( (
magSqr(gradOmega)/ magSqr(gradOmega)/sqr(omega_),
sqr(omega_ + omegaSmall_), magSqr(gradK)/sqr(k_)
magSqr(gradK)/
sqr(k_ + k0())
); );
// Turbulent frequency equation // Turbulent frequency equation
@ -397,7 +396,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU)
+ FSAS_ + FSAS_
*max *max
( (
dimensionedScalar("zero",dimensionSet(0, 0 , -2, 0, 0),0. ), dimensionedScalar("zero",dimensionSet(0, 0, -2, 0, 0), 0.0),
zetaTilda2_*kappa_*S2*(L/Lvk2(S2)) zetaTilda2_*kappa_*S2*(L/Lvk2(S2))
- 2.0/alphaPhi_*k_*grad_omega_k - 2.0/alphaPhi_*k_*grad_omega_k
) )
@ -406,7 +405,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU)
omegaEqn.relax(); omegaEqn.relax();
omegaEqn.solve(); omegaEqn.solve();
} }
bound(omega_, omega0_); bound(omega_, omegaMin_);
updateSubGridScaleFields(S2); updateSubGridScaleFields(S2);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -103,8 +103,7 @@ protected:
dimensionedScalar zetaTilda2_; dimensionedScalar zetaTilda2_;
dimensionedScalar FSAS_; dimensionedScalar FSAS_;
dimensionedScalar omega0_; dimensionedScalar omegaMin_;
dimensionedScalar omegaSmall_;
wallDist y_; wallDist y_;
dimensionedScalar Cmu_; dimensionedScalar Cmu_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -119,6 +119,8 @@ locDynOneEqEddy::locDynOneEqEddy
filterPtr_(LESfilter::New(U.mesh(), coeffDict())), filterPtr_(LESfilter::New(U.mesh(), coeffDict())),
filter_(filterPtr_()) filter_(filterPtr_())
{ {
bound(k_, kMin_);
volScalarField KK = 0.5*(filter_(magSqr(U)) - magSqr(filter_(U))); volScalarField KK = 0.5*(filter_(magSqr(U)) - magSqr(filter_(U)));
updateSubGridScaleFields(symm(fvc::grad(U)), KK); updateSubGridScaleFields(symm(fvc::grad(U)), KK);
@ -139,7 +141,7 @@ void locDynOneEqEddy::correct(const tmp<volTensorField>& gradU)
volScalarField P = 2.0*nuSgs_*magSqr(D); volScalarField P = 2.0*nuSgs_*magSqr(D);
fvScalarMatrix kEqn tmp<fvScalarMatrix> kEqn
( (
fvm::ddt(k_) fvm::ddt(k_)
+ fvm::div(phi(), k_) + fvm::div(phi(), k_)
@ -149,10 +151,10 @@ void locDynOneEqEddy::correct(const tmp<volTensorField>& gradU)
- fvm::Sp(ce(D, KK)*sqrt(k_)/delta(), k_) - fvm::Sp(ce(D, KK)*sqrt(k_)/delta(), k_)
); );
kEqn.relax(); kEqn().relax();
kEqn.solve(); kEqn().solve();
bound(k_, k0()); bound(k_, kMin_);
updateSubGridScaleFields(D, KK); updateSubGridScaleFields(D, KK);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -86,6 +86,8 @@ oneEqEddy::oneEqEddy
) )
) )
{ {
bound(k_, kMin_);
updateSubGridScaleFields(); updateSubGridScaleFields();
printCoeffs(); printCoeffs();
@ -100,7 +102,7 @@ void oneEqEddy::correct(const tmp<volTensorField>& gradU)
volScalarField G = 2.0*nuSgs_*magSqr(symm(gradU)); volScalarField G = 2.0*nuSgs_*magSqr(symm(gradU));
fvScalarMatrix kEqn tmp<fvScalarMatrix> kEqn
( (
fvm::ddt(k_) fvm::ddt(k_)
+ fvm::div(phi(), k_) + fvm::div(phi(), k_)
@ -110,10 +112,10 @@ void oneEqEddy::correct(const tmp<volTensorField>& gradU)
- fvm::Sp(ce_*sqrt(k_)/delta(), k_) - fvm::Sp(ce_*sqrt(k_)/delta(), k_)
); );
kEqn.relax(); kEqn().relax();
kEqn.solve(); kEqn().solve();
bound(k_, k0()); bound(k_, kMin_);
updateSubGridScaleFields(); updateSubGridScaleFields();
} }

View File

@ -72,7 +72,6 @@ spectEddyVisc::spectEddyVisc
LESModel(typeName, U, phi, transport), LESModel(typeName, U, phi, transport),
GenEddyVisc(U, phi, transport), GenEddyVisc(U, phi, transport),
cB_ cB_
( (
dimensioned<scalar>::lookupOrAddToDict dimensioned<scalar>::lookupOrAddToDict

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -186,9 +186,6 @@ LRR::LRR
autoCreateNut("nut", mesh_) autoCreateNut("nut", mesh_)
) )
{ {
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
nut_.correctBoundaryConditions();
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0) if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
{ {
FatalErrorIn FatalErrorIn
@ -201,6 +198,12 @@ LRR::LRR
<< exit(FatalError); << exit(FatalError);
} }
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
} }
@ -320,7 +323,7 @@ void LRR::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Reynolds stress equation // Reynolds stress equation
@ -368,15 +371,15 @@ void LRR::correct()
R_.dimensions(), R_.dimensions(),
symmTensor symmTensor
( (
k0_.value(), -GREAT, -GREAT, kMin_.value(), -GREAT, -GREAT,
k0_.value(), -GREAT, kMin_.value(), -GREAT,
k0_.value() kMin_.value()
) )
) )
); );
k_ = 0.5*tr(R_); k_ = 0.5*tr(R_);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -140,7 +140,10 @@ LamBremhorstKE::LamBremhorstKE
autoCreateLowReNut("nut", mesh_) autoCreateLowReNut("nut", mesh_)
) )
{ {
nut_ = Cmu_*fMu_*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_*fMu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -260,7 +263,7 @@ void LamBremhorstKE::correct()
epsEqn().relax(); epsEqn().relax();
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -276,7 +279,7 @@ void LamBremhorstKE::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -224,7 +224,10 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
autoCreateNut("nut", mesh_) autoCreateNut("nut", mesh_)
) )
{ {
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0) if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
@ -362,7 +365,7 @@ void LaunderGibsonRSTM::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Reynolds stress equation // Reynolds stress equation
@ -419,15 +422,15 @@ void LaunderGibsonRSTM::correct()
R_.dimensions(), R_.dimensions(),
symmTensor symmTensor
( (
k0_.value(), -GREAT, -GREAT, kMin_.value(), -GREAT, -GREAT,
k0_.value(), -GREAT, kMin_.value(), -GREAT,
k0_.value() kMin_.value()
) )
) )
); );
k_ == 0.5*tr(R_); k_ == 0.5*tr(R_);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate turbulent viscosity // Re-calculate turbulent viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -146,7 +146,10 @@ LaunderSharmaKE::LaunderSharmaKE
autoCreateLowReNut("nut", mesh_) autoCreateLowReNut("nut", mesh_)
) )
{ {
nut_ = Cmu_*fMu()*sqr(k_)/(epsilonTilda_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilonTilda_, epsilonMin_);
nut_ = Cmu_*fMu()*sqr(k_)/epsilonTilda_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -256,7 +259,7 @@ void LaunderSharmaKE::correct()
epsEqn().relax(); epsEqn().relax();
solve(epsEqn); solve(epsEqn);
bound(epsilonTilda_, epsilon0_); bound(epsilonTilda_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -272,7 +275,7 @@ void LaunderSharmaKE::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -171,8 +171,16 @@ LienCubicKE::LienCubicKE
), ),
gradU_(fvc::grad(U)), gradU_(fvc::grad(U)),
eta_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))), eta_
ksi_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))), (
k_/(epsilon_ + epsilonMin_)
*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))
),
ksi_
(
k_/(epsilon_ + epsilonMin_)
*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))
),
Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))), Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
fEta_(A2_ + pow(eta_, 3.0)), fEta_(A2_ + pow(eta_, 3.0)),
@ -226,7 +234,10 @@ LienCubicKE::LienCubicKE
) )
) )
{ {
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_) + C5viscosity_; bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_*sqr(k_)/epsilon_ + C5viscosity_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -350,7 +361,7 @@ void LienCubicKE::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -367,7 +378,7 @@ void LienCubicKE::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -220,14 +220,22 @@ LienCubicKELowRe::LienCubicKELowRe
y_(mesh_), y_(mesh_),
gradU_(fvc::grad(U)), gradU_(fvc::grad(U)),
eta_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))), eta_
ksi_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))), (
k_/(epsilon_ + epsilonMin_)
*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))
),
ksi_
(
k_/(epsilon_ + epsilonMin_)
*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))
),
Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))), Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
fEta_(A2_ + pow(eta_, 3.0)), fEta_(A2_ + pow3(eta_)),
C5viscosity_ C5viscosity_
( (
-2.0*pow(Cmu_, 3.0)*pow(k_, 4.0)/pow(epsilon_, 3.0) -2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_ + epsilonMin_)
*(magSqr(gradU_ + gradU_.T()) - magSqr(gradU_ - gradU_.T())) *(magSqr(gradU_ + gradU_.T()) - magSqr(gradU_ - gradU_.T()))
), ),
@ -252,7 +260,7 @@ LienCubicKELowRe::LienCubicKELowRe
symm symm
( (
// quadratic terms // quadratic terms
pow(k_, 3.0)/sqr(epsilon_) pow3(k_)/sqr(epsilon_ + epsilonMin_)
*( *(
Ctau1_/fEta_ Ctau1_/fEta_
*( *(
@ -263,8 +271,8 @@ LienCubicKELowRe::LienCubicKELowRe
+ Ctau3_/fEta_*(gradU_.T() & gradU_) + Ctau3_/fEta_*(gradU_.T() & gradU_)
) )
// cubic term C4 // cubic term C4
- 20.0*pow(k_, 4.0)/pow(epsilon_, 3.0) - 20.0*pow4(k_)/pow3(epsilon_ + epsilonMin_)
*pow(Cmu_, 3.0) *pow3(Cmu_)
*( *(
((gradU_ & gradU_) & gradU_.T()) ((gradU_ & gradU_) & gradU_.T())
+ ((gradU_ & gradU_.T()) & gradU_.T()) + ((gradU_ & gradU_.T()) & gradU_.T())
@ -280,12 +288,13 @@ LienCubicKELowRe::LienCubicKELowRe
) )
) )
{ {
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_ nut_ = Cmu_
*( * (scalar(1) - exp(-Am_*yStar_))
scalar(1) - exp(-Am_*yStar_)) / (scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL * sqr(k_)/epsilon_
)
*sqr(k_)/(epsilon_ + epsilonSmall_)
// cubic term C5, implicit part // cubic term C5, implicit part
+ max + max
( (
@ -430,11 +439,11 @@ void LienCubicKELowRe::correct()
epsEqn().relax(); epsEqn().relax();
# include "LienCubicKELowReSetWallDissipation.H" #include "LienCubicKELowReSetWallDissipation.H"
# include "wallDissipationI.H" #include "wallDissipationI.H"
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -451,7 +460,7 @@ void LienCubicKELowRe::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -180,9 +180,12 @@ LienLeschzinerLowRe::LienLeschzinerLowRe
autoCreateLowReNut("nut", mesh_) autoCreateLowReNut("nut", mesh_)
) )
{ {
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_*(scalar(1) - exp(-Am_*yStar_)) nut_ = Cmu_*(scalar(1) - exp(-Am_*yStar_))
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)*sqr(k_) /(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)*sqr(k_)
/(epsilon_ + epsilonSmall_); /(epsilon_);
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -322,7 +325,7 @@ void LienLeschzinerLowRe::correct()
#include "wallDissipationI.H" #include "wallDissipationI.H"
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -339,7 +342,7 @@ void LienLeschzinerLowRe::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -190,19 +190,27 @@ NonlinearKEShih::NonlinearKEShih
), ),
gradU_(fvc::grad(U)), gradU_(fvc::grad(U)),
eta_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))), eta_
ksi_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))), (
k_/(epsilon_ + epsilonMin_)
*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))
),
ksi_
(
k_/(epsilon_+ epsilonMin_)
*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))
),
Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))), Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
fEta_(A2_ + pow(eta_, 3.0)), fEta_(A2_ + pow(eta_, 3.0)),
nut_("nut", Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_)), nut_("nut", Cmu_*sqr(k_)/(epsilon_ + epsilonMin_)),
nonlinearStress_ nonlinearStress_
( (
"nonlinearStress", "nonlinearStress",
symm symm
( (
pow(k_, 3.0)/sqr(epsilon_) pow3(k_)/sqr(epsilon_ + epsilonMin_)
*( *(
Ctau1_/fEta_ Ctau1_/fEta_
*( *(
@ -215,6 +223,9 @@ NonlinearKEShih::NonlinearKEShih
) )
) )
{ {
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
#include "wallNonlinearViscosityI.H" #include "wallNonlinearViscosityI.H"
printCoeffs(); printCoeffs();
@ -343,7 +354,7 @@ void NonlinearKEShih::correct()
#include "wallDissipationI.H" #include "wallDissipationI.H"
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -360,7 +371,7 @@ void NonlinearKEShih::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -80,11 +80,9 @@ RASModel::RASModel
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(subOrEmptyDict(type + "Coeffs")), coeffDict_(subOrEmptyDict(type + "Coeffs")),
k0_("k0", dimVelocity*dimVelocity, SMALL), kMin_("kMin", sqr(dimVelocity), SMALL),
epsilon0_("epsilon", k0_.dimensions()/dimTime, SMALL), epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL),
epsilonSmall_("epsilonSmall", epsilon0_.dimensions(), SMALL), omegaMin_("omegaMin", dimless/dimTime, SMALL),
omega0_("omega0", dimless/dimTime, SMALL),
omegaSmall_("omegaSmall", omega0_.dimensions(), SMALL),
y_(mesh_) y_(mesh_)
{ {
@ -133,8 +131,12 @@ autoPtr<RASModel> RASModel::New
{ {
FatalErrorIn FatalErrorIn
( (
"RASModel::New(const volVectorField&, " "RASModel::New"
"const surfaceScalarField&, transportModel&)" "("
"const volVectorField&, "
"const surfaceScalarField&, "
"transportModel&"
")"
) << "Unknown RASModel type " << modelName ) << "Unknown RASModel type " << modelName
<< endl << endl << endl << endl
<< "Valid RASModel types are :" << endl << "Valid RASModel types are :" << endl
@ -213,11 +215,9 @@ bool RASModel::read()
coeffDict_ <<= *dictPtr; coeffDict_ <<= *dictPtr;
} }
k0_.readIfPresent(*this); kMin_.readIfPresent(*this);
epsilon0_.readIfPresent(*this); epsilonMin_.readIfPresent(*this);
epsilonSmall_.readIfPresent(*this); omegaMin_.readIfPresent(*this);
omega0_.readIfPresent(*this);
omegaSmall_.readIfPresent(*this);
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -87,19 +87,13 @@ protected:
dictionary coeffDict_; dictionary coeffDict_;
//- Lower limit of k //- Lower limit of k
dimensionedScalar k0_; dimensionedScalar kMin_;
//- Lower limit of epsilon //- Lower limit of epsilon
dimensionedScalar epsilon0_; dimensionedScalar epsilonMin_;
//- Small epsilon value used to avoid divide by zero
dimensionedScalar epsilonSmall_;
//- Lower limit for omega //- Lower limit for omega
dimensionedScalar omega0_; dimensionedScalar omegaMin_;
//- Small omega value used to avoid divide by zero
dimensionedScalar omegaSmall_;
//- Near wall distance boundary field //- Near wall distance boundary field
nearWallDist y_; nearWallDist y_;
@ -176,68 +170,40 @@ public:
// Access // Access
//- Return the value of k0 which k is not allowed to be less than //- Return lower allowable limit for k (default: SMALL)
const dimensionedScalar& k0() const const dimensionedScalar& kMin() const
{ {
return k0_; return kMin_;
} }
//- Return the value of epsilon0 which epsilon is not allowed to be //- Return the lower allowable limit for epsilon (default: SMALL)
// less than const dimensionedScalar& epsilonMin() const
const dimensionedScalar& epsilon0() const
{ {
return epsilon0_; return epsilonMin_;
} }
//- Return the value of epsilonSmall which is added to epsilon when //- Return the lower allowable limit for omega (default: SMALL)
// calculating nut const dimensionedScalar& omegaMin() const
const dimensionedScalar& epsilonSmall() const
{ {
return epsilonSmall_; return omegaMin_;
} }
//- Return the value of omega0 which epsilon is not allowed to be //- Allow kMin to be changed
// less than dimensionedScalar& kMin()
const dimensionedScalar& omega0() const
{ {
return omega0_; return kMin_;
} }
//- Return the value of omegaSmall which is added to epsilon when //- Allow epsilonMin to be changed
// calculating nut dimensionedScalar& epsilonMin()
const dimensionedScalar& omegaSmall() const
{ {
return omegaSmall_; return epsilonMin_;
} }
//- Allow k0 to be changed //- Allow omegaMin to be changed
dimensionedScalar& k0() dimensionedScalar& omegaMin()
{ {
return k0_; return omegaMin_;
}
//- Allow epsilon0 to be changed
dimensionedScalar& epsilon0()
{
return epsilon0_;
}
//- Allow epsilonSmall to be changed
dimensionedScalar& epsilonSmall()
{
return epsilonSmall_;
}
//- Allow omega0 to be changed
dimensionedScalar& omega0()
{
return omega0_;
}
//- Allow omegaSmall to be changed
dimensionedScalar& omegaSmall()
{
return omegaSmall_;
} }
//- Return the near wall distances //- Return the near wall distances

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -155,7 +155,10 @@ RNGkEpsilon::RNGkEpsilon
autoCreateNut("nut", mesh_) autoCreateNut("nut", mesh_)
) )
{ {
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -274,7 +277,7 @@ void RNGkEpsilon::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -290,7 +293,7 @@ void RNGkEpsilon::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -128,7 +128,10 @@ kEpsilon::kEpsilon
autoCreateNut("nut", mesh_) autoCreateNut("nut", mesh_)
) )
{ {
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -237,7 +240,7 @@ void kEpsilon::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -254,7 +257,7 @@ void kEpsilon::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -137,7 +137,10 @@ kOmega::kOmega
autoCreateNut("nut", mesh_) autoCreateNut("nut", mesh_)
) )
{ {
nut_ = k_/(omega_ + omegaSmall_); bound(k_, kMin_);
bound(omega_, omegaMin_);
nut_ = k_/omega_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -246,7 +249,7 @@ void kOmega::correct()
omegaEqn().boundaryManipulate(omega_.boundaryField()); omegaEqn().boundaryManipulate(omega_.boundaryField());
solve(omegaEqn); solve(omegaEqn);
bound(omega_, omega0_); bound(omega_, omegaMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -263,11 +266,11 @@ void kOmega::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity
nut_ = k_/(omega_ + omegaSmall_); nut_ = k_/omega_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -236,13 +236,18 @@ kOmegaSST::kOmegaSST
autoCreateNut("nut", mesh_) autoCreateNut("nut", mesh_)
) )
{ {
bound(k_, kMin_);
bound(omega_, omegaMin_);
nut_ = nut_ =
(
a1_*k_ a1_*k_
/max / max
( (
a1_*(omega_ + omegaSmall_), a1_*omega_,
F2()*mag(symm(fvc::grad(U_))) F2()*mag(symm(fvc::grad(U_)))
); )
);
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -374,7 +379,7 @@ void kOmegaSST::correct()
omegaEqn().boundaryManipulate(omega_.boundaryField()); omegaEqn().boundaryManipulate(omega_.boundaryField());
solve(omegaEqn); solve(omegaEqn);
bound(omega_, omega0_); bound(omega_, omegaMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
tmp<fvScalarMatrix> kEqn tmp<fvScalarMatrix> kEqn
@ -390,7 +395,7 @@ void kOmegaSST::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -126,6 +126,9 @@ qZeta::qZeta
) )
), ),
qMin_("qMin", dimVelocity, SMALL),
zetaMin_("zetaMin", dimVelocity/dimTime, SMALL),
k_ k_
( (
IOobject IOobject
@ -193,7 +196,12 @@ qZeta::qZeta
autoCreateNut("nut", mesh_) autoCreateNut("nut", mesh_)
) )
{ {
nut_ = Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_); bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
bound(q_, qMin_);
bound(zeta_, zetaMin_);
nut_ = Cmu_*fMu()*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -263,6 +271,9 @@ bool qZeta::read()
sigmaZeta_.readIfPresent(coeffDict()); sigmaZeta_.readIfPresent(coeffDict());
anisotropic_.readIfPresent("anisotropic", coeffDict()); anisotropic_.readIfPresent("anisotropic", coeffDict());
qMin_.readIfPresent(*this);
zetaMin_.readIfPresent(*this);
return true; return true;
} }
else else
@ -302,7 +313,7 @@ void qZeta::correct()
zetaEqn().relax(); zetaEqn().relax();
solve(zetaEqn); solve(zetaEqn);
bound(zeta_, epsilon0_/(2*sqrt(k0_))); bound(zeta_, zetaMin_);
// q equation // q equation
@ -318,7 +329,7 @@ void qZeta::correct()
qEqn().relax(); qEqn().relax();
solve(qEqn); solve(qEqn);
bound(q_, sqrt(k0_)); bound(q_, qMin_);
// Re-calculate k and epsilon // Re-calculate k and epsilon

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -66,6 +66,11 @@ class qZeta
dimensionedScalar sigmaZeta_; dimensionedScalar sigmaZeta_;
Switch anisotropic_; Switch anisotropic_;
//- Lower limit of q
dimensionedScalar qMin_;
//- Lower limit of zeta
dimensionedScalar zetaMin_;
// Fields // Fields
@ -107,6 +112,33 @@ public:
// Member Functions // Member Functions
// Access
//- Return lower allowable limit for q (default: SMALL)
const dimensionedScalar& qMin() const
{
return qMin_;
}
//- Return the lower allowable limit for zeta (default: SMALL)
const dimensionedScalar& zetaMin() const
{
return zetaMin_;
}
//- Allow qMin to be changed
dimensionedScalar& qMin()
{
return qMin_;
}
//- Allow zetaMin to be changed
dimensionedScalar& zetaMin()
{
return zetaMin_;
}
//- Return the turbulence viscosity //- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const virtual tmp<volScalarField> nut() const
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -69,7 +69,7 @@ tmp<volScalarField> realizableKE::rCmu
volScalarField As = sqrt(6.0)*cos(phis); volScalarField As = sqrt(6.0)*cos(phis);
volScalarField Us = sqrt(S2/2.0 + magSqr(skew(gradU))); volScalarField Us = sqrt(S2/2.0 + magSqr(skew(gradU)));
return 1.0/(A0_ + As*Us*k_/(epsilon_ + epsilonSmall_)); return 1.0/(A0_ + As*Us*k_/epsilon_);
} }
@ -178,10 +178,10 @@ realizableKE::realizableKE
autoCreateNut("nut", mesh_) autoCreateNut("nut", mesh_)
) )
{ {
bound(k_, k0_); bound(k_, kMin_);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
nut_ = rCmu(fvc::grad(U_))*sqr(k_)/(epsilon_ + epsilonSmall_); nut_ = rCmu(fvc::grad(U_))*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions(); nut_.correctBoundaryConditions();
printCoeffs(); printCoeffs();
@ -303,7 +303,7 @@ void realizableKE::correct()
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
bound(epsilon_, epsilon0_); bound(epsilon_, epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -319,7 +319,7 @@ void realizableKE::correct()
kEqn().relax(); kEqn().relax();
solve(kEqn); solve(kEqn);
bound(k_, k0_); bound(k_, kMin_);
// Re-calculate viscosity // Re-calculate viscosity

View File

@ -353,14 +353,17 @@ meshQualityControls
// Set to 180 to disable. // Set to 180 to disable.
maxConcave 80; maxConcave 80;
//- Minimum projected area v.s. actual area. Set to -1 to disable.
minFlatness 0.5;
//- Minimum pyramid volume. Is absolute volume of cell pyramid. //- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to a sensible fraction of the smallest cell volume expected. // Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable. // Set to very negative number (e.g. -1E30) to disable.
minVol 1e-13; minVol 1e-13;
//- Minimum tet volume. Is absolute volume of the tet formed by the
// face-centre decomposition triangle and the cell centre.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable.
minTetVol 1e-20;
//- Minimum face area. Set to <0 to disable. //- Minimum face area. Set to <0 to disable.
minArea -1; minArea -1;

View File

@ -335,13 +335,16 @@ meshQualityControls
// Set to 180 to disable. // Set to 180 to disable.
maxConcave 80; maxConcave 80;
//- Minimum projected area v.s. actual area. Set to -1 to disable.
minFlatness 0.5;
//- Minimum pyramid volume. Is absolute volume of cell pyramid. //- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to very negative number (e.g. -1E30) to disable. // Set to very negative number (e.g. -1E30) to disable.
minVol 0; minVol 0;
//- Minimum tet volume. Is absolute volume of the tet formed by the
// face-centre decomposition triangle and the cell centre.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable.
minTetVol 1e-20;
//- Minimum face area. Set to <0 to disable. //- Minimum face area. Set to <0 to disable.
minArea -1; minArea -1;

View File

@ -546,14 +546,17 @@ meshQualityControls
// Set to 180 to disable. // Set to 180 to disable.
maxConcave 80; maxConcave 80;
//- Minimum projected area v.s. actual area. Set to -1 to disable.
minFlatness 0.5;
//- Minimum pyramid volume. Is absolute volume of cell pyramid. //- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to a sensible fraction of the smallest cell volume expected. // Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable. // Set to very negative number (e.g. -1E30) to disable.
minVol 1e-13; minVol 1e-13;
//- Minimum tet volume. Is absolute volume of the tet formed by the
// face-centre decomposition triangle and the cell centre.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable.
minTetVol 1e-20;
//- Minimum face area. Set to <0 to disable. //- Minimum face area. Set to <0 to disable.
minArea -1; minArea -1;

View File

@ -288,13 +288,16 @@ meshQualityControls
// Set to 180 to disable. // Set to 180 to disable.
maxConcave 80; maxConcave 80;
//- Minimum projected area v.s. actual area. Set to -1 to disable.
minFlatness 0.5;
//- Minimum pyramid volume. Is absolute volume of cell pyramid. //- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to very negative number (e.g. -1E30) to disable. // Set to very negative number (e.g. -1E30) to disable.
minVol 1e-20; minVol 1e-20;
//- Minimum tet volume. Is absolute volume of the tet formed by the
// face-centre decomposition triangle and the cell centre.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable.
minTetVol 1e-20;
//- Minimum face area. Set to <0 to disable. //- Minimum face area. Set to <0 to disable.
minArea -1; minArea -1;

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -31,7 +31,7 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# The Makefile use a POSIX shell # The Makefile uses a POSIX shell
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
SHELL = /bin/sh SHELL = /bin/sh
@ -120,7 +120,7 @@ MAKE_DEP = @$(MKDEP) $< | $(WM_SCRIPTS)/addCompile $<
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Include PROJECT directory tree file and # Include PROJECT directory tree file and
# source, object and dependency list files. # source, object and dependency list files.
# These are constructed by wmakeDerivedFiles # These are constructed by scripts/makeDerivedFiles
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
include $(OBJECTS_DIR)/options include $(OBJECTS_DIR)/options
@ -148,7 +148,7 @@ LIB_HEADER_DIRS = \
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
$(EXE): $(OBJECTS) $(EXE): $(OBJECTS)
@$(WM_SCRIPTS)/mkObjectDir $(EXE) @$(WM_SCRIPTS)/makeTargetDir $(EXE)
$(LINKEXE) $(OBJECTS) -L$(LIB_WM_OPTIONS_DIR) \ $(LINKEXE) $(OBJECTS) -L$(LIB_WM_OPTIONS_DIR) \
$(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE) $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE)
@ -156,7 +156,7 @@ exe: $(SEXE)
@echo \'$(SEXE)\' is up to date. @echo \'$(SEXE)\' is up to date.
$(SEXE): $(OBJECTS) $(SEXE): $(OBJECTS)
@$(WM_SCRIPTS)/mkObjectDir $(SEXE) @$(WM_SCRIPTS)/makeTargetDir $(SEXE)
$(LINKEXE) $(OBJECTS) $(EXE_LIBS) \ $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
$(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
@ -169,7 +169,7 @@ libso: $(LIB).$(SO)
@echo \'$(LIB).$(SO)\' is up to date. @echo \'$(LIB).$(SO)\' is up to date.
$(LIB).$(SO): $(OBJECTS) $(LIB).$(SO): $(OBJECTS)
@$(WM_SCRIPTS)/mkObjectDir $(LIB) @$(WM_SCRIPTS)/makeTargetDir $(LIB)
@rm -f so_locations @rm -f so_locations
@cd $(OBJECTS_DIR) ; \ @cd $(OBJECTS_DIR) ; \
$(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO) $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
@ -178,7 +178,7 @@ lib: $(LIB).a
@echo \'$(LIB).a\' is up to date. @echo \'$(LIB).a\' is up to date.
$(LIB).a: $(OBJECTS) $(LIB).a: $(OBJECTS)
@$(WM_SCRIPTS)/mkObjectDir $(LIB) @$(WM_SCRIPTS)/makeTargetDir $(LIB)
@rm -f $(LIB).a @rm -f $(LIB).a
$(AR) $(ARFLAGS) $(LIB).a $(OBJECTS) $(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
$(RANLIB) $(LIB).a $(RANLIB) $(LIB).a
@ -187,7 +187,7 @@ libo: $(LIB).o
@echo \'$(LIB).o\' is up to date. @echo \'$(LIB).o\' is up to date.
$(LIB).o: $(OBJECTS) $(LIB).o: $(OBJECTS)
@$(WM_SCRIPTS)/mkObjectDir $(LIB) @$(WM_SCRIPTS)/makeTargetDir $(LIB)
@rm -f $(LIB).o @rm -f $(LIB).o
$(LD) -r -o $(LIB).o $(OBJECTS) $(LD) -r -o $(LIB).o $(OBJECTS)
@ -195,7 +195,7 @@ jar: $(LIB).jar
@echo \'$(LIB).jar\' is up to date. @echo \'$(LIB).jar\' is up to date.
$(LIB).jar: $(OBJECTS) $(LIB).jar: $(OBJECTS)
@$(WM_SCRIPTS)/mkObjectDir $(LIB) @$(WM_SCRIPTS)/makeTargetDir $(LIB)
jar cfm $(LIB).jar $(LIB_LIBS) -C $(CLASSES_DIR) . jar cfm $(LIB).jar $(LIB_LIBS) -C $(CLASSES_DIR) .
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -32,6 +32,7 @@
GENERAL_RULES = $(WM_DIR)/rules/General GENERAL_RULES = $(WM_DIR)/rules/General
RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
WM_SCRIPTS = $(WM_DIR)/scripts
OBJECTS_DIR = $(WM_OPTIONS) OBJECTS_DIR = $(WM_OPTIONS)
FFLAGS = FFLAGS =
@ -61,16 +62,16 @@ $(FILES) : files
@$(CPP) $(GFLAGS) $(FFLAGS) files > $(FILES) @$(CPP) $(GFLAGS) $(FFLAGS) files > $(FILES)
$(SFILES): files $(SFILES): files
@wmakeDerivedFiles @$(WM_SCRIPTS)/makeDerivedFiles
$(OFILES): files $(OFILES): files
@wmakeDerivedFiles @$(WM_SCRIPTS)/makeDerivedFiles
$(DFILES): files $(DFILES): files
@wmakeDerivedFiles @$(WM_SCRIPTS)/makeDerivedFiles
$(IFILES): files $(IFILES): files
@wmakeDerivedFiles @$(WM_SCRIPTS)/makeDerivedFiles
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -32,6 +32,7 @@
GENERAL_RULES = $(WM_DIR)/rules/General GENERAL_RULES = $(WM_DIR)/rules/General
RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
WM_SCRIPTS = $(WM_DIR)/scripts
include $(GENERAL_RULES)/general include $(GENERAL_RULES)/general
include $(RULES)/general include $(RULES)/general
@ -47,8 +48,8 @@ OPTIONS = $(WM_OPTIONS)/options
# Causes all derived files to be remade if any are changed or missing # Causes all derived files to be remade if any are changed or missing
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
$(OPTIONS) : options $(OPTIONS) : options
@wmkdir $(WM_OPTIONS) ; $(CPP) $(GFLAGS) options > $(OPTIONS) @$(WM_SCRIPTS)/makeDir $(WM_OPTIONS) ; $(CPP) $(GFLAGS) options > $(OPTIONS)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License

View File

@ -1,4 +1,11 @@
CGAL_INC = \ CGAL_INC = \
-Wno-old-style-cast \ -Wno-old-style-cast \
-I${CGAL_SRC}/include \ -I$(CGAL_ARCH_PATH)/include \
-I${BOOST_ROOT}/include/boost-${BOOST_LIB_VERSION} -I$(MPFR_ARCH_PATH)/include \
-I$(BOOST_ARCH_PATH)/include/boost
CGAL_LIBS = \
-L$(MPFR_ARCH_PATH)/lib \
-L$(BOOST_ARCH_PATH)/lib \
-lmpfr \
-lboost_thread

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -24,22 +24,21 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Script # Script
# wmakeDerivedFiles # makeDerivedFiles
# #
# Description # Description
# Constructs all the file list for make given the source file list # Constructs all the file list for make given the source file list,
# (which written by hand or using makeFilesAndDirectories.) # written was by hand or using makeFilesAndOptions.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if [ ! -d "$WM_OPTIONS" ] [ -d "$WM_OPTIONS" ] || {
then echo "The '$WM_OPTIONS' directory does not exist, exiting" 1>&2
echo "The $WM_OPTIONS directory does not exist, exiting" 1>&2
exit 1 exit 1
fi }
# change to the $WM_OPTIONS directory # change to the $WM_OPTIONS directory
cd $WM_OPTIONS 2>/dev/null || { cd "$WM_OPTIONS" 2>/dev/null || {
echo "Could not change to directory '$WM_OPTIONS'" 1>&2 echo "Could not change to directory '$WM_OPTIONS'" 1>&2
exit 1 exit 1
} }
@ -50,15 +49,15 @@ grep "=" files > filesMacros
# Remove all macro definitions from the files list # Remove all macro definitions from the files list
grep -v "=" files > filesPlusBlank grep -v "=" files > filesPlusBlank
# Add a newline to files to make sure the last line is followed by a newline # Add a newline to files to ensure the last line is followed by a newline
echo "" >> filesPlusBlank echo "" >> filesPlusBlank
# Remove commented lines blank lines, and trailing blanks from files # Remove commented lines, blank lines, and trailing blanks from files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sed -e '/^#/ d' \ sed -e '/^#/ d' \
-e '/^[ \t]*$/ d' \ -e '/^[ \t]*$/ d' \
-e 's/[ \t]*$//' \ -e 's/[ \t]*$//' \
filesPlusBlank > files.$$ filesPlusBlank > files.$$
rm filesPlusBlank rm filesPlusBlank
@ -80,7 +79,7 @@ rm tmpSourceFile
# ~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~
sed -e 's%.*/%%' \ sed -e 's%.*/%%' \
-e 's%^%$(OBJECTS_DIR)/%' \ -e 's%^%$(OBJECTS_DIR)/%' \
-e 's%\.[a-zA-Z]*$%\.o%' \ -e 's%\.[a-zA-Z]*$%\.o%' \
files.$$ > tmpObjectFiles files.$$ > tmpObjectFiles
echo "OBJECTS = " > tmpObjectFiles2 echo "OBJECTS = " > tmpObjectFiles2
@ -96,7 +95,7 @@ rm tmpObjectFiles tmpObjectFiles2
# make localObjectFiles # make localObjectFiles
# ~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~
sed -e 's%.*/%%' \ sed -e 's%.*/%%' \
-e 's%\.[a-zA-Z]*$%\.o%' \ -e 's%\.[a-zA-Z]*$%\.o%' \
files.$$ > tmpLocalObjectFiles files.$$ > tmpLocalObjectFiles
echo "LOCAL_OBJECTS = " > tmpLocalObjectFiles2 echo "LOCAL_OBJECTS = " > tmpLocalObjectFiles2
@ -132,6 +131,4 @@ sed -e 's/\.[a-zA-Z]*$/.dep/' \
rm files.$$ rm files.$$
cd ..
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -24,28 +24,18 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Script # Script
# wmkdir # makeDir
# #
# Description # Description
# Script to make directories that do not already exist # Script to make directories that do not already exist
# Usage : wmkdir <dir> [.. <dirN>] # Usage : makeDir <dir> [.. <dirN>]
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if [ $# -ge 1 ] for dir
then do
# provide help [ -d "$dir" ] || mkdir -p "$dir"
if [ "$1" = "-h" -o "$1" = "-help" ] done
then
echo "usage: ${0##*/} <dir> [.. <dirN>]"
echo " mkdir if directories do not already exist"
echo
else
for dir
do
[ -d "$dir" ] || mkdir -p "$dir"
done
fi
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -24,21 +24,19 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Script # Script
# mkObjectDir # makeTargetDir
# #
# Description # Description
# Makes a directory hierarchy for the given object file # Makes a directory hierarchy for the given target file
# #
# Usage: mkObjectDir <directory> # Usage: makeTargetDir <directory>
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if [ $# -eq 1 ] for target
then do
if [ ! -d ${1%/*} -a $1 != ${1%/*} ] dir=${target%/*}
then [ -d "$dir" ] || [ "$dir" = "$target" ] || mkdir -p "$dir"
mkdir -p ${1%/*} done
fi
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -58,13 +58,14 @@ USAGE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# simple option parsing # default 'find' option
unset forceUpdate
unset findOpt unset findOpt
# default ln option # default 'ln' option
lnOpt="-s" lnOpt="-s"
unset forceUpdate
# simple parse options # simple parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
@ -74,7 +75,7 @@ do
;; ;;
-f) -f)
shift shift
forceUpdate=1 forceUpdate=true
lnOpt="-sf" lnOpt="-sf"
;; ;;
-*) -*)
@ -110,28 +111,25 @@ done
incDir=$baseDir/lnInclude incDir=$baseDir/lnInclude
if [ ! -d $baseDir ] [ -d $baseDir ] || {
then
echo "$Script error: base directory $baseDir does not exist" 1>&2 echo "$Script error: base directory $baseDir does not exist" 1>&2
exit 2 exit 2
fi }
if [ -d $incDir ] if [ -d $incDir ]
then then
if [ ! "$forceUpdate" ] [ "$forceUpdate" = true ] || {
then # echo "$Script error: include directory $incDir already exists" 1>&2
# echo "$Script error: include directory $incDir already exists" 1>&2 exit 0
exit 0 }
fi
else else
mkdir $incDir mkdir $incDir
fi fi
if [ ! -d $incDir ] [ -d $incDir ] || {
then
echo "$Script error: failed to create include directory $incDir" 1>&2 echo "$Script error: failed to create include directory $incDir" 1>&2
exit 0 exit 0
fi }
cd $incDir || exit 1 cd $incDir || exit 1

Some files were not shown because too many files have changed in this diff Show More