Commit 4e837c7f authored by Andrew Heather's avatar Andrew Heather
Browse files
parents 91ac6f90 9f1d94bd
// Solve the Momentum equation
tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
);
UEqn().relax();
solve(UEqn() == -fvc::grad(p));
{
fvScalarMatrix hEqn
(
fvm::div(phi, h)
- fvm::Sp(fvc::div(phi), h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)"))
- p*fvc::div(phi/fvc::interpolate(rho))
);
hEqn.relax();
hEqn.solve();
thermo.correct();
rho = thermo.rho();
if (!transonic)
{
rho.relax();
}
Info<< "rho max/min : "
<< max(rho).value() << " "
<< min(rho).value() << endl;
}
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
volScalarField p0 = p;
volScalarField AU = UEqn().A();
......@@ -24,8 +29,8 @@ if (transonic)
+ phid*(fvc::interpolate(p) - fvc::interpolate(p, "UD"))
);
refCast<mixedFvPatchScalarField>(p.boundaryField()[1]).refValue()
= p.boundaryField()[1];
//refCast<mixedFvPatchScalarField>(p.boundaryField()[1]).refValue()
// = p.boundaryField()[1];
fvScalarMatrix pEqn
(
......@@ -35,6 +40,7 @@ if (transonic)
+ fvc::div(phid)*p
- fvm::laplacian(rho/AtU, p)
);
//pEqn.relax();
pEqn.setReference(pRefCell, pRefValue);
......
......@@ -57,6 +57,7 @@ int main(int argc, char *argv[])
#include "readSIMPLEControls.H"
p.storePrevIter();
rho.storePrevIter();
if (!transonic)
{
......
memInfo.C
EXE = $(FOAM_USER_APPBIN)/memInfo
#include "memInfo.H"
#include "IOstreams.H"
#include "List.H"
#include "vector.H"
using namespace Foam;
int main()
{
memInfo m;
Info<< m << endl;
List<vector> l(10000000, vector::one);
Info<< m.update() << endl;
return 0;
}
......@@ -56,6 +56,14 @@ int main(int argc, char *argv[])
"specify a list of fields to be reconstructed. Eg, '(U T p)' - "
"regular expressions not currently supported"
);
argList::addOption
(
"lagrangianFields",
"list",
"specify a list of lagrangian fields to be reconstructed. Eg, '(U d)' -"
"regular expressions not currently supported, "
"positions always included."
);
argList::addBoolOption
(
"noLagrangian",
......@@ -73,6 +81,20 @@ int main(int argc, char *argv[])
const bool noLagrangian = args.optionFound("noLagrangian");
HashSet<word> selectedLagrangianFields;
if (args.optionFound("lagrangianFields"))
{
if (noLagrangian)
{
FatalErrorIn(args.executable())
<< "Cannot specify noLagrangian and lagrangianFields "
<< "options together."
<< exit(FatalError);
}
args.optionLookup("lagrangianFields")() >> selectedLagrangianFields;
}
// determine the processor count directly
label nProcs = 0;
while (isDir(args.path()/(word("processor") + name(nProcs))))
......@@ -403,84 +425,96 @@ int main(int argc, char *argv[])
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<label>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<scalar>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<scalar>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<vector>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<vector>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<sphericalTensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<sphericalTensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<symmTensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<symmTensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFields<tensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
reconstructLagrangianFieldFields<tensor>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
sprayObjs,
selectedLagrangianFields
);
}
}
......
......@@ -188,12 +188,12 @@ then
fi
mpiopts="-np $NPROCS"
#
#
# is the machine ready to run parallel?
#
echo "Parallel processing using $WM_MPLIB with $NPROCS processors"
case "$WM_MPLIB" in
OPENMPI)
*OPENMPI)
# add hostfile info
for hostfile in \
hostfile \
......
......@@ -221,7 +221,7 @@ done
unset cmd
case "$WM_MPLIB" in
OPENMPI)
*OPENMPI)
cmd="mpirun -app $PWD/mpirun.schema </dev/null"
;;
MPICH)
......
......@@ -146,13 +146,20 @@ checkIllegalCode()
badFiles=$(
for f in $fileList
do
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -E -hn -e "$reBad" $scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
case "$f" in
# exclude potential makefiles
(wmake/[Mm]akefile* | wmake/rules/*)
;;
(*)
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -E -hn -e "$reBad" $scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
;;
esac
done
)
......@@ -243,7 +250,7 @@ checkLineLengthNonComments()
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -hn -e '^.\{81,\}' \
--and --not -e "^ *//" \
--and --not -e '^ *//' \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
......@@ -276,7 +283,7 @@ checkLineLengthNonDirective()
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -hn -e '^.\{81,\}' \
--and --not -e "^ *#" \
--and --not -e '^ *#' \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
......
......@@ -109,13 +109,20 @@ checkIllegalCode()
badFiles=$(
for f in $fileList
do
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -E -hn -e "$reBad" $scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
case "$f" in
# exclude potential makefiles
(wmake/[Mm]akefile* | wmake/rules/*)
;;
(*)
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -E -hn -e "$reBad" $scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
;;
esac
done
)
......@@ -206,7 +213,7 @@ checkLineLengthNonComments()
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -hn -e '^.\{81,\}' \
--and --not -e "^ *//" \
--and --not -e '^ *//' \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
......@@ -239,7 +246,7 @@ checkLineLengthNonDirective()
# parse line numbers from grep output:
# <lineNr>: contents
lines=$(git grep -hn -e '^.\{81,\}' \
--and --not -e "^ *#" \
--and --not -e '^ *#' \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
......
......@@ -24,21 +24,63 @@ be quite a gain on large numbers of processors.
- all file monitoring is done by an instance of 'fileMonitor' in the Time
class. The fileMonitor class can be found in OSspecific. Default is
to use the (linux-specific) 'inotify' system calls.
If compiled with -DFOAM_USE_STAT it will revert to the current 'stat' system
calls.
class. The fileMonitor class can be found in OSspecific. It uses either
timestamps as before or the (linux-specific) 'inotify' system framework
(available only if compiled with -DFOAM_USE_INOTIFY).
- inotify does not need timestamps. There is no need for fileModificationSkew
to allow for time differences. (there can still temporarily be a difference
in modified status between different processors due to nfs lagging)
- the monitoring can be done in one of four modes as set by
OptimisationSwitches::fileModificationChecking
- timeStamp : old behaviour : all nodes check the timestamp
- inotify : using inotify instead of timestamps
- timeStampMaster,inotifyMaster : only the master node checks the file
and only the master node reads it and distribute it to the
slaves. This makes runTimeModifiable possible on distributed
running (see below).
- distributed running:
- set fileModificationChecking to e.g. timeStampMaster
- decompose a case, e.g. cavity
- copy system and constant to processor0/
- put the all the processor* directories on the wanted nodes inside
the case directory. E.g.
- on master have /tmp/cavity/processor0
- on slaveN have /tmp/cavity/processorN
- so to reiterate:
- there is no need for cavity/constant or cavity/system, all the
dictionaries are only in processor0/constant or processor0/system
- the slave processor directories have no system directory and the
constant directory only contains the mesh.
- start the job in distributed mode by specifying the slave roots
(so one less than the number of processors) with
the -roots command line option:
mpirun -np 2 icoFoam -roots '("/tmp")' -parallel
- the alternative to the -roots option is to have a
cavity/system/decomposeParDict on the master with
distributed yes;
roots ("/tmp");
Details:
- timeStampMaster, inotifyMaster : this works only for IOdictionaries that
are READ_IF_MODIFIED. It means that slaves read exactly the same dictionary
as the master so cannot be used for dictionaries that contain e.g. mesh
specific information.
- inotify is a monitoring framework used to monitor changes in
lots of files (e.g. used in desktop searched like beagle). You specify
files to monitor and then get warned for any changes to these files.
It does not need timestamps. There is no need for fileModificationSkew
to allow for time differences. (there can still temporarily be a difference
in modified status between different processors due to nfs lagging). The big
problem is that it does not work over nfs3 (not sure about nfs4).
- fileMonitor stores two hashtables per file so there is a small overhead
adding and removing files from monitoring.
- if runTimeModifiable is false at start of run no files will get monitored,
however if runTimeModified gets set to false during the run the files
will still get monitored (though never reloaded). This is only a hypothetical
......@@ -46,7 +88,6 @@ problem in that the kernel still stores events for the monitored files. However
inotify is very efficient - e.g. it gets used to track changes on file systems
for desktop search engines.
- in the old system one could call modified() on any object and get
and uptodate state. In the new system it will return the state from
the last runTime++ (which if it triggered any re-reads will have reset the
......
......@@ -872,6 +872,14 @@ InfoSwitches
OptimisationSwitches
{
fileModificationSkew 10;
//- Modification checking:
// - timeStamp : use modification time on file
// - inotify : use inotify framework
// - timeStampMaster : do time stamp (and file reading) only on master.
// - inotifyMaster : do inotify (and file reading) only on master.
fileModificationChecking timeStampMaster;//inotify;timeStamp;inotifyMaster;
commsType nonBlocking; //scheduled; //blocking;
floatTransfer 0;
nProcsSimpleSum 0;
......
......@@ -90,17 +90,20 @@ switch ("$compilerInstall")
case OpenFOAM:
switch ("$WM_COMPILER")
case Gcc:
case Gcc++0x:
set gcc_version=gcc-4.4.3
set gmp_version=gmp-5.0.1
set mpfr_version=mpfr-2.4.2
breaksw
case Gcc45:
case Gcc45++0x:
set gcc_version=gcc-4.5.0
set gmp_version=gmp-5.0.1
set mpfr_version=mpfr-2.4.2
set mpc_version=mpc-0.8.1
breaksw
case Gcc44:
case Gcc44++0x:
set gcc_version=gcc-4.4.3
set gmp_version=gmp-5.0.1
set mpfr_version=mpfr-2.4.2
......@@ -190,6 +193,18 @@ case OpenFOAM:
endsw
#
# add c++0x flags for external programs
#
if ( $?WM_CXXFLAGS ) then
switch ("$WM_COMPILER")
case Gcc*++0x:
setenv WM_CXXFLAGS "$WM_CXXFLAGS -std=c++0x"
breaksw
endsw
endif
# boost and CGAL
# ~~~~~~~~~~~~~~
......@@ -236,9 +251,7 @@ case OPENMPI:
breaksw
case SYSTEMOPENMPI:
# This uses the installed openmpi. It needs mpicc installed!
# Use the system installed openmpi, get library directory via mpicc
set mpi_version=openmpi-system
# Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
......
......@@ -111,18 +111,18 @@ unset MPFR_ARCH_PATH
case "${compilerInstall:-OpenFOAM}" in
OpenFOAM)
case "$WM_COMPILER" in
Gcc)
Gcc | Gcc++0x)
gcc_version=gcc-4.4.3
gmp_version=gmp-5.0.1
mpfr_version=mpfr-2.4.2
;;
Gcc45)
Gcc45 | Gcc45++0x)
gcc_version=gcc-4.5.0
gmp_version=gmp-5.0.1
mpfr_version=mpfr-2.4.2
mpc_version=mpc-0.8.1
;;
Gcc44)
Gcc44 | Gcc44++0x)
gcc_version=gcc-4.4.3
gmp_version=gmp-5.0.1
mpfr_version=mpfr-2.4.2
......@@ -213,6 +213,19 @@ OpenFOAM)
esac
#
# add c++0x flags for external programs
#
if [ -n "$WM_CXXFLAGS" ]
then
case "$WM_COMPILER" in
Gcc*++0x)
WM_CXXFLAGS="$WM_CXXFLAGS -std=c++0x"
;;
esac
fi
# boost and CGAL
# ~~~~~~~~~~~~~~
......@@ -261,7 +274,7 @@ OPENMPI)
;;
SYSTEMOPENMPI)
# use the system installed openmpi, get library directory via mpicc
# Use the system installed openmpi, get library directory via mpicc
mpi_version=openmpi-system
# Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
......
......@@ -12,9 +12,9 @@ unset COMP_FLAGS LINK_FLAGS
if [ -f /usr/include/sys/inotify.h -a "${1%USE_STAT}" = "$1" ]
then
echo "Found <sys/inotify.h> -- using inotify for file monitoring."
unset COMP_FLAGS
export COMP_FLAGS="-DFOAM_USE_INOTIFY"
else
export COMP_FLAGS="-DFOAM_USE_STAT"
unset COMP_FLAGS
fi
......
......@@ -8,6 +8,7 @@ fileStat.C
POSIX.C
cpuTime/cpuTime.C
clockTime/clockTime.C
memInfo/memInfo.C
/*
* Note: fileMonitor assumes inotify by default. Compile with -DFOAM_USE_STAT
......
......@@ -36,6 +36,7 @@ Description
#include "fileName.H"
#include "fileStat.H"
#include "timer.H"
#include "IFstream.H"
#include <fstream>
#include <cstdlib>
......
......@@ -24,38 +24,25 @@ License
\*---------------------------------------------------------------------------*/
#include "clockTime.H"
#include "scalar.H"
#include <sys/time.h>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void clockTime::getTime(struct timeval& t)
void Foam::clockTime::getTime(timeType& t)
{
gettimeofday(&t, NULL);
gettimeofday(&t, 0);
}
double clockTime::timeDifference
(
const struct timeval& start,
const struct timeval& end