Merge remote-tracking branch 'origin/nr/multiSolverFix' into nextRelease

This commit is contained in:
Henrik Rusche 2013-08-30 12:13:34 +02:00
commit abdb73255b
65 changed files with 2552 additions and 523 deletions

View file

@ -1,7 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/multiSolver/lnInclude \
-I$(LIB_SRC)/multiSolver/multiSolver
-I../../../../src/multiSolver/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View file

@ -26,7 +26,8 @@ Application
multiSolverDemo
Description
Demonstration multiSolver-enabled application.
Combination of icoFoam and scalarTransportFoam for testing of new multiTime
framework.
Author
David L. F. Gaden
@ -61,8 +62,10 @@ int main(int argc, char *argv[])
# include "solverScalarTransportFoam.H"
// Only necessary if we revisit the same solver domain twice in the same
// superLoop (scalarTransportFoam, in this case)
multiRun++;
// * * * * * * * * * * * * * * * * icoFoam2 * * * * * * * * * * * * * * * * //
Info << "*** Switching to icoFoam2 ***\n" << endl;

View file

@ -31,7 +31,7 @@
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf())
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);
adjustPhi(phi, U, p);

View file

@ -12,7 +12,13 @@
{
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H"
dictionary simple = mesh.solutionDict().subDict("SIMPLE");
int nNonOrthCorr =
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor =
simple.lookupOrDefault<Switch>("momentumPredictor", true);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{

View file

@ -1,7 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/multiSolver/lnInclude \
-I$(LIB_SRC)/multiSolver/multiSolver
-I../../../../src/multiSolver/lnInclude
EXE_LIBS = \
-lfiniteVolume \

View file

@ -49,11 +49,18 @@ void parseOptions
IStringStream optionsStream(options);
label nSolverDomains(0);
label nSuperLoops(0);
// Get solverDomainNames, if any
while (not optionsStream.eof())
{
token nextOption(optionsStream);
// Bug workaround
if (nextOption.type() == token::ERROR)
{
break;
}
if (nextOption.isLabel())
{
ptrSuperLoops->setSize(++nSuperLoops);
@ -76,18 +83,25 @@ void parseOptions
<< abort(FatalError);
}
}
// Get superLoopList
while (not optionsStream.eof())
{
token nextOption(optionsStream);
// Bug workaround
if (nextOption.type() == token::ERROR)
{
break;
}
if (nextOption.isLabel())
{
ptrSuperLoops->setSize(++nSuperLoops);
ptrSuperLoops->operator[](nSuperLoops - 1)
= nextOption.labelToken();
}
else if (nSuperLoops > 0)
else if (nSuperLoops > 0)
{
// might be a range -> label : label
@ -104,7 +118,7 @@ void parseOptions
(
ptrSuperLoops->operator[](nSuperLoops - 1)
);
if (toValue > fromValue)
{
// correct range format
@ -182,20 +196,20 @@ int main(int argc, char *argv[])
argList::validOptions.insert("postDecompose", "");
argList::validOptions.insert("preReconstruct", "");
argList::validOptions.insert("postReconstruct", "");
argList::validOptions.insert("global","");
argList::validOptions.insert("local","");
// default behaviour is purge the case/[time] directory before '-load'
// command. '-noPurge' prevents this. Allows for more complicated
// load data selections by executing multiSolver several times
argList::validOptions.insert("noPurge","");
// default behaviour is: if there is only one solverDomain specified, use
// setSolverDomain() on it. Same as multiSolver -set solverDomain.
// '-noSet' prevents this.
argList::validOptions.insert("noSet","");
// default behaviour is: if there are storeFields defined, when loading, it
// will copy the store fields into every time instance where they are
// absent. '-noStore' will prevent this.
@ -224,7 +238,7 @@ int main(int argc, char *argv[])
bool noSet = false;
bool noStore = false;
label nCommands(0);
// Read arguments
if (args.optionFound("list"))
{
@ -331,7 +345,7 @@ int main(int argc, char *argv[])
args.rootPath(),
args.caseName()
);
const IOdictionary& mcd(multiRun.multiControlDict());
wordList solverDomains(0);
labelList superLoops(0);
@ -420,7 +434,7 @@ int main(int argc, char *argv[])
{
// Incorrect solver domain name
FatalErrorIn("multiSolver::main")
<< "solverDomainName " << solverDomains[i] << " is not "
<< "solverDomainName " << solverDomains[i] << "is not "
<< "found."
<< abort(FatalError);
}
@ -504,7 +518,7 @@ int main(int argc, char *argv[])
<< "No data found with specified parameters."
<< abort(FatalError);
}
}
}
switch (command)
{
@ -517,7 +531,7 @@ int main(int argc, char *argv[])
(
multiRun.multiDictRegistry().path()/"multiSolver"
);
forAll(solverDomains, i)
{
if (solverDomains[i] == "default") continue;
@ -561,7 +575,7 @@ int main(int argc, char *argv[])
<< endl;
multiRun.purgeTimeDirs(multiRun.multiDictRegistry().path());
}
Info << "Loading data from multiSolver directories to case root"
<< endl;
if
@ -634,7 +648,7 @@ int main(int argc, char *argv[])
(
dirEntries[de]
);
// Copy system to processorN
cp
(
@ -642,7 +656,7 @@ int main(int argc, char *argv[])
/multiRun.multiDictRegistry().system(),
multiRun.multiDictRegistry().path()/dirEntries[de]
);
// Copy constant/files to processorN/constant
fileNameList constantContents
(
@ -664,7 +678,7 @@ int main(int argc, char *argv[])
/multiRun.multiDictRegistry().constant()
);
}
// Copy constant/directories to processorN/constant
constantContents = readDir
(
@ -731,7 +745,7 @@ int main(int argc, char *argv[])
Info << "Purging preconditioned time directories"
<< endl;
// Clean up extra time directories
fileNameList dirEntries
(
@ -758,7 +772,7 @@ int main(int argc, char *argv[])
// Execute set command - either from an explicit '-set' or from a '-load'
// with only one solverDomain as an option
if
if
(
(command == set)
|| (

View file

@ -68,5 +68,4 @@ wmake libso engine
wmake libso equationReader
wmake libso multiSolver
# ----------------------------------------------------------------- end-of-file

View file

@ -1,4 +1,5 @@
dummyControlDict/dummyControlDict.C
multiTime/multiTime.C
multiSolver/multiSolver.C
timeCluster/timeCluster.C
timeCluster/timeClusterList.C

View file

@ -1,6 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-Ituple2Lists
LIB_LIBS = \
-lfiniteVolume

View file

@ -108,4 +108,3 @@ Foam::dummyControlDict::~dummyControlDict()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -72,7 +72,7 @@ public:
//- Construct, reading the multiControlDict data from a file
explicit dummyControlDict(const fileName&);
//- Construct given the multiControlDict dictionary
explicit dummyControlDict(const dictionary&);
@ -90,3 +90,5 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -1,3 +1,3 @@
} // previous solver domain goes out of scope
multiRun++;
} // previous solver domain goes out of scope
multiRun++;
} // end While loop

View file

@ -0,0 +1,6 @@
#ifndef multiSolverVersion_H
# define multiSolverVersion_H
# define multiSolverVersionMajor 0
# define multiSolverVersionMinor 6
# define multiSolverVersionBuild 0
#endif

View file

@ -1,7 +1,7 @@
} // previous solver domain goes out of scope
multiRun.setSolverDomain(solverDomain);
// Clear defines that may interfere with other solver domains
// Clear defines that may interfere with other solver domains
#undef createPhi_H
#undef createPhiV_H
#undef initContinuityErrs_H

File diff suppressed because it is too large Load diff

View file

@ -45,7 +45,8 @@ Author
#ifndef multiSolver_H
#define multiSolver_H
#include "Time.H"
#include "multiSolverVersion.H"
#include "multiTime.H"
#include "dummyControlDict.H"
#include "timeClusterList.H"
#include "IFstream.H"
@ -63,53 +64,56 @@ class multiSolver
{
// Private data
// A dummy controlDict, required to initialize multiDictRegistry
dummyControlDict dcd_;
// A mini-objectRegistry for the dictionaries - done this way to allow
// run-time modification of dictionaries
Time multiDictRegistry_;
multiTime multiDictRegistry_;
// Main control dictionary for multiSolver
IOdictionary multiControlDict_;
// All multiDicts contained in the case directory
PtrList<IOdictionary> multiDicts_;
// Reference to multiSolverControl subdictionary in multiControlDict
dictionary& multiSolverControl_;
// Reference to solverDomains subdictionary in multiControlDict
dictionary& solverDomains_;
// Current solverDomain dictionary
dictionary currentSolverDomainDict_;
// List of all the solver domain prefixes
wordList prefixes_;
// True when the end condition has been met
bool finished_;
// True when setInitialSolverDomain has been run
bool initialized_;
// Set by the solver to force a global end
bool forcedEnd_;
// True when superLoop++ just happened, but the previous solverDomain
// has not yet been saved (to prevent the first solverDomain from
// saving to the *next* superLoop.
bool noSaveSinceSuperLoopIncrement_;
// True if this is the lowest number on a local shared drive - parallel
// only.
bool manageLocalRoot_;
// Private member functions
// Set manageLocalRoot_ flags on all processors (parallel only)
void setUpParallel();
// Ensure all processors are synchronized (parallel only)
void synchronizeParallel() const;
// Load initial data and controls
// *** Located in multiSolverSetInitialSolverDomain.C ***
void setInitialSolverDomain(const word& solverDomainName);
@ -122,7 +126,7 @@ class multiSolver
// multiControlDict
// *** Located in multiSolverSetControls.C ***
void setMultiSolverControls();
// Sets controls from the solverDomains subdictionary in the
// multiControlDict
// *** Located in multiSolverSetControls.C ***
@ -130,16 +134,31 @@ class multiSolver
// Use stopAt and finalStopAt settings to determine the endTime for
// the current solverDomain. Returns the controlDict's stopAt word,
// which may differ from that in multiControlDict. Sets finished_ to
// true if the end condition will be met.
// which may differ from that in multiControlDict.
word setLocalEndTime();
// If the current solver domain should not start, returns true.
bool checkGlobalEnd() const;
// Looks for case/multiSolver/solverDomain/initial/0. Fail if missing.
void checkTimeDirectories() const;
// Creates a solverDomain's dictionary from a multiDict format:
// -Merges "default" if available
// -Merge "sameAs" or "multiLoad" dicts, recursively
// -Merges inputDict.subDict("solverDomainName") last
// outputDict - overwrites any existing entries
// inputDict - the "multiSolver" subdict
void buildDictionary
(
dictionary& outputDict,
const dictionary& inputDict,
const word& solverDomainName
);
// Change all catalogued multiDicts to another solverDomain
void swapDictionaries(const word& solverDomainName);
// When setting up for a different solverDomain, the boundary
// conditions are allowed to change. This function copies all valid
// case/intoSolverDomain/inital/0 files, and overwrites the
@ -167,9 +186,9 @@ class multiSolver
// Rereads modified dictionaries and sets the controls
void readIfModified();
// Converts a fileName with the naming convention:
// solverDomain@superLoop@globalOffset@fileName
// solverDomain@superLoop@globalOffset@globalIndex@fileName
// to a timeCluster
timeCluster parseConditionedFile
(
@ -196,7 +215,7 @@ public:
misLatestTimeInStartDomainInStartSuperLoop
};
//- Final stop at control options
//- Final stop at control options
enum finalStopAtControls
{
mfsEndTime,
@ -209,7 +228,7 @@ public:
};
// solverDomains enumerations
//- Time value start from control options
enum startFromControls
{
@ -218,7 +237,7 @@ public:
mtsLatestTimeThisDomain,
mtsLatestTimeAllDomains
};
//- Stop at control options
enum stopAtControls
{
@ -234,67 +253,71 @@ public:
protected:
// multiSolverControl data
label superLoop_;
word currentSolverDomain_;
static const NamedEnum<initialStartFromControls, 9>
initialStartFromControlsNames_;
initialStartFromControls initialStartFrom_;
scalar initialStartTime_;
word startDomain_;
label startSuperLoop_;
static const NamedEnum<finalStopAtControls, 7>
finalStopAtControlsNames_;
finalStopAtControls finalStopAt_;
word endDomain_;
scalar finalEndTime_;
label endSuperLoop_;
bool multiDictsRunTimeModifiable_;
scalar globalTimeOffset_;
//- Each solverDomain / superLoop combination is assigned a unique
// index that increments chronologically
label globalIndex_;
// solverDomains data
// This data is transient, changing between solver domains
static const NamedEnum<startFromControls, 4>
startFromControlsNames_;
startFromControls startFrom_;
scalar startTime_;
static const NamedEnum<stopAtControls, 7> stopAtControlsNames_;
stopAtControls stopAt_;
scalar endTime_;
label purgeWriteSuperLoops_;
scalar deltaT_;
label iterations_;
scalar elapsedTime_;
wordList storeFields_;
public:
TypeName("multiSolver");
//- The default multiSolver dictionary name
static word multiControlDictName;
/* Not implemented yet
//- Indicates whether the 'solverSignal' option for the finalStopAt setting
// in the multiControlDict is permitted. Default false. Set this to true
@ -311,7 +334,8 @@ public:
const fileName& rootPath,
const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant"
const word& constantName = "constant",
bool showSplash = true
);
//- Construct reading the multiControlDict from file
@ -321,7 +345,8 @@ public:
const fileName& rootPath,
const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant"
const word& constantName = "constant",
bool showSplash = true
);
@ -330,16 +355,20 @@ public:
// Member functions
// Access
// Database
//- Version number
word version() const;
// Database
inline const Time& multiDictRegistry() const;
inline const IOdictionary multiControlDict() const;
inline const IOdictionary& multiControlDict() const;
inline const wordList& prefixes() const;
// multiSolverControl data
inline const label& superLoop() const;
@ -347,7 +376,7 @@ public:
inline const word& currentSolverDomain() const;
inline const initialStartFromControls& initialStartFrom() const;
inline const word& startDomain() const;
inline const scalar& initialStartTime() const;
@ -355,39 +384,43 @@ public:
inline const finalStopAtControls& finalStopAt() const;
inline const word& endDomain() const;
inline const scalar& finalEndTime() const;
inline const label& startSuperLoop() const;
inline const label& endSuperLoop() const;
inline const bool& multiDictsRunTimeModifiable() const;
inline const scalar& globalTimeOffset() const;
// Write permission
inline scalar& globalTimeOffset();
inline const label& globalIndex() const;
// solverDomains data
inline const startFromControls& startFrom() const;
inline const stopAtControls& stopAt() const;
inline const scalar& startTime() const;
inline const scalar& endTime() const;
inline scalar& endTime();
inline const label& iterations() const;
inline const scalar& elapsedTime() const;
inline const wordList& storeFields() const;
inline const label& purgeWriteSuperLoops() const;
inline const scalar& deltaT() const;
inline scalar& deltaT();
// Solver (and pre/post-processor) interface functions
@ -398,6 +431,11 @@ public:
// reconstructPar
void postCondition(const word& processor = word::null);
// Return the source data that multiControlDict currently points to
// Returns "default" solverDomain if initial conditions are to be
// used and no solverDomain is set yet.
timeCluster initialDataSource() const;
// Switch to another solver domain
void setSolverDomain(const word& solverDomainName);
@ -407,6 +445,9 @@ public:
// Stop the run at the next setSolverDomain
inline void setFinished();
// Archive the last set of data into case/multiSolver
void finalize();
// Increment the superLoop (prefix)
multiSolver& operator++();
@ -421,7 +462,7 @@ public:
//- Return true if end of run
bool end() const;
// Time functions
// The multiSolver time directory structure should have the form:
@ -431,22 +472,22 @@ public:
// | |-initial {initial directory, superLoop -1}
// | |-0 {superLoop}
// | |-1 {superLoop}
// | | '-multiSolverTime {auto-generated dictionary}
// | | |-multiSolverTime {auto-generated file}
// | | '-0.01, etc.. {time directories}
// | '-2, etc..
// |-prefix2, etc..
//
// *** All time functions are located in ***
// *** multiSolverTimeFunctions.C ***
// Create a list of all superLoops in a directory, (usually in
// case/prefix). Only looks for integer directory names, does not
// check for valid time subdirectories.
// *** Located in multiSolverTimeFunctions.C ***
static labelList findSuperLoops(const fileName& path);
// Find the closest global time to a given value in a
// timeClusterList. Assumes timeClusters do not overlap global time
// values (as they shouldn't). If exact is true, this function
// throws a FatalError when no exact match is found.
// *** Located in multiSolverTimeFunctions.C ***
static timeCluster findClosestGlobalTime
(
const scalar value,
@ -459,6 +500,7 @@ public:
// If overlaps exist, it uses only the latest superloop. If exact
// is true, this function throws a FatalError when no exact match
// is found.
// *** Located in multiSolverTimeFunctions.C ***
static timeCluster findClosestLocalTime
(
const scalar value,
@ -467,18 +509,37 @@ public:
);
// Find the latest global time
// *** Located in multiSolverTimeFunctions.C ***
static timeCluster findLatestGlobalTime
(
const timeClusterList& tcl
);
// Find the latest global time
// *** Located in multiSolverTimeFunctions.C ***
static timeCluster findLatestLocalTime
(
const timeClusterList& tcl
);
// Find the timeCluster with the given globalIndex. Returns an
// empty timeCluster if not found.
// *** Located in multiSolverTimeFunctions.C ***
static timeCluster findGlobalIndex
(
const label& index,
const timeClusterList& tcl
);
// Adds all earlier times in the same superLoop directory to the
// time cluster
void includePreviousTimes
(
timeCluster& tc
) const;
// Find the path to a specific entry in a time cluster
// *** Located in multiSolverTimeFunctions.C ***
fileName findInstancePath
(
const timeCluster& tc,
@ -486,15 +547,21 @@ public:
) const;
// Find the largest superLoop
// *** Located in multiSolverTimeFunctions.C ***
static label findMaxSuperLoopValue(const timeClusterList& tcl);
// Find the timeClusterList index for the timeClusterList that has
// the largest superLoop
static labelList findMaxSuperLoopIndices(const timeClusterList& tcl);
// *** Located in multiSolverTimeFunctions.C ***
static labelList findMaxSuperLoopIndices
(
const timeClusterList& tcl
);
// Checks if any of the time ranges overlap one another in a
// timeClusterList. (If startTime = previous end, this is okay.)
// True means they do not overlap.
// *** Located in multiSolverTimeFunctions.C ***
static bool nonOverlapping
(
const timeClusterList& tcl,
@ -503,15 +570,17 @@ public:
// Maps the time directories in a single superLoop directory
// Include a processor name, and it uses the processorN directory
// *** Located in multiSolverTimeFunctions.C ***
timeCluster readSuperLoopTimes
(
const word& solverDomain,
const label superLoop,
const word& processor = word::null
) const;
// Maps the time directories in a single solverDomain
// Include a processor name, and it uses the processorN directory
// *** Located in multiSolverTimeFunctions.C ***
timeClusterList readSolverDomainTimes
(
const word& solverDomain,
@ -521,6 +590,7 @@ public:
// Create a snapshot of all the multiSolver time directories
// Give it a processor name, and it searches instead in the
// processor directory
// *** Located in multiSolverTimeFunctions.C ***
timeClusterList readAllTimes
(
const word processor = word::null
@ -531,14 +601,16 @@ public:
// time values overlap when forced to useGlobalTime.
// loadStoreFields will copy storeFields into every time folder
// even though they do not change.
// *** Located in multiSolverTimeFunctions.C ***
bool loadTimeClusterList
(
const timeClusterList& tcl,
const bool useGlobalTime = true,
const bool loadStoreFields = true
) const;
);
// Move all the time directories from sourcePath to archivePath
// *** Located in multiSolverTimeFunctions.C ***
static void archiveTimeDirs
(
const fileName& sourcePath,
@ -547,6 +619,7 @@ public:
);
// Delete all time directories in path, do not delete "constant"
// *** Located in multiSolverTimeFunctions.C ***
static void purgeTimeDirs(const fileName& path);
};
@ -559,4 +632,8 @@ public:
#include "multiSolverI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -36,12 +36,18 @@ inline const Time& multiSolver::multiDictRegistry() const
}
inline const IOdictionary multiSolver::multiControlDict() const
inline const IOdictionary& multiSolver::multiControlDict() const
{
return multiControlDict_;
}
inline const wordList& multiSolver::prefixes() const
{
return prefixes_;
}
inline const label& multiSolver::superLoop() const
{
return superLoop_;
@ -54,7 +60,8 @@ inline const word& multiSolver::currentSolverDomain() const
}
inline const multiSolver::initialStartFromControls& multiSolver::initialStartFrom() const
inline const multiSolver::initialStartFromControls&
multiSolver::initialStartFrom() const
{
return initialStartFrom_;
}
@ -120,6 +127,12 @@ inline scalar& multiSolver::globalTimeOffset()
}
inline const label& multiSolver::globalIndex() const
{
return globalIndex_;
}
inline const multiSolver::startFromControls& multiSolver::startFrom() const
{
return startFrom_;
@ -135,13 +148,19 @@ inline const scalar& multiSolver::startTime() const
{
return startTime_;
}
inline const scalar& multiSolver::endTime() const
{
return endTime_;
}
inline scalar& multiSolver::endTime()
{
return endTime_;
}
inline const label& multiSolver::iterations() const
{
return iterations_;
@ -172,9 +191,15 @@ inline const scalar& multiSolver::deltaT() const
}
inline scalar& multiSolver::deltaT()
{
return deltaT_;
}
void Foam::multiSolver::setFinished()
{
finished_ = true;
forcedEnd_ = true;
}
} // End namespace Foam

View file

@ -1,34 +1,34 @@
// Common elements in the constructor initialization list for multiSolver
// Quenching compiler warning
// HR, 18/Jul/2013
multiDicts_(0),
multiSolverControl_(multiControlDict_.subDict("multiSolverControl")),
solverDomains_(multiControlDict_.subDict("solverDomains")),
currentSolverDomainDict_(),
prefixes_(solverDomains_.toc()),
finished_(false),
initialized_(false),
forcedEnd_(false),
noSaveSinceSuperLoopIncrement_(false),
manageLocalRoot_(false),
superLoop_(0),
currentSolverDomain_("default"),
initialStartFrom_(misLatestTime),
// startDomain_,
initialStartTime_(0),
startDomain_("default"),
startSuperLoop_(0),
finalStopAt_(mfsEndTime),
// endDomain_,
finalEndTime_(0),
endSuperLoop_(0),
multiDictsRunTimeModifiable_(true),
globalTimeOffset_(0),
globalIndex_(0),
purgeWriteSuperLoops_(prefixes_.size()),
// timeValueStartFrom_,

View file

@ -38,7 +38,7 @@ void Foam::multiSolver::setMultiSolverControls()
multiSolverControl_.lookup("initialStartFrom")
);
}
if (multiSolverControl_.found("startTime"))
{
initialStartTime_ = readScalar(multiSolverControl_.lookup("startTime"));
@ -72,7 +72,7 @@ void Foam::multiSolver::setMultiSolverControls()
{
startDomain_ = word(multiSolverControl_.lookup("startDomain"));
}
else if
else if
(
(initialStartFrom_ == misFirstTimeInStartDomain)
|| (initialStartFrom_ == misFirstTimeInStartDomainInStartSuperLoop)
@ -93,7 +93,7 @@ void Foam::multiSolver::setMultiSolverControls()
<< "'latestTimeInStartDomainInStartSuperLoop'."
<< abort(FatalError);
}
finalStopAt_ = mfsEndTime;
if (multiSolverControl_.found("finalStopAt"))
{
@ -102,7 +102,7 @@ void Foam::multiSolver::setMultiSolverControls()
multiSolverControl_.lookup("finalStopAt")
);
}
if (multiSolverControl_.found("endDomain"))
{
endDomain_ = word(multiSolverControl_.lookup("endDomain"));
@ -160,10 +160,10 @@ void Foam::multiSolver::setMultiSolverControls()
<< "'latestTimeInStartDomainInStartSuperLoop'."
<< abort(FatalError);
}
if (multiSolverControl_.found("endSuperLoop"))
{
endSuperLoop_ =
endSuperLoop_ =
readLabel(multiSolverControl_.lookup("endSuperLoop"));
}
else if
@ -200,7 +200,7 @@ void Foam::multiSolver::setMultiSolverControls()
<< "other than 'default'."
<< abort(FatalError);
}
dictionary solverDomainsDefault
(
solverDomains_.found("default")
@ -213,11 +213,12 @@ void Foam::multiSolver::setMultiSolverControls()
void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
{
currentSolverDomainDict_.clear();
if (solverDomains_.found("default"))
{
currentSolverDomainDict_.merge(solverDomains_.subDict("default"));
}
currentSolverDomainDict_.merge(solverDomains_.subDict(solverDomainName));
buildDictionary
(
currentSolverDomainDict_,
solverDomains_,
solverDomainName
);
startFrom_ = mtsLatestTimeAllDomains;
if (currentSolverDomainDict_.found("startFrom"))
@ -234,7 +235,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
if (startTime_ < 0)
{
FatalErrorIn("multiSolver::setSolverDomainControls")
<< "'startTime' in multiControlDict/solverDomains/"
<< "'startTime' in multiControlDict/solverDomains/"
<< solverDomainName << " cannot be negative."
<< abort(FatalError);
}
@ -247,7 +248,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
<< "is set to 'startTime'."
<< abort(FatalError);
}
stopAt_ = msaEndTime;
if (currentSolverDomainDict_.found("stopAt"))
{
@ -271,7 +272,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
<< abort(FatalError);
}
}
endTime_ = 0;
if (currentSolverDomainDict_.found("endTime"))
{
@ -293,7 +294,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
<< "when stopAt is set to iterations."
<< abort(FatalError);
}
if (currentSolverDomainDict_.found("elapsedTime"))
{
elapsedTime_ = readScalar(currentSolverDomainDict_.lookup("elapsedTime"));
@ -314,7 +315,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
currentSolverDomainDict_.lookup("storeFields")
);
}
purgeWriteSuperLoops_ = 0;
if (currentSolverDomainDict_.found("purgeWriteSuperLoops"))
{
@ -323,7 +324,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
currentSolverDomainDict_.lookup("purgeWriteSuperLoops")
);
}
if (currentSolverDomainDict_.found("deltaT"))
{
deltaT_ = readScalar
@ -338,7 +339,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
<< solverDomainName << "' or 'default'. deltaT is required."
<< abort(FatalError);
}
if
(
currentSolverDomainDict_.found("timeFormat")
@ -354,6 +355,4 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -43,6 +43,17 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
// Purge all time directories from case directory root
purgeTimeDirs(multiDictRegistry_.path());
// Purge any constant/superLoopData/
fileName superLoopDataPath
(
multiDictRegistry_.path()/multiDictRegistry_.constant()
/"superLoopData"
);
if (exists(superLoopDataPath))
{
rmDir(superLoopDataPath);
}
// Read initial settings and determine data source (from which path the
// initial data is copied, the starting superLoop_, and the current
@ -59,100 +70,26 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
// subdictionary.
// 4. endTime is determined by the solverDomains subdictionary
// a. unless the finalStopAt trumps it
timeCluster tcSource;
switch (initialStartFrom_)
{
case misFirstTime:
tcSource = findClosestGlobalTime
(
0, readSuperLoopTimes(currentSolverDomain_, -1)
);
break;
case misFirstTimeInStartDomain:
tcSource = findClosestGlobalTime
(
0, readSuperLoopTimes(startDomain_, -1)
);
break;
case misFirstTimeInStartDomainInStartSuperLoop:
tcSource = findClosestGlobalTime
(
0, readSuperLoopTimes(startDomain_, startSuperLoop_)
);
break;
case misStartTime:
if (initialStartTime_ == 0)
{
tcSource = findClosestGlobalTime
(
initialStartTime_,
readSuperLoopTimes(currentSolverDomain_, -1)
);
}
else
{
tcSource = findClosestGlobalTime
(
initialStartTime_, readAllTimes()
);
}
break;
case misStartTimeInStartDomain:
tcSource = findClosestLocalTime
(
initialStartTime_, readSolverDomainTimes(startDomain_)
);
break;
case misStartTimeInStartDomainInStartSuperLoop:
tcSource = findClosestLocalTime
(
initialStartTime_,
readSuperLoopTimes(startDomain_, startSuperLoop_)
);
break;
case misLatestTime:
tcSource = findLatestGlobalTime(readAllTimes());
break;
case misLatestTimeInStartDomain:
tcSource = findLatestLocalTime(readSolverDomainTimes(startDomain_));
break;
case misLatestTimeInStartDomainInStartSuperLoop:
tcSource = findLatestLocalTime
(
readSuperLoopTimes(startDomain_, startSuperLoop_)
);
break;
}
if (!tcSource.times().size())
{
// No relevant data found, set to initial conditions
tcSource = timeCluster
(
Time::findTimes
(
multiDictRegistry_.path()/"multiSolver"/currentSolverDomain_
/"initial"
),
0,
-1, // superLoop of -1 signifies "initial" directory
currentSolverDomain_
);
}
// Find initial data source
timeCluster tcSource(initialDataSource());
fileName sourcePath(findInstancePath(tcSource, 0));
fileName sourcePath(findInstancePath(tcSource, tcSource.size() - 1));
superLoop_ = tcSource.superLoop();
globalIndex_ = tcSource.globalIndex();
// If starting from initial conditions, superLoop_ = -1
if (superLoop_ < 0) superLoop_ = 0;
scalar globalTime(tcSource.globalValue(0));
scalar localStartTime(tcSource.localValue(0));
scalar globalTime(tcSource.globalValue(tcSource.size() - 1));
scalar localStartTime(tcSource.localValue(tcSource.size() -1));
// Now to apply the exceptions if currentSolverDomain_ != data source
// solverDomain (see long comment above).
if (sourcePath.path().path().name() != currentSolverDomain_)
{
superLoop_++;
globalIndex_++;
switch (startFrom_)
{
case mtsFirstTime:
@ -182,13 +119,18 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
startTime_ = localStartTime;
globalTimeOffset_ = globalTime - startTime_;
// Give multiDictRegistry a time value (required for regIOobject::write()
// to case/[timeValue]
multiDictRegistry_.setTime(startTime_, 0);
// Copy the source data to case/[localTime]
cp(sourcePath, multiDictRegistry_.path());
// Copy the source data and any previous time directories to
// case/[localTime]
forAll(tcSource, i)
{
fileName copyMe(findInstancePath(tcSource, i));
cp(copyMe, multiDictRegistry_.path());
}
mv
(
multiDictRegistry_.path()/sourcePath.name(),
@ -222,7 +164,7 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
),
currentSolverDomainDict_
);
// Remove multiSolver-specific values from dictionary
newControlDict.remove("startFrom");
newControlDict.remove("startTime");
@ -234,8 +176,31 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
newControlDict.remove("timePrecision");
newControlDict.remove("storeFields");
newControlDict.remove("elapsedTime");
// Add values to obtain the desired behaviour
// Start with timePrecision, it may affect writePrecision, which affects
// all other settings
if (multiSolverControl_.found("timePrecision"))
{
unsigned int newPrecision
(
readUint(multiSolverControl_.lookup("timePrecision"))
);
// Increase writePrecision if less than timePrecision, otherwise
// resuming a run will fail
if (IOstream::defaultPrecision() < (newPrecision + 1))
{
IOstream::defaultPrecision(newPrecision + 1);
}
newControlDict.set
(
"timePrecision",
newPrecision
);
}
newControlDict.set("startFrom", "startTime");
newControlDict.set("startTime", startTime_);
newControlDict.set("stopAt", stopAtSetting);
@ -248,18 +213,20 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
word(multiSolverControl_.lookup("timeFormat"))
);
}
if (multiSolverControl_.found("timePrecision"))
{
newControlDict.set
(
"timePrecision",
readScalar(multiSolverControl_.lookup("timePrecision"))
);
}
// Write the dictionary to the case directory
newControlDict.regIOobject::write();
// Copy files in the superLoop/superLoopData directory of tcSource to
// constant/superLoopData
cp
(
sourcePath.path()/"superLoopData",
multiDictRegistry_.path()/multiDictRegistry_.constant()
);
swapDictionaries(currentSolverDomain_);
initialized_ = true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -77,13 +77,16 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
)
);
multiSolverTime.set("globalOffset", globalTimeOffset_);
multiSolverTime.set("globalIndex", globalIndex_);
globalIndex_++;
// Write multiSolverTime to the case/constant directory, then move to
// archivePath
multiSolverTime.regIOobject::write();
mv(multiDictRegistry_.constantPath()/"multiSolverTime", archivePath);
// tcSource is where the latest data has been moved to
// tcSource is to where the latest data has been moved
timeCluster tcSource
(
findLatestLocalTime
@ -128,7 +131,7 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
localStartTime = globalTime;
break;
}
startTime_ = localStartTime;
globalTimeOffset_ = globalTime - startTime_;
@ -138,7 +141,7 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
word stopAtSetting("endTime");
if (!finished_)
if (!checkGlobalEnd())
{
// Copy the source data to case/[localTime]
cp(sourcePath, multiDictRegistry_.path());
@ -168,14 +171,14 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
0
)
);
forAll (previousStoreFields, i)
{
// Copy the stored fields to case/[localTime].
if (exists(storedSourcePath/previousStoreFields[i]))
{
fileName storedSource(storedSourcePath/previousStoreFields[i]);
cp
(
storedSource,
@ -190,15 +193,15 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
<< previousStoreFields[i] << " from "
<< previousSolverDomain << " to "
<< currentSolverDomain_ << " in superLoop "
<< saveToSuperLoop << ". File not found. This may occur "
<< "if " << previousSolverDomain << " is the first "
<< "solverDomain to be initialized, and you did not put "
<< "the stored fields into its 0/0 directory."
<< saveToSuperLoop << ". File not found. This may "
<< "occur if " << previousSolverDomain << " is the "
<< "first solverDomain to be initialized, and you did "
<< "not put the stored fields into its 0/0 directory."
<< abort(FatalError);
}
}
}
}
swapBoundaryConditions
(
multiDictRegistry_.path()/Time::timeName(startTime_),
@ -207,8 +210,26 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
// Determine localEndTime and stopAtSetting
stopAtSetting = setLocalEndTime();
// This is the new solverDomain's archive path
fileName nextArchivePath
(
multiDictRegistry_.path()/"multiSolver"/solverDomainName/name
(
superLoop_
)
);
// Copy constant/superLoopData to multiSolver/solverDomainName/superLoop/
// of the new solver domain.
cp
(
multiDictRegistry_.path()/multiDictRegistry_.constant()
/"superLoopData",
nextArchivePath
);
}
else //finished_
else // global end
{
stopAtSetting = "noWriteNow";
}
@ -227,7 +248,7 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
),
currentSolverDomainDict_
);
// Remove multiSolver-specific values from dictionary
newControlDict.remove("startFrom");
newControlDict.remove("startTime");
@ -239,28 +260,27 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
newControlDict.remove("timePrecision");
newControlDict.remove("storeFields");
newControlDict.remove("elapsedTime");
// Add values to obtain the desired behaviour
newControlDict.set("startFrom", "startTime");
newControlDict.set("startTime", startTime_);
newControlDict.set("stopAt", stopAtSetting);
newControlDict.set("endTime", endTime_);
if (multiSolverControl_.found("timeFormat"))
switch (multiDictRegistry_.format())
{
newControlDict.set
(
"timeFormat",
word(multiSolverControl_.lookup("timeFormat"))
);
}
if (multiSolverControl_.found("timePrecision"))
{
newControlDict.set
(
"timePrecision",
readScalar(multiSolverControl_.lookup("timePrecision"))
);
case Time::general:
newControlDict.set("timeFormat", "general");
break;
case Time::fixed:
newControlDict.set("timeFormat", "fixed");
break;
case Time::scientific:
newControlDict.set("timeFormat", "scientific");
break;
default:
break;
}
newControlDict.set("timePrecision", multiDictRegistry_.precision());
// Write the dictionary to the case directory
newControlDict.regIOobject::write();
@ -275,3 +295,4 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -34,7 +34,7 @@ Foam::labelList Foam::multiSolver::findSuperLoops(const fileName& path)
labelList superLoopList(dirEntries.size());
label nSuperLoops(0);
// Loop through dirEntries, checking for valid integers, sort entries
forAll(dirEntries, de)
{
@ -47,7 +47,7 @@ Foam::labelList Foam::multiSolver::findSuperLoops(const fileName& path)
IStringStream superLoopStream(dirEntries[de]);
token superLoopToken(superLoopStream);
// Check if directory is an integer
if (superLoopToken.isLabel() && superLoopStream.eof())
{
@ -72,7 +72,7 @@ Foam::timeCluster Foam::multiSolver::findClosestGlobalTime
label underShoot(-1);
label best(-1);
label initial(-1);
// Find closest global minimum that does not exceed value
forAll(tcl, i)
{
@ -117,7 +117,7 @@ Foam::timeCluster Foam::multiSolver::findClosestGlobalTime
}
else
{
FatalErrorIn("multiSolver::findClosestGlobalTime")
<< "The timeClusterList passed to this function has no non-"
<< "empty instantLists. Use timeClusterList::purgeEmpties "
@ -125,7 +125,7 @@ Foam::timeCluster Foam::multiSolver::findClosestGlobalTime
<< abort(FatalError);
}
}
label timeIndex
(
Time::findClosestTimeIndex
@ -133,7 +133,7 @@ Foam::timeCluster Foam::multiSolver::findClosestGlobalTime
tcl[best].times(), value - tcl[best].globalOffset()
)
);
if (exact && (maxDiff < -VSMALL))
{
FatalErrorIn("multiSolver::findClosestGlobalTime")
@ -169,7 +169,7 @@ Foam::timeCluster Foam::multiSolver::findClosestLocalTime
tclDummy = tcl.selectiveSubList(findMaxSuperLoopIndices(tcl));
tclPtr = & tclDummy;
}
for (label i = 0; i < tclPtr->size(); i++)
{
if (!tclPtr->operator[](i).times().size()) continue;
@ -205,7 +205,7 @@ Foam::timeCluster Foam::multiSolver::findClosestLocalTime
// "initial" directory is the only match
best = initial;
}
if (best == -1)
{
if (minDiff != -1)
@ -215,7 +215,7 @@ Foam::timeCluster Foam::multiSolver::findClosestLocalTime
}
else
{
FatalErrorIn("multiSolver::findClosestLocalTime")
<< "The timeClusterList passed to this function has no non-"
<< "empty instantLists. Use timeClusterList::purgeEmpties "
@ -223,7 +223,7 @@ Foam::timeCluster Foam::multiSolver::findClosestLocalTime
<< abort(FatalError);
}
}
label timeIndex
(
Time::findClosestTimeIndex
@ -251,13 +251,13 @@ Foam::timeCluster Foam::multiSolver::findLatestGlobalTime
timeCluster bestMax(0);
timeCluster currentMax;
forAll(tcl, i)
{
if (tcl[i].times().size() == 0) continue;
currentMax = tcl[i](tcl[i].globalMaxIndex());
if
if
(
(currentMax.globalValue(0) > bestMax.globalValue(0))
|| (
@ -306,7 +306,7 @@ Foam::timeCluster Foam::multiSolver::findLatestLocalTime
{
if (tclPtr->operator[](i).times().size() == 0) continue;
currentMax =
currentMax =
tclPtr->operator[](i)(tclPtr->operator[](i).localMaxIndex());
if
@ -330,11 +330,59 @@ Foam::timeCluster Foam::multiSolver::findLatestLocalTime
<< " return value to prevent this."
<< abort(FatalError);
}
return bestMax;
}
Foam::timeCluster Foam::multiSolver::findGlobalIndex
(
const label& index,
const timeClusterList& tcl
)
{
forAll(tcl, i)
{
if (tcl[i].globalIndex() == index)
{
return tcl[i];
}
}
return timeCluster();
}
void Foam::multiSolver::includePreviousTimes
(
timeCluster& tc
) const
{
scalar minTime(VGREAT);
forAll(tc, i)
{
minTime = min(tc[i].value(), minTime);
}
if (minTime != VGREAT)
{
fileName thePath(findInstancePath(tc, 0).path());
instantList il(Time::findTimes(thePath));
forAll(il, i)
{
if (il[i].value() < minTime)
{
label newIndex(tc.size());
tc.setSize(newIndex + 1);
tc[newIndex] = il[i];
}
}
if (tc.size() > 1)
{
std::sort(&tc[0], tc.end(), instant::less());
}
}
}
Foam::fileName Foam::multiSolver::findInstancePath
(
const timeCluster& tc,
@ -369,7 +417,8 @@ Foam::fileName Foam::multiSolver::findInstancePath
}
Foam::label Foam::multiSolver::findMaxSuperLoopValue(const timeClusterList& tcl)
Foam::label
Foam::multiSolver::findMaxSuperLoopValue(const timeClusterList& tcl)
{
if (!tcl.size())
{
@ -383,7 +432,8 @@ Foam::label Foam::multiSolver::findMaxSuperLoopValue(const timeClusterList& tcl)
}
Foam::labelList Foam::multiSolver::findMaxSuperLoopIndices(const timeClusterList& tcl)
Foam::labelList
Foam::multiSolver::findMaxSuperLoopIndices(const timeClusterList& tcl)
{
label currentMax(-2);
labelList bestIndices(0);
@ -507,9 +557,10 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes
currentPath/"multiSolverTime"
);
IFstream mstFile(mstFileName);
bool mstFileGood(false);
scalar globalOffset(0);
label globalIndex(0);
if (mstFile.good())
{
@ -518,6 +569,8 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes
{
globalOffset =
readScalar(mstDict.lookup("globalOffset"));
globalIndex =
readLabel(mstDict.lookup("globalIndex"));
mstFileGood = true;
}
}
@ -534,6 +587,7 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes
(
Time::findTimes(currentPath),
globalOffset,
globalIndex,
superLoop,
solverDomain
);
@ -549,7 +603,7 @@ Foam::timeClusterList Foam::multiSolver::readSolverDomainTimes
{
timeClusterList tcl(0);
label nTimeClusters(0);
fileName locale;
if (processor.size())
{
@ -563,9 +617,9 @@ Foam::timeClusterList Foam::multiSolver::readSolverDomainTimes
(
multiDictRegistry_.path()/locale/solverDomain
);
labelList superLoopList(multiSolver::findSuperLoops(currentPath));
// Loop through superLoopList, check for valid data, store in tcl
forAll(superLoopList, sl)
{
@ -576,7 +630,7 @@ Foam::timeClusterList Foam::multiSolver::readSolverDomainTimes
// If there are no time directories, ignore this superLoop
if (tc.times().size() == 0) continue;
// Store timeCluster
tcl.setSize(++nTimeClusters);
tcl[nTimeClusters - 1] = tc;
@ -609,7 +663,7 @@ bool Foam::multiSolver::loadTimeClusterList
const Foam::timeClusterList& tcl,
const bool useGlobalTime,
const bool loadStoreFields
) const
)
{
if (!nonOverlapping(tcl, useGlobalTime)) return false;
@ -628,30 +682,28 @@ bool Foam::multiSolver::loadTimeClusterList
currentPath/il[Time::findClosestTimeIndex(il, -1.0)].name()
);
setSolverDomainPostProcessing(tcl[i].solverDomainName());
if
(
loadStoreFields
&& solverDomains_
.subDict(tcl[i].solverDomainName())
.found("storeFields")
&& currentSolverDomainDict_.found("storeFields")
)
{
storeFields = wordList(solverDomains_
.subDict(tcl[i].solverDomainName())
.lookup("storeFields"));
storeFields = wordList(currentSolverDomainDict_.lookup("storeFields"));
}
else
{
storeFields.clear();
}
forAll(tcl[i].times(), j)
{
fileName storeFieldsDestination
(
multiDictRegistry_.path()/tcl[i].times()[j].name()
);
cp
(
currentPath/tcl[i].times()[j].name(),
@ -664,7 +716,7 @@ bool Foam::multiSolver::loadTimeClusterList
(
tcl[i].globalValue(j)
);
mv
(
multiDictRegistry_.path()/tcl[i].times()[j].name(),
@ -719,14 +771,14 @@ void Foam::multiSolver::archiveTimeDirs
{
labelList allSL(findSuperLoops(archivePath.path()));
label currentSL(atoi(archivePath.name().c_str()));
sort(allSL);
label i = 0;
while (allSL[i] < currentSL)
{
i++;
}
for (label j = 1; j <= (i - purgeWrite); j++)
{
rmDir(archivePath.path()/name(allSL[j]));
@ -753,6 +805,4 @@ void Foam::multiSolver::purgeTimeDirs(const Foam::fileName& path)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "multiTime.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(multiTime, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::multiTime::multiTime
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const word& systemName,
const word& constantName
)
:
Time
(
name,
rootPath,
caseName,
systemName,
constantName
)
{}
Foam::multiTime::multiTime
(
const dictionary& dict,
const fileName& rootPath,
const fileName& caseName,
const word& systemName,
const word& constantName
)
:
Time
(
dict,
rootPath,
caseName,
systemName,
constantName
)
{}
Foam::multiTime::multiTime
(
const fileName& rootPath,
const fileName& caseName,
const word& systemName,
const word& constantName
)
:
Time
(
rootPath,
caseName,
systemName,
constantName
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::multiTime::~multiTime()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::multiTime
Description
Gives read access to time directory format and precision.
SourceFiles
multiTime.C
Author
David L. F. Gaden
\*---------------------------------------------------------------------------*/
#ifndef multiTime_H
#define multiTime_H
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiTime Declaration
\*---------------------------------------------------------------------------*/
class multiTime
:
public Time
{
public:
TypeName("multiTime");
// Constructors
//- Construct given name, rootPath and casePath
multiTime
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant"
);
//- Construct given dictionary, rootPath and casePath
multiTime
(
const dictionary& dict,
const fileName& rootPath,
const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant"
);
//- Construct given endTime, rootPath and casePath
multiTime
(
const fileName& rootPath,
const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant"
);
// Destructor
virtual ~multiTime();
// Member functions
// Access
//- Time directory precision
inline const int& precision() const
{
return Time::precision_;
}
//- Time directory format
inline const Time::fmtflags& format() const
{
return Time::format_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -41,6 +41,7 @@ Foam::timeCluster::timeCluster
(
const instantList& times,
const scalar globalOffset,
const label globalIndex,
const label superLoop,
const word& solverDomainName,
const word& preConName
@ -48,6 +49,7 @@ Foam::timeCluster::timeCluster
:
instantList(times),
globalOffset_(globalOffset),
globalIndex_(globalIndex),
superLoop_(superLoop),
solverDomainName_(solverDomainName),
preConName_(preConName)
@ -61,6 +63,7 @@ Foam::timeCluster::timeCluster
:
instantList(1, tc[index]),
globalOffset_(tc.globalOffset_),
globalIndex_(tc.globalIndex_),
superLoop_(tc.superLoop_),
solverDomainName_(tc.solverDomainName_),
preConName_(tc.preConName_)
@ -71,6 +74,7 @@ Foam::timeCluster::timeCluster(const Foam::scalar t)
:
instantList(1, instant(0)),
globalOffset_(0),
globalIndex_(0),
superLoop_(0),
solverDomainName_(word::null),
preConName_(word::null)
@ -223,6 +227,7 @@ Foam::timeCluster Foam::timeCluster::operator()(const Foam::label index) const
Foam::Istream& Foam::operator>>(Istream& is, timeCluster& I)
{
return is >> I.globalOffset_
>> I.globalIndex_
>> I.superLoop_
>> I.solverDomainName_
>> I.preConName_
@ -233,11 +238,11 @@ Foam::Istream& Foam::operator>>(Istream& is, timeCluster& I)
Foam::Ostream& Foam::operator<<(Ostream& os, const timeCluster& I)
{
return os << "/* globalOffset: */\t" << I.globalOffset_ << nl
<< "/* globalIndex: */\t" << I.globalIndex_ << nl
<< "/* superLoop: */\t" << I.superLoop_ << nl
<< "/* solverDomain: */\t" << I.solverDomainName_ << nl
<< "/* preConName: */\t" << I.preConName_ << nl
<< "/* Instant list: */\t" << I.times();
}
// ************************************************************************* //

View file

@ -72,9 +72,10 @@ class timeCluster
// Private data
scalar globalOffset_;
label globalIndex_;
label superLoop_;
word solverDomainName_;
// PreConditioned file name - used only for pre and post conditioning
// a data set for parallel runs
word preConName_;
@ -110,6 +111,7 @@ public:
(
const instantList& times,
const scalar globalOffset,
const label globalIndex,
const label superLoop,
const word& solverDomainName,
const word& preConName = word::null
@ -123,7 +125,7 @@ public:
const timeCluster& tc,
const label index
);
//- Construct a time cluster given a scalar value. This constructs
// a timeCluster with a single instant of time at value t, and whose
// other values are zero or empty.
@ -143,6 +145,11 @@ public:
inline scalar& globalOffset();
//- Global index
inline label globalIndex() const;
inline label& globalIndex();
//- SuperLoop
inline label superLoop() const;
@ -159,43 +166,43 @@ public:
inline word& preConName();
// Derived values
//- Global value at index
scalar globalValue(const label& index) const;
//- Search for and return global min value. If empty,
// returns VGREAT.
scalar globalMinValue() const;
//- Search for and return global max value. If empty,
// returns 0.
scalar globalMaxValue() const;
//- Search for and return index of global min value
label globalMinIndex() const;
//- Search for and return index of global max value
label globalMaxIndex() const;
//- Global closest time
scalar globalFindClosestTimeValue(const scalar) const;
//- Global closest time index
label globalFindClosestTimeIndex(const scalar) const;
//- Local value at index
scalar localValue(const label& index) const;
//- Search for and return local min value
scalar localMinValue() const;
//- Search for and return local max value
scalar localMaxValue() const;
//- Search for and return index of global min value. If empty,
// returns VGREAT
label localMinIndex() const;
//- Search for and return index of global max value. If empty,
// returns 0.
label localMaxIndex() const;
@ -205,9 +212,9 @@ public:
//-Local closest time index
label localFindClosestTimeIndex(const scalar) const;
// Operators
//- Chip off a single instant given an index, return as timeCluster
// This retains superLoop, solverDomain, etc.. with a timevalue
timeCluster operator()(const label index) const;
@ -228,6 +235,8 @@ public:
#include "timeClusterI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -52,6 +52,16 @@ inline scalar& timeCluster::globalOffset()
return globalOffset_;
}
inline label timeCluster::globalIndex() const
{
return globalIndex_;
}
inline label& timeCluster::globalIndex()
{
return globalIndex_;
}
inline label timeCluster::superLoop() const
{
return superLoop_;

View file

@ -85,7 +85,7 @@ void Foam::timeClusterList::append(const timeClusterList& tclIn)
{
label wasSize = this->size();
this->setSize(tclIn.size() + this->size());
for (label i = 0; i < tclIn.size(); i++)
{
this->operator[](i + wasSize) = tclIn[i];
@ -97,7 +97,7 @@ void Foam::timeClusterList::append(const timeCluster& tcIn)
{
label wasSize = this->size();
this->setSize(this->size() + 1);
this->operator[](wasSize) = tcIn;
}
@ -105,7 +105,7 @@ void Foam::timeClusterList::append(const timeCluster& tcIn)
bool Foam::timeClusterList::purgeEmpties()
{
if (!this->size()) return false;
label empties(0);
for (label i = 0; i < this->size(); i++)
{
@ -133,7 +133,7 @@ Foam::timeClusterList Foam::timeClusterList::selectiveSubList
) const
{
timeClusterList tcl(indices.size());
forAll(indices, i)
{
if (indices[i] > this->size())
@ -151,6 +151,4 @@ Foam::timeClusterList Foam::timeClusterList::selectiveSubList
return tcl;
}
// ************************************************************************* //

View file

@ -60,7 +60,7 @@ public:
static const char* const typeName;
// Constructors
//- Null constructor
timeClusterList();
@ -72,7 +72,7 @@ public:
//- Construct with given size and value for all elements.
timeClusterList(const label, const timeCluster&);
//- Construct as a sublist of another timeClusterList. This is not
// like the SubList in that this is not a new class, rather it is only
// producing a new copy that contains the specified entries.
@ -82,7 +82,7 @@ public:
timeClusterList(Istream&);
// Member functions
//- Sort by global time
void globalSort();
@ -91,7 +91,7 @@ public:
//- Append a timeCluster on the end of this list
void append(const timeCluster& tcIn);
//- Remove timeClusters with empty instantLists return false if all are
// empty
bool purgeEmpties();

View file

@ -0,0 +1,73 @@
|---------------------.
| David L. F. Gaden's |
.----------------|---------------------'
| multiSolver | Version: 0.6.0
'----------------|
| If you use, please cite:
V
* D. L. F. Gaden, and E. L. Bibeau (2012), "A programmable logic controller
emulator with automatic algorithm-switching for computational fluid dynamics
using OpenFOAM," Proceedings of the 2012 CSME International Congress, Paper
number 156959763, June 4-6, Winnipeg, MB.
Description
===========
An extension to OpenFOAM that allows you to run multiple solvers in sequence on
the same dataset.
Original Author
===============
David L. F. Gaden (dlfgaden@gmail.com)
Current Maintainer
==================
David L. F. Gaden (dlfgaden@gmail.com)
Contributors
============
David L. F. Gaden : base version
Documentation
=============
github.com/Marupio/multiSolver/wiki
Installation/Compilation
========================
See documentation.
Contents
========
- src - the library source files
- applications\solvers - a demo application that uses multiSolver
- applications\utilities - a data handling utility
- tutorials - a sample case that runs the demo application
Required OpenFOAM-Version (Known to work with)
==============================================
1.6-ext
2.0.x
2.1.x
2.2.x
History
=======
2010-07-23: Initial import
2011-03-29: Minor bug fix for 1.6-ext and 1.7.1
2011-04-05:
* Major upgrade
* Now works for parallel simulations
2011-06-03:
* Minor bug fix:
* Parallel decomposing no longer omits the initial directory
2011-07-01: Overhauled documentation; no change to code
2012-10-25: Version 0.5.0
* Moved to git
* Enabled boundary switching
* Introduced version numbers to keep track of changes
2013-08-29: Version 0.6.0
* Uploaded to github and OpenFOAM-extend
* Restructured applications and tutorials directories for consistency
* Made opening splash optional

View file

@ -16,7 +16,7 @@ FoamFile
convertToMeters 0.1;
vertices
vertices
(
(0 0 0)
(1.5 0 0)
@ -42,7 +42,7 @@ vertices
);
blocks
blocks
(
hex (0 1 2 3 10 11 12 13) (20 20 1) simpleGrading (1 1 1)
hex (1 4 7 2 11 14 17 12) (20 20 1) simpleGrading (1 1 1)
@ -50,11 +50,11 @@ blocks
hex (2 7 9 8 12 17 19 18) (20 20 1) simpleGrading (1 1 1)
);
edges
edges
(
);
patches
patches
(
wall steetWalls
(
@ -83,7 +83,7 @@ patches
)
);
mergePatchPairs
mergePatchPairs
(
);

View file

@ -1,9 +1,9 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5-dev |
| \\ / A nd | Revision: exported |
| \\/ M anipulation | Web: http://www.OpenFOAM.org |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
@ -10,7 +10,8 @@ FoamFile
version 2.0;
format ascii;
class volScalarField;
object p;
location "-1";
object icoFoam1@-1@0@T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -36,7 +37,7 @@ boundaryField
{
type zeroGradient;
}
northBranch // inlet
northBranch
{
type fixedValue;
value uniform 1;
@ -47,4 +48,5 @@ boundaryField
}
}
// ************************************************************************* //

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
@ -10,7 +10,8 @@ FoamFile
version 2.0;
format ascii;
class volVectorField;
object U;
location "-1";
object icoFoam1@-1@0@U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -30,16 +31,16 @@ boundaryField
type fixedValue;
value uniform (0 0 0);
}
westStreet // closed
westStreet
{
type fixedValue;
value uniform (0 0 0);
}
eastStreet // outlet
eastStreet
{
type zeroGradient;
}
northBranch // inlet
northBranch
{
type fixedValue;
value uniform (0 -1 0);
@ -50,4 +51,5 @@ boundaryField
}
}
// ************************************************************************* //

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
@ -10,7 +10,8 @@ FoamFile
version 2.0;
format ascii;
class volScalarField;
object p;
location "-1";
object icoFoam1@-1@0@p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -28,16 +29,16 @@ boundaryField
{
type zeroGradient;
}
westStreet // closed
westStreet
{
type zeroGradient;
}
eastStreet // outlet
eastStreet
{
type fixedValue;
value uniform 0;
}
northBranch // inlet
northBranch
{
type zeroGradient;
}
@ -47,4 +48,5 @@ boundaryField
}
}
// ************************************************************************* //

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
@ -10,7 +10,8 @@ FoamFile
version 2.0;
format ascii;
class volScalarField;
object p;
location "-1";
object icoFoam2@-1@0@T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,4 +48,5 @@ boundaryField
}
}
// ************************************************************************* //

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
@ -10,7 +10,8 @@ FoamFile
version 2.0;
format ascii;
class volVectorField;
object U;
location "-1";
object icoFoam2@-1@0@U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -30,16 +31,16 @@ boundaryField
type fixedValue;
value uniform (0 0 0);
}
westStreet // outlet
westStreet
{
type zeroGradient;
}
eastStreet // inlet
eastStreet
{
type fixedValue;
value uniform (-1 0 0);
}
northBranch // outlet
northBranch
{
type zeroGradient;
}
@ -49,4 +50,5 @@ boundaryField
}
}
// ************************************************************************* //

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
@ -10,7 +10,8 @@ FoamFile
version 2.0;
format ascii;
class volScalarField;
object p;
location "-1";
object icoFoam2@-1@0@p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -28,16 +29,16 @@ boundaryField
{
type zeroGradient;
}
westStreet // outlet
westStreet
{
type fixedValue;
value uniform 0;
}
eastStreet // inlet
eastStreet
{
type zeroGradient;
}
northBranch // outlet
northBranch
{
type fixedValue;
value uniform 0;
@ -48,4 +49,5 @@ boundaryField
}
}
// ************************************************************************* //

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
@ -10,7 +10,8 @@ FoamFile
version 2.0;
format ascii;
class volScalarField;
object p;
location "-1";
object scalarTransportFoam@-1@0@T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -36,7 +37,7 @@ boundaryField
{
type zeroGradient;
}
northBranch // inlet
northBranch
{
type fixedValue;
value uniform 1;
@ -47,4 +48,5 @@ boundaryField
}
}
// ************************************************************************* //

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
@ -10,7 +10,8 @@ FoamFile
version 2.0;
format ascii;
class volVectorField;
object U;
location "-1";
object scalarTransportFoam@-1@0@U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -30,15 +31,15 @@ boundaryField
type fixedValue;
value uniform (0 0 0);
}
westStreet // outlet
westStreet
{
type zeroGradient;
}
eastStreet // closed
eastStreet
{
type zeroGradient;
}
northBranch // inlet
northBranch
{
type fixedValue;
value uniform (0 -1 0);
@ -49,4 +50,5 @@ boundaryField
}
}
// ************************************************************************* //

View file

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5-dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object multiTransportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryName transportProperties;
multiSolver
{
scalarTransportFoam
{
DT DT [0 2 -1 0 0 0 0] 0.0;
}
icoFoam1
{
nu nu [0 2 -1 0 0 0 0] 0.01;
}
icoFoam2
{
nu nu [0 2 -1 0 0 0 0] 0.01;
}
}

View file

@ -0,0 +1,90 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.1;
vertices
(
(0 0 0)
(1.5 0 0)
(1.5 1 0)
(0 1 0)
(2.5 0 0)
(4 0 0)
(4 1 0)
(2.5 1 0)
(1.5 2.5 0)
(2.5 2.5 0)
(0 0 0.1)
(1.5 0 0.1)
(1.5 1 0.1)
(0 1 0.1)
(2.5 0 0.1)
(4 0 0.1)
(4 1 0.1)
(2.5 1 0.1)
(1.5 2.5 0.1)
(2.5 2.5 0.1)
);
blocks
(
hex (0 1 2 3 10 11 12 13) (20 20 1) simpleGrading (1 1 1)
hex (1 4 7 2 11 14 17 12) (20 20 1) simpleGrading (1 1 1)
hex (4 5 6 7 14 15 16 17) (20 20 1) simpleGrading (1 1 1)
hex (2 7 9 8 12 17 19 18) (20 20 1) simpleGrading (1 1 1)
);
edges
(
);
patches
(
wall steetWalls
(
(1 0 10 11)
(4 1 11 14)
(5 4 14 15)
(2 3 13 12)
(6 7 17 16)
)
wall branchWalls
(
(8 2 12 18)
(7 9 19 17)
)
patch westStreet
(
(3 0 10 13)
)
patch eastStreet
(
(5 6 16 15)
)
patch northBranch
(
(9 8 18 19)
)
);
mergePatchPairs
(
);
// ************************************************************************* //

View file

@ -0,0 +1,58 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6
(
steetWalls
{
type wall;
nFaces 100;
startFace 3100;
}
branchWalls
{
type wall;
nFaces 40;
startFace 3200;
}
westStreet
{
type patch;
nFaces 20;
startFace 3240;
}
eastStreet
{
type patch;
nFaces 20;
startFace 3260;
}
northBranch
{
type patch;
nFaces 20;
startFace 3280;
}
defaultFaces
{
type empty;
nFaces 3200;
startFace 3300;
}
)
// ************************************************************************* //

View file

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu nu [ 0 2 -1 0 0 0 0 ] 0.01;
// ************************************************************************* //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "-1";
object icoFoam1@-1@0@T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
boundaryField
{
steetWalls
{
type zeroGradient;
}
branchWalls
{
type zeroGradient;
}
westStreet
{
type zeroGradient;
}
eastStreet
{
type zeroGradient;
}
northBranch
{
type fixedValue;
value uniform 1;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "-1";
object icoFoam1@-1@0@U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
steetWalls
{
type fixedValue;
value uniform (0 0 0);
}
branchWalls
{
type fixedValue;
value uniform (0 0 0);
}
westStreet
{
type fixedValue;
value uniform (0 0 0);
}
eastStreet
{
type zeroGradient;
}
northBranch
{
type fixedValue;
value uniform (0 -1 0);
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "-1";
object icoFoam1@-1@0@p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
steetWalls
{
type zeroGradient;
}
branchWalls
{
type zeroGradient;
}
westStreet
{
type zeroGradient;
}
eastStreet
{
type fixedValue;
value uniform 0;
}
northBranch
{
type zeroGradient;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "-1";
object icoFoam2@-1@0@T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
boundaryField
{
steetWalls
{
type zeroGradient;
}
branchWalls
{
type zeroGradient;
}
westStreet
{
type zeroGradient;
}
eastStreet
{
type zeroGradient;
}
northBranch
{
type fixedValue;
value uniform 1;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "-1";
object icoFoam2@-1@0@U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
steetWalls
{
type fixedValue;
value uniform (0 0 0);
}
branchWalls
{
type fixedValue;
value uniform (0 0 0);
}
westStreet
{
type zeroGradient;
}
eastStreet
{
type fixedValue;
value uniform (-1 0 0);
}
northBranch
{
type zeroGradient;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "-1";
object icoFoam2@-1@0@p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
steetWalls
{
type zeroGradient;
}
branchWalls
{
type zeroGradient;
}
westStreet
{
type fixedValue;
value uniform 0;
}
eastStreet
{
type zeroGradient;
}
northBranch
{
type fixedValue;
value uniform 0;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "-1";
object scalarTransportFoam@-1@0@T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
boundaryField
{
steetWalls
{
type zeroGradient;
}
branchWalls
{
type zeroGradient;
}
westStreet
{
type zeroGradient;
}
eastStreet
{
type zeroGradient;
}
northBranch
{
type fixedValue;
value uniform 1;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "-1";
object scalarTransportFoam@-1@0@U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
steetWalls
{
type fixedValue;
value uniform (0 0 0);
}
branchWalls
{
type fixedValue;
value uniform (0 0 0);
}
westStreet
{
type zeroGradient;
}
eastStreet
{
type zeroGradient;
}
northBranch
{
type fixedValue;
value uniform (0 -1 0);
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
runTimeModifiable yes;
application icoFoam;
deltaT 0.01;
writeControl timeStep;
writeInterval 1;
startFrom startTime;
startTime 0.1;
stopAt endTime;
endTime 0.1;
timeFormat scientific;
timePrecision 6;
// ************************************************************************* //

View file

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method simple;
simpleCoeffs
{
n (2 1 1);
delta 0.001;
}
hierarchicalCoeffs
{
n ( 1 1 1 );
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* //

View file

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
}
laplacianSchemes
{
default none;
laplacian(nu,U) Gauss linear corrected;
laplacian((1|A(U)),p) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
interpolate(HbyA) linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
p ;
}
// ************************************************************************* //

View file

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
// ************************************************************************* //

View file

@ -0,0 +1,70 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5-dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object multiSolverDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
multiSolverControl
{
initialStartFrom startTime;
startTime 0;
finalStopAt endSuperLoop;
endSuperLoop 3;
timeFormat scientific;
timePrecision 6;
}
solverDomains
{
icoFoam1
{
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.1;
deltaT 0.01;
writeControl timeStep;
writeInterval 1;
storeFields ( T );
}
icoFoam2
{
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.1;
deltaT 0.01;
writeControl timeStep;
writeInterval 1;
storeFields ( T );
}
scalarTransportFoam
{
application scalarTransportFoam;
startFrom latestTimeAllDomains;
stopAt elapsedTime;
elapsedTime 1;
deltaT 0.1;
writeControl timeStep;
writeInterval 1;
storeFields ( p );
}
default
{
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
runTimeModifiable yes;
}
}

View file

@ -0,0 +1,150 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5-dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object multiFvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryName fvSchemes;
multiSolver
{
icoFoam1
{
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
}
laplacianSchemes
{
default none;
laplacian(nu,U) Gauss linear corrected;
laplacian((1|A(U)),p) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
interpolate(HbyA) linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
p;
}
}
icoFoam2
{
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
}
laplacianSchemes
{
default none;
laplacian(nu,U) Gauss linear corrected;
laplacian((1|A(U)),p) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
interpolate(HbyA) linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
p;
}
}
scalarTransportFoam
{
ddtSchemes
{
default none;
ddt(T) Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,T) Gauss upwind;
}
laplacianSchemes
{
default none;
laplacian(DT,T) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
}
}
}
// ************************************************************************* //

View file

@ -0,0 +1,100 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5-dev |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object multiFvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryName fvSolution;
multiSolver
{
icoFoam1
{
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0;
};
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0;
};
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
}
icoFoam2
{
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0;
};
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0;
};
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
}
scalarTransportFoam
{
solvers
{
T
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0;
};
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View file

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 2;
method simple;
simpleCoeffs
{
n (2 1 1);
delta 0.001;
}
hierarchicalCoeffs
{
n ( 1 1 1 );
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* //

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

View file

@ -76,7 +76,7 @@ multiSolver
pRefValue 0;
}
}
scalarTransportFoam
{
solvers