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,6 +62,8 @@ 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 * * * * * * * * * * * * * * * * //

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

@ -54,6 +54,13 @@ void parseOptions
while (not optionsStream.eof())
{
token nextOption(optionsStream);
// Bug workaround
if (nextOption.type() == token::ERROR)
{
break;
}
if (nextOption.isLabel())
{
ptrSuperLoops->setSize(++nSuperLoops);
@ -81,6 +88,13 @@ void parseOptions
while (not optionsStream.eof())
{
token nextOption(optionsStream);
// Bug workaround
if (nextOption.type() == token::ERROR)
{
break;
}
if (nextOption.isLabel())
{
ptrSuperLoops->setSize(++nSuperLoops);
@ -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);
}

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

@ -90,3 +90,5 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

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

View file

@ -38,7 +38,11 @@ namespace Foam
template<>
const char* Foam::NamedEnum<Foam::multiSolver::initialStartFromControls, 9>::names[] =
const char* Foam::NamedEnum
<
Foam::multiSolver::initialStartFromControls,
9
>::names[] =
{
"firstTime",
"firstTimeInStartDomain",
@ -56,7 +60,11 @@ const Foam::NamedEnum<Foam::multiSolver::initialStartFromControls, 9>
template<>
const char* Foam::NamedEnum<Foam::multiSolver::finalStopAtControls, 7>::names[] =
const char* Foam::NamedEnum
<
Foam::multiSolver::finalStopAtControls,
7
>::names[] =
{
"endTime",
"endTimeInEndDomain",
@ -179,12 +187,10 @@ void Foam::multiSolver::synchronizeParallel() const
}
else
{
// Receive go signal
// Recieve go signal
{
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
// Quenching compiler warning
// HR, 18/Jul/2013
readBool(fromMaster);
bool okayToGo(readBool(fromMaster));
}
}
}
@ -200,15 +206,12 @@ Foam::word Foam::multiSolver::setLocalEndTime()
break;
case msaNoWriteNow:
stopAtSetting = "noWriteNow";
finished_ = true;
break;
case msaWriteNow:
stopAtSetting = "writeNow";
finished_ = true;
break;
case msaNextWrite:
stopAtSetting = "nextWrite";
finished_ = true;
break;
case msaIterations:
endTime_ = deltaT_ * iterations_ + startTime_;
@ -228,7 +231,6 @@ Foam::word Foam::multiSolver::setLocalEndTime()
if ((endTime_ + globalTimeOffset_) >= finalEndTime_)
{
endTime_ = finalEndTime_ - globalTimeOffset_;
finished_ = true;
if ((startTime_ + globalTimeOffset_) >= finalEndTime_)
{
// Initialized beyond end
@ -245,7 +247,6 @@ Foam::word Foam::multiSolver::setLocalEndTime()
)
{
endTime_ = finalEndTime_;
finished_ = true;
if (startTime_ >= finalEndTime_)
{
// Initialized beyond end
@ -263,7 +264,6 @@ Foam::word Foam::multiSolver::setLocalEndTime()
)
{
endTime_ = finalEndTime_;
finished_ = true;
if (startTime_ > finalEndTime_)
{
// Initialized beyond end
@ -279,25 +279,179 @@ Foam::word Foam::multiSolver::setLocalEndTime()
if (superLoop_ > endSuperLoop_)
{
stopAtSetting = "noWriteNow";
finished_ = true;
}
break;
case mfsWriteNow:
finished_ = true;
stopAtSetting = "writeNow";
break;
case mfsNoWriteNow:
finished_ = true;
stopAtSetting = "noWriteNow";
break;
case mfsNextWrite:
stopAtSetting = "nextWrite";
finished_ = true;
break;
}
return stopAtSetting;
}
bool Foam::multiSolver::checkGlobalEnd() const
{
if (forcedEnd_) return true;
/*word stopAtSetting("endTime");
switch (stopAt_)
{
case msaNoWriteNow:
case msaWriteNow:
case msaNextWrite:
return true;
default:
// do nothing
break;
}*/
// Modify endTime_ if it exceeds finalEndTime
switch (finalStopAt_)
{
case mfsEndTime:
if ((startTime_ + globalTimeOffset_) >= finalEndTime_)
{
return true;
}
break;
case mfsEndTimeInEndDomain:
if
(
(currentSolverDomain_ == endDomain_)
&& (startTime_ >= finalEndTime_)
)
{
return true;
}
break;
case mfsEndTimeInEndDomainInEndSuperLoop:
if (currentSolverDomain_ == endDomain_)
{
if
(
(superLoop_ >= endSuperLoop_)
&& (startTime_ >= finalEndTime_)
)
{
return true;
}
}
break;
case mfsEndSuperLoop:
if (superLoop_ > endSuperLoop_)
{
return true;
}
break;
case mfsWriteNow:
case mfsNoWriteNow:
case mfsNextWrite:
return true;
}
return false;
}
void Foam::multiSolver::buildDictionary
(
dictionary& outputDict,
const dictionary& inputDict,
const word& solverDomainName
)
{
outputDict.remove("sameAs");
outputDict.remove("multiLoad");
wordList alreadyMerged(0);
wordList mergeMe(0);
if (inputDict.found("default"))
{
if (outputDict.found("multiLoad"))
{
mergeMe = wordList(outputDict.lookup("multiLoad"));
outputDict.remove("multiLoad");
}
if (outputDict.found("sameAs"))
{
label newIndex(mergeMe.size());
mergeMe.setSize(newIndex + 1);
mergeMe[newIndex] = word(outputDict.lookup("sameAs"));
outputDict.remove("sameAs");
}
}
// We load solverDomain last, but we need its sameAs / multiLoad now
if (inputDict.found(solverDomainName))
{
const dictionary& solverDict(inputDict.subDict(solverDomainName));
if (solverDict.found("multiLoad"))
{
mergeMe.append(wordList(solverDict.lookup("multiLoad")));
}
if (solverDict.found("sameAs"))
{
label newIndex(mergeMe.size());
mergeMe.setSize(newIndex + 1);
mergeMe[newIndex] = word(solverDict.lookup("sameAs"));
}
}
label mergeI(-1);
while ((mergeI + 1) < mergeMe.size())
{
mergeI++;
bool skipMe(false);
forAll(alreadyMerged, alreadyI)
{
if (mergeMe[mergeI] == alreadyMerged[alreadyI])
{
skipMe = true;
break;
}
}
if (skipMe)
{
break;
}
outputDict.merge(inputDict.subDict(mergeMe[mergeI]));
// Add to alreadyMerged
label mergedIndex(alreadyMerged.size());
alreadyMerged.setSize(mergedIndex + 1);
alreadyMerged[mergedIndex] = mergeMe[mergeI];
// Recursive search
if (outputDict.found("multiLoad"))
{
mergeMe.append(wordList(outputDict.lookup("multiLoad")));
outputDict.remove("multiLoad");
}
if (outputDict.found("sameAs"))
{
label newMergeMeIndex(mergeMe.size());
mergeMe.setSize(newMergeMeIndex + 1);
mergeMe[newMergeMeIndex] = word(outputDict.lookup("sameAs"));
outputDict.remove("sameAs");
}
}
// Merge the solverDomain name, even if it already has merged
if (inputDict.found(solverDomainName))
{
outputDict.merge(inputDict.subDict(solverDomainName));
// These have been handled already
outputDict.remove("sameAs");
outputDict.remove("multiLoad");
}
}
void Foam::multiSolver::checkTimeDirectories() const
{
forAll(prefixes_, i)
@ -310,6 +464,9 @@ void Foam::multiSolver::checkTimeDirectories() const
<< "multiControlDict. These two names are prohibitted."
<< abort(FatalError);
}
// Nolonger checking for initial directories - allows for virtual
// solverDomains
/*
fileName checkMe
(
multiDictRegistry_.path()/"multiSolver"/prefixes_[i]/"initial/0"
@ -323,7 +480,7 @@ void Foam::multiSolver::checkTimeDirectories() const
<< "Initial time directory missing for solver domain ["
<< prefixes_[i] << "]. Expecting " << checkMe
<< abort(FatalError);
}
}*/
}
}
@ -345,50 +502,34 @@ void Foam::multiSolver::swapDictionaries(const word& solverDomainName)
false
)
);
if (multiDicts_[i].subDict("multiSolver").found("default"))
{
newMultiDict.merge
(
multiDicts_[i].subDict("multiSolver").subDict("default")
);
}
if (multiDicts_[i].subDict("multiSolver").found(solverDomainName))
{
if (multiDicts_[i].subDict("multiSolver")
.subDict(solverDomainName).found("sameAs"))
{
word sameAsSolverDomain(multiDicts_[i].subDict("multiSolver")
.subDict(solverDomainName).lookup("sameAs"));
if (multiControlDict_.subDict("solverDomains")
.found(sameAsSolverDomain))
{
newMultiDict.merge
buildDictionary
(
multiDicts_[i].subDict("multiSolver")
.subDict(sameAsSolverDomain)
newMultiDict,
multiDicts_[i].subDict("multiSolver"),
solverDomainName
);
}
else
{
FatalIOErrorIn
(
"multiSolver::swapDictionaries", multiDicts_[i]
)
<< "'sameAs' solverDomain name " << sameAsSolverDomain
<< " not found."
<< exit(FatalIOError);
}
}
else
newMultiDict.merge
(
multiDicts_[i].subDict("multiSolver").subDict(solverDomainName)
);
}
newMultiDict.regIOobject::write();
}
if
(
exists
(
multiDictRegistry_.path()/multiDictRegistry_.constant()
/"polyMesh"/"boundary." + solverDomainName
)
)
{
cp
(
multiDictRegistry_.path()/multiDictRegistry_.constant()
/"polyMesh"/"boundary." + solverDomainName,
multiDictRegistry_.path()/multiDictRegistry_.constant()
/"polyMesh"/"boundary"
);
}
}
@ -482,23 +623,36 @@ void Foam::multiSolver::swapBoundaryConditions
if (dataPatches.size() != bcPatches.size())
{
FatalErrorIn("multiSolver::swapBoundaryConditions")
WarningIn("multiSolver::swapBoundaryConditions")
<< "Boundary fields do not match. Solver domain ["
<< intoSolverDomain << "] has " << bcPatches.size() << " patches "
<< "and the previous domain has " << dataPatches.size() << "."
<< abort(FatalError);
<< ", and the previous domain has " << dataPatches.size() << "."
<< endl;
}
forAll(dataPatches, j)
{
if (dataPatches[j] != bcPatches[j])
label offset(0);
while (dataPatches[j] != bcPatches[j + offset])
{
if ((j + offset) == bcPatches.size())
{
FatalErrorIn("multiSolver::swapBoundaryConditions")
<< "Boundary fields do not match. Solver domain ["
<< intoSolverDomain << "] has:" << bcPatches
<< " and the previous domain has:" << dataPatches << "."
<< abort(FatalError);
}
offset++;
}
/*if (dataPatches[j] != bcPatches[j])
{
FatalErrorIn("multiSolver::swapBoundaryConditions")
<< "Boundary fields do not match. Solver domain ["
<< intoSolverDomain << "] has:" << bcPatches << " patches "
<< "and the previous domain has:" << dataPatches << "."
<< abort(FatalError);
}
}*/
if (exists(firstDataSourcePath/dirEntries[i]))
{
IFstream firstDataStream(firstDataSourcePath/dirEntries[i]);
@ -509,13 +663,14 @@ void Foam::multiSolver::swapBoundaryConditions
if
(
firstDict.subDict("boundaryField")
.subDict(bcPatches[j]).found("multiSolverRemembering")
.subDict(bcPatches[j + offset])
.found("multiSolverRemembering")
)
{
wordList msr
(
firstDict.subDict("boundaryField")
.subDict(bcPatches[j])
.subDict(bcPatches[j + offset])
.lookup("multiSolverRemembering")
);
forAll(msr, k)
@ -529,24 +684,24 @@ void Foam::multiSolver::swapBoundaryConditions
)
<< "'multiSolverRemember' word '" << msr[k]
<< "' missing from boundary patch '"
<< dataPatches[j] << "' while switching to "
<< currentSolverDomain_ << ". This may be "
<< "the result of manual editting datafiles "
<< "or data corruption. If the problem "
<< "persists, this is a bug."
<< dataPatches[j] << "' while "
<< "switching to " << currentSolverDomain_
<< ". This may be the result of manual "
<< "editting datafiles or data corruption. "
<< "If the problem persists, this is a bug."
<< exit(FatalIOError);
}
outputDict.subDict("boundaryField")
.subDict(bcPatches[j]).set
.subDict(bcPatches[j + offset]).set
(
msr[k],
firstDict.subDict("boundaryField")
.subDict(bcPatches[j]).lookup(msr[k])
.subDict(bcPatches[j + offset]).lookup(msr[k])
);
}
outputDict.subDict("boundaryField")
.subDict(bcPatches[j]).set
.subDict(bcPatches[j + offset]).set
(
"multiSolverRemembering",
msr
@ -563,14 +718,15 @@ void Foam::multiSolver::swapBoundaryConditions
if
(
icDict.subDict("boundaryField")
.subDict(bcPatches[j]).found("multiSolverRemember")
.subDict(bcPatches[j + offset])
.found("multiSolverRemember")
)
{
wordList remember
(
icDict
.subDict("boundaryField")
.subDict(bcPatches[j])
.subDict(bcPatches[j + offset])
.lookup("multiSolverRemember")
);
@ -584,19 +740,20 @@ void Foam::multiSolver::swapBoundaryConditions
dataDict
)
<< "'multiSolverRemember' wordList found, "
<< "but keyword '" << remember[k] << "' not"
<< "present in dictionary for "
<< "but keyword '" << remember[k]
<< "' not present in dictionary for "
<< dirEntries[i]
<< exit(FatalIOError);
}
outputDict
.subDict("boundaryField")
.subDict(bcPatches[j]).set
.subDict(bcPatches[j + offset]).set
(
remember[j],
dataDict.subDict("boundaryField")
.subDict(bcPatches[j]).lookup(remember[k])
.subDict(bcPatches[j + offset])
.lookup(remember[k])
);
}
@ -605,14 +762,14 @@ void Foam::multiSolver::swapBoundaryConditions
if
(
firstDict.subDict("boundaryField")
.subDict(bcPatches[j])
.subDict(bcPatches[j + offset])
.found("multiSolverRemembering")
)
{
wordList msr
(
firstDict.subDict("boundaryField")
.subDict(bcPatches[j])
.subDict(bcPatches[j + offset])
.lookup("multiSolverRemembering")
);
remembering.setSize(remember.size() + msr.size());
@ -624,7 +781,7 @@ void Foam::multiSolver::swapBoundaryConditions
outputDict
.subDict("boundaryField")
.subDict(bcPatches[j]).set
.subDict(bcPatches[j + offset]).set
(
"multiSolverRemembering",
remembering
@ -653,7 +810,7 @@ void Foam::multiSolver::swapBoundaryConditions
IOobject::writeDivider(os);
os << endl;
outputDict.write(os);
outputDict.write(os, false);
} // end cycle through files
}
@ -796,7 +953,7 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile
const instant& inst
) const
{
// solverDomain@superLoop@globalOffset@preConName
// solverDomain@superLoop@globalOffset@globalIndex@preConName
# ifdef FULLDEBUG
if (!pcFile.size())
{
@ -849,6 +1006,26 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile
}
# endif
// Find fourth @
string::size_type fourth = pcFile
(
first + second + third + 3,
pcFile.size() - first - second - third - 3
).find("@");
# ifdef FULLDEBUG
if
(
third == string::npos
|| pcFile.size() == first + second + third + fourth + 4
)
{
FatalErrorIn("multiSolver::parseConditionedFile")
<< "Bad preConditioned fileName: " << pcFile
<< abort(FatalError);
}
# endif
word solverDomain
(
pcFile(first)
@ -888,12 +1065,32 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile
globalOffsetToken.number()
);
IStringStream globalIndexStream
(
pcFile(first + second + third + 3, fourth)
);
token globalIndexToken(globalIndexStream);
# ifdef FULLDEBUG
if (!globalIndexToken.isLabel() || !globalIndexStream.eof())
{
FatalErrorIn("multiSolver::parseConditionedFile")
<< "Bad preConditioned fileName: " << pcFile
<< abort(FatalError);
}
# endif
label globalIndex
(
globalIndexToken.labelToken()
);
word preConName
(
pcFile
(
first + second + third + 3,
pcFile.size() - first - second - third - 3
first + second + third + fourth + 4,
pcFile.size() - first - second - third - fourth - 4
)
);
@ -901,6 +1098,7 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile
(
instantList(1, inst),
globalOffset,
globalIndex,
superLoop,
solverDomain,
preConName
@ -917,7 +1115,8 @@ Foam::multiSolver::multiSolver
const fileName& rootPath,
const fileName& caseName,
const word& systemName,
const word& constantName
const word& constantName,
bool showSplash
)
:
dcd_(dict),
@ -946,6 +1145,20 @@ Foam::multiSolver::multiSolver
),
#include "multiSolverInit.H"
{
if (showSplash)
{
Info
<< "/* |---------------------." << token::NL
<< " * This application uses | David L. F. Gaden's | "
<< "Please cite me if possible" << token::NL
<< " * .----------------|---------------------' "
<< "See the wiki for more info" << token::NL
<< " * | multiSolver | Version: " << version()
<< token::NL
<< " * '----------------| "
<< "github.com/Marupio/multiSolver/wiki" << token::NL
<< " */" << endl;
}
if (Pstream::parRun())
{
setUpParallel();
@ -962,7 +1175,8 @@ Foam::multiSolver::multiSolver
const fileName& rootPath,
const fileName& caseName,
const word& systemName,
const word& constantName
const word& constantName,
bool showSplash
)
:
dcd_(rootPath/caseName/systemName/multiControlDictName),
@ -990,6 +1204,20 @@ Foam::multiSolver::multiSolver
),
#include "multiSolverInit.H"
{
if (showSplash)
{
Info
<< "/* |---------------------." << token::NL
<< " * This application uses | David L. F. Gaden's | "
<< "Please cite me if possible" << token::NL
<< " * .----------------|---------------------' "
<< "See the wiki for more info" << token::NL
<< " * | multiSolver | Version: " << version()
<< token::NL
<< " * '----------------| "
<< "github.com/Marupio/multiSolver/wiki" << token::NL
<< " */" << endl;
}
if (Pstream::parRun())
{
setUpParallel();
@ -1008,6 +1236,17 @@ Foam::multiSolver::~multiSolver()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::word Foam::multiSolver::version() const
{
OStringStream os;
os << label(multiSolverVersionMajor) << "."
<< label(multiSolverVersionMinor) << "."
<< label(multiSolverVersionBuild);
return word(os.str());
}
void Foam::multiSolver::preCondition(const word& processor)
{
fileName path(multiDictRegistry_.path());
@ -1197,6 +1436,7 @@ void Foam::multiSolver::postCondition(const word& processor)
)
);
multiSolverTime.set("globalOffset", tcSubject.globalOffset());
multiSolverTime.set("globalIndex", tcSubject.globalIndex());
// Write multiSolverTime to the case/constant directory, then
// move to destination path
@ -1262,11 +1502,104 @@ void Foam::multiSolver::postCondition(const word& processor)
}
Foam::timeCluster Foam::multiSolver::initialDataSource() const
{
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)
);
includePreviousTimes(tcSource);
}
else
{
tcSource = findClosestGlobalTime
(
initialStartTime_, readAllTimes()
);
includePreviousTimes(tcSource);
}
break;
case misStartTimeInStartDomain:
tcSource = findClosestLocalTime
(
initialStartTime_, readSolverDomainTimes(startDomain_)
);
includePreviousTimes(tcSource);
break;
case misStartTimeInStartDomainInStartSuperLoop:
tcSource = findClosestLocalTime
(
initialStartTime_,
readSuperLoopTimes(startDomain_, startSuperLoop_)
);
includePreviousTimes(tcSource);
break;
case misLatestTime:
tcSource = findLatestGlobalTime(readAllTimes());
includePreviousTimes(tcSource);
break;
case misLatestTimeInStartDomain:
tcSource = findLatestLocalTime(readSolverDomainTimes(startDomain_));
includePreviousTimes(tcSource);
break;
case misLatestTimeInStartDomainInStartSuperLoop:
tcSource = findLatestLocalTime
(
readSuperLoopTimes(startDomain_, startSuperLoop_)
);
includePreviousTimes(tcSource);
break;
}
if (!tcSource.times().size())
{
// No relevant data found, set to initial conditions
tcSource = timeCluster
(
Time::findTimes
(
multiDictRegistry_.path()/"multiSolver"/currentSolverDomain_
/"initial"
),
0,
0,
-1, // superLoop of -1 signifies "initial" directory
currentSolverDomain_
);
}
return tcSource;
}
void Foam::multiSolver::setSolverDomain(const Foam::word& solverDomainName)
{
if (run())
{
if (currentSolverDomain_ == "default")
if (!initialized_)
{
setInitialSolverDomain(solverDomainName);
}
@ -1364,6 +1697,17 @@ void Foam::multiSolver::setSolverDomainPostProcessing
}
void Foam::multiSolver::finalize()
{
forcedEnd_ = true;
instantList il(Time::findTimes(multiDictRegistry_.path()));
if (il.size() == 1)
{
setNextSolverDomain(currentSolverDomain_);
}
}
Foam::multiSolver& Foam::multiSolver::operator++()
{
superLoop_++;
@ -1383,7 +1727,7 @@ bool Foam::multiSolver::run() const
// If case/[time] are present, run must continue to next 'setSolverDomain'
// so that they are archived properly.
instantList il(Time::findTimes(multiDictRegistry_.path()));
return !(finished_ && (il.size() == 1));
return !(checkGlobalEnd() && (il.size() == 1));
}
@ -1392,7 +1736,7 @@ bool Foam::multiSolver::end() const
// If case/[time] are present, run must continue to next 'setSolverDomain'
// so that they are archived properly.
instantList il(Time::findTimes(multiDictRegistry_.path()));
return (finished_ && (il.size() == 1));
return (checkGlobalEnd() && (il.size() == 1));
}
#include "multiSolverSetControls.C"
@ -1401,4 +1745,3 @@ bool Foam::multiSolver::end() const
#include "multiSolverTimeFunctions.C"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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"
@ -69,7 +70,7 @@ class multiSolver
// 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_;
@ -89,8 +90,11 @@ class multiSolver
// 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
@ -130,13 +134,28 @@ 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);
@ -169,7 +188,7 @@ class multiSolver
void readIfModified();
// Converts a fileName with the naming convention:
// solverDomain@superLoop@globalOffset@fileName
// solverDomain@superLoop@globalOffset@globalIndex@fileName
// to a timeCluster
timeCluster parseConditionedFile
(
@ -263,6 +282,10 @@ protected:
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
@ -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
);
@ -333,12 +358,16 @@ public:
// Access
//- 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
@ -369,6 +398,8 @@ public:
// Write permission
inline scalar& globalTimeOffset();
inline const label& globalIndex() const;
// solverDomains data
inline const startFromControls& startFrom() const;
@ -377,6 +408,7 @@ public:
inline const scalar& startTime() const;
inline const scalar& endTime() const;
inline scalar& endTime();
inline const label& iterations() const;
@ -387,6 +419,7 @@ public:
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++();
@ -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,6 +570,7 @@ 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,
@ -512,6 +580,7 @@ public:
// 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_;
@ -142,6 +155,12 @@ inline const scalar& multiSolver::endTime() const
}
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,14 +1,13 @@
// 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),
@ -16,8 +15,8 @@
currentSolverDomain_("default"),
initialStartFrom_(misLatestTime),
// startDomain_,
initialStartTime_(0),
startDomain_("default"),
startSuperLoop_(0),
finalStopAt_(mfsEndTime),
// endDomain_,
@ -28,6 +27,7 @@
multiDictsRunTimeModifiable_(true),
globalTimeOffset_(0),
globalIndex_(0),
purgeWriteSuperLoops_(prefixes_.size()),

View file

@ -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"))
@ -354,6 +355,4 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -44,6 +44,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
// globalTime (used to determine globalOffset). Rules that are applied:
@ -59,99 +70,25 @@ 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_)
{
@ -187,8 +124,13 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
// 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(),
@ -236,6 +178,29 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
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
@ -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());
@ -190,10 +193,10 @@ 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);
}
}
@ -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";
}
@ -245,22 +266,21 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
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

@ -335,6 +335,54 @@ Foam::timeCluster Foam::multiSolver::findLatestLocalTime
}
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);
@ -510,6 +560,7 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes
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
);
@ -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,17 +682,15 @@ 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
{
@ -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,6 +72,7 @@ class timeCluster
// Private data
scalar globalOffset_;
label globalIndex_;
label superLoop_;
word solverDomainName_;
@ -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
@ -143,6 +145,11 @@ public:
inline scalar& globalOffset();
//- Global index
inline label globalIndex() const;
inline label& globalIndex();
//- SuperLoop
inline label superLoop() 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

@ -151,6 +151,4 @@ Foam::timeClusterList Foam::timeClusterList::selectiveSubList
return tcl;
}
// ************************************************************************* //

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

@ -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