Commit a044048c authored by andy's avatar andy
Browse files

Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-2.0/

parents d8aa9e8d cb96a677
......@@ -105,7 +105,6 @@ int main(int argc, char *argv[])
runTime.functionObjects().end();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
......
......@@ -265,8 +265,8 @@ bool Foam::domainDecomposition::writeDecomposition()
Time::controlDictName,
time().rootPath(),
processorCasePath,
"system",
"constant"
word("system"),
word("constant")
);
processorDb.setTime(time());
......
......@@ -80,7 +80,7 @@ case [0-9]*:
endsw
set paraviewInstDir=$WM_THIRD_PARTY_DIR/paraview-${ParaView_VERSION}
set paraviewInstDir=$WM_THIRD_PARTY_DIR/ParaView-${ParaView_VERSION}
setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-${ParaView_VERSION}
# set paths if binaries or source are present
......
......@@ -88,7 +88,7 @@ case "$ParaView_VERSION" in
esac
export ParaView_VERSION ParaView_MAJOR
paraviewInstDir=$WM_THIRD_PARTY_DIR/paraview-$ParaView_VERSION
paraviewInstDir=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
export ParaView_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION
# set paths if binaries or source are present
......
......@@ -25,6 +25,7 @@ License
#include "Time.H"
#include "PstreamReduceOps.H"
#include "argList.H"
#include <sstream>
......@@ -215,7 +216,8 @@ Foam::Time::Time
const fileName& rootPath,
const fileName& caseName,
const word& systemName,
const word& constantName
const word& constantName,
const bool enableFunctionObjects
)
:
TimePaths
......@@ -259,7 +261,94 @@ Foam::Time::Time
graphFormat_("raw"),
runTimeModifiable_(true),
functionObjects_(*this)
functionObjects_(*this, enableFunctionObjects)
{
libs_.open(controlDict_, "libs");
// Explicitly set read flags on objectRegistry so anything constructed
// from it reads as well (e.g. fvSolution).
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
setControls();
// Time objects not registered so do like objectRegistry::checkIn ourselves.
if (runTimeModifiable_)
{
monitorPtr_.reset
(
new fileMonitor
(
regIOobject::fileModificationChecking == inotify
|| regIOobject::fileModificationChecking == inotifyMaster
)
);
// File might not exist yet.
fileName f(controlDict_.filePath());
if (!f.size())
{
// We don't have this file but would like to re-read it.
// Possibly if in master-only reading mode. Use a non-existing
// file to keep fileMonitor synced.
f = controlDict_.objectPath();
}
controlDict_.watchIndex() = addWatch(f);
}
}
Foam::Time::Time
(
const word& controlDictName,
const argList& args,
const word& systemName,
const word& constantName
)
:
TimePaths
(
args.rootPath(),
args.caseName(),
systemName,
constantName
),
objectRegistry(*this),
libs_(),
controlDict_
(
IOobject
(
controlDictName,
system(),
*this,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
),
startTimeIndex_(0),
startTime_(0),
endTime_(0),
stopAt_(saEndTime),
writeControl_(wcTimeStep),
writeInterval_(GREAT),
purgeWrite_(0),
subCycling_(false),
writeFormat_(IOstream::ASCII),
writeVersion_(IOstream::currentVersion),
writeCompression_(IOstream::UNCOMPRESSED),
graphFormat_("raw"),
runTimeModifiable_(true),
functionObjects_(*this, !args.optionFound("noFunctionObjects"))
{
libs_.open(controlDict_, "libs");
......@@ -303,7 +392,8 @@ Foam::Time::Time
const fileName& rootPath,
const fileName& caseName,
const word& systemName,
const word& constantName
const word& constantName,
const bool enableFunctionObjects
)
:
TimePaths
......@@ -348,7 +438,7 @@ Foam::Time::Time
graphFormat_("raw"),
runTimeModifiable_(true),
functionObjects_(*this)
functionObjects_(*this, enableFunctionObjects)
{
libs_.open(controlDict_, "libs");
......@@ -395,7 +485,8 @@ Foam::Time::Time
const fileName& rootPath,
const fileName& caseName,
const word& systemName,
const word& constantName
const word& constantName,
const bool enableFunctionObjects
)
:
TimePaths
......@@ -439,7 +530,7 @@ Foam::Time::Time
graphFormat_("raw"),
runTimeModifiable_(true),
functionObjects_(*this)
functionObjects_(*this, enableFunctionObjects)
{
libs_.open(controlDict_, "libs");
}
......
......@@ -57,6 +57,8 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class argList;
/*---------------------------------------------------------------------------*\
Class Time Declaration
......@@ -184,14 +186,24 @@ public:
// Constructors
//- Construct given name, rootPath and casePath
//- Construct given name of dictionary to read and argument list
Time
(
const word& name,
const argList& args,
const word& systemName = "system",
const word& constantName = "constant"
);
//- Construct given name of dictionary to read, rootPath and casePath
Time
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant"
const word& constantName = "constant",
const bool enableFunctionObjects = true
);
//- Construct given dictionary, rootPath and casePath
......@@ -201,7 +213,8 @@ public:
const fileName& rootPath,
const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant"
const word& constantName = "constant",
const bool enableFunctionObjects = true
);
//- Construct given endTime, rootPath and casePath
......@@ -210,7 +223,8 @@ public:
const fileName& rootPath,
const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant"
const word& constantName = "constant",
const bool enableFunctionObjects = true
);
......
......@@ -64,6 +64,12 @@ Foam::argList::initValidTables::initValidTables()
);
validParOptions.set("roots", "(dir1 .. dirN)");
argList::addBoolOption
(
"noFunctionObjects",
"do not execute functionObjects"
);
Pstream::addValidParOptions(validParOptions);
}
......
......@@ -4,9 +4,4 @@
Foam::Info<< "Create time\n" << Foam::endl;
Foam::Time runTime
(
Foam::Time::controlDictName,
args.rootPath(),
args.caseName()
);
Foam::Time runTime(Foam::Time::controlDictName, args);
......@@ -91,6 +91,7 @@ $(cellSources)/zoneToCell/zoneToCell.C
$(cellSources)/sphereToCell/sphereToCell.C
$(cellSources)/cylinderToCell/cylinderToCell.C
$(cellSources)/faceZoneToCell/faceZoneToCell.C
$(cellSources)/cylinderAnnulusToCell/cylinderAnnulusToCell.C
faceSources = sets/faceSources
$(faceSources)/faceToFace/faceToFace.C
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cylinderAnnulusToCell.H"
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cylinderAnnulusToCell, 0);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, word);
addToRunTimeSelectionTable(topoSetSource, cylinderAnnulusToCell, istream);
}
Foam::topoSetSource::addToUsageTable Foam::cylinderAnnulusToCell::usage_
(
cylinderAnnulusToCell::typeName,
"\n Usage: cylinderAnnulusToCell (p1X p1Y p1Z) (p2X p2Y p2Z)"
" outerRadius innerRadius\n\n"
" Select all cells with cell centre within bounding cylinder annulus\n\n"
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::cylinderAnnulusToCell::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const scalar orad2 = sqr(outerRadius_);
const scalar irad2 = sqr(innerRadius_);
const scalar magAxis2 = magSqr(axis);
const pointField& ctrs = mesh_.cellCentres();
forAll(ctrs, cellI)
{
vector d = ctrs[cellI] - p1_;
scalar magD = d & axis;
if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
if ((d2 < orad2) && (d2 > irad2))
{
addOrDelete(set, cellI, add);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const scalar outerRadius,
const scalar innerRadius
)
:
topoSetSource(mesh),
p1_(p1),
p2_(p2),
outerRadius_(outerRadius),
innerRadius_(innerRadius)
{}
Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
p1_(dict.lookup("p1")),
p2_(dict.lookup("p2")),
outerRadius_(readScalar(dict.lookup("outerRadius"))),
innerRadius_(readScalar(dict.lookup("innerRadius")))
{}
// Construct from Istream
Foam::cylinderAnnulusToCell::cylinderAnnulusToCell
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
p1_(checkIs(is)),
p2_(checkIs(is)),
outerRadius_(readScalar(checkIs(is))),
innerRadius_(readScalar(checkIs(is)))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cylinderAnnulusToCell::~cylinderAnnulusToCell()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cylinderAnnulusToCell::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding cells with centre within cylinder annulus,"
<< " with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius = " << innerRadius_
<< endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing cells with centre within cylinder, with p1 = "
<< p1_ << ", p2 = " << p2_ << " and outer radius = " << outerRadius_
<< " and inner radius " << innerRadius_
<< endl;
combine(set, false);
}
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::cylinderAnnulusToCell
Description
A topoSetSource to select cells based on cell centres inside a
cylinder annulus.
SourceFiles
cylinderAnnulusToCell.C
\*---------------------------------------------------------------------------*/
#ifndef cylinderAnnulusToCell_H
#define cylinderAnnulusToCell_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cylinderAnnulusToCell Declaration
\*---------------------------------------------------------------------------*/
class cylinderAnnulusToCell
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- First point on cylinder axis
vector p1_;
//- Second point on cylinder axis
vector p2_;
//- Outer Radius
scalar outerRadius_;
//- Inner Radius
scalar innerRadius_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
TypeName("cylinderAnnulusToCell");
// Constructors
//- Construct from components
cylinderAnnulusToCell
(
const polyMesh& mesh,
const vector& p1,
const vector& p2,
const scalar outerRadius,
const scalar innerRadius
);
//- Construct from dictionary
cylinderAnnulusToCell
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
cylinderAnnulusToCell
(
const polyMesh& mesh,
Istream&
);
// Destructor
virtual ~cylinderAnnulusToCell();
// Member Functions
virtual sourceType setType() const
{
return CELLSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -6,6 +6,32 @@ cd ${0%/*} || exit 1 # run from this directory
application=`getApplication`
# This case uses the #codeStream which is disabled by default. Enable for
# just this case.
MAIN_CONTROL_DICT=`foamEtcFile controlDict`
if [ -f "$MAIN_CONTROL_DICT" ]
then
echo "Modifying ${MAIN_CONTROL_DICT}"
if [ -e ${MAIN_CONTROL_DICT}.org ]
then
echo "File ${MAIN_CONTROL_DICT}.org already exists"
echo "Did Allrun fail in some way and then run again?"
exit 1
fi
# Clean up on termination and on Ctrl-C
trap 'mv ${MAIN_CONTROL_DICT}.org ${MAIN_CONTROL_DICT} 2>/dev/null; exit 0' \
EXIT TERM INT
cp ${MAIN_CONTROL_DICT} ${MAIN_CONTROL_DICT}.org
echo "Enabling allowSystemOperations in ${MAIN_CONTROL_DICT}."
sed \
-e s/"\(allowSystemOperations[ \t]*\)\([0-9]\);"/"\1 1;"/g \
${MAIN_CONTROL_DICT}.org > ${MAIN_CONTROL_DICT}
fi
cp -r 0.org 0 > /dev/null 2>&1