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 = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/multiSolver/lnInclude \ -I../../../../src/multiSolver/lnInclude
-I$(LIB_SRC)/multiSolver/multiSolver
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \

View file

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

View file

@ -12,7 +12,13 @@
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; 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++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {

View file

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

View file

@ -54,6 +54,13 @@ void parseOptions
while (not optionsStream.eof()) while (not optionsStream.eof())
{ {
token nextOption(optionsStream); token nextOption(optionsStream);
// Bug workaround
if (nextOption.type() == token::ERROR)
{
break;
}
if (nextOption.isLabel()) if (nextOption.isLabel())
{ {
ptrSuperLoops->setSize(++nSuperLoops); ptrSuperLoops->setSize(++nSuperLoops);
@ -81,6 +88,13 @@ void parseOptions
while (not optionsStream.eof()) while (not optionsStream.eof())
{ {
token nextOption(optionsStream); token nextOption(optionsStream);
// Bug workaround
if (nextOption.type() == token::ERROR)
{
break;
}
if (nextOption.isLabel()) if (nextOption.isLabel())
{ {
ptrSuperLoops->setSize(++nSuperLoops); ptrSuperLoops->setSize(++nSuperLoops);
@ -420,7 +434,7 @@ int main(int argc, char *argv[])
{ {
// Incorrect solver domain name // Incorrect solver domain name
FatalErrorIn("multiSolver::main") FatalErrorIn("multiSolver::main")
<< "solverDomainName " << solverDomains[i] << " is not " << "solverDomainName " << solverDomains[i] << "is not "
<< "found." << "found."
<< abort(FatalError); << abort(FatalError);
} }

View file

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

View file

@ -1,4 +1,5 @@
dummyControlDict/dummyControlDict.C dummyControlDict/dummyControlDict.C
multiTime/multiTime.C
multiSolver/multiSolver.C multiSolver/multiSolver.C
timeCluster/timeCluster.C timeCluster/timeCluster.C
timeCluster/timeClusterList.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 #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -1,3 +1,3 @@
} // previous solver domain goes out of scope } // previous solver domain goes out of scope
multiRun++; multiRun++;
} // end While loop } // 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

@ -38,7 +38,11 @@ namespace Foam
template<> template<>
const char* Foam::NamedEnum<Foam::multiSolver::initialStartFromControls, 9>::names[] = const char* Foam::NamedEnum
<
Foam::multiSolver::initialStartFromControls,
9
>::names[] =
{ {
"firstTime", "firstTime",
"firstTimeInStartDomain", "firstTimeInStartDomain",
@ -56,7 +60,11 @@ const Foam::NamedEnum<Foam::multiSolver::initialStartFromControls, 9>
template<> template<>
const char* Foam::NamedEnum<Foam::multiSolver::finalStopAtControls, 7>::names[] = const char* Foam::NamedEnum
<
Foam::multiSolver::finalStopAtControls,
7
>::names[] =
{ {
"endTime", "endTime",
"endTimeInEndDomain", "endTimeInEndDomain",
@ -179,12 +187,10 @@ void Foam::multiSolver::synchronizeParallel() const
} }
else else
{ {
// Receive go signal // Recieve go signal
{ {
IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
// Quenching compiler warning bool okayToGo(readBool(fromMaster));
// HR, 18/Jul/2013
readBool(fromMaster);
} }
} }
} }
@ -200,15 +206,12 @@ Foam::word Foam::multiSolver::setLocalEndTime()
break; break;
case msaNoWriteNow: case msaNoWriteNow:
stopAtSetting = "noWriteNow"; stopAtSetting = "noWriteNow";
finished_ = true;
break; break;
case msaWriteNow: case msaWriteNow:
stopAtSetting = "writeNow"; stopAtSetting = "writeNow";
finished_ = true;
break; break;
case msaNextWrite: case msaNextWrite:
stopAtSetting = "nextWrite"; stopAtSetting = "nextWrite";
finished_ = true;
break; break;
case msaIterations: case msaIterations:
endTime_ = deltaT_ * iterations_ + startTime_; endTime_ = deltaT_ * iterations_ + startTime_;
@ -228,7 +231,6 @@ Foam::word Foam::multiSolver::setLocalEndTime()
if ((endTime_ + globalTimeOffset_) >= finalEndTime_) if ((endTime_ + globalTimeOffset_) >= finalEndTime_)
{ {
endTime_ = finalEndTime_ - globalTimeOffset_; endTime_ = finalEndTime_ - globalTimeOffset_;
finished_ = true;
if ((startTime_ + globalTimeOffset_) >= finalEndTime_) if ((startTime_ + globalTimeOffset_) >= finalEndTime_)
{ {
// Initialized beyond end // Initialized beyond end
@ -245,7 +247,6 @@ Foam::word Foam::multiSolver::setLocalEndTime()
) )
{ {
endTime_ = finalEndTime_; endTime_ = finalEndTime_;
finished_ = true;
if (startTime_ >= finalEndTime_) if (startTime_ >= finalEndTime_)
{ {
// Initialized beyond end // Initialized beyond end
@ -263,7 +264,6 @@ Foam::word Foam::multiSolver::setLocalEndTime()
) )
{ {
endTime_ = finalEndTime_; endTime_ = finalEndTime_;
finished_ = true;
if (startTime_ > finalEndTime_) if (startTime_ > finalEndTime_)
{ {
// Initialized beyond end // Initialized beyond end
@ -279,25 +279,179 @@ Foam::word Foam::multiSolver::setLocalEndTime()
if (superLoop_ > endSuperLoop_) if (superLoop_ > endSuperLoop_)
{ {
stopAtSetting = "noWriteNow"; stopAtSetting = "noWriteNow";
finished_ = true;
} }
break; break;
case mfsWriteNow: case mfsWriteNow:
finished_ = true;
stopAtSetting = "writeNow"; stopAtSetting = "writeNow";
break; break;
case mfsNoWriteNow: case mfsNoWriteNow:
finished_ = true;
stopAtSetting = "noWriteNow"; stopAtSetting = "noWriteNow";
break; break;
case mfsNextWrite: case mfsNextWrite:
stopAtSetting = "nextWrite"; stopAtSetting = "nextWrite";
finished_ = true;
break; break;
} }
return stopAtSetting; 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 void Foam::multiSolver::checkTimeDirectories() const
{ {
forAll(prefixes_, i) forAll(prefixes_, i)
@ -310,6 +464,9 @@ void Foam::multiSolver::checkTimeDirectories() const
<< "multiControlDict. These two names are prohibitted." << "multiControlDict. These two names are prohibitted."
<< abort(FatalError); << abort(FatalError);
} }
// Nolonger checking for initial directories - allows for virtual
// solverDomains
/*
fileName checkMe fileName checkMe
( (
multiDictRegistry_.path()/"multiSolver"/prefixes_[i]/"initial/0" multiDictRegistry_.path()/"multiSolver"/prefixes_[i]/"initial/0"
@ -323,7 +480,7 @@ void Foam::multiSolver::checkTimeDirectories() const
<< "Initial time directory missing for solver domain [" << "Initial time directory missing for solver domain ["
<< prefixes_[i] << "]. Expecting " << checkMe << prefixes_[i] << "]. Expecting " << checkMe
<< abort(FatalError); << abort(FatalError);
} }*/
} }
} }
@ -345,50 +502,34 @@ void Foam::multiSolver::swapDictionaries(const word& solverDomainName)
false false
) )
); );
if (multiDicts_[i].subDict("multiSolver").found("default"))
{
newMultiDict.merge
(
multiDicts_[i].subDict("multiSolver").subDict("default")
);
}
if (multiDicts_[i].subDict("multiSolver").found(solverDomainName)) buildDictionary
{ (
if (multiDicts_[i].subDict("multiSolver") newMultiDict,
.subDict(solverDomainName).found("sameAs")) multiDicts_[i].subDict("multiSolver"),
{ solverDomainName
word sameAsSolverDomain(multiDicts_[i].subDict("multiSolver") );
.subDict(solverDomainName).lookup("sameAs"));
if (multiControlDict_.subDict("solverDomains")
.found(sameAsSolverDomain))
{
newMultiDict.merge
(
multiDicts_[i].subDict("multiSolver")
.subDict(sameAsSolverDomain)
);
}
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(); 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()) if (dataPatches.size() != bcPatches.size())
{ {
FatalErrorIn("multiSolver::swapBoundaryConditions") WarningIn("multiSolver::swapBoundaryConditions")
<< "Boundary fields do not match. Solver domain [" << "Boundary fields do not match. Solver domain ["
<< intoSolverDomain << "] has " << bcPatches.size() << " patches " << intoSolverDomain << "] has " << bcPatches.size() << " patches "
<< "and the previous domain has " << dataPatches.size() << "." << ", and the previous domain has " << dataPatches.size() << "."
<< abort(FatalError); << endl;
} }
forAll(dataPatches, j) 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") FatalErrorIn("multiSolver::swapBoundaryConditions")
<< "Boundary fields do not match. Solver domain [" << "Boundary fields do not match. Solver domain ["
<< intoSolverDomain << "] has:" << bcPatches << " patches " << intoSolverDomain << "] has:" << bcPatches << " patches "
<< "and the previous domain has:" << dataPatches << "." << "and the previous domain has:" << dataPatches << "."
<< abort(FatalError); << abort(FatalError);
} }*/
if (exists(firstDataSourcePath/dirEntries[i])) if (exists(firstDataSourcePath/dirEntries[i]))
{ {
IFstream firstDataStream(firstDataSourcePath/dirEntries[i]); IFstream firstDataStream(firstDataSourcePath/dirEntries[i]);
@ -509,13 +663,14 @@ void Foam::multiSolver::swapBoundaryConditions
if if
( (
firstDict.subDict("boundaryField") firstDict.subDict("boundaryField")
.subDict(bcPatches[j]).found("multiSolverRemembering") .subDict(bcPatches[j + offset])
.found("multiSolverRemembering")
) )
{ {
wordList msr wordList msr
( (
firstDict.subDict("boundaryField") firstDict.subDict("boundaryField")
.subDict(bcPatches[j]) .subDict(bcPatches[j + offset])
.lookup("multiSolverRemembering") .lookup("multiSolverRemembering")
); );
forAll(msr, k) forAll(msr, k)
@ -529,24 +684,24 @@ void Foam::multiSolver::swapBoundaryConditions
) )
<< "'multiSolverRemember' word '" << msr[k] << "'multiSolverRemember' word '" << msr[k]
<< "' missing from boundary patch '" << "' missing from boundary patch '"
<< dataPatches[j] << "' while switching to " << dataPatches[j] << "' while "
<< currentSolverDomain_ << ". This may be " << "switching to " << currentSolverDomain_
<< "the result of manual editting datafiles " << ". This may be the result of manual "
<< "or data corruption. If the problem " << "editting datafiles or data corruption. "
<< "persists, this is a bug." << "If the problem persists, this is a bug."
<< exit(FatalIOError); << exit(FatalIOError);
} }
outputDict.subDict("boundaryField") outputDict.subDict("boundaryField")
.subDict(bcPatches[j]).set .subDict(bcPatches[j + offset]).set
( (
msr[k], msr[k],
firstDict.subDict("boundaryField") firstDict.subDict("boundaryField")
.subDict(bcPatches[j]).lookup(msr[k]) .subDict(bcPatches[j + offset]).lookup(msr[k])
); );
} }
outputDict.subDict("boundaryField") outputDict.subDict("boundaryField")
.subDict(bcPatches[j]).set .subDict(bcPatches[j + offset]).set
( (
"multiSolverRemembering", "multiSolverRemembering",
msr msr
@ -563,14 +718,15 @@ void Foam::multiSolver::swapBoundaryConditions
if if
( (
icDict.subDict("boundaryField") icDict.subDict("boundaryField")
.subDict(bcPatches[j]).found("multiSolverRemember") .subDict(bcPatches[j + offset])
.found("multiSolverRemember")
) )
{ {
wordList remember wordList remember
( (
icDict icDict
.subDict("boundaryField") .subDict("boundaryField")
.subDict(bcPatches[j]) .subDict(bcPatches[j + offset])
.lookup("multiSolverRemember") .lookup("multiSolverRemember")
); );
@ -584,19 +740,20 @@ void Foam::multiSolver::swapBoundaryConditions
dataDict dataDict
) )
<< "'multiSolverRemember' wordList found, " << "'multiSolverRemember' wordList found, "
<< "but keyword '" << remember[k] << "' not" << "but keyword '" << remember[k]
<< "present in dictionary for " << "' not present in dictionary for "
<< dirEntries[i] << dirEntries[i]
<< exit(FatalIOError); << exit(FatalIOError);
} }
outputDict outputDict
.subDict("boundaryField") .subDict("boundaryField")
.subDict(bcPatches[j]).set .subDict(bcPatches[j + offset]).set
( (
remember[j], remember[j],
dataDict.subDict("boundaryField") 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 if
( (
firstDict.subDict("boundaryField") firstDict.subDict("boundaryField")
.subDict(bcPatches[j]) .subDict(bcPatches[j + offset])
.found("multiSolverRemembering") .found("multiSolverRemembering")
) )
{ {
wordList msr wordList msr
( (
firstDict.subDict("boundaryField") firstDict.subDict("boundaryField")
.subDict(bcPatches[j]) .subDict(bcPatches[j + offset])
.lookup("multiSolverRemembering") .lookup("multiSolverRemembering")
); );
remembering.setSize(remember.size() + msr.size()); remembering.setSize(remember.size() + msr.size());
@ -624,7 +781,7 @@ void Foam::multiSolver::swapBoundaryConditions
outputDict outputDict
.subDict("boundaryField") .subDict("boundaryField")
.subDict(bcPatches[j]).set .subDict(bcPatches[j + offset]).set
( (
"multiSolverRemembering", "multiSolverRemembering",
remembering remembering
@ -653,7 +810,7 @@ void Foam::multiSolver::swapBoundaryConditions
IOobject::writeDivider(os); IOobject::writeDivider(os);
os << endl; os << endl;
outputDict.write(os); outputDict.write(os, false);
} // end cycle through files } // end cycle through files
} }
@ -796,7 +953,7 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile
const instant& inst const instant& inst
) const ) const
{ {
// solverDomain@superLoop@globalOffset@preConName // solverDomain@superLoop@globalOffset@globalIndex@preConName
# ifdef FULLDEBUG # ifdef FULLDEBUG
if (!pcFile.size()) if (!pcFile.size())
{ {
@ -849,6 +1006,26 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile
} }
# endif # 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 word solverDomain
( (
pcFile(first) pcFile(first)
@ -888,12 +1065,32 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile
globalOffsetToken.number() 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 word preConName
( (
pcFile pcFile
( (
first + second + third + 3, first + second + third + fourth + 4,
pcFile.size() - first - second - third - 3 pcFile.size() - first - second - third - fourth - 4
) )
); );
@ -901,6 +1098,7 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile
( (
instantList(1, inst), instantList(1, inst),
globalOffset, globalOffset,
globalIndex,
superLoop, superLoop,
solverDomain, solverDomain,
preConName preConName
@ -917,7 +1115,8 @@ Foam::multiSolver::multiSolver
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const word& systemName, const word& systemName,
const word& constantName const word& constantName,
bool showSplash
) )
: :
dcd_(dict), dcd_(dict),
@ -946,6 +1145,20 @@ Foam::multiSolver::multiSolver
), ),
#include "multiSolverInit.H" #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()) if (Pstream::parRun())
{ {
setUpParallel(); setUpParallel();
@ -962,7 +1175,8 @@ Foam::multiSolver::multiSolver
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const word& systemName, const word& systemName,
const word& constantName const word& constantName,
bool showSplash
) )
: :
dcd_(rootPath/caseName/systemName/multiControlDictName), dcd_(rootPath/caseName/systemName/multiControlDictName),
@ -990,6 +1204,20 @@ Foam::multiSolver::multiSolver
), ),
#include "multiSolverInit.H" #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()) if (Pstream::parRun())
{ {
setUpParallel(); setUpParallel();
@ -1008,6 +1236,17 @@ Foam::multiSolver::~multiSolver()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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) void Foam::multiSolver::preCondition(const word& processor)
{ {
fileName path(multiDictRegistry_.path()); fileName path(multiDictRegistry_.path());
@ -1197,6 +1436,7 @@ void Foam::multiSolver::postCondition(const word& processor)
) )
); );
multiSolverTime.set("globalOffset", tcSubject.globalOffset()); multiSolverTime.set("globalOffset", tcSubject.globalOffset());
multiSolverTime.set("globalIndex", tcSubject.globalIndex());
// Write multiSolverTime to the case/constant directory, then // Write multiSolverTime to the case/constant directory, then
// move to destination path // 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) void Foam::multiSolver::setSolverDomain(const Foam::word& solverDomainName)
{ {
if (run()) if (run())
{ {
if (currentSolverDomain_ == "default") if (!initialized_)
{ {
setInitialSolverDomain(solverDomainName); 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++() Foam::multiSolver& Foam::multiSolver::operator++()
{ {
superLoop_++; superLoop_++;
@ -1383,7 +1727,7 @@ bool Foam::multiSolver::run() const
// If case/[time] are present, run must continue to next 'setSolverDomain' // If case/[time] are present, run must continue to next 'setSolverDomain'
// so that they are archived properly. // so that they are archived properly.
instantList il(Time::findTimes(multiDictRegistry_.path())); 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' // If case/[time] are present, run must continue to next 'setSolverDomain'
// so that they are archived properly. // so that they are archived properly.
instantList il(Time::findTimes(multiDictRegistry_.path())); instantList il(Time::findTimes(multiDictRegistry_.path()));
return (finished_ && (il.size() == 1)); return (checkGlobalEnd() && (il.size() == 1));
} }
#include "multiSolverSetControls.C" #include "multiSolverSetControls.C"
@ -1401,4 +1745,3 @@ bool Foam::multiSolver::end() const
#include "multiSolverTimeFunctions.C" #include "multiSolverTimeFunctions.C"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -45,7 +45,8 @@ Author
#ifndef multiSolver_H #ifndef multiSolver_H
#define multiSolver_H #define multiSolver_H
#include "Time.H" #include "multiSolverVersion.H"
#include "multiTime.H"
#include "dummyControlDict.H" #include "dummyControlDict.H"
#include "timeClusterList.H" #include "timeClusterList.H"
#include "IFstream.H" #include "IFstream.H"
@ -69,7 +70,7 @@ class multiSolver
// A mini-objectRegistry for the dictionaries - done this way to allow // A mini-objectRegistry for the dictionaries - done this way to allow
// run-time modification of dictionaries // run-time modification of dictionaries
Time multiDictRegistry_; multiTime multiDictRegistry_;
// Main control dictionary for multiSolver // Main control dictionary for multiSolver
IOdictionary multiControlDict_; IOdictionary multiControlDict_;
@ -89,8 +90,11 @@ class multiSolver
// List of all the solver domain prefixes // List of all the solver domain prefixes
wordList prefixes_; wordList prefixes_;
// True when the end condition has been met // True when setInitialSolverDomain has been run
bool finished_; bool initialized_;
// Set by the solver to force a global end
bool forcedEnd_;
// True when superLoop++ just happened, but the previous solverDomain // True when superLoop++ just happened, but the previous solverDomain
// has not yet been saved (to prevent the first solverDomain from // 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 // Use stopAt and finalStopAt settings to determine the endTime for
// the current solverDomain. Returns the controlDict's stopAt word, // the current solverDomain. Returns the controlDict's stopAt word,
// which may differ from that in multiControlDict. Sets finished_ to // which may differ from that in multiControlDict.
// true if the end condition will be met.
word setLocalEndTime(); 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. // Looks for case/multiSolver/solverDomain/initial/0. Fail if missing.
void checkTimeDirectories() const; 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 // Change all catalogued multiDicts to another solverDomain
void swapDictionaries(const word& solverDomainName); void swapDictionaries(const word& solverDomainName);
@ -169,7 +188,7 @@ class multiSolver
void readIfModified(); void readIfModified();
// Converts a fileName with the naming convention: // Converts a fileName with the naming convention:
// solverDomain@superLoop@globalOffset@fileName // solverDomain@superLoop@globalOffset@globalIndex@fileName
// to a timeCluster // to a timeCluster
timeCluster parseConditionedFile timeCluster parseConditionedFile
( (
@ -263,6 +282,10 @@ protected:
scalar globalTimeOffset_; scalar globalTimeOffset_;
//- Each solverDomain / superLoop combination is assigned a unique
// index that increments chronologically
label globalIndex_;
// solverDomains data // solverDomains data
// This data is transient, changing between solver domains // This data is transient, changing between solver domains
@ -311,7 +334,8 @@ public:
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const word& systemName = "system", const word& systemName = "system",
const word& constantName = "constant" const word& constantName = "constant",
bool showSplash = true
); );
//- Construct reading the multiControlDict from file //- Construct reading the multiControlDict from file
@ -321,7 +345,8 @@ public:
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const word& systemName = "system", const word& systemName = "system",
const word& constantName = "constant" const word& constantName = "constant",
bool showSplash = true
); );
@ -333,12 +358,16 @@ public:
// Access // Access
//- Version number
word version() const;
// Database // Database
inline const Time& multiDictRegistry() const; inline const Time& multiDictRegistry() const;
inline const IOdictionary multiControlDict() const; inline const IOdictionary& multiControlDict() const;
inline const wordList& prefixes() const;
// multiSolverControl data // multiSolverControl data
@ -369,6 +398,8 @@ public:
// Write permission // Write permission
inline scalar& globalTimeOffset(); inline scalar& globalTimeOffset();
inline const label& globalIndex() const;
// solverDomains data // solverDomains data
inline const startFromControls& startFrom() const; inline const startFromControls& startFrom() const;
@ -377,6 +408,7 @@ public:
inline const scalar& startTime() const; inline const scalar& startTime() const;
inline const scalar& endTime() const; inline const scalar& endTime() const;
inline scalar& endTime();
inline const label& iterations() const; inline const label& iterations() const;
@ -387,6 +419,7 @@ public:
inline const label& purgeWriteSuperLoops() const; inline const label& purgeWriteSuperLoops() const;
inline const scalar& deltaT() const; inline const scalar& deltaT() const;
inline scalar& deltaT();
// Solver (and pre/post-processor) interface functions // Solver (and pre/post-processor) interface functions
@ -398,6 +431,11 @@ public:
// reconstructPar // reconstructPar
void postCondition(const word& processor = word::null); 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 // Switch to another solver domain
void setSolverDomain(const word& solverDomainName); void setSolverDomain(const word& solverDomainName);
@ -407,6 +445,9 @@ public:
// Stop the run at the next setSolverDomain // Stop the run at the next setSolverDomain
inline void setFinished(); inline void setFinished();
// Archive the last set of data into case/multiSolver
void finalize();
// Increment the superLoop (prefix) // Increment the superLoop (prefix)
multiSolver& operator++(); multiSolver& operator++();
@ -431,22 +472,22 @@ public:
// | |-initial {initial directory, superLoop -1} // | |-initial {initial directory, superLoop -1}
// | |-0 {superLoop} // | |-0 {superLoop}
// | |-1 {superLoop} // | |-1 {superLoop}
// | | '-multiSolverTime {auto-generated dictionary} // | | |-multiSolverTime {auto-generated file}
// | | '-0.01, etc.. {time directories}
// | '-2, etc.. // | '-2, etc..
// |-prefix2, etc.. // |-prefix2, etc..
//
// *** All time functions are located in ***
// *** multiSolverTimeFunctions.C ***
// Create a list of all superLoops in a directory, (usually in // Create a list of all superLoops in a directory, (usually in
// case/prefix). Only looks for integer directory names, does not // case/prefix). Only looks for integer directory names, does not
// check for valid time subdirectories. // check for valid time subdirectories.
// *** Located in multiSolverTimeFunctions.C ***
static labelList findSuperLoops(const fileName& path); static labelList findSuperLoops(const fileName& path);
// Find the closest global time to a given value in a // Find the closest global time to a given value in a
// timeClusterList. Assumes timeClusters do not overlap global time // timeClusterList. Assumes timeClusters do not overlap global time
// values (as they shouldn't). If exact is true, this function // values (as they shouldn't). If exact is true, this function
// throws a FatalError when no exact match is found. // throws a FatalError when no exact match is found.
// *** Located in multiSolverTimeFunctions.C ***
static timeCluster findClosestGlobalTime static timeCluster findClosestGlobalTime
( (
const scalar value, const scalar value,
@ -459,6 +500,7 @@ public:
// If overlaps exist, it uses only the latest superloop. If exact // If overlaps exist, it uses only the latest superloop. If exact
// is true, this function throws a FatalError when no exact match // is true, this function throws a FatalError when no exact match
// is found. // is found.
// *** Located in multiSolverTimeFunctions.C ***
static timeCluster findClosestLocalTime static timeCluster findClosestLocalTime
( (
const scalar value, const scalar value,
@ -467,18 +509,37 @@ public:
); );
// Find the latest global time // Find the latest global time
// *** Located in multiSolverTimeFunctions.C ***
static timeCluster findLatestGlobalTime static timeCluster findLatestGlobalTime
( (
const timeClusterList& tcl const timeClusterList& tcl
); );
// Find the latest global time // Find the latest global time
// *** Located in multiSolverTimeFunctions.C ***
static timeCluster findLatestLocalTime static timeCluster findLatestLocalTime
( (
const timeClusterList& tcl 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 // Find the path to a specific entry in a time cluster
// *** Located in multiSolverTimeFunctions.C ***
fileName findInstancePath fileName findInstancePath
( (
const timeCluster& tc, const timeCluster& tc,
@ -486,15 +547,21 @@ public:
) const; ) const;
// Find the largest superLoop // Find the largest superLoop
// *** Located in multiSolverTimeFunctions.C ***
static label findMaxSuperLoopValue(const timeClusterList& tcl); static label findMaxSuperLoopValue(const timeClusterList& tcl);
// Find the timeClusterList index for the timeClusterList that has // Find the timeClusterList index for the timeClusterList that has
// the largest superLoop // 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 // Checks if any of the time ranges overlap one another in a
// timeClusterList. (If startTime = previous end, this is okay.) // timeClusterList. (If startTime = previous end, this is okay.)
// True means they do not overlap. // True means they do not overlap.
// *** Located in multiSolverTimeFunctions.C ***
static bool nonOverlapping static bool nonOverlapping
( (
const timeClusterList& tcl, const timeClusterList& tcl,
@ -503,6 +570,7 @@ public:
// Maps the time directories in a single superLoop directory // Maps the time directories in a single superLoop directory
// Include a processor name, and it uses the processorN directory // Include a processor name, and it uses the processorN directory
// *** Located in multiSolverTimeFunctions.C ***
timeCluster readSuperLoopTimes timeCluster readSuperLoopTimes
( (
const word& solverDomain, const word& solverDomain,
@ -512,6 +580,7 @@ public:
// Maps the time directories in a single solverDomain // Maps the time directories in a single solverDomain
// Include a processor name, and it uses the processorN directory // Include a processor name, and it uses the processorN directory
// *** Located in multiSolverTimeFunctions.C ***
timeClusterList readSolverDomainTimes timeClusterList readSolverDomainTimes
( (
const word& solverDomain, const word& solverDomain,
@ -521,6 +590,7 @@ public:
// Create a snapshot of all the multiSolver time directories // Create a snapshot of all the multiSolver time directories
// Give it a processor name, and it searches instead in the // Give it a processor name, and it searches instead in the
// processor directory // processor directory
// *** Located in multiSolverTimeFunctions.C ***
timeClusterList readAllTimes timeClusterList readAllTimes
( (
const word processor = word::null const word processor = word::null
@ -531,14 +601,16 @@ public:
// time values overlap when forced to useGlobalTime. // time values overlap when forced to useGlobalTime.
// loadStoreFields will copy storeFields into every time folder // loadStoreFields will copy storeFields into every time folder
// even though they do not change. // even though they do not change.
// *** Located in multiSolverTimeFunctions.C ***
bool loadTimeClusterList bool loadTimeClusterList
( (
const timeClusterList& tcl, const timeClusterList& tcl,
const bool useGlobalTime = true, const bool useGlobalTime = true,
const bool loadStoreFields = true const bool loadStoreFields = true
) const; );
// Move all the time directories from sourcePath to archivePath // Move all the time directories from sourcePath to archivePath
// *** Located in multiSolverTimeFunctions.C ***
static void archiveTimeDirs static void archiveTimeDirs
( (
const fileName& sourcePath, const fileName& sourcePath,
@ -547,6 +619,7 @@ public:
); );
// Delete all time directories in path, do not delete "constant" // Delete all time directories in path, do not delete "constant"
// *** Located in multiSolverTimeFunctions.C ***
static void purgeTimeDirs(const fileName& path); static void purgeTimeDirs(const fileName& path);
}; };
@ -559,4 +632,8 @@ public:
#include "multiSolverI.H" #include "multiSolverI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #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_; return multiControlDict_;
} }
inline const wordList& multiSolver::prefixes() const
{
return prefixes_;
}
inline const label& multiSolver::superLoop() const inline const label& multiSolver::superLoop() const
{ {
return superLoop_; 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_; 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 inline const multiSolver::startFromControls& multiSolver::startFrom() const
{ {
return startFrom_; return startFrom_;
@ -142,6 +155,12 @@ inline const scalar& multiSolver::endTime() const
} }
inline scalar& multiSolver::endTime()
{
return endTime_;
}
inline const label& multiSolver::iterations() const inline const label& multiSolver::iterations() const
{ {
return iterations_; return iterations_;
@ -172,9 +191,15 @@ inline const scalar& multiSolver::deltaT() const
} }
inline scalar& multiSolver::deltaT()
{
return deltaT_;
}
void Foam::multiSolver::setFinished() void Foam::multiSolver::setFinished()
{ {
finished_ = true; forcedEnd_ = true;
} }
} // End namespace Foam } // End namespace Foam

View file

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

View file

@ -213,11 +213,12 @@ void Foam::multiSolver::setMultiSolverControls()
void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName)
{ {
currentSolverDomainDict_.clear(); currentSolverDomainDict_.clear();
if (solverDomains_.found("default")) buildDictionary
{ (
currentSolverDomainDict_.merge(solverDomains_.subDict("default")); currentSolverDomainDict_,
} solverDomains_,
currentSolverDomainDict_.merge(solverDomains_.subDict(solverDomainName)); solverDomainName
);
startFrom_ = mtsLatestTimeAllDomains; startFrom_ = mtsLatestTimeAllDomains;
if (currentSolverDomainDict_.found("startFrom")) 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 // Purge all time directories from case directory root
purgeTimeDirs(multiDictRegistry_.path()); 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 // Read initial settings and determine data source (from which path the
// initial data is copied, the starting superLoop_, and the current // initial data is copied, the starting superLoop_, and the current
// globalTime (used to determine globalOffset). Rules that are applied: // globalTime (used to determine globalOffset). Rules that are applied:
@ -59,99 +70,25 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
// subdictionary. // subdictionary.
// 4. endTime is determined by the solverDomains subdictionary // 4. endTime is determined by the solverDomains subdictionary
// a. unless the finalStopAt trumps it // 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()) // Find initial data source
{ timeCluster tcSource(initialDataSource());
// 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_
);
}
fileName sourcePath(findInstancePath(tcSource, 0)); fileName sourcePath(findInstancePath(tcSource, tcSource.size() - 1));
superLoop_ = tcSource.superLoop(); superLoop_ = tcSource.superLoop();
globalIndex_ = tcSource.globalIndex();
// If starting from initial conditions, superLoop_ = -1 // If starting from initial conditions, superLoop_ = -1
if (superLoop_ < 0) superLoop_ = 0; if (superLoop_ < 0) superLoop_ = 0;
scalar globalTime(tcSource.globalValue(0)); scalar globalTime(tcSource.globalValue(tcSource.size() - 1));
scalar localStartTime(tcSource.localValue(0)); scalar localStartTime(tcSource.localValue(tcSource.size() -1));
// Now to apply the exceptions if currentSolverDomain_ != data source // Now to apply the exceptions if currentSolverDomain_ != data source
// solverDomain (see long comment above). // solverDomain (see long comment above).
if (sourcePath.path().path().name() != currentSolverDomain_) if (sourcePath.path().path().name() != currentSolverDomain_)
{ {
superLoop_++; superLoop_++;
globalIndex_++;
switch (startFrom_) switch (startFrom_)
{ {
@ -187,8 +124,13 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
// to case/[timeValue] // to case/[timeValue]
multiDictRegistry_.setTime(startTime_, 0); multiDictRegistry_.setTime(startTime_, 0);
// Copy the source data to case/[localTime] // Copy the source data and any previous time directories to
cp(sourcePath, multiDictRegistry_.path()); // case/[localTime]
forAll(tcSource, i)
{
fileName copyMe(findInstancePath(tcSource, i));
cp(copyMe, multiDictRegistry_.path());
}
mv mv
( (
multiDictRegistry_.path()/sourcePath.name(), multiDictRegistry_.path()/sourcePath.name(),
@ -236,6 +178,29 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
newControlDict.remove("elapsedTime"); newControlDict.remove("elapsedTime");
// Add values to obtain the desired behaviour // 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("startFrom", "startTime");
newControlDict.set("startTime", startTime_); newControlDict.set("startTime", startTime_);
newControlDict.set("stopAt", stopAtSetting); newControlDict.set("stopAt", stopAtSetting);
@ -248,18 +213,20 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName)
word(multiSolverControl_.lookup("timeFormat")) word(multiSolverControl_.lookup("timeFormat"))
); );
} }
if (multiSolverControl_.found("timePrecision"))
{
newControlDict.set
(
"timePrecision",
readScalar(multiSolverControl_.lookup("timePrecision"))
);
}
// Write the dictionary to the case directory // Write the dictionary to the case directory
newControlDict.regIOobject::write(); 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_); swapDictionaries(currentSolverDomain_);
initialized_ = true;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -77,13 +77,16 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
) )
); );
multiSolverTime.set("globalOffset", globalTimeOffset_); multiSolverTime.set("globalOffset", globalTimeOffset_);
multiSolverTime.set("globalIndex", globalIndex_);
globalIndex_++;
// Write multiSolverTime to the case/constant directory, then move to // Write multiSolverTime to the case/constant directory, then move to
// archivePath // archivePath
multiSolverTime.regIOobject::write(); multiSolverTime.regIOobject::write();
mv(multiDictRegistry_.constantPath()/"multiSolverTime", archivePath); 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 timeCluster tcSource
( (
findLatestLocalTime findLatestLocalTime
@ -138,7 +141,7 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
word stopAtSetting("endTime"); word stopAtSetting("endTime");
if (!finished_) if (!checkGlobalEnd())
{ {
// Copy the source data to case/[localTime] // Copy the source data to case/[localTime]
cp(sourcePath, multiDictRegistry_.path()); cp(sourcePath, multiDictRegistry_.path());
@ -190,10 +193,10 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
<< previousStoreFields[i] << " from " << previousStoreFields[i] << " from "
<< previousSolverDomain << " to " << previousSolverDomain << " to "
<< currentSolverDomain_ << " in superLoop " << currentSolverDomain_ << " in superLoop "
<< saveToSuperLoop << ". File not found. This may occur " << saveToSuperLoop << ". File not found. This may "
<< "if " << previousSolverDomain << " is the first " << "occur if " << previousSolverDomain << " is the "
<< "solverDomain to be initialized, and you did not put " << "first solverDomain to be initialized, and you did "
<< "the stored fields into its 0/0 directory." << "not put the stored fields into its 0/0 directory."
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -207,8 +210,26 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
// Determine localEndTime and stopAtSetting // Determine localEndTime and stopAtSetting
stopAtSetting = setLocalEndTime(); 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"; stopAtSetting = "noWriteNow";
} }
@ -245,22 +266,21 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName)
newControlDict.set("startTime", startTime_); newControlDict.set("startTime", startTime_);
newControlDict.set("stopAt", stopAtSetting); newControlDict.set("stopAt", stopAtSetting);
newControlDict.set("endTime", endTime_); newControlDict.set("endTime", endTime_);
if (multiSolverControl_.found("timeFormat")) switch (multiDictRegistry_.format())
{ {
newControlDict.set case Time::general:
( newControlDict.set("timeFormat", "general");
"timeFormat", break;
word(multiSolverControl_.lookup("timeFormat")) case Time::fixed:
); newControlDict.set("timeFormat", "fixed");
} break;
if (multiSolverControl_.found("timePrecision")) case Time::scientific:
{ newControlDict.set("timeFormat", "scientific");
newControlDict.set break;
( default:
"timePrecision", break;
readScalar(multiSolverControl_.lookup("timePrecision"))
);
} }
newControlDict.set("timePrecision", multiDictRegistry_.precision());
// Write the dictionary to the case directory // Write the dictionary to the case directory
newControlDict.regIOobject::write(); 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 Foam::fileName Foam::multiSolver::findInstancePath
( (
const timeCluster& tc, 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()) 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); label currentMax(-2);
labelList bestIndices(0); labelList bestIndices(0);
@ -510,6 +560,7 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes
bool mstFileGood(false); bool mstFileGood(false);
scalar globalOffset(0); scalar globalOffset(0);
label globalIndex(0);
if (mstFile.good()) if (mstFile.good())
{ {
@ -518,6 +569,8 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes
{ {
globalOffset = globalOffset =
readScalar(mstDict.lookup("globalOffset")); readScalar(mstDict.lookup("globalOffset"));
globalIndex =
readLabel(mstDict.lookup("globalIndex"));
mstFileGood = true; mstFileGood = true;
} }
} }
@ -534,6 +587,7 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes
( (
Time::findTimes(currentPath), Time::findTimes(currentPath),
globalOffset, globalOffset,
globalIndex,
superLoop, superLoop,
solverDomain solverDomain
); );
@ -609,7 +663,7 @@ bool Foam::multiSolver::loadTimeClusterList
const Foam::timeClusterList& tcl, const Foam::timeClusterList& tcl,
const bool useGlobalTime, const bool useGlobalTime,
const bool loadStoreFields const bool loadStoreFields
) const )
{ {
if (!nonOverlapping(tcl, useGlobalTime)) return false; if (!nonOverlapping(tcl, useGlobalTime)) return false;
@ -628,17 +682,15 @@ bool Foam::multiSolver::loadTimeClusterList
currentPath/il[Time::findClosestTimeIndex(il, -1.0)].name() currentPath/il[Time::findClosestTimeIndex(il, -1.0)].name()
); );
setSolverDomainPostProcessing(tcl[i].solverDomainName());
if if
( (
loadStoreFields loadStoreFields
&& solverDomains_ && currentSolverDomainDict_.found("storeFields")
.subDict(tcl[i].solverDomainName())
.found("storeFields")
) )
{ {
storeFields = wordList(solverDomains_ storeFields = wordList(currentSolverDomainDict_.lookup("storeFields"));
.subDict(tcl[i].solverDomainName())
.lookup("storeFields"));
} }
else 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 instantList& times,
const scalar globalOffset, const scalar globalOffset,
const label globalIndex,
const label superLoop, const label superLoop,
const word& solverDomainName, const word& solverDomainName,
const word& preConName const word& preConName
@ -48,6 +49,7 @@ Foam::timeCluster::timeCluster
: :
instantList(times), instantList(times),
globalOffset_(globalOffset), globalOffset_(globalOffset),
globalIndex_(globalIndex),
superLoop_(superLoop), superLoop_(superLoop),
solverDomainName_(solverDomainName), solverDomainName_(solverDomainName),
preConName_(preConName) preConName_(preConName)
@ -61,6 +63,7 @@ Foam::timeCluster::timeCluster
: :
instantList(1, tc[index]), instantList(1, tc[index]),
globalOffset_(tc.globalOffset_), globalOffset_(tc.globalOffset_),
globalIndex_(tc.globalIndex_),
superLoop_(tc.superLoop_), superLoop_(tc.superLoop_),
solverDomainName_(tc.solverDomainName_), solverDomainName_(tc.solverDomainName_),
preConName_(tc.preConName_) preConName_(tc.preConName_)
@ -71,6 +74,7 @@ Foam::timeCluster::timeCluster(const Foam::scalar t)
: :
instantList(1, instant(0)), instantList(1, instant(0)),
globalOffset_(0), globalOffset_(0),
globalIndex_(0),
superLoop_(0), superLoop_(0),
solverDomainName_(word::null), solverDomainName_(word::null),
preConName_(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) Foam::Istream& Foam::operator>>(Istream& is, timeCluster& I)
{ {
return is >> I.globalOffset_ return is >> I.globalOffset_
>> I.globalIndex_
>> I.superLoop_ >> I.superLoop_
>> I.solverDomainName_ >> I.solverDomainName_
>> I.preConName_ >> I.preConName_
@ -233,11 +238,11 @@ Foam::Istream& Foam::operator>>(Istream& is, timeCluster& I)
Foam::Ostream& Foam::operator<<(Ostream& os, const timeCluster& I) Foam::Ostream& Foam::operator<<(Ostream& os, const timeCluster& I)
{ {
return os << "/* globalOffset: */\t" << I.globalOffset_ << nl return os << "/* globalOffset: */\t" << I.globalOffset_ << nl
<< "/* globalIndex: */\t" << I.globalIndex_ << nl
<< "/* superLoop: */\t" << I.superLoop_ << nl << "/* superLoop: */\t" << I.superLoop_ << nl
<< "/* solverDomain: */\t" << I.solverDomainName_ << nl << "/* solverDomain: */\t" << I.solverDomainName_ << nl
<< "/* preConName: */\t" << I.preConName_ << nl << "/* preConName: */\t" << I.preConName_ << nl
<< "/* Instant list: */\t" << I.times(); << "/* Instant list: */\t" << I.times();
} }
// ************************************************************************* // // ************************************************************************* //

View file

@ -72,6 +72,7 @@ class timeCluster
// Private data // Private data
scalar globalOffset_; scalar globalOffset_;
label globalIndex_;
label superLoop_; label superLoop_;
word solverDomainName_; word solverDomainName_;
@ -110,6 +111,7 @@ public:
( (
const instantList& times, const instantList& times,
const scalar globalOffset, const scalar globalOffset,
const label globalIndex,
const label superLoop, const label superLoop,
const word& solverDomainName, const word& solverDomainName,
const word& preConName = word::null const word& preConName = word::null
@ -143,6 +145,11 @@ public:
inline scalar& globalOffset(); inline scalar& globalOffset();
//- Global index
inline label globalIndex() const;
inline label& globalIndex();
//- SuperLoop //- SuperLoop
inline label superLoop() const; inline label superLoop() const;
@ -228,6 +235,8 @@ public:
#include "timeClusterI.H" #include "timeClusterI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View file

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

View file

@ -151,6 +151,4 @@ Foam::timeClusterList Foam::timeClusterList::selectiveSubList
return tcl; 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++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.5-dev | | \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Revision: exported | | \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | Web: http://www.OpenFOAM.org | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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