Lots of changes from Mark and my changes to ddtPhiCorr all mixed together

because I failed to work out how to merge Mark's stuff -- HELP!!!
This commit is contained in:
henry
2008-05-25 21:46:37 +01:00
parent a016fa314e
commit 4a2a23a710
60 changed files with 938 additions and 410 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
set -x set -x
(cd solvers ; wmake all) ( cd solvers && wmake all )
(cd utilities ; wmake all) ( cd utilities && wmake all )

View File

@ -56,32 +56,35 @@ int main(int argc, char *argv[])
{ {
# include "readControls.H" # include "readControls.H"
# include "CourantNo.H" # include "CourantNo.H"
p.storePrevIter();
// Make the fluxes absolute
fvc::makeAbsolute(phi, U);
# include "setDeltaT.H" # include "setDeltaT.H"
runTime++; runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
bool meshChanged = mesh.update(); // Make the fluxes absolute
if (mesh.changing())
{
phi = fvc::interpolate(U) & mesh.Sf();
}
if (correctPhi && meshChanged) mesh.update();
if (mesh.changing() && correctPhi)
{ {
# include "correctPhi.H" # include "correctPhi.H"
} }
// Keep the absolute fluxes for use in ddtPhiCorr // Keep the absolute fluxes for use in ddtPhiCorr
surfaceScalarField phiAbs("phiAbs", phi); surfaceScalarField phiAbs0("phiAbs0", phi);
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U); if (mesh.changing())
{
fvc::makeRelative(phi, U);
}
if (meshChanged && checkMeshCourantNo) if (mesh.changing() && checkMeshCourantNo)
{ {
# include "meshCourantNo.H" # include "meshCourantNo.H"
} }
@ -89,6 +92,8 @@ int main(int argc, char *argv[])
// --- PIMPLE loop // --- PIMPLE loop
for (int ocorr=0; ocorr<nOuterCorr; ocorr++) for (int ocorr=0; ocorr<nOuterCorr; ocorr++)
{ {
p.storePrevIter();
# include "UEqn.H" # include "UEqn.H"
// --- PISO loop // --- PISO loop
@ -101,10 +106,50 @@ int main(int argc, char *argv[])
if (ddtPhiCorr) if (ddtPhiCorr)
{ {
phi += fvc::ddtPhiCorr(rAU, U, phiAbs); if (mesh.changing())
{
dimensionedScalar rDeltaT = 1.0/mesh.time().deltaT();
volScalarField V0byV
(
IOobject
(
"V0byV",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar("V0byV", dimless, 1),
zeroGradientFvPatchScalarField::typeName
);
V0byV.dimensionedInternalField() = mesh.V0()/mesh.V();
V0byV.correctBoundaryConditions();
phi += rDeltaT*
(
fvc::interpolate(rAU*V0byV)*phiAbs0
- (fvc::interpolate(rAU*V0byV*U.oldTime()) & mesh.Sf())
);
}
else
{
phi += fvc::ddtPhiCorr(rAU, U, phiAbs0);
}
} }
adjustPhi(phi, U, p); if (p.needReference())
{
if (mesh.changing())
{
fvc::makeRelative(phi, U);
adjustPhi(phi, U, p);
fvc::makeAbsolute(phi, U);
}
else
{
adjustPhi(phi, U, p);
}
}
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
@ -138,11 +183,11 @@ int main(int argc, char *argv[])
p.relax(); p.relax();
} }
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
} }
} }

View File

@ -41,6 +41,7 @@ Description
#include "twoPhaseMixture.H" #include "twoPhaseMixture.H"
#include "incompressible/turbulenceModel/turbulenceModel.H" #include "incompressible/turbulenceModel/turbulenceModel.H"
#include "probes.H" #include "probes.H"
#include "EulerDdtScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -66,7 +67,6 @@ int main(int argc, char *argv[])
{ {
#include "readControls.H" #include "readControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setDeltaT.H" #include "setDeltaT.H"
runTime++; runTime++;
@ -76,7 +76,7 @@ int main(int argc, char *argv[])
// Make the fluxes absolute // Make the fluxes absolute
if (mesh.changing()) if (mesh.changing())
{ {
fvc::makeAbsolute(phi, U); phi = fvc::interpolate(U) & mesh.Sf();
} }
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
@ -100,7 +100,7 @@ int main(int argc, char *argv[])
} }
// Keep the absolute fluxes for use in ddtPhiCorr // Keep the absolute fluxes for use in ddtPhiCorr
surfaceScalarField phiAbs("phiAbs", phi); surfaceScalarField phiAbs0("phiAbs0", phi);
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
if (mesh.changing()) if (mesh.changing())
@ -125,8 +125,6 @@ int main(int argc, char *argv[])
#include "pEqn.H" #include "pEqn.H"
} }
#include "continuityErrs.H"
p = pd + rho*gh; p = pd + rho*gh;
if (pd.needReference()) if (pd.needReference())

View File

@ -2,21 +2,42 @@
volScalarField rAU = 1.0/UEqn.A(); volScalarField rAU = 1.0/UEqn.A();
surfaceScalarField rAUf = fvc::interpolate(rAU); surfaceScalarField rAUf = fvc::interpolate(rAU);
volVectorField HU = UEqn.H(); U = rAU*UEqn.H();
U = rAU*HU;
surfaceScalarField phiU("phiU", (fvc::interpolate(U) & mesh.Sf())); surfaceScalarField phiU("phiU", (fvc::interpolate(U) & mesh.Sf()));
if (ddtPhiCorr) if (ddtPhiCorr)
{ {
phiU += fvc::ddtPhiCorr(rAU, rho, U, phiAbs); //phiU += fvc::ddtPhiCorr(rAU, rho, U, phiAbs0);
dimensionedScalar rDeltaT = 1.0/mesh.time().deltaT();
volScalarField V0byV
(
IOobject
(
"V0byV",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar("V0byV", dimless, 1),
zeroGradientFvPatchScalarField::typeName
);
V0byV.dimensionedInternalField() = mesh.V0()/mesh.V();
V0byV.correctBoundaryConditions();
phiU += rDeltaT*
(
fvc::interpolate(rAU*rho.oldTime()*V0byV)*phiAbs0
- (fvc::interpolate(rAU*rho.oldTime()*V0byV*U.oldTime()) & mesh.Sf())
);
} }
phi = phiU + phi = phiU +
( (
fvc::interpolate(interface.sigmaK())*fvc::snGrad(gamma) fvc::interpolate(interface.sigmaK())*fvc::snGrad(gamma)
- ghf*fvc::snGrad(rho) - ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf(); )*rAUf*mesh.magSf();
if (pd.needReference()) if (pd.needReference())
{ {
@ -59,6 +80,8 @@
U += rAU*fvc::reconstruct((phi - phiU)/rAUf); U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
#include "continuityErrs.H"
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U); fvc::makeRelative(phi, U);
} }

View File

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
set -x set -x
# Some fun: prostar uses ccmio2.3, Star-ccm+ uses ccmio2.4 # compile cd-adapco's CCM library
wmake libso libccmio/libadf
wmake libso libccmio/libccmio
wmake libso libccmio/libcgns
(cd libccmio; wmake libso libadf) wmake ccm26ToFoam
(cd libccmio; wmake libso libccmio)
(cd libccmio; wmake libso libcgns)
(cd ccm26ToFoam; wmake)

View File

@ -72,6 +72,7 @@ find -H $newDir \
! -type d -type f \ ! -type d -type f \
! -name "*~" \ ! -name "*~" \
-a ! -name ".*~" \ -a ! -name ".*~" \
-a ! -name ".#*" \
-a ! -name "*.orig" \ -a ! -name "*.orig" \
-a ! -name "*.dep" \ -a ! -name "*.dep" \
-a ! -name "*.o" \ -a ! -name "*.o" \
@ -83,10 +84,11 @@ find -H $newDir \
-a ! -name "log[0-9]*" \ -a ! -name "log[0-9]*" \
| sed \ | sed \
-e "\@$newDir/lib/@d" \ -e "\@$newDir/lib/@d" \
-e "\@$newDir/src/mico-[0-9.]*/platforms@d" \ -e "\@$newDir/src/other/mico-*/platforms@d" \
-e "\@$newDir/src/mpich-[0-9.]*/platforms@d" \ -e "\@$newDir/src/other/mpich-*/platforms@d" \
-e "\@$newDir/src/mpich-[0-9.]*/lib@d" \ -e "\@$newDir/src/other/mpich-*/lib@d" \
-e "\@$newDir/src/lam-[0-9.]*/platforms@d" \ -e "\@$newDir/src/other/lam-*/platforms@d" \
-e "\@$newDir/src/other/openmpi-*/platforms@d" \
-e '\@applications/bin/@d' \ -e '\@applications/bin/@d' \
-e '\@/t/@d' \ -e '\@/t/@d' \
-e '\@Make[.A-Za-z]*/[^/]*/@d' \ -e '\@Make[.A-Za-z]*/[^/]*/@d' \
@ -118,7 +120,7 @@ find -H $newDir \
done done
) )
# file fileCount # file fileCount
fileCount=$(cat $tmpFile | wc -l) fileCount=$(cat $tmpFile | wc -l)
echo "----------------------------------------------------------------------" echo "----------------------------------------------------------------------"
echo "pack $fileCount changed/new files" echo "pack $fileCount changed/new files"

View File

@ -86,10 +86,11 @@ find -H $packDir \
-a ! -name "so_locations" \ -a ! -name "so_locations" \
| sed \ | sed \
-e "\@$packDir/lib/@d" \ -e "\@$packDir/lib/@d" \
-e "\@$packDir/src/mico-[0-9.]*/platforms@d" \ -e "\@$packDir/src/other/mico-*/platforms@d" \
-e "\@$packDir/src/mpich-[0-9.]*/platforms@d" \ -e "\@$packDir/src/other/mpich-*/platforms@d" \
-e "\@$packDir/src/mpich-[0-9.]*/lib@d" \ -e "\@$packDir/src/other/mpich-*/lib@d" \
-e "\@$packDir/src/lam-[0-9.]*/platforms@d" \ -e "\@$packDir/src/other/lam-*/platforms@d" \
-e "\@$packDir/src/other/openmpi-*/platforms@d" \
-e '\@applications/bin/@d' \ -e '\@applications/bin/@d' \
-e '\@/t/@d' \ -e '\@/t/@d' \
-e '\@Make[.A-Za-z]*/[^/]*/@d' \ -e '\@Make[.A-Za-z]*/[^/]*/@d' \

View File

@ -75,11 +75,11 @@ find -H $packDir \
-a ! -name "log[0-9]*" \ -a ! -name "log[0-9]*" \
| sed \ | sed \
-e "\@$packDir/lib/@d" \ -e "\@$packDir/lib/@d" \
-e "\@$packDir/src/other/mico-[0-9.]*/platforms@d" \ -e "\@$packDir/src/other/mico-*/platforms@d" \
-e "\@$packDir/src/other/mpich-[0-9.]*/platforms@d" \ -e "\@$packDir/src/other/mpich-*/platforms@d" \
-e "\@$packDir/src/other/mpich-[0-9.]*/lib@d" \ -e "\@$packDir/src/other/mpich-*/lib@d" \
-e "\@$packDir/src/other/lam-[0-9.]*/platforms@d" \ -e "\@$packDir/src/other/lam-*/platforms@d" \
-e "\@$packDir/src/other/openmpi-[0-9.]*/platforms@d" \ -e "\@$packDir/src/other/openmpi-*/platforms@d" \
-e '\@applications/bin/@d' \ -e '\@applications/bin/@d' \
-e '\@/t/@d' \ -e '\@/t/@d' \
-e '\@Make[.A-Za-z]*/[^/]*/@d' \ -e '\@Make[.A-Za-z]*/[^/]*/@d' \

View File

@ -33,33 +33,33 @@
Script=${0##*/} Script=${0##*/}
usage() { usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: $Script [-case dir] usage: $Script [-case dir]
* start paraview $ParaView_VERSION with the OpenFOAM libraries * start paraview $ParaView_VERSION with the OpenFOAM libraries
USAGE USAGE
exit 1 exit 1
} }
# parse options # parse options
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then
case "$1" in case "$1" in
-h | -help) -h | -help)
usage usage
;; ;;
-case) -case)
shift shift
caseDir=$1 caseDir=$1
[ "$#" -ge 1 ] || usage "'-case' option requires an argument" [ "$#" -ge 1 ] || usage "'-case' option requires an argument"
cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'" cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'"
;; ;;
*) *)
usage "unknown option/argument: '$*'" usage "unknown option/argument: '$*'"
;; ;;
esac esac
fi fi
# get a sensible caseName # get a sensible caseName
@ -67,41 +67,38 @@ caseName=${PWD##*/}
# parent directory for normal or parallel results # parent directory for normal or parallel results
case "$caseName" in case "$caseName" in
processor*) parentDir=".." ;; processor*) parentDir=".." ;;
*) parentDir="." ;; *) parentDir="." ;;
esac esac
# check existence of essential files # check existence of essential files
for check in system/controlDict system/fvSchemes system/fvSolution for check in system/controlDict system/fvSchemes system/fvSolution
do do
[ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'"
done done
OpenFoamExt="foam" caseFile="$caseName.foam"
# OpenFoamExt="OpenFOAM" # caseFile="$caseName.OpenFOAM"
if [ "$ParaView_VERSION" = "3" ]; then case "$ParaView_VERSION" in
2*)
# Clean up on termination and on Ctrl-C
trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT
touch $caseFile
# check existence of essential files # since we are now in the cwd, %CASE% is '$PWD/$caseFile'
for check in system/controlDict system/fvSchemes system/fvSolution sed -e s@%CASE%@$PWD/$caseFile@g \
do $WM_PROJECT_DIR/bin/paraFoam.pvs > paraFoam.pvs
[ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'"
done
touch $caseName.$OpenFoamExt paraview paraFoam.pvs
paraview --data=$caseName.$OpenFoamExt ;;
rm $caseName.$OpenFoamExt 2>/dev/null
else *)
# Clean up on termination and on Ctrl-C
# since we are now in the cwd, FOAM_ROOT/FOAM_CASE is '$PWD' trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
sed -e s%FOAM_ROOT/FOAM_CASE%$PWD%g \ touch $caseFile
-e s%FOAM_CASE%$caseName%g $WM_PROJECT_DIR/bin/paraFoam.pvs > paraFoam.pvs paraview --data=$caseFile
;;
touch $caseName.$OpenFoamExt
paraview paraFoam.pvs
rm paraFoam.pvs $caseName.$OpenFoamExt 2>/dev/null
fi
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -41,18 +41,26 @@ export CMAKE_HOME=$WM_PROJECT_INST_DIR/$WM_ARCH/cmake-2.4.6
if [ -r $CMAKE_HOME ]; then if [ -r $CMAKE_HOME ]; then
export PATH=$CMAKE_HOME/bin:$PATH export PATH=$CMAKE_HOME/bin:$PATH
else
unset CMAKE_HOME
fi fi
export ParaView_VERSION=3 # export ParaView_VERSION="3.3-cvs"
export ParaView_VERSION=3.3
export ParaView_INST_DIR=$WM_PROJECT_INST_DIR/ParaView3.3-cvs export ParaView_INST_DIR=$WM_PROJECT_INST_DIR/paraview-$ParaView_VERSION
export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_OPTIONS export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_OPTIONS
export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/bin:$ParaView_DIR/Utilities/VTKPythonWrapping if [ "$PYTHONPATH" ]; then
export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping
else
export PYTHONPATH=$ParaView_DIR/Utilities/VTKPythonWrapping
fi
if [ -r $ParaView_DIR ]; then if [ -r $ParaView_DIR ]; then
export PATH=$ParaView_DIR/bin:$PATH export PATH=$ParaView_DIR/bin:$PATH
export LD_LIBRARY_PATH=${ParaView_DIR}/bin:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-$ParaView_VERSION:$LD_LIBRARY_PATH
export PV_PLUGIN_PATH=$FOAM_LIBBIN export PV_PLUGIN_PATH=$FOAM_LIBBIN
fi fi

View File

@ -41,11 +41,14 @@ setenv CMAKE_HOME $WM_PROJECT_INST_DIR/$WM_ARCH/cmake-2.4.6
if ( -r $CMAKE_HOME ) then if ( -r $CMAKE_HOME ) then
set path=($CMAKE_HOME/bin $path) set path=($CMAKE_HOME/bin $path)
else
unset CMAKE_HOME
endif endif
setenv ParaView_VERSION 3 # setenv ParaView_VERSION 3.3-cvs
setenv ParaView_VERSION 3.3
setenv ParaView_INST_DIR $WM_PROJECT_INST_DIR/ParaView3.3-cvs export ParaView_INST_DIR=$WM_PROJECT_INST_DIR/paraview-$ParaView_VERSION
setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_OPTIONS setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_OPTIONS
if ($?PYTHONPATH) then if ($?PYTHONPATH) then
@ -56,7 +59,7 @@ endif
if ( -r $ParaView_INST_DIR ) then if ( -r $ParaView_INST_DIR ) then
set path=($ParaView_DIR/bin $path) set path=($ParaView_DIR/bin $path)
setenv LD_LIBRARY_PATH ${ParaView_DIR}/bin:${LD_LIBRARY_PATH} setenv LD_LIBRARY_PATH $ParaView_DIR/lib/paraview-$ParaView_VERSION:$LD_LIBRARY_PATH
setenv PV_PLUGIN_PATH $FOAM_LIBBIN setenv PV_PLUGIN_PATH $FOAM_LIBBIN
endif endif

View File

@ -63,7 +63,7 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# Compiler (if set to "" use the system compiler) # Compiler (if set to "" use the system compiler)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export WM_COMPILER=Gcc export WM_COMPILER=Gcc43
export WM_COMPILER_ARCH= export WM_COMPILER_ARCH=
export WM_COMPILER_LIB_ARCH= export WM_COMPILER_LIB_ARCH=

View File

@ -97,7 +97,14 @@ WM_COMPILER_INST=OpenFOAM
case "$WM_COMPILER_INST" in case "$WM_COMPILER_INST" in
OpenFOAM) OpenFOAM)
export WM_COMPILER_DIR=$FOAM_INST_DIR/$WM_ARCH/gcc-4.2.2$WM_COMPILER_ARCH case "$WM_COMPILER" in
Gcc43)
export WM_COMPILER_DIR=$FOAM_INST_DIR/$WM_ARCH/gcc-4.3.0$WM_COMPILER_ARCH
;;
Gcc)
export WM_COMPILER_DIR=$FOAM_INST_DIR/$WM_ARCH/gcc-4.2.2$WM_COMPILER_ARCH
;;
esac
# Check that the compiler directory can be found # Check that the compiler directory can be found
if [ ! -d "$WM_COMPILER_DIR" ] if [ ! -d "$WM_COMPILER_DIR" ]

View File

@ -202,7 +202,12 @@ List<Key> HashTable<T, Key, Hash>::toc() const
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
bool HashTable<T, Key, Hash>::insert(const Key& key, const T& newEntry) bool HashTable<T, Key, Hash>::set
(
const Key& key,
const T& newEntry,
const bool protect
)
{ {
if (tableSize_ == 0) if (tableSize_ == 0)
{ {
@ -210,40 +215,70 @@ bool HashTable<T, Key, Hash>::insert(const Key& key, const T& newEntry)
} }
label ii = Hash()(key, tableSize_); label ii = Hash()(key, tableSize_);
hashedEntry* existing = 0;
hashedEntry* prev = 0;
for (hashedEntry* n=table_[ii]; n; n=n->next_) for (hashedEntry* curr = table_[ii]; curr; curr = curr->next_)
{ {
if (key == n->key_) if (key == curr->key_)
{
existing = curr;
break;
}
prev = curr;
}
// not found, insert it at the head
if (!existing)
{
table_[ii] = new hashedEntry(key, table_[ii], newEntry);
nElmts_++;
if (double(nElmts_)/tableSize_ > 0.8)
{ {
# ifdef FULLDEBUG # ifdef FULLDEBUG
if (debug) if (debug)
{ {
Info<< "HashTable<T, Key, Hash>::insert" Info<< "HashTable<T, Key, Hash>::set"
"(const Key& key, T newEntry) : " "(const Key& key, T newEntry) : "
"Cannot insert " << key << " already in hash table\n"; "Doubling table size\n";
} }
# endif # endif
return false; resize(2*tableSize_);
} }
} }
else if (protect)
table_[ii] = new hashedEntry(key, table_[ii], newEntry);
nElmts_++;
if (double(nElmts_)/tableSize_ > 0.8)
{ {
// found - but protected from overwriting
// this corresponds to the STL 'insert' convention
# ifdef FULLDEBUG # ifdef FULLDEBUG
if (debug) if (debug)
{ {
Info<< "HashTable<T, Key, Hash>::insert" Info<< "HashTable<T, Key, Hash>::set"
"(const Key& key, T newEntry) : " "(const Key& key, T newEntry, false) : "
"Doubling table size\n"; "Cannot insert " << key << " already in hash table\n";
} }
# endif # endif
return false;
}
else
{
// found - overwrite existing entry
// this corresponds to the Perl convention
hashedEntry* elemPtr = new hashedEntry(key, existing->next_, newEntry);
resize(2*tableSize_); // replace existing element - within list or insert at the head
if (prev)
{
prev->next_ = elemPtr;
}
else
{
table_[ii] = elemPtr;
}
delete existing;
} }
return true; return true;

View File

@ -123,6 +123,11 @@ class HashTable
label nElmts_; label nElmts_;
// Private Member Functions
//- Assign a new hashedEntry to a possibly already existing key
bool set(const Key& key, const T& newElmt, bool protect);
public: public:
//- Declare friendship with the HashPtrTable class //- Declare friendship with the HashPtrTable class
@ -181,7 +186,10 @@ public:
// Edit // Edit
//- Insert a new hashedEntry //- Insert a new hashedEntry
bool insert(const Key& key, const T& newElmt); inline bool insert(const Key& key, const T& newElmt);
//- Assign a new hashedEntry, overwriting existing entries
inline bool set(const Key& key, const T& newElmt);
//- Erase an hashedEntry specified by given iterator //- Erase an hashedEntry specified by given iterator
bool erase(const iterator& it); bool erase(const iterator& it);

View File

@ -56,6 +56,19 @@ inline label HashTable<T, Key, Hash>::size() const
} }
template<class T, class Key, class Hash>
inline bool HashTable<T, Key, Hash>::insert(const Key& key, const T& newEntry)
{
return set(key, newEntry, true);
}
template<class T, class Key, class Hash>
inline bool HashTable<T, Key, Hash>::set(const Key& key, const T& newEntry)
{
return set(key, newEntry, false);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
@ -292,7 +305,7 @@ inline HashTable<T, Key, Hash>::const_iterator::const_iterator
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline HashTable<T, Key, Hash>::const_iterator::const_iterator inline HashTable<T, Key, Hash>::const_iterator::const_iterator
( (
const iterator& iter const iterator& iter
) )
: :

View File

@ -229,6 +229,43 @@ DLListBase::link* DLListBase::remove(DLListBase::link* l)
} }
DLListBase::link* DLListBase::replace
(
DLListBase::link* oldLink,
DLListBase::link* newLink
)
{
link* ret = oldLink;
newLink->prev_ = oldLink->prev_;
newLink->next_ = oldLink->next_;
if (oldLink == first_ && first_ == last_)
{
first_ = newLink;
last_ = newLink;
}
else if (oldLink == first_)
{
first_ = newLink;
newLink->next_->prev_ = newLink;
}
else if (oldLink == last_)
{
last_ = newLink;
newLink->prev_->next_ = newLink;
}
else
{
newLink->prev_->next_ = newLink;
newLink->next_->prev_ = newLink;
}
ret->deregister();
return ret;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -158,6 +158,12 @@ public:
// Remove and return element specified by iterator // Remove and return element specified by iterator
inline link* remove(iterator&); inline link* remove(iterator&);
//- Replace oldLink with newLink and return element
link* replace(link* oldLink, link* newLink);
//- Replace oldIter with newLink and return element
inline link* replace(iterator& oldIter, link* newLink);
//- Clear the list //- Clear the list
inline void clear(); inline void clear();

View File

@ -148,6 +148,16 @@ inline DLListBase::link* DLListBase::remove(DLListBase::iterator& it)
} }
inline DLListBase::link* DLListBase::replace
(
DLListBase::iterator& oldIter,
DLListBase::link* newLink
)
{
return replace(oldIter.curElmt_, newLink);
}
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
inline DLListBase::iterator::iterator(DLListBase& s, link* elmt) inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)

View File

@ -435,6 +435,20 @@ void sort(List<T>& a, const Cmp& cmp)
} }
template<class T>
void stableSort(List<T>& a)
{
std::stable_sort(a.begin(), a.end());
}
template<class T, class Cmp>
void stableSort(List<T>& a, const Cmp& cmp)
{
std::stable_sort(a.begin(), a.end(), cmp);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// Assignment to UList operator. Takes linear time. // Assignment to UList operator. Takes linear time.

View File

@ -28,7 +28,7 @@ Class
Description Description
A 1D array of objects of type \<T\>, where the size of the vector A 1D array of objects of type \<T\>, where the size of the vector
is known and used for subscript bounds checking, etc. is known and used for subscript bounds checking, etc.
Storage is allocated on free-store during construction. Storage is allocated on free-store during construction.
SourceFiles SourceFiles
@ -195,6 +195,12 @@ void sort(List<T>& a);
template<class T, class Cmp> template<class T, class Cmp>
void sort(List<T>& a, const Cmp&); void sort(List<T>& a, const Cmp&);
template<class T>
void stableSort(List<T>& a);
template<class T, class Cmp>
void stableSort(List<T>& a, const Cmp&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,14 +28,11 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from List // Construct from List
template <class Type> template <class Type>
SortableList<Type>::SortableList(const List<Type>& values) Foam::SortableList<Type>::SortableList(const List<Type>& values)
: :
List<Type>(values), List<Type>(values),
indices_(values.size()) indices_(values.size())
@ -46,7 +43,7 @@ SortableList<Type>::SortableList(const List<Type>& values)
// Construct given size. Sort later on. // Construct given size. Sort later on.
template <class Type> template <class Type>
SortableList<Type>::SortableList(const label size) Foam::SortableList<Type>::SortableList(const label size)
: :
List<Type>(size), List<Type>(size),
indices_(size) indices_(size)
@ -55,7 +52,7 @@ SortableList<Type>::SortableList(const label size)
// Construct given size and initial value. Sort later on. // Construct given size and initial value. Sort later on.
template <class Type> template <class Type>
SortableList<Type>::SortableList(const label size, const Type& val) Foam::SortableList<Type>::SortableList(const label size, const Type& val)
: :
List<Type>(size, val), List<Type>(size, val),
indices_(size) indices_(size)
@ -64,7 +61,7 @@ SortableList<Type>::SortableList(const label size, const Type& val)
// Construct as copy. // Construct as copy.
template <class Type> template <class Type>
SortableList<Type>::SortableList(const SortableList<Type>& lst) Foam::SortableList<Type>::SortableList(const SortableList<Type>& lst)
: :
List<Type>(lst), List<Type>(lst),
indices_(lst.indices()) indices_(lst.indices())
@ -74,7 +71,7 @@ SortableList<Type>::SortableList(const SortableList<Type>& lst)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class Type> template <class Type>
void SortableList<Type>::setSize(const label newSize) void Foam::SortableList<Type>::setSize(const label newSize)
{ {
List<Type>::setSize(newSize); List<Type>::setSize(newSize);
indices_.setSize(newSize); indices_.setSize(newSize);
@ -82,7 +79,7 @@ void SortableList<Type>::setSize(const label newSize)
template <class Type> template <class Type>
void SortableList<Type>::sort() void Foam::SortableList<Type>::sort()
{ {
forAll(indices_, i) forAll(indices_, i)
{ {
@ -98,7 +95,29 @@ void SortableList<Type>::sort()
tmpValues[i] = this->operator[](indices_[i]); tmpValues[i] = this->operator[](indices_[i]);
} }
List<Type>::operator=(tmpValues); List<Type>::transfer(tmpValues);
}
template <class Type>
void Foam::SortableList<Type>::stableSort()
{
forAll(indices_, i)
{
indices_[i] = i;
}
Foam::stableSort(indices_, less(*this));
List<Type> tmpValues(this->size());
forAll(indices_, i)
{
tmpValues[i] = this->operator[](indices_[i]);
}
List<Type>::transfer(tmpValues);
} }
@ -114,6 +133,4 @@ void Foam::SortableList<Type>::operator=(const SortableList<Type>& rhs)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -100,7 +100,7 @@ public:
// Member Functions // Member Functions
//- Return the list of sorted point indices. Updated every sort. //- Return the list of sorted indices. Updated every sort.
const labelList& indices() const const labelList& indices() const
{ {
return indices_; return indices_;
@ -112,6 +112,9 @@ public:
//- Sort the list (if changed after construction time) //- Sort the list (if changed after construction time)
void sort(); void sort();
//- Sort the list (if changed after construction time)
void stableSort();
// Member Operators // Member Operators

View File

@ -34,6 +34,7 @@ defineTypeNameAndDebug(Foam::dictionary, 0);
const Foam::dictionary Foam::dictionary::null; const Foam::dictionary Foam::dictionary::null;
#undef DICTIONARY_INPLACE_MERGE
// * * * * * * * * * * * * * Private member functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private member functions * * * * * * * * * * * //
@ -53,7 +54,27 @@ bool Foam::dictionary::add(entry* ePtr, bool mergeEntry)
} }
else else
{ {
#ifdef DICTIONARY_INPLACE_MERGE
if (hashedEntries_.set(ePtr->keyword(), ePtr))
{
ePtr->name() = name_ + "::" + ePtr->keyword();
replace(iter(), ePtr);
return true;
}
else
{
IOWarningIn("dictionary::add(entry* ePtr)", (*this))
<< "problem replacing entry in dictionary "
<< name()
<< endl;
delete ePtr;
return false;
}
#else
remove(ePtr->keyword()); remove(ePtr->keyword());
#endif
} }
} }
@ -517,8 +538,12 @@ bool Foam::dictionary::merge(const dictionary& dict)
} }
else else
{ {
#ifdef DICTIONARY_INPLACE_MERGE
add(iter().clone(*this).ptr(), true);
#else
remove(keyword); remove(keyword);
add(iter().clone(*this)()); add(iter().clone(*this)());
#endif
changed = true; changed = true;
} }
} }
@ -526,6 +551,7 @@ bool Foam::dictionary::merge(const dictionary& dict)
{ {
// not found - just add // not found - just add
add(iter().clone(*this)()); add(iter().clone(*this)());
changed = true;
} }
} }

View File

@ -119,6 +119,12 @@ public:
//- Return edge line //- Return edge line
inline linePointRef line(const pointField&) const; inline linePointRef line(const pointField&) const;
//- compare edges
// - 0: different
// - +1: identical
// - -1: same edge, but different orientation
static inline int compare(const edge&, const edge&);
// Friend Operators // Friend Operators
@ -127,7 +133,7 @@ public:
}; };
//- Hash<edge> specialisation //- Hash<edge> specialisation
// Simple commutative hash. // Simple commutative hash.
template<> template<>
inline label Hash<edge>::operator()(const edge& e) const inline label Hash<edge>::operator()(const edge& e) const

View File

@ -26,6 +26,30 @@ License
#include "IOstreams.H" #include "IOstreams.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// return
// - 0: different
// - +1: identical
// - -1: same edge, but different orientation
inline int Foam::edge::compare(const edge& a, const edge& b)
{
if (a[0] == b[0] && a[1] == b[1])
{
return 1;
}
else if (a[0] == b[1] && a[1] == b[0])
{
return -1;
}
else
{
return 0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::edge::edge() inline Foam::edge::edge()
@ -146,17 +170,13 @@ inline Foam::linePointRef Foam::edge::line(const pointField& p) const
inline bool Foam::operator==(const edge& a, const edge& b) inline bool Foam::operator==(const edge& a, const edge& b)
{ {
return return edge::compare(a,b) != 0;
(
(a[0] == b[0] && a[1] == b[1])
|| (a[0] == b[1] && a[1] == b[0])
);
} }
inline bool Foam::operator!=(const edge& a, const edge& b) inline bool Foam::operator!=(const edge& a, const edge& b)
{ {
return !(a == b); return edge::compare(a,b) == 0;
} }

View File

@ -438,7 +438,7 @@ int Foam::face::compare(const face& a, const face& b)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::face::collapse() Foam::label Foam::face::collapse()
{ {
if (size() > 1) if (size() > 1)
{ {
@ -458,6 +458,8 @@ void Foam::face::collapse()
setSize(ci); setSize(ci);
} }
return size();
} }
@ -696,6 +698,47 @@ Foam::edgeList Foam::face::edges() const
} }
int Foam::face::edgeDirection(const edge& e) const
{
if (size() > 2)
{
edge found(-1,-1);
// find start/end points - this breaks down for degenerate faces
forAll (*this, i)
{
if (operator[](i) == e.start())
{
found.start() = i;
}
else if (operator[](i) == e.end())
{
found.end() = i;
}
}
label diff = found.end() - found.start();
if (!diff || found.start() < 0 || found.end() < 0)
{
return 0;
}
// forward direction
if (diff == 1 || diff == 1 - size())
{
return 1;
}
// reverse direction
if (diff == -1 || diff == -1 + size())
{
return -1;
}
}
return 0;
}
// Number of triangles directly known from number of vertices // Number of triangles directly known from number of vertices
Foam::label Foam::face::nTriangles Foam::label Foam::face::nTriangles
( (

View File

@ -145,7 +145,8 @@ public:
// Member Functions // Member Functions
//- Collapse face by removing duplicate point labels //- Collapse face by removing duplicate point labels
void collapse(); // return the collapsed size
label collapse();
//- Return the points corresponding to this face //- Return the points corresponding to this face
inline pointField points(const pointField& meshPoints) const; inline pointField points(const pointField& meshPoints) const;
@ -251,6 +252,11 @@ public:
//- Return n-th face edge //- Return n-th face edge
inline edge faceEdge(const label n) const; inline edge faceEdge(const label n) const;
//- Return the edge direction on the face
// - 0: edge not found on the face
// - +1: forward (counter-clockwise) on the face
// - -1: reverse (clockwise) on the face
int edgeDirection(const edge&) const;
// Face splitting utilities // Face splitting utilities

View File

@ -81,18 +81,35 @@ public:
const label c const label c
); );
//- Construct from a face, discarding excess points
inline triFace(const face&);
//- Construct from a labelList, discarding excess points
explicit inline triFace(const labelList&);
//- Construct from Istream //- Construct from Istream
inline triFace(Istream&); inline triFace(Istream&);
// Member Functions // Member Functions
//- Collapse face by removing duplicate point labels
// return the collapsed size, set collapsed point labels to -1
inline label collapse();
//- Return the edge direction on the face
// - +1: forward (counter-clockwise) on the face
// - -1: reverse (clockwise) on the face
// - 0: edge not found on the face
inline int edgeDirection(const edge&) const;
// Properties // Properties
//- Return the points corresponding to this face //- Return the points corresponding to this face
inline pointField points(const pointField& points) const; inline pointField points(const pointField& points) const;
//- Return triagle as a face //- Return triangle as a face
inline face triFaceFace() const; inline face triFaceFace() const;
//- Return number of edges //- Return number of edges
@ -128,9 +145,14 @@ public:
const intersection::direction dir = intersection::VECTOR const intersection::direction dir = intersection::VECTOR
) const; ) const;
//- Return the tetrahedron //- Return the triangle
inline triPointRef tri(const pointField&) const; inline triPointRef tri(const pointField&) const;
//- compare triFaces
// - 0: different
// - +1: identical
// - -1: same face, but different orientation
static inline int compare(const triFace&, const triFace&);
// Friend Operators // Friend Operators
@ -139,7 +161,7 @@ public:
}; };
//- Hash<triFace> specialisation //- Hash<triFace> specialisation
// Simple commutative hash. // Simple commutative hash.
template<> template<>
inline label Hash<triFace>::operator()(const triFace& t) const inline label Hash<triFace>::operator()(const triFace& t) const

View File

@ -33,14 +33,45 @@ License
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
inline int triFace::compare(const triFace& a, const triFace& b)
{
if
(
(a[0] == b[0] && a[1] == b[1] && a[2] == b[2])
|| (a[0] == b[1] && a[1] == b[2] && a[2] == b[0])
|| (a[0] == b[2] && a[1] == b[0] && a[2] == b[1])
)
{
// identical
return 1;
}
else if
(
(a[0] == b[2] && a[1] == b[1] && a[2] == b[0])
|| (a[0] == b[1] && a[1] == b[0] && a[2] == b[2])
|| (a[0] == b[0] && a[1] == b[2] && a[2] == b[1])
)
{
// same face, but reversed orientation
return -1;
}
else
{
return 0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct null // Construct null
inline triFace::triFace() inline triFace::triFace()
{} {}
//- Construct from components // Construct from components
inline triFace::triFace inline triFace::triFace
( (
const label a, const label a,
@ -53,6 +84,18 @@ inline triFace::triFace
operator[](2) = c; operator[](2) = c;
} }
// Construct from a face
inline triFace::triFace(const face& f)
:
FixedList<label, 3>(SubList<label>(f,3))
{}
// Construct from a labelList
inline triFace::triFace(const labelList& l)
:
FixedList<label, 3>(SubList<label>(l,3))
{}
inline triFace::triFace(Istream& is) inline triFace::triFace(Istream& is)
: :
@ -62,6 +105,34 @@ inline triFace::triFace(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::label Foam::triFace::collapse()
{
// we cannot resize a FixedList, so mark duplicates with '-1'
// (the lower vertex is retained)
// catch any '-1' - ie, if called twice
label n = 3;
if (operator[](0) == operator[](1) || operator[](1) == -1)
{
operator[](1) = -1;
n--;
}
else if (operator[](1) == operator[](2) || operator[](2) == -1)
{
operator[](2) = -1;
n--;
}
if (operator[](0) == operator[](2))
{
operator[](2) = -1;
n--;
}
return n;
}
// Return the points associated with this face // Return the points associated with this face
inline pointField triFace::points(const pointField& points) const inline pointField triFace::points(const pointField& points) const
{ {
@ -111,6 +182,37 @@ inline edgeList triFace::edges() const
} }
// return
// - +1: forward (counter-clockwise) on the face
// - -1: reverse (clockwise) on the face
// - 0: edge not found on the face
inline int triFace::edgeDirection(const edge& e) const
{
if
(
(operator[](0) == e.start() && operator[](1) == e.end())
|| (operator[](1) == e.start() && operator[](2) == e.end())
|| (operator[](2) == e.start() && operator[](0) == e.end())
)
{
return 1;
}
else if
(
(operator[](0) == e.end() && operator[](1) == e.start())
|| (operator[](1) == e.end() && operator[](2) == e.start())
|| (operator[](2) == e.end() && operator[](0) == e.start())
)
{
return -1;
}
else
{
return 0;
}
}
inline point triFace::centre(const pointField& points) const inline point triFace::centre(const pointField& points) const
{ {
return (1.0/3.0)* return (1.0/3.0)*
@ -202,23 +304,15 @@ inline triPointRef triFace::tri(const pointField& points) const
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
inline bool operator==(const triFace& tf1, const triFace& tf2) inline bool operator==(const triFace& a, const triFace& b)
{ {
return return triFace::compare(a,b) != 0;
(
(tf1[0] == tf2[0] && tf1[1] == tf2[1] && tf1[2] == tf2[2])
|| (tf1[0] == tf2[1] && tf1[1] == tf2[2] && tf1[2] == tf2[0])
|| (tf1[0] == tf2[2] && tf1[1] == tf2[0] && tf1[2] == tf2[1])
|| (tf1[0] == tf2[2] && tf1[1] == tf2[1] && tf1[2] == tf2[0])
|| (tf1[0] == tf2[1] && tf1[1] == tf2[0] && tf1[2] == tf2[2])
|| (tf1[0] == tf2[0] && tf1[1] == tf2[2] && tf1[2] == tf2[1])
);
} }
inline bool operator!=(const triFace& tf1, const triFace& tf2) inline bool operator!=(const triFace& a, const triFace& b)
{ {
return !(tf1 == tf2); return triFace::compare(a,b) == 0;
} }

View File

@ -76,12 +76,12 @@ void ZoneMesh<ZoneType>::calcZoneMap() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Read constructor given IOobject and a polyMesh reference // Read constructor given IOobject and a MeshType reference
template<class ZoneType> template<class ZoneType>
ZoneMesh<ZoneType>::ZoneMesh ZoneMesh<ZoneType>::ZoneMesh
( (
const IOobject& io, const IOobject& io,
const polyMesh& mesh const MeshType& mesh
) )
: :
PtrList<ZoneType>(), PtrList<ZoneType>(),
@ -122,7 +122,7 @@ ZoneMesh<ZoneType>::ZoneMesh
is.check is.check
( (
"ZoneMesh::ZoneMesh" "ZoneMesh::ZoneMesh"
"(const IOobject&, const polyMesh&)" "(const IOobject&, const MeshType&)"
); );
close(); close();
@ -140,7 +140,7 @@ template<class ZoneType>
ZoneMesh<ZoneType>::ZoneMesh ZoneMesh<ZoneType>::ZoneMesh
( (
const IOobject& io, const IOobject& io,
const polyMesh& mesh, const MeshType& mesh,
const label size const label size
) )
: :
@ -175,8 +175,8 @@ const Map<label>& ZoneMesh<ZoneType>::zoneMap() const
} }
// Given a global object index, return the zone it is in. If // Given a global object index, return the zone it is in.
//object does not belong to any zones, return -1 // If object does not belong to any zones, return -1
template<class ZoneType> template<class ZoneType>
label ZoneMesh<ZoneType>::whichZone(const label objectIndex) const label ZoneMesh<ZoneType>::whichZone(const label objectIndex) const
{ {

View File

@ -69,8 +69,11 @@ class ZoneMesh
{ {
// Private data // Private data
//- Typedef in preparation of a second template parameter
typedef polyMesh MeshType;
//- Reference to mesh //- Reference to mesh
const polyMesh& mesh_; const MeshType& mesh_;
//- Map of zone labels for given element //- Map of zone labels for given element
mutable Map<label>* zoneMapPtr_; mutable Map<label>* zoneMapPtr_;
@ -93,18 +96,18 @@ public:
// Constructors // Constructors
//- Read constructor given IOobject and a polyMesh reference //- Read constructor given IOobject and a MeshType reference
ZoneMesh ZoneMesh
( (
const IOobject&, const IOobject&,
const polyMesh& const MeshType&
); );
//- Construct given size //- Construct given size
ZoneMesh ZoneMesh
( (
const IOobject&, const IOobject&,
const polyMesh&, const MeshType&,
const label size const label size
); );
@ -116,7 +119,7 @@ public:
// Member functions // Member functions
//- Return the mesh reference //- Return the mesh reference
const polyMesh& mesh() const const MeshType& mesh() const
{ {
return mesh_; return mesh_;
} }

View File

@ -84,11 +84,14 @@ public:
inline word(); inline word();
//- Construct as copy //- Construct as copy
inline word(const word& w); inline word(const word&);
//- Construct as copy of character array //- Construct as copy of character array
inline word(const char*); inline word(const char*);
//- Construct as copy with a maximum number of characters
inline word(const char*, const size_type);
//- Construct as copy of string //- Construct as copy of string
inline word(const string&); inline word(const string&);
@ -96,7 +99,7 @@ public:
inline word(const std::string&); inline word(const std::string&);
//- Construct from Istream //- Construct from Istream
word(Istream& is); word(Istream&);
// Member functions // Member functions

View File

@ -39,7 +39,7 @@ inline void Foam::word::stripInvalid()
std::cerr std::cerr
<< "word::stripInvalid() called for word " << "word::stripInvalid() called for word "
<< this->c_str() << std::endl; << this->c_str() << std::endl;
if (debug > 1) if (debug > 1)
{ {
std::cerr std::cerr
@ -65,25 +65,32 @@ inline Foam::word::word()
{} {}
inline Foam::word::word(const string& str) inline Foam::word::word(const string& s)
: :
string(str) string(s)
{ {
stripInvalid(); stripInvalid();
} }
inline Foam::word::word(const std::string& stdStr) inline Foam::word::word(const std::string& s)
: :
string(stdStr) string(s)
{ {
stripInvalid(); stripInvalid();
} }
inline Foam::word::word(const char* chars) inline Foam::word::word(const char* s)
: :
string(chars) string(s)
{
stripInvalid();
}
inline Foam::word::word(const char* s, const size_type n)
:
string(s, n)
{ {
stripInvalid(); stripInvalid();
} }

View File

@ -27,21 +27,35 @@ License
#include "engineTime.H" #include "engineTime.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
namespace Foam void Foam::engineTime::timeAdjustment()
{ {
deltaT_ = degToTime(deltaT_);
endTime_ = degToTime(endTime_);
if
(
writeControl_ == wcRunTime
|| writeControl_ == wcAdjustableRunTime
)
{
writeInterval_ = degToTime(writeInterval_);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from objectRegistry arguments //- Construct from objectRegistry arguments
engineTime::engineTime Foam::engineTime::engineTime
( (
const word& name, const word& name,
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const fileName& systemName, const fileName& systemName,
const fileName& constantName const fileName& constantName,
const fileName& dictName
) )
: :
Time Time
@ -52,7 +66,7 @@ engineTime::engineTime
systemName, systemName,
constantName constantName
), ),
engineGeometry_ dict_
( (
IOobject IOobject
( (
@ -64,78 +78,84 @@ engineTime::engineTime
false false
) )
), ),
conRodLength_(engineGeometry_.lookup("conRodLength")), rpm_(dict_.lookup("rpm")),
bore_(engineGeometry_.lookup("bore")), conRodLength_(dimensionedScalar("conRodLength", dimLength, 0)),
stroke_(engineGeometry_.lookup("stroke")), bore_(dimensionedScalar("bore", dimLength, 0)),
clearance_(engineGeometry_.lookup("clearance")), stroke_(dimensionedScalar("stroke", dimLength, 0)),
rpm_(engineGeometry_.lookup("rpm")) clearance_(dimensionedScalar("clearance", dimLength, 0))
{ {
value() = degToTime(value()); // the geometric parameters are not strictly required for Time
if (dict_.found("conRodLength"))
{
dict_.lookup("conRodLength") >> conRodLength_;
}
if (dict_.found("bore"))
{
dict_.lookup("bore") >> bore_;
}
if (dict_.found("stroke"))
{
dict_.lookup("stroke") >> stroke_;
}
if (dict_.found("clearance"))
{
dict_.lookup("clearance") >> clearance_;
}
timeAdjustment();
startTime_ = degToTime(startTime_); startTime_ = degToTime(startTime_);
endTime_ = degToTime(endTime_); value() = degToTime(value());
deltaT0_ = deltaT_;
deltaT_ = degToTime(deltaT_);
deltaT0_ = deltaT_;
if
(
writeControl_ == wcRunTime
|| writeControl_ == wcAdjustableRunTime
)
{
writeInterval_ = degToTime(writeInterval_);
}
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Read the controlDict and set all the parameters // Read the controlDict and set all the parameters
bool engineTime::read() void Foam::engineTime::readDict()
{ {
if (!Time::read()) Time::readDict();
timeAdjustment();
}
// Read the controlDict and set all the parameters
bool Foam::engineTime::read()
{
if (Time::read())
{ {
return false; timeAdjustment();
return true;
} }
else else
{ {
deltaT_ = degToTime(deltaT_); return false;
endTime_ = degToTime(endTime_);
if
(
writeControl_ == wcRunTime
|| writeControl_ == wcAdjustableRunTime
)
{
writeInterval_ = degToTime(writeInterval_);
}
return true;
} }
} }
scalar engineTime::degToRad(const scalar deg) const Foam::scalar Foam::engineTime::degToRad(const scalar deg) const
{ {
return mathematicalConstant::pi*deg/180.0; return mathematicalConstant::pi*deg/180.0;
} }
scalar engineTime::degToTime(const scalar theta) const Foam::scalar Foam::engineTime::degToTime(const scalar theta) const
{ {
return theta/(360.0*rpm_.value()/60.0); // 6 * rpm => deg/s
return theta/(6.0*rpm_.value());
} }
scalar engineTime::timeToDeg(const scalar t) const Foam::scalar Foam::engineTime::timeToDeg(const scalar t) const
{ {
return t*(360.0*rpm_.value()/60.0); // 6 * rpm => deg/s
return t*(6.0*rpm_.value());
} }
scalar engineTime::theta() const Foam::scalar Foam::engineTime::theta() const
{ {
return timeToDeg(value()); return timeToDeg(value());
} }
@ -143,7 +163,7 @@ scalar engineTime::theta() const
// Return current crank-angle translated to a single revolution // Return current crank-angle translated to a single revolution
// (value between -180 and 180 with 0 = top dead centre) // (value between -180 and 180 with 0 = top dead centre)
scalar engineTime::thetaRevolution() const Foam::scalar Foam::engineTime::thetaRevolution() const
{ {
scalar t = theta(); scalar t = theta();
@ -161,13 +181,13 @@ scalar engineTime::thetaRevolution() const
} }
scalar engineTime::deltaTheta() const Foam::scalar Foam::engineTime::deltaTheta() const
{ {
return timeToDeg(deltaT().value()); return timeToDeg(deltaT().value());
} }
scalar engineTime::pistonPosition(const scalar theta) const Foam::scalar Foam::engineTime::pistonPosition(const scalar theta) const
{ {
return return
( (
@ -186,7 +206,7 @@ scalar engineTime::pistonPosition(const scalar theta) const
} }
dimensionedScalar engineTime::pistonPosition() const Foam::dimensionedScalar Foam::engineTime::pistonPosition() const
{ {
return dimensionedScalar return dimensionedScalar
( (
@ -197,7 +217,7 @@ dimensionedScalar engineTime::pistonPosition() const
} }
dimensionedScalar engineTime::pistonDisplacement() const Foam::dimensionedScalar Foam::engineTime::pistonDisplacement() const
{ {
return dimensionedScalar return dimensionedScalar
( (
@ -208,24 +228,24 @@ dimensionedScalar engineTime::pistonDisplacement() const
} }
dimensionedScalar engineTime::pistonSpeed() const Foam::dimensionedScalar Foam::engineTime::pistonSpeed() const
{ {
return dimensionedScalar return dimensionedScalar
( (
"pistonSpeed", "pistonSpeed",
dimLength/dimTime, dimVelocity,
pistonDisplacement().value()/(deltaT().value() + VSMALL) pistonDisplacement().value()/(deltaT().value() + VSMALL)
); );
} }
scalar engineTime::userTimeToTime(const scalar theta) const Foam::scalar Foam::engineTime::userTimeToTime(const scalar theta) const
{ {
return degToTime(theta); return degToTime(theta);
} }
scalar engineTime::timeToUserTime(const scalar t) const Foam::scalar Foam::engineTime::timeToUserTime(const scalar t) const
{ {
return timeToDeg(t); return timeToDeg(t);
} }
@ -233,6 +253,4 @@ scalar engineTime::timeToUserTime(const scalar t) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -26,7 +26,25 @@ Class
Foam::engineTime Foam::engineTime
Description Description
Foam::engineTime Manage time in terms of engine RPM and crank-angle.
When engineTime is in effect, the userTime is reported in degrees
crank-angle instead of in seconds. The RPM to be used is specified in
@c constant/engineGeometry. If only a time conversion is required,
the geometric engine parameters can be dropped or set to zero.
For example,
@verbatim
rpm rpm [0 0 -1 0 0] 2000;
conRodLength conRodLength [0 1 0 0 0] 0.0;
bore bore [0 1 0 0 0] 0.0;
stroke stroke [0 1 0 0 0] 0.0;
clearance clearance [0 1 0 0 0] 0.0;
@endverbatim
Note
The engineTime can currently only be selected at compile-time.
SourceFiles SourceFiles
engineTime.C engineTime.C
@ -46,7 +64,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class engineTime Declaration Class engineTime Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class engineTime class engineTime
@ -55,13 +73,16 @@ class engineTime
{ {
// Private data // Private data
IOdictionary engineGeometry_; IOdictionary dict_;
//- RPM is required
dimensionedScalar rpm_;
//- Optional engine geometry parameters
dimensionedScalar conRodLength_; dimensionedScalar conRodLength_;
dimensionedScalar bore_; dimensionedScalar bore_;
dimensionedScalar stroke_; dimensionedScalar stroke_;
dimensionedScalar clearance_; dimensionedScalar clearance_;
dimensionedScalar rpm_;
// Private Member Functions // Private Member Functions
@ -72,6 +93,8 @@ class engineTime
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const engineTime&); void operator=(const engineTime&);
//- adjust read time values
void timeAdjustment();
public: public:
@ -84,7 +107,8 @@ public:
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const fileName& systemName = "system", const fileName& systemName = "system",
const fileName& constantName = "constant" const fileName& constantName = "constant",
const fileName& dictName = "engineGeometry"
); );
// Destructor // Destructor
@ -116,7 +140,13 @@ public:
//- Return the engine geometry dictionary //- Return the engine geometry dictionary
const dictionary& engineDict() const const dictionary& engineDict() const
{ {
return engineGeometry_; return dict_;
}
//- Return the engines current operating RPM
const dimensionedScalar& rpm() const
{
return rpm_;
} }
//- Return the engines connecting-rod length //- Return the engines connecting-rod length
@ -143,12 +173,6 @@ public:
return clearance_; return clearance_;
} }
//- Return the engines current operating RPM
const dimensionedScalar& rpm() const
{
return rpm_;
}
//- Return current crank-angle //- Return current crank-angle
scalar theta() const; scalar theta() const;
@ -173,16 +197,19 @@ public:
// Member functions overriding the virtual functions in time // Member functions overriding the virtual functions in time
//- Convert the user-time (CA deg) to real-time (s). //- Convert the user-time (CA deg) to real-time (s).
scalar userTimeToTime(const scalar theta) const; virtual scalar userTimeToTime(const scalar theta) const;
//- Convert the real-time (s) into user-time (CA deg) //- Convert the real-time (s) into user-time (CA deg)
scalar timeToUserTime(const scalar t) const; virtual scalar timeToUserTime(const scalar t) const;
//- Read the control dictionary and set the write controls etc.
virtual void readDict();
// Edit // Edit
//- Read the controlDict and set all the parameters //- Read the controlDict and set all the parameters
bool read(); virtual bool read();
}; };

View File

@ -471,8 +471,8 @@ EulerDdtScheme<Type>::fvcDdtPhiCorr
( (
rA*rho.oldTime()*U.oldTime() rA*rho.oldTime()*U.oldTime()
) & mesh().Sf() ) & mesh().Sf()
) )
) )
) )
); );
} }

0
src/lagrangian/basic/Make/files Executable file → Normal file
View File

0
src/lagrangian/basic/Make/options Executable file → Normal file
View File

0
src/lagrangian/dieselSpray/Make/files Executable file → Normal file
View File

0
src/lagrangian/dieselSpray/Make/options Executable file → Normal file
View File

View File

@ -38,21 +38,20 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineParticleTypeNameAndDebug(parcel, 0); defineParticleTypeNameAndDebug(parcel, 0);
defineTemplateTypeNameAndDebug(Cloud<parcel>, 0); defineTemplateTypeNameAndDebug(Cloud<parcel>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
parcel::parcel Foam::parcel::parcel
( (
const Cloud<parcel>& cloud, const Cloud<parcel>& cloud,
const vector& position, const vector& position,
const label celli, const label cellI,
const vector& n, const vector& n,
const scalar d, const scalar d,
const scalar T, const scalar T,
@ -67,14 +66,13 @@ parcel::parcel
const vector& U, const vector& U,
const vector& Uturb, const vector& Uturb,
const scalarField& X, const scalarField& X,
const List<word>& fuelNames const List<word>& liquidNames
) )
: :
Particle<parcel>(cloud, position, celli), Particle<parcel>(cloud, position, cellI),
liquidComponents_
fuelNames_
( (
fuelNames liquidNames
), ),
d_(d), d_(d),
T_(T), T_(T),
@ -96,7 +94,7 @@ parcel::parcel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool parcel::move(spray& sDB) bool Foam::parcel::move(spray& sDB)
{ {
const polyMesh& mesh = cloud().pMesh(); const polyMesh& mesh = cloud().pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh(); const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
@ -329,7 +327,7 @@ bool parcel::move(spray& sDB)
} }
void parcel::updateParcelProperties void Foam::parcel::updateParcelProperties
( (
const scalar dt, const scalar dt,
spray& sDB, spray& sDB,
@ -638,18 +636,16 @@ void parcel::updateParcelProperties
} }
void parcel::transformProperties(const tensor& T) void Foam::parcel::transformProperties(const tensor& T)
{ {
U_ = transform(T, U_); U_ = transform(T, U_);
} }
void parcel::transformProperties(const vector&) void Foam::parcel::transformProperties(const vector&)
{} {}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -54,7 +54,7 @@ class parcel
// Private member data // Private member data
// Reference to the names of the liquid components // Reference to the names of the liquid components
List<word> fuelNames_; List<word> liquidComponents_;
// Defining data (read and written to field files) // Defining data (read and written to field files)
@ -85,7 +85,7 @@ class parcel
//- Part of liquid core (1-fully liquid, 0-droplet) //- Part of liquid core (1-fully liquid, 0-droplet)
scalar liquidCore_; scalar liquidCore_;
//- injected from injector //- injected from injector
// Should really be a label, but is scalar due to // Should really be a label, but is scalar due to
// post-processing reasons // post-processing reasons
scalar injector_; scalar injector_;
@ -100,7 +100,7 @@ class parcel
// in which the particle moves // in which the particle moves
vector n_; vector n_;
//- Liquid fuel molar fractions //- Liquid components molar fractions
scalarField X_; scalarField X_;
// Derived state information (not read or written) // Derived state information (not read or written)
@ -166,7 +166,7 @@ public:
const vector& U, const vector& U,
const vector& Uturb, const vector& Uturb,
const scalarField& X, const scalarField& X,
const List<word>& fuelNames const List<word>& liquidNames
); );
//- Construct from Istream reading field values if required //- Construct from Istream reading field values if required
@ -182,7 +182,10 @@ public:
// Access // Access
//- Return the names of the liquid fuel components //- Return the names of the liquid components
inline const List<word>& liquidNames() const;
//- Return the names of the liquid fuel components - identical with liquidNames
inline const List<word>& fuelNames() const; inline const List<word>& fuelNames() const;
//- Return diameter of droplets in parcel //- Return diameter of droplets in parcel
@ -265,10 +268,10 @@ public:
//- Return the normal used for 2D purposes //- Return the normal used for 2D purposes
inline vector& n(); inline vector& n();
//- Return the liquid fuel molar fractions //- Return the liquid components molar fractions
inline const scalarField& X() const; inline const scalarField& X() const;
//- Return the liquid fuel molar fractions //- Return the liquid components molar fractions
inline scalarField& X(); inline scalarField& X();
//- Return the momentum relaxation time of droplets in parcel //- Return the momentum relaxation time of droplets in parcel
@ -355,7 +358,7 @@ public:
void transformProperties(const vector& separation); void transformProperties(const vector& separation);
//- fix the 2D plane normal, //- fix the 2D plane normal,
// when particle hits a face it is slightly perturbed // when particle hits a face it is slightly perturbed
// towards the face centre and n_ will no longer be valid // towards the face centre and n_ will no longer be valid
inline void correctNormal(const vector& sym); inline void correctNormal(const vector& sym);

View File

@ -31,9 +31,14 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const List<word>& parcel::liquidNames() const
{
return liquidComponents_;
}
inline const List<word>& parcel::fuelNames() const inline const List<word>& parcel::fuelNames() const
{ {
return fuelNames_; return liquidComponents_;
} }
inline scalar parcel::d() const inline scalar parcel::d() const
@ -115,7 +120,7 @@ inline scalar parcel::tTurb() const
{ {
return tTurb_; return tTurb_;
} }
inline scalar& parcel::liquidCore() inline scalar& parcel::liquidCore()
{ {
return liquidCore_; return liquidCore_;
@ -135,7 +140,7 @@ inline scalar parcel::injector() const
{ {
return injector_; return injector_;
} }
inline const vector& parcel::U() const inline const vector& parcel::U() const
{ {
return U_; return U_;

View File

@ -38,17 +38,17 @@ Foam::parcel::parcel
: :
Particle<parcel>(cloud, is), Particle<parcel>(cloud, is),
fuelNames_ liquidComponents_
( (
(cloud.pMesh().lookupObject<dictionary>("thermophysicalProperties")) (cloud.pMesh().lookupObject<dictionary>("thermophysicalProperties"))
.lookup("liquidFuelComponents") .lookup("liquidComponents")
), ),
X_(fuelNames_.size(), 0.0), X_(liquidComponents_.size(), 0.0),
tMom_(GREAT) tMom_(GREAT)
{ {
label nX = fuelNames_.size(); label nX = X_.size();
if (readFields) if (readFields)
{ {
@ -67,7 +67,7 @@ Foam::parcel::parcel
is >> U_; is >> U_;
is >> Uturb_; is >> Uturb_;
is >> n_; is >> n_;
for(label j=0; j<nX; j++) for (label j=0; j<nX; j++)
{ {
X_[j] = readScalar(is); X_[j] = readScalar(is);
} }
@ -79,7 +79,7 @@ Foam::parcel::parcel
reinterpret_cast<char*>(&d_), reinterpret_cast<char*>(&d_),
sizeof(d_) + sizeof(T_) + sizeof(m_) + sizeof(y_) sizeof(d_) + sizeof(T_) + sizeof(m_) + sizeof(y_)
+ sizeof(yDot_) + sizeof(ct_) + sizeof(ms_) + sizeof(tTurb_) + sizeof(yDot_) + sizeof(ct_) + sizeof(ms_) + sizeof(tTurb_)
+ sizeof(liquidCore_) + sizeof(injector_) + sizeof(liquidCore_) + sizeof(injector_)
+ sizeof(U_) + sizeof(Uturb_) + sizeof(n_) + sizeof(U_) + sizeof(Uturb_) + sizeof(n_)
); );
@ -175,11 +175,10 @@ void Foam::parcel::readFields
const parcel& p0 = iter(); const parcel& p0 = iter();
label nX = p0.X().size(); label nX = p0.X().size();
List<word> names(p0.fuelNames()); const List<word>& names = p0.liquidNames();
for (label j=0; j<nX; j++) for (label j=0; j<nX; j++)
{ {
IOField<scalar> X(c.fieldIOobject(names[j])); IOField<scalar> X(c.fieldIOobject(names[j]));
label i = 0; label i = 0;
@ -262,8 +261,7 @@ void Foam::parcel::writeFields
const parcel& p0 = iter(); const parcel& p0 = iter();
label nX = p0.X().size(); label nX = p0.X().size();
const List<word>& names = p0.liquidNames();
List<word> names(p0.fuelNames());
for (label j=0; j<nX; j++) for (label j=0; j<nX; j++)
{ {
@ -312,7 +310,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const parcel& p)
( (
reinterpret_cast<const char*>(&p.d_), reinterpret_cast<const char*>(&p.d_),
sizeof(p.d_) + sizeof(p.T_) + sizeof(p.m_) + sizeof(p.y_) sizeof(p.d_) + sizeof(p.T_) + sizeof(p.m_) + sizeof(p.y_)
+ sizeof(p.yDot_) + sizeof(p.ct_) + sizeof(p.ms_) + sizeof(p.tTurb_) + sizeof(p.yDot_) + sizeof(p.ct_) + sizeof(p.ms_) + sizeof(p.tTurb_)
+ sizeof(p.liquidCore_) + sizeof(p.injector_) + sizeof(p.liquidCore_) + sizeof(p.injector_)
+ sizeof(p.U_) + sizeof(p.Uturb_) + sizeof(p.n_) + sizeof(p.U_) + sizeof(p.Uturb_) + sizeof(p.n_)
); );

View File

@ -63,7 +63,7 @@ Foam::spray::spray
const dictionary& environmentalProperties const dictionary& environmentalProperties
) )
: :
Cloud<parcel>(U.mesh()), Cloud<parcel>(U.mesh(), false), // suppress className checking on positions
runTime_(U.time()), runTime_(U.time()),
time0_(runTime_.value()), time0_(runTime_.value()),
mesh_(U.mesh()), mesh_(U.mesh()),

0
src/lagrangian/intermediate/Make/options Executable file → Normal file
View File

0
src/lagrangian/solidParticle/Make/files Executable file → Normal file
View File

0
src/lagrangian/solidParticle/Make/options Executable file → Normal file
View File

View File

@ -29,10 +29,8 @@ License
#include "specie.H" #include "specie.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{ const Foam::scalar Foam::liquidMixture::TrMax = 0.999;
const scalar liquidMixture::TrMax = 0.999;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -42,17 +40,35 @@ Foam::liquidMixture::liquidMixture
const dictionary& thermophysicalProperties const dictionary& thermophysicalProperties
) )
: :
components_(thermophysicalProperties.lookup("liquidFuelComponents")), components_(thermophysicalProperties.lookup("liquidComponents")),
properties_(components_.size()) properties_(components_.size())
{ {
// use sub-dictionary "liquidProperties" if possible to avoid
// collisions with identically named gas-phase entries
// (eg, H2O liquid vs. gas)
forAll(components_, i) forAll(components_, i)
{ {
properties_.set const dictionary* subDictPtr = thermophysicalProperties.subDictPtr
( (
i, "liquidProperties"
liquid::New(thermophysicalProperties.lookup(components_[i]))
); );
if (subDictPtr)
{
properties_.set
(
i,
liquid::New(subDictPtr->lookup(components_[i]))
);
}
else
{
properties_.set
(
i,
liquid::New(thermophysicalProperties.lookup(components_[i]))
);
}
} }
} }
@ -347,7 +363,7 @@ Foam::scalar Foam::liquidMixture::mu
mu += x[i]*log(properties_[i].mu(p, Ti)); mu += x[i]*log(properties_[i].mu(p, Ti));
} }
} }
return exp(mu); return exp(mu);
} }
@ -390,7 +406,7 @@ Foam::scalar Foam::liquidMixture::K
K += phii[i]*phii[j]*Kij; K += phii[i]*phii[j]*Kij;
} }
} }
return K; return K;
} }
@ -412,7 +428,7 @@ Foam::scalar Foam::liquidMixture::D
Dinv += x[i]/properties_[i].D(p, Ti); Dinv += x[i]/properties_[i].D(p, Ti);
} }
} }
return 1.0/Dinv; return 1.0/Dinv;
} }

View File

@ -34,6 +34,48 @@ Description
For now it does not do much, since the perfect gas equation is used. For now it does not do much, since the perfect gas equation is used.
The dictionary constructor searches for the entry @c liquidComponents,
which is a wordList. The liquid properties of each component can either
be contained within a @c liquidProperties sub-dictionary or (for legacy
purposes) can be found directly in the dictionary.
The @c liquidProperties sub-dictionary entry should be used when possible
to avoid conflicts with identically named gas-phase entries.
A simple example of a single-component liquidMixture:
@verbatim
liquidComponents
(
H2O
);
// the gas-phase species
species
(
AIR H2O
);
// thermo values from BurcatCpData
AIR
AIR 1 28.96518 // specie: name/nMoles/MolWt
200 6000 1000 // low/high/common temperature
3.0879272 0.0012459718 -4.2371895e-07 6.7477479e-11 -3.9707697e-15 -995.26275 5.9596093 // 7 upper Temp. coeffs
3.5683962 -0.00067872943 1.5537148e-06 -3.2993706e-12 -4.6639539e-13 -1062.3466 3.7158296 // 7 lower Temp. coeffs
1.4792e-06 116 // sutherlandTransport for AIR (STAR-CD)
;
H2O
H2O 1 18.01528 // specie: name/nMoles/MolWt
200 6000 1000 // low/high/common temperature
2.6770389 0.0029731816 -7.7376889e-07 9.4433514e-11 -4.2689991e-15 -29885.894 6.88255 // 7 upper Temp. coeffs
4.1986352 -0.0020364017 6.5203416e-06 -5.4879269e-09 1.771968e-12 -30293.726 -0.84900901 // 7 lower Temp. coeffs
1.4792e-06 116 // sutherlandTransport for AIR (STAR-CD)
;
liquidProperties
{
H2O H2O defaultCoeffs;
}
@endverbatim
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef liquidMixture_H #ifndef liquidMixture_H
@ -51,7 +93,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class liquidMixture Declaration Class liquidMixture Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class liquidMixture class liquidMixture

0
src/thermophysicalModels/radiation/Make/files Executable file → Normal file
View File

0
src/thermophysicalModels/radiation/Make/options Executable file → Normal file
View File

View File

@ -1,23 +1,17 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.4 | | \\ / O peration | Version: 1.4.2 |
| \\ / A nd | Web: http://www.openfoam.org | | \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary;
root ""; object chemistryProperties;
case ""; location "constant";
instance "";
local "";
class dictionary;
object chemistryProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,23 +1,17 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.4 | | \\ / O peration | Version: 1.4.2 |
| \\ / A nd | Web: http://www.openfoam.org | | \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary;
root ""; object combustionProperties;
case ""; location "constant";
instance "";
local "";
class dictionary;
object combustionProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -27,11 +21,8 @@ Cmix Cmix [ 0 0 0 0 0 0 0 ] 1.0 ;
ignitionProperties1 ignitionProperties1
{ {
ignite off; ignite off;
ignitionPoint ignitionPoint [ 0 1 0 0 0 0 0 ] ( 0.2 0 0.02 ) ; ignitionPoint ignitionPoint [ 0 1 0 0 0 0 0 ] ( 0.2 0 0.02 ) ;
timing timing [ 0 0 1 0 0 0 0 ] 0.0e-1 ; timing timing [ 0 0 1 0 0 0 0 ] 0.0e-1 ;
duration duration [ 0 0 1 0 0 0 0 ] 1.0e-0 ; duration duration [ 0 0 1 0 0 0 0 ] 1.0e-0 ;
} }

View File

@ -1,23 +1,17 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.4 | | \\ / O peration | Version: 1.4.2 |
| \\ / A nd | Web: http://www.openfoam.org | | \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary;
root ""; object environmentalProperties;
case ""; location "constant";
instance "";
local "";
class dictionary;
object environmentalProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,23 +1,17 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.4 | | \\ / O peration | Version: 1.4.2 |
| \\ / A nd | Web: http://www.openfoam.org | | \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary;
root ""; object injectorProperties;
case ""; location "constant";
instance "";
local "";
class dictionary;
object injectorProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,23 +1,17 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.4 | | \\ / O peration | Version: 1.4.2 |
| \\ / A nd | Web: http://www.openfoam.org | | \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary;
root ""; object sprayProperties;
case ""; location "constant";
instance "";
local "";
class dictionary;
object sprayProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,11 +55,11 @@ wallModel reflect;
specConstAtomizationCoeffs specConstAtomizationCoeffs
{ {
dropletNozzleDiameterRatio dropletNozzleDiameterRatio
( (
0.4 0.4
); );
sprayAngle sprayAngle
( (
10 10
); );
@ -142,9 +136,9 @@ hollowConeInjectorCoeffs
{ {
dropletPDF dropletPDF
{ {
//pdfType exponential; //pdfType exponential;
pdfType RosinRammler; pdfType RosinRammler;
RosinRammlerPDF RosinRammlerPDF
{ {
minValue 1.00e-6; minValue 1.00e-6;
@ -154,7 +148,7 @@ hollowConeInjectorCoeffs
( (
1.5e-4 1.5e-4
); );
n n
( (
3 3

View File

@ -1,39 +1,38 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.4 | | \\ / O peration | Version: 1.4.2 |
| \\ / A nd | Web: http://www.openfoam.org | | \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary;
root ""; object thermodynamicProperties;
case ""; location "constant";
instance "";
local "";
class dictionary;
object thermodynamicProperties;
} }
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
thermoType hMixtureThermo<reactingMixture>; thermoType hMixtureThermo<reactingMixture>;
CHEMKINFile "$FOAM_ROOT/$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_ROOT/$FOAM_CASE/chemkin/therm.dat"; // We use the central thermo data:
CHEMKINThermoFile "~OpenFOAM/thermoData/therm.dat";
inertSpecie N2; inertSpecie N2;
liquidFuelComponents liquidComponents
( (
C7H16 C7H16
); );
C7H16 C7H16 defaultCoeffs; liquidProperties
{
C7H16 C7H16 defaultCoeffs;
C7H16
}
/*********************************************************************/ /*********************************************************************/

View File

@ -1,23 +1,17 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.4 | | \\ / O peration | Version: 1.4.2 |
| \\ / A nd | Web: http://www.openfoam.org | | \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary;
root ""; object turbulenceProperties;
case ""; location "constant";
instance "";
local "";
class dictionary;
object turbulenceProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //