From 9630e8099e68390ce884c1dbf7be1f2cb1edf5b5 Mon Sep 17 00:00:00 2001 From: "David L. F. Gaden" Date: Thu, 29 Aug 2013 17:04:32 -0500 Subject: [PATCH 1/2] Update multiSolver libraries --- .../multiSolver/multiSolverDemo/Make/options | 3 +- .../multiSolverDemo/multiSolverDemo.C | 7 +- .../multiSolverDemo/solverIcoFoam.H | 2 +- .../solverScalarTransportFoam.H | 8 +- .../postProcessing/multiSolver/Make/options | 3 +- .../postProcessing/multiSolver/multiSolver.C | 52 +- src/Allwmake | 1 - src/multiSolver/Make/files | 1 + src/multiSolver/Make/options | 6 - .../dummyControlDict/dummyControlDict.C | 1 - .../dummyControlDict/dummyControlDict.H | 4 +- src/multiSolver/include/endMultiSolver.H | 4 +- src/multiSolver/include/multiSolverVersion.H | 6 + src/multiSolver/include/setSolverDomain.H | 2 +- src/multiSolver/multiSolver/multiSolver.C | 601 ++++++++++++++---- src/multiSolver/multiSolver/multiSolver.H | 211 ++++-- src/multiSolver/multiSolver/multiSolverI.H | 33 +- src/multiSolver/multiSolver/multiSolverInit.H | 14 +- .../multiSolver/multiSolverSetControls.C | 41 +- .../multiSolverSetInitialSolverDomain.C | 159 ++--- .../multiSolverSetNextSolverDomain.C | 81 ++- .../multiSolver/multiSolverTimeFunctions.C | 122 ++-- src/multiSolver/multiTime/multiTime.C | 103 +++ src/multiSolver/multiTime/multiTime.H | 126 ++++ src/multiSolver/timeCluster/timeCluster.C | 7 +- src/multiSolver/timeCluster/timeCluster.H | 33 +- src/multiSolver/timeCluster/timeClusterI.H | 10 + src/multiSolver/timeCluster/timeClusterList.C | 10 +- src/multiSolver/timeCluster/timeClusterList.H | 8 +- tutorials/multiSolver/README | 73 +++ .../constant/polyMesh/blockMeshDict | 10 +- .../teeFitting2d/constant/polyMesh/boundary | 8 +- .../teeFitting2d/constant/transportProperties | 6 +- .../constant/multiTransportProperties | 32 + .../constant/polyMesh/blockMeshDict | 90 +++ .../constant/polyMesh/boundary | 58 ++ .../constant/transportProperties | 21 + .../multiSolver/icoFoam1/initial/0/T | 52 ++ .../multiSolver/icoFoam1/initial/0/U | 55 ++ .../multiSolver/icoFoam1/initial/0/p | 52 ++ .../multiSolver/icoFoam2/initial/0/T | 52 ++ .../multiSolver/icoFoam2/initial/0/U | 54 ++ .../multiSolver/icoFoam2/initial/0/p | 53 ++ .../scalarTransportFoam/initial/0/T | 52 ++ .../scalarTransportFoam/initial/0/U | 54 ++ .../parTeeFitting2d/system/controlDict | 47 ++ .../parTeeFitting2d/system/decomposeParDict | 44 ++ .../parTeeFitting2d/system/fvSchemes | 60 ++ .../parTeeFitting2d/system/fvSolution | 45 ++ .../parTeeFitting2d/system/multiControlDict | 70 ++ .../parTeeFitting2d/system/multiFvSchemes | 150 +++++ .../parTeeFitting2d/system/multiFvSolution | 100 +++ .../teeFitting2d/system/controlDict | 6 +- .../teeFitting2d/system/decomposeParDict | 44 ++ .../teeFitting2d/system/fvSchemes | 6 +- .../teeFitting2d/system/fvSolution | 6 +- .../teeFitting2d/system/multiFvSolution | 2 +- 57 files changed, 2487 insertions(+), 474 deletions(-) create mode 100644 src/multiSolver/include/multiSolverVersion.H create mode 100644 src/multiSolver/multiTime/multiTime.C create mode 100644 src/multiSolver/multiTime/multiTime.H create mode 100644 tutorials/multiSolver/README create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/multiTransportProperties create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/polyMesh/blockMeshDict create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/polyMesh/boundary create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/transportProperties create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/T create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/U create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/p create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/T create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/U create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/p create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/scalarTransportFoam/initial/0/T create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/scalarTransportFoam/initial/0/U create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/controlDict create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/decomposeParDict create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/fvSchemes create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/fvSolution create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiControlDict create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiFvSchemes create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiFvSolution create mode 100644 tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/decomposeParDict diff --git a/applications/solvers/multiSolver/multiSolverDemo/Make/options b/applications/solvers/multiSolver/multiSolverDemo/Make/options index 685f625d6..78cccd6b8 100644 --- a/applications/solvers/multiSolver/multiSolverDemo/Make/options +++ b/applications/solvers/multiSolver/multiSolverDemo/Make/options @@ -1,7 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/multiSolver/lnInclude \ - -I$(LIB_SRC)/multiSolver/multiSolver + -I../../../../src/multiSolver/lnInclude EXE_LIBS = \ -lfiniteVolume \ diff --git a/applications/solvers/multiSolver/multiSolverDemo/multiSolverDemo.C b/applications/solvers/multiSolver/multiSolverDemo/multiSolverDemo.C index 83a48db6e..38addae20 100644 --- a/applications/solvers/multiSolver/multiSolverDemo/multiSolverDemo.C +++ b/applications/solvers/multiSolver/multiSolverDemo/multiSolverDemo.C @@ -26,7 +26,8 @@ Application multiSolverDemo Description - Demonstration multiSolver-enabled application. + Combination of icoFoam and scalarTransportFoam for testing of new multiTime + framework. Author David L. F. Gaden @@ -61,8 +62,10 @@ int main(int argc, char *argv[]) # include "solverScalarTransportFoam.H" + // Only necessary if we revisit the same solver domain twice in the same + // superLoop (scalarTransportFoam, in this case) multiRun++; - + // * * * * * * * * * * * * * * * * icoFoam2 * * * * * * * * * * * * * * * * // Info << "*** Switching to icoFoam2 ***\n" << endl; diff --git a/applications/solvers/multiSolver/multiSolverDemo/solverIcoFoam.H b/applications/solvers/multiSolver/multiSolverDemo/solverIcoFoam.H index 1fedb60d0..f62ba240e 100644 --- a/applications/solvers/multiSolver/multiSolverDemo/solverIcoFoam.H +++ b/applications/solvers/multiSolver/multiSolverDemo/solverIcoFoam.H @@ -31,7 +31,7 @@ volScalarField rUA = 1.0/UEqn.A(); U = rUA*UEqn.H(); - phi = (fvc::interpolate(U) & mesh.Sf()) + phi = (fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, U, phi); adjustPhi(phi, U, p); diff --git a/applications/solvers/multiSolver/multiSolverDemo/solverScalarTransportFoam.H b/applications/solvers/multiSolver/multiSolverDemo/solverScalarTransportFoam.H index dc47ae4d0..024effd64 100644 --- a/applications/solvers/multiSolver/multiSolverDemo/solverScalarTransportFoam.H +++ b/applications/solvers/multiSolver/multiSolverDemo/solverScalarTransportFoam.H @@ -12,7 +12,13 @@ { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readSIMPLEControls.H" + dictionary simple = mesh.solutionDict().subDict("SIMPLE"); + + int nNonOrthCorr = + simple.lookupOrDefault("nNonOrthogonalCorrectors", 0); + + bool momentumPredictor = + simple.lookupOrDefault("momentumPredictor", true); for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/utilities/postProcessing/multiSolver/Make/options b/applications/utilities/postProcessing/multiSolver/Make/options index d08b2e20d..f67337ce3 100644 --- a/applications/utilities/postProcessing/multiSolver/Make/options +++ b/applications/utilities/postProcessing/multiSolver/Make/options @@ -1,7 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/multiSolver/lnInclude \ - -I$(LIB_SRC)/multiSolver/multiSolver + -I../../../../src/multiSolver/lnInclude EXE_LIBS = \ -lfiniteVolume \ diff --git a/applications/utilities/postProcessing/multiSolver/multiSolver.C b/applications/utilities/postProcessing/multiSolver/multiSolver.C index 68ce743dc..744a77ebc 100644 --- a/applications/utilities/postProcessing/multiSolver/multiSolver.C +++ b/applications/utilities/postProcessing/multiSolver/multiSolver.C @@ -49,11 +49,18 @@ void parseOptions IStringStream optionsStream(options); label nSolverDomains(0); label nSuperLoops(0); - + // Get solverDomainNames, if any while (not optionsStream.eof()) { token nextOption(optionsStream); + + // Bug workaround + if (nextOption.type() == token::ERROR) + { + break; + } + if (nextOption.isLabel()) { ptrSuperLoops->setSize(++nSuperLoops); @@ -76,18 +83,25 @@ void parseOptions << abort(FatalError); } } - + // Get superLoopList while (not optionsStream.eof()) { token nextOption(optionsStream); + + // Bug workaround + if (nextOption.type() == token::ERROR) + { + break; + } + if (nextOption.isLabel()) { ptrSuperLoops->setSize(++nSuperLoops); ptrSuperLoops->operator[](nSuperLoops - 1) = nextOption.labelToken(); } - else if (nSuperLoops > 0) + else if (nSuperLoops > 0) { // might be a range -> label : label @@ -104,7 +118,7 @@ void parseOptions ( ptrSuperLoops->operator[](nSuperLoops - 1) ); - + if (toValue > fromValue) { // correct range format @@ -182,20 +196,20 @@ int main(int argc, char *argv[]) argList::validOptions.insert("postDecompose", ""); argList::validOptions.insert("preReconstruct", ""); argList::validOptions.insert("postReconstruct", ""); - + argList::validOptions.insert("global",""); argList::validOptions.insert("local",""); - + // default behaviour is purge the case/[time] directory before '-load' // command. '-noPurge' prevents this. Allows for more complicated // load data selections by executing multiSolver several times argList::validOptions.insert("noPurge",""); - + // default behaviour is: if there is only one solverDomain specified, use // setSolverDomain() on it. Same as multiSolver -set solverDomain. // '-noSet' prevents this. argList::validOptions.insert("noSet",""); - + // default behaviour is: if there are storeFields defined, when loading, it // will copy the store fields into every time instance where they are // absent. '-noStore' will prevent this. @@ -224,7 +238,7 @@ int main(int argc, char *argv[]) bool noSet = false; bool noStore = false; label nCommands(0); - + // Read arguments if (args.optionFound("list")) { @@ -331,7 +345,7 @@ int main(int argc, char *argv[]) args.rootPath(), args.caseName() ); - + const IOdictionary& mcd(multiRun.multiControlDict()); wordList solverDomains(0); labelList superLoops(0); @@ -420,7 +434,7 @@ int main(int argc, char *argv[]) { // Incorrect solver domain name FatalErrorIn("multiSolver::main") - << "solverDomainName " << solverDomains[i] << " is not " + << "solverDomainName " << solverDomains[i] << "is not " << "found." << abort(FatalError); } @@ -504,7 +518,7 @@ int main(int argc, char *argv[]) << "No data found with specified parameters." << abort(FatalError); } - } + } switch (command) { @@ -517,7 +531,7 @@ int main(int argc, char *argv[]) ( multiRun.multiDictRegistry().path()/"multiSolver" ); - + forAll(solverDomains, i) { if (solverDomains[i] == "default") continue; @@ -561,7 +575,7 @@ int main(int argc, char *argv[]) << endl; multiRun.purgeTimeDirs(multiRun.multiDictRegistry().path()); } - + Info << "Loading data from multiSolver directories to case root" << endl; if @@ -634,7 +648,7 @@ int main(int argc, char *argv[]) ( dirEntries[de] ); - + // Copy system to processorN cp ( @@ -642,7 +656,7 @@ int main(int argc, char *argv[]) /multiRun.multiDictRegistry().system(), multiRun.multiDictRegistry().path()/dirEntries[de] ); - + // Copy constant/files to processorN/constant fileNameList constantContents ( @@ -664,7 +678,7 @@ int main(int argc, char *argv[]) /multiRun.multiDictRegistry().constant() ); } - + // Copy constant/directories to processorN/constant constantContents = readDir ( @@ -731,7 +745,7 @@ int main(int argc, char *argv[]) Info << "Purging preconditioned time directories" << endl; - + // Clean up extra time directories fileNameList dirEntries ( @@ -758,7 +772,7 @@ int main(int argc, char *argv[]) // Execute set command - either from an explicit '-set' or from a '-load' // with only one solverDomain as an option - if + if ( (command == set) || ( diff --git a/src/Allwmake b/src/Allwmake index a4e102586..29d78084e 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -67,5 +67,4 @@ fvAgglomerationMethods/Allwmake wmake libso engine wmake libso multiSolver - # ----------------------------------------------------------------- end-of-file diff --git a/src/multiSolver/Make/files b/src/multiSolver/Make/files index eb2f99562..06f0ae6d2 100644 --- a/src/multiSolver/Make/files +++ b/src/multiSolver/Make/files @@ -1,4 +1,5 @@ dummyControlDict/dummyControlDict.C +multiTime/multiTime.C multiSolver/multiSolver.C timeCluster/timeCluster.C timeCluster/timeClusterList.C diff --git a/src/multiSolver/Make/options b/src/multiSolver/Make/options index 35e429d68..e69de29bb 100644 --- a/src/multiSolver/Make/options +++ b/src/multiSolver/Make/options @@ -1,6 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -Ituple2Lists - -LIB_LIBS = \ - -lfiniteVolume diff --git a/src/multiSolver/dummyControlDict/dummyControlDict.C b/src/multiSolver/dummyControlDict/dummyControlDict.C index 48c8cf6ab..3a4741880 100644 --- a/src/multiSolver/dummyControlDict/dummyControlDict.C +++ b/src/multiSolver/dummyControlDict/dummyControlDict.C @@ -108,4 +108,3 @@ Foam::dummyControlDict::~dummyControlDict() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - diff --git a/src/multiSolver/dummyControlDict/dummyControlDict.H b/src/multiSolver/dummyControlDict/dummyControlDict.H index feff8bcdc..b32f04130 100644 --- a/src/multiSolver/dummyControlDict/dummyControlDict.H +++ b/src/multiSolver/dummyControlDict/dummyControlDict.H @@ -72,7 +72,7 @@ public: //- Construct, reading the multiControlDict data from a file explicit dummyControlDict(const fileName&); - + //- Construct given the multiControlDict dictionary explicit dummyControlDict(const dictionary&); @@ -90,3 +90,5 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/multiSolver/include/endMultiSolver.H b/src/multiSolver/include/endMultiSolver.H index 3ca84c21f..9a389b6b8 100644 --- a/src/multiSolver/include/endMultiSolver.H +++ b/src/multiSolver/include/endMultiSolver.H @@ -1,3 +1,3 @@ - } // previous solver domain goes out of scope - multiRun++; + } // previous solver domain goes out of scope + multiRun++; } // end While loop diff --git a/src/multiSolver/include/multiSolverVersion.H b/src/multiSolver/include/multiSolverVersion.H new file mode 100644 index 000000000..57a67be4e --- /dev/null +++ b/src/multiSolver/include/multiSolverVersion.H @@ -0,0 +1,6 @@ +#ifndef multiSolverVersion_H +# define multiSolverVersion_H +# define multiSolverVersionMajor 0 +# define multiSolverVersionMinor 6 +# define multiSolverVersionBuild 0 +#endif diff --git a/src/multiSolver/include/setSolverDomain.H b/src/multiSolver/include/setSolverDomain.H index 178915d7d..52b2a5a33 100644 --- a/src/multiSolver/include/setSolverDomain.H +++ b/src/multiSolver/include/setSolverDomain.H @@ -1,7 +1,7 @@ } // previous solver domain goes out of scope multiRun.setSolverDomain(solverDomain); -// Clear defines that may interfere with other solver domains +// Clear defines that may interfere with other solver domains #undef createPhi_H #undef createPhiV_H #undef initContinuityErrs_H diff --git a/src/multiSolver/multiSolver/multiSolver.C b/src/multiSolver/multiSolver/multiSolver.C index 16fbd38b8..ac1add78c 100644 --- a/src/multiSolver/multiSolver/multiSolver.C +++ b/src/multiSolver/multiSolver/multiSolver.C @@ -38,7 +38,11 @@ namespace Foam template<> -const char* Foam::NamedEnum::names[] = +const char* Foam::NamedEnum +< + Foam::multiSolver::initialStartFromControls, + 9 +>::names[] = { "firstTime", "firstTimeInStartDomain", @@ -56,7 +60,11 @@ const Foam::NamedEnum template<> -const char* Foam::NamedEnum::names[] = +const char* Foam::NamedEnum +< + Foam::multiSolver::finalStopAtControls, + 7 +>::names[] = { "endTime", "endTimeInEndDomain", @@ -110,10 +118,10 @@ void Foam::multiSolver::setUpParallel() if (Pstream::master()) { fileNameList roots(Pstream::nProcs()); - + roots[0] = multiDictRegistry_.rootPath(); manageLocalRoot_ = true; - + // Receive from slaves for ( @@ -125,7 +133,7 @@ void Foam::multiSolver::setUpParallel() IPstream fromSlave(Pstream::blocking, slave); roots[slave] = fileName(fromSlave); } - + // Distribute for ( @@ -179,12 +187,10 @@ void Foam::multiSolver::synchronizeParallel() const } else { - // Receive go signal + // Recieve go signal { IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); - // Quenching compiler warning - // HR, 18/Jul/2013 - readBool(fromMaster); + bool okayToGo(readBool(fromMaster)); } } } @@ -200,15 +206,12 @@ Foam::word Foam::multiSolver::setLocalEndTime() break; case msaNoWriteNow: stopAtSetting = "noWriteNow"; - finished_ = true; break; case msaWriteNow: stopAtSetting = "writeNow"; - finished_ = true; break; case msaNextWrite: stopAtSetting = "nextWrite"; - finished_ = true; break; case msaIterations: endTime_ = deltaT_ * iterations_ + startTime_; @@ -228,7 +231,6 @@ Foam::word Foam::multiSolver::setLocalEndTime() if ((endTime_ + globalTimeOffset_) >= finalEndTime_) { endTime_ = finalEndTime_ - globalTimeOffset_; - finished_ = true; if ((startTime_ + globalTimeOffset_) >= finalEndTime_) { // Initialized beyond end @@ -238,14 +240,13 @@ Foam::word Foam::multiSolver::setLocalEndTime() break; case mfsEndTimeInEndDomain: - if + if ( (currentSolverDomain_ == endDomain_) && (endTime_ >= finalEndTime_) ) { endTime_ = finalEndTime_; - finished_ = true; if (startTime_ >= finalEndTime_) { // Initialized beyond end @@ -263,7 +264,6 @@ Foam::word Foam::multiSolver::setLocalEndTime() ) { endTime_ = finalEndTime_; - finished_ = true; if (startTime_ > finalEndTime_) { // Initialized beyond end @@ -279,25 +279,179 @@ Foam::word Foam::multiSolver::setLocalEndTime() if (superLoop_ > endSuperLoop_) { stopAtSetting = "noWriteNow"; - finished_ = true; } break; case mfsWriteNow: - finished_ = true; stopAtSetting = "writeNow"; break; case mfsNoWriteNow: - finished_ = true; stopAtSetting = "noWriteNow"; break; case mfsNextWrite: stopAtSetting = "nextWrite"; - finished_ = true; break; } return stopAtSetting; } + +bool Foam::multiSolver::checkGlobalEnd() const +{ + if (forcedEnd_) return true; + + /*word stopAtSetting("endTime"); + switch (stopAt_) + { + case msaNoWriteNow: + case msaWriteNow: + case msaNextWrite: + return true; + default: + // do nothing + break; + }*/ + + // Modify endTime_ if it exceeds finalEndTime + switch (finalStopAt_) + { + case mfsEndTime: + if ((startTime_ + globalTimeOffset_) >= finalEndTime_) + { + return true; + } + break; + case mfsEndTimeInEndDomain: + if + ( + (currentSolverDomain_ == endDomain_) + && (startTime_ >= finalEndTime_) + ) + { + return true; + } + break; + case mfsEndTimeInEndDomainInEndSuperLoop: + if (currentSolverDomain_ == endDomain_) + { + if + ( + (superLoop_ >= endSuperLoop_) + && (startTime_ >= finalEndTime_) + ) + { + return true; + } + } + break; + case mfsEndSuperLoop: + if (superLoop_ > endSuperLoop_) + { + return true; + } + break; + case mfsWriteNow: + case mfsNoWriteNow: + case mfsNextWrite: + return true; + } + return false; +} + + +void Foam::multiSolver::buildDictionary +( + dictionary& outputDict, + const dictionary& inputDict, + const word& solverDomainName +) +{ + outputDict.remove("sameAs"); + outputDict.remove("multiLoad"); + wordList alreadyMerged(0); + wordList mergeMe(0); + if (inputDict.found("default")) + { + if (outputDict.found("multiLoad")) + { + mergeMe = wordList(outputDict.lookup("multiLoad")); + outputDict.remove("multiLoad"); + } + if (outputDict.found("sameAs")) + { + label newIndex(mergeMe.size()); + mergeMe.setSize(newIndex + 1); + mergeMe[newIndex] = word(outputDict.lookup("sameAs")); + outputDict.remove("sameAs"); + } + } + + // We load solverDomain last, but we need its sameAs / multiLoad now + if (inputDict.found(solverDomainName)) + { + const dictionary& solverDict(inputDict.subDict(solverDomainName)); + if (solverDict.found("multiLoad")) + { + mergeMe.append(wordList(solverDict.lookup("multiLoad"))); + } + if (solverDict.found("sameAs")) + { + label newIndex(mergeMe.size()); + mergeMe.setSize(newIndex + 1); + mergeMe[newIndex] = word(solverDict.lookup("sameAs")); + } + } + + label mergeI(-1); + while ((mergeI + 1) < mergeMe.size()) + { + mergeI++; + bool skipMe(false); + forAll(alreadyMerged, alreadyI) + { + if (mergeMe[mergeI] == alreadyMerged[alreadyI]) + { + skipMe = true; + break; + } + } + if (skipMe) + { + break; + } + outputDict.merge(inputDict.subDict(mergeMe[mergeI])); + + // Add to alreadyMerged + label mergedIndex(alreadyMerged.size()); + alreadyMerged.setSize(mergedIndex + 1); + alreadyMerged[mergedIndex] = mergeMe[mergeI]; + + // Recursive search + if (outputDict.found("multiLoad")) + { + mergeMe.append(wordList(outputDict.lookup("multiLoad"))); + outputDict.remove("multiLoad"); + } + if (outputDict.found("sameAs")) + { + label newMergeMeIndex(mergeMe.size()); + mergeMe.setSize(newMergeMeIndex + 1); + mergeMe[newMergeMeIndex] = word(outputDict.lookup("sameAs")); + outputDict.remove("sameAs"); + } + } + + // Merge the solverDomain name, even if it already has merged + if (inputDict.found(solverDomainName)) + { + outputDict.merge(inputDict.subDict(solverDomainName)); + + // These have been handled already + outputDict.remove("sameAs"); + outputDict.remove("multiLoad"); + } +} + + void Foam::multiSolver::checkTimeDirectories() const { forAll(prefixes_, i) @@ -310,6 +464,9 @@ void Foam::multiSolver::checkTimeDirectories() const << "multiControlDict. These two names are prohibitted." << abort(FatalError); } + // Nolonger checking for initial directories - allows for virtual + // solverDomains + /* fileName checkMe ( multiDictRegistry_.path()/"multiSolver"/prefixes_[i]/"initial/0" @@ -323,7 +480,7 @@ void Foam::multiSolver::checkTimeDirectories() const << "Initial time directory missing for solver domain [" << prefixes_[i] << "]. Expecting " << checkMe << abort(FatalError); - } + }*/ } } @@ -345,50 +502,34 @@ void Foam::multiSolver::swapDictionaries(const word& solverDomainName) false ) ); - if (multiDicts_[i].subDict("multiSolver").found("default")) - { - newMultiDict.merge - ( - multiDicts_[i].subDict("multiSolver").subDict("default") - ); - } - - if (multiDicts_[i].subDict("multiSolver").found(solverDomainName)) - { - if (multiDicts_[i].subDict("multiSolver") - .subDict(solverDomainName).found("sameAs")) - { - word sameAsSolverDomain(multiDicts_[i].subDict("multiSolver") - .subDict(solverDomainName).lookup("sameAs")); - if (multiControlDict_.subDict("solverDomains") - .found(sameAsSolverDomain)) - { - newMultiDict.merge - ( - 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) - ); - } + + buildDictionary + ( + newMultiDict, + multiDicts_[i].subDict("multiSolver"), + solverDomainName + ); newMultiDict.regIOobject::write(); } + + if + ( + exists + ( + multiDictRegistry_.path()/multiDictRegistry_.constant() + /"polyMesh"/"boundary." + solverDomainName + ) + ) + { + cp + ( + multiDictRegistry_.path()/multiDictRegistry_.constant() + /"polyMesh"/"boundary." + solverDomainName, + multiDictRegistry_.path()/multiDictRegistry_.constant() + /"polyMesh"/"boundary" + ); + } } @@ -420,7 +561,7 @@ void Foam::multiSolver::swapBoundaryConditions ( readDir(dataSourcePath, fileName::FILE) ); - + word headerClassName; forAll(dirEntries, i) { @@ -444,7 +585,7 @@ void Foam::multiSolver::swapBoundaryConditions dictionary bcDict(bc); dictionary dataDict(data); - + if ( !bcDict.found("dimensions") @@ -470,7 +611,7 @@ void Foam::multiSolver::swapBoundaryConditions << bcDims << " and the previous domain has " << dataDims << "." << abort(FatalError); } - + dictionary outputDict(bcDict); outputDict.set("internalField", dataDict.lookup("internalField")); @@ -479,43 +620,57 @@ void Foam::multiSolver::swapBoundaryConditions wordList bcPatches(bcDict.subDict("boundaryField").toc()); sort(dataPatches); sort(bcPatches); - + if (dataPatches.size() != bcPatches.size()) { - FatalErrorIn("multiSolver::swapBoundaryConditions") - << "Boundary fields do not match. Solver domain [" + WarningIn("multiSolver::swapBoundaryConditions") + << "Boundary fields do not match. Solver domain [" << intoSolverDomain << "] has " << bcPatches.size() << " patches " - << "and the previous domain has " << dataPatches.size() << "." - << abort(FatalError); + << ", and the previous domain has " << dataPatches.size() << "." + << endl; } forAll(dataPatches, j) { - if (dataPatches[j] != bcPatches[j]) + label offset(0); + while (dataPatches[j] != bcPatches[j + offset]) + { + if ((j + offset) == bcPatches.size()) + { + FatalErrorIn("multiSolver::swapBoundaryConditions") + << "Boundary fields do not match. Solver domain [" + << intoSolverDomain << "] has:" << bcPatches + << " and the previous domain has:" << dataPatches << "." + << abort(FatalError); + } + offset++; + } + /*if (dataPatches[j] != bcPatches[j]) { FatalErrorIn("multiSolver::swapBoundaryConditions") - << "Boundary fields do not match. Solver domain [" + << "Boundary fields do not match. Solver domain [" << intoSolverDomain << "] has:" << bcPatches << " patches " << "and the previous domain has:" << dataPatches << "." << abort(FatalError); - } + }*/ if (exists(firstDataSourcePath/dirEntries[i])) { IFstream firstDataStream(firstDataSourcePath/dirEntries[i]); dictionary firstDict(firstDataStream); - + // Check for 'multiSolverRemembering' entries, copy them from // the earliest time (this superLoop) to the outputDict if ( firstDict.subDict("boundaryField") - .subDict(bcPatches[j]).found("multiSolverRemembering") + .subDict(bcPatches[j + offset]) + .found("multiSolverRemembering") ) { wordList msr ( firstDict.subDict("boundaryField") - .subDict(bcPatches[j]) + .subDict(bcPatches[j + offset]) .lookup("multiSolverRemembering") ); forAll(msr, k) @@ -529,24 +684,24 @@ void Foam::multiSolver::swapBoundaryConditions ) << "'multiSolverRemember' word '" << msr[k] << "' missing from boundary patch '" - << dataPatches[j] << "' while switching to " - << currentSolverDomain_ << ". This may be " - << "the result of manual editting datafiles " - << "or data corruption. If the problem " - << "persists, this is a bug." + << dataPatches[j] << "' while " + << "switching to " << currentSolverDomain_ + << ". This may be the result of manual " + << "editting datafiles or data corruption. " + << "If the problem persists, this is a bug." << exit(FatalIOError); } outputDict.subDict("boundaryField") - .subDict(bcPatches[j]).set + .subDict(bcPatches[j + offset]).set ( msr[k], firstDict.subDict("boundaryField") - .subDict(bcPatches[j]).lookup(msr[k]) + .subDict(bcPatches[j + offset]).lookup(msr[k]) ); } outputDict.subDict("boundaryField") - .subDict(bcPatches[j]).set + .subDict(bcPatches[j + offset]).set ( "multiSolverRemembering", msr @@ -563,14 +718,15 @@ void Foam::multiSolver::swapBoundaryConditions if ( icDict.subDict("boundaryField") - .subDict(bcPatches[j]).found("multiSolverRemember") + .subDict(bcPatches[j + offset]) + .found("multiSolverRemember") ) { wordList remember ( icDict .subDict("boundaryField") - .subDict(bcPatches[j]) + .subDict(bcPatches[j + offset]) .lookup("multiSolverRemember") ); @@ -584,19 +740,20 @@ void Foam::multiSolver::swapBoundaryConditions dataDict ) << "'multiSolverRemember' wordList found, " - << "but keyword '" << remember[k] << "' not" - << "present in dictionary for " + << "but keyword '" << remember[k] + << "' not present in dictionary for " << dirEntries[i] << exit(FatalIOError); } - + outputDict .subDict("boundaryField") - .subDict(bcPatches[j]).set + .subDict(bcPatches[j + offset]).set ( remember[j], dataDict.subDict("boundaryField") - .subDict(bcPatches[j]).lookup(remember[k]) + .subDict(bcPatches[j + offset]) + .lookup(remember[k]) ); } @@ -605,14 +762,14 @@ void Foam::multiSolver::swapBoundaryConditions if ( firstDict.subDict("boundaryField") - .subDict(bcPatches[j]) + .subDict(bcPatches[j + offset]) .found("multiSolverRemembering") ) { wordList msr ( firstDict.subDict("boundaryField") - .subDict(bcPatches[j]) + .subDict(bcPatches[j + offset]) .lookup("multiSolverRemembering") ); remembering.setSize(remember.size() + msr.size()); @@ -621,10 +778,10 @@ void Foam::multiSolver::swapBoundaryConditions remembering[remember.size() + l] = msr[l]; } } - + outputDict .subDict("boundaryField") - .subDict(bcPatches[j]).set + .subDict(bcPatches[j + offset]).set ( "multiSolverRemembering", remembering @@ -653,7 +810,7 @@ void Foam::multiSolver::swapBoundaryConditions IOobject::writeDivider(os); os << endl; - outputDict.write(os); + outputDict.write(os, false); } // end cycle through files } @@ -668,7 +825,7 @@ void Foam::multiSolver::readAllMultiDicts() ( multiDictRegistry_.path()/multiDictRegistry_.constant() ); - + label done(0); while (done <= 0) { @@ -696,7 +853,7 @@ void Foam::multiSolver::readAllMultiDicts() constantPath, fileName::DIRECTORY ); - + forAll(dirEntries, i) { readMultiDictDirectory @@ -705,7 +862,7 @@ void Foam::multiSolver::readAllMultiDicts() dirEntries[i] ); } - + // Add local root for parallel runs and repeat if (manageLocalRoot_) { @@ -750,7 +907,7 @@ void Foam::multiSolver::readMultiDictDirectory { IFstream is(sourcePath/dirEntries[i]); dictionary candidate(is); - + if ( candidate.found("dictionaryName") @@ -796,7 +953,7 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile const instant& inst ) const { - // solverDomain@superLoop@globalOffset@preConName + // solverDomain@superLoop@globalOffset@globalIndex@preConName # ifdef FULLDEBUG if (!pcFile.size()) { @@ -849,11 +1006,31 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile } # endif + // Find fourth @ + string::size_type fourth = pcFile + ( + first + second + third + 3, + pcFile.size() - first - second - third - 3 + ).find("@"); + +# ifdef FULLDEBUG + if + ( + third == string::npos + || pcFile.size() == first + second + third + fourth + 4 + ) + { + FatalErrorIn("multiSolver::parseConditionedFile") + << "Bad preConditioned fileName: " << pcFile + << abort(FatalError); + } +# endif + word solverDomain ( pcFile(first) ); - + IStringStream superLoopStream(pcFile(first + 1, second)); token superLoopToken(superLoopStream); @@ -870,7 +1047,7 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile ( superLoopToken.labelToken() ); - + IStringStream globalOffsetStream(pcFile(first + second + 2, third)); token globalOffsetToken(globalOffsetStream); @@ -888,19 +1065,40 @@ Foam::timeCluster Foam::multiSolver::parseConditionedFile globalOffsetToken.number() ); + IStringStream globalIndexStream + ( + pcFile(first + second + third + 3, fourth) + ); + token globalIndexToken(globalIndexStream); + +# ifdef FULLDEBUG + if (!globalIndexToken.isLabel() || !globalIndexStream.eof()) + { + FatalErrorIn("multiSolver::parseConditionedFile") + << "Bad preConditioned fileName: " << pcFile + << abort(FatalError); + } +# endif + + label globalIndex + ( + globalIndexToken.labelToken() + ); + word preConName ( pcFile ( - first + second + third + 3, - pcFile.size() - first - second - third - 3 + first + second + third + fourth + 4, + pcFile.size() - first - second - third - fourth - 4 ) ); - + return timeCluster ( instantList(1, inst), globalOffset, + globalIndex, superLoop, solverDomain, preConName @@ -917,11 +1115,12 @@ Foam::multiSolver::multiSolver const fileName& rootPath, const fileName& caseName, const word& systemName, - const word& constantName + const word& constantName, + bool showSplash ) : dcd_(dict), - + multiDictRegistry_ ( dcd_, @@ -930,7 +1129,7 @@ Foam::multiSolver::multiSolver systemName, constantName ), - + multiControlDict_ ( IOobject @@ -946,6 +1145,20 @@ Foam::multiSolver::multiSolver ), #include "multiSolverInit.H" { + if (showSplash) + { + Info + << "/* |---------------------." << token::NL + << " * This application uses | David L. F. Gaden's | " + << "Please cite me if possible" << token::NL + << " * .----------------|---------------------' " + << "See the wiki for more info" << token::NL + << " * | multiSolver | Version: " << version() + << token::NL + << " * '----------------| " + << "github.com/Marupio/multiSolver/wiki" << token::NL + << " */" << endl; + } if (Pstream::parRun()) { setUpParallel(); @@ -962,11 +1175,12 @@ Foam::multiSolver::multiSolver const fileName& rootPath, const fileName& caseName, const word& systemName, - const word& constantName + const word& constantName, + bool showSplash ) : dcd_(rootPath/caseName/systemName/multiControlDictName), - + multiDictRegistry_ ( dcd_, @@ -990,6 +1204,20 @@ Foam::multiSolver::multiSolver ), #include "multiSolverInit.H" { + if (showSplash) + { + Info + << "/* |---------------------." << token::NL + << " * This application uses | David L. F. Gaden's | " + << "Please cite me if possible" << token::NL + << " * .----------------|---------------------' " + << "See the wiki for more info" << token::NL + << " * | multiSolver | Version: " << version() + << token::NL + << " * '----------------| " + << "github.com/Marupio/multiSolver/wiki" << token::NL + << " */" << endl; + } if (Pstream::parRun()) { setUpParallel(); @@ -1008,6 +1236,17 @@ Foam::multiSolver::~multiSolver() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::word Foam::multiSolver::version() const +{ + OStringStream os; + os << label(multiSolverVersionMajor) << "." + << label(multiSolverVersionMinor) << "." + << label(multiSolverVersionBuild); + + return word(os.str()); +} + + void Foam::multiSolver::preCondition(const word& processor) { fileName path(multiDictRegistry_.path()); @@ -1028,7 +1267,7 @@ void Foam::multiSolver::preCondition(const word& processor) forAll(tclSource, tc) { forAll(tclSource[tc], inst) - { + { fileName sourcePath; fileName destPath; @@ -1050,7 +1289,7 @@ void Foam::multiSolver::preCondition(const word& processor) destPath = path/tclSource[tc][inst].name(); } mkDir(destPath); - + fileNameList rootFiles ( readDir(sourcePath, fileName::FILE) @@ -1066,16 +1305,16 @@ void Foam::multiSolver::preCondition(const word& processor) + "@" + rootFiles[rf] ); } - + fileNameList subDirs ( readDir(sourcePath, fileName::DIRECTORY) ); - + forAll(subDirs, sd) { mkDir(destPath/subDirs[sd]); - + fileNameList subDirFiles ( readDir(sourcePath/subDirs[sd], fileName::FILE) @@ -1135,7 +1374,7 @@ void Foam::multiSolver::postCondition(const word& processor) ( path/times[t].name() ); - + // If timeFormat is not general, it will miss the -1 initial directory if (!exists(sourcePath)) { @@ -1148,7 +1387,7 @@ void Foam::multiSolver::postCondition(const word& processor) continue; } } - + // Root files first fileNameList rootFiles ( @@ -1197,7 +1436,8 @@ void Foam::multiSolver::postCondition(const word& processor) ) ); multiSolverTime.set("globalOffset", tcSubject.globalOffset()); - + multiSolverTime.set("globalIndex", tcSubject.globalIndex()); + // Write multiSolverTime to the case/constant directory, then // move to destination path multiSolverTime.regIOobject::write(); @@ -1219,7 +1459,7 @@ void Foam::multiSolver::postCondition(const word& processor) ( readDir(sourcePath, fileName::DIRECTORY) ); - + forAll(subDirs, sd) { fileNameList subDirFiles @@ -1262,11 +1502,104 @@ void Foam::multiSolver::postCondition(const word& processor) } +Foam::timeCluster Foam::multiSolver::initialDataSource() const +{ + timeCluster tcSource; + switch (initialStartFrom_) + { + case misFirstTime: + tcSource = findClosestGlobalTime + ( + 0, readSuperLoopTimes(currentSolverDomain_, -1) + ); + break; + case misFirstTimeInStartDomain: + tcSource = findClosestGlobalTime + ( + 0, readSuperLoopTimes(startDomain_, -1) + ); + break; + case misFirstTimeInStartDomainInStartSuperLoop: + tcSource = findClosestGlobalTime + ( + 0, readSuperLoopTimes(startDomain_, startSuperLoop_) + ); + break; + case misStartTime: + if (initialStartTime_ == 0) + { + tcSource = findClosestGlobalTime + ( + initialStartTime_, + readSuperLoopTimes(currentSolverDomain_, -1) + ); + includePreviousTimes(tcSource); + } + else + { + tcSource = findClosestGlobalTime + ( + initialStartTime_, readAllTimes() + ); + includePreviousTimes(tcSource); + } + break; + case misStartTimeInStartDomain: + tcSource = findClosestLocalTime + ( + initialStartTime_, readSolverDomainTimes(startDomain_) + ); + includePreviousTimes(tcSource); + break; + case misStartTimeInStartDomainInStartSuperLoop: + tcSource = findClosestLocalTime + ( + initialStartTime_, + readSuperLoopTimes(startDomain_, startSuperLoop_) + ); + includePreviousTimes(tcSource); + break; + case misLatestTime: + tcSource = findLatestGlobalTime(readAllTimes()); + includePreviousTimes(tcSource); + break; + case misLatestTimeInStartDomain: + tcSource = findLatestLocalTime(readSolverDomainTimes(startDomain_)); + includePreviousTimes(tcSource); + break; + case misLatestTimeInStartDomainInStartSuperLoop: + tcSource = findLatestLocalTime + ( + readSuperLoopTimes(startDomain_, startSuperLoop_) + ); + includePreviousTimes(tcSource); + break; + } + if (!tcSource.times().size()) + { + // No relevant data found, set to initial conditions + tcSource = timeCluster + ( + Time::findTimes + ( + multiDictRegistry_.path()/"multiSolver"/currentSolverDomain_ + /"initial" + ), + 0, + 0, + -1, // superLoop of -1 signifies "initial" directory + currentSolverDomain_ + ); + } + return tcSource; +} + + void Foam::multiSolver::setSolverDomain(const Foam::word& solverDomainName) { if (run()) { - if (currentSolverDomain_ == "default") + if (!initialized_) { setInitialSolverDomain(solverDomainName); } @@ -1297,7 +1630,7 @@ void Foam::multiSolver::setSolverDomainPostProcessing } currentSolverDomain_ = solverDomainName; - + setSolverDomainControls(currentSolverDomain_); // startTime is set to the earliest in case/[time] @@ -1322,7 +1655,7 @@ void Foam::multiSolver::setSolverDomainPostProcessing ), currentSolverDomainDict_ ); - + // Remove multiSolver-specific values from dictionary newControlDict.remove("startFrom"); newControlDict.remove("startTime"); @@ -1334,14 +1667,14 @@ void Foam::multiSolver::setSolverDomainPostProcessing newControlDict.remove("timePrecision"); newControlDict.remove("storeFields"); newControlDict.remove("elapsedTime"); - + // Add values to obtain the desired behaviour newControlDict.set("startFrom", "startTime"); newControlDict.set("startTime", startTime_); newControlDict.set("stopAt", stopAtSetting); newControlDict.set("endTime", endTime_); if (multiSolverControl_.found("timeFormat")) - { + { newControlDict.set ( "timeFormat", @@ -1349,7 +1682,7 @@ void Foam::multiSolver::setSolverDomainPostProcessing ); } if (multiSolverControl_.found("timePrecision")) - { + { newControlDict.set ( "timePrecision", @@ -1364,6 +1697,17 @@ void Foam::multiSolver::setSolverDomainPostProcessing } +void Foam::multiSolver::finalize() +{ + forcedEnd_ = true; + instantList il(Time::findTimes(multiDictRegistry_.path())); + if (il.size() == 1) + { + setNextSolverDomain(currentSolverDomain_); + } +} + + Foam::multiSolver& Foam::multiSolver::operator++() { superLoop_++; @@ -1383,7 +1727,7 @@ bool Foam::multiSolver::run() const // If case/[time] are present, run must continue to next 'setSolverDomain' // so that they are archived properly. instantList il(Time::findTimes(multiDictRegistry_.path())); - return !(finished_ && (il.size() == 1)); + return !(checkGlobalEnd() && (il.size() == 1)); } @@ -1392,7 +1736,7 @@ bool Foam::multiSolver::end() const // If case/[time] are present, run must continue to next 'setSolverDomain' // so that they are archived properly. instantList il(Time::findTimes(multiDictRegistry_.path())); - return (finished_ && (il.size() == 1)); + return (checkGlobalEnd() && (il.size() == 1)); } #include "multiSolverSetControls.C" @@ -1401,4 +1745,3 @@ bool Foam::multiSolver::end() const #include "multiSolverTimeFunctions.C" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - diff --git a/src/multiSolver/multiSolver/multiSolver.H b/src/multiSolver/multiSolver/multiSolver.H index 934a22b44..7372a9fdb 100644 --- a/src/multiSolver/multiSolver/multiSolver.H +++ b/src/multiSolver/multiSolver/multiSolver.H @@ -45,7 +45,8 @@ Author #ifndef multiSolver_H #define multiSolver_H -#include "Time.H" +#include "multiSolverVersion.H" +#include "multiTime.H" #include "dummyControlDict.H" #include "timeClusterList.H" #include "IFstream.H" @@ -63,53 +64,56 @@ class multiSolver { // Private data - + // A dummy controlDict, required to initialize multiDictRegistry dummyControlDict dcd_; // A mini-objectRegistry for the dictionaries - done this way to allow // run-time modification of dictionaries - Time multiDictRegistry_; + multiTime multiDictRegistry_; // Main control dictionary for multiSolver IOdictionary multiControlDict_; - + // All multiDicts contained in the case directory PtrList multiDicts_; // Reference to multiSolverControl subdictionary in multiControlDict dictionary& multiSolverControl_; - + // Reference to solverDomains subdictionary in multiControlDict dictionary& solverDomains_; - + // Current solverDomain dictionary dictionary currentSolverDomainDict_; // List of all the solver domain prefixes wordList prefixes_; - - // True when the end condition has been met - bool finished_; - + + // True when setInitialSolverDomain has been run + bool initialized_; + + // Set by the solver to force a global end + bool forcedEnd_; + // True when superLoop++ just happened, but the previous solverDomain // has not yet been saved (to prevent the first solverDomain from // saving to the *next* superLoop. bool noSaveSinceSuperLoopIncrement_; - + // True if this is the lowest number on a local shared drive - parallel // only. bool manageLocalRoot_; // Private member functions - + // Set manageLocalRoot_ flags on all processors (parallel only) void setUpParallel(); - + // Ensure all processors are synchronized (parallel only) void synchronizeParallel() const; - + // Load initial data and controls // *** Located in multiSolverSetInitialSolverDomain.C *** void setInitialSolverDomain(const word& solverDomainName); @@ -122,7 +126,7 @@ class multiSolver // multiControlDict // *** Located in multiSolverSetControls.C *** void setMultiSolverControls(); - + // Sets controls from the solverDomains subdictionary in the // multiControlDict // *** Located in multiSolverSetControls.C *** @@ -130,16 +134,31 @@ class multiSolver // Use stopAt and finalStopAt settings to determine the endTime for // the current solverDomain. Returns the controlDict's stopAt word, - // which may differ from that in multiControlDict. Sets finished_ to - // true if the end condition will be met. + // which may differ from that in multiControlDict. word setLocalEndTime(); + + // If the current solver domain should not start, returns true. + bool checkGlobalEnd() const; // Looks for case/multiSolver/solverDomain/initial/0. Fail if missing. void checkTimeDirectories() const; + // Creates a solverDomain's dictionary from a multiDict format: + // -Merges "default" if available + // -Merge "sameAs" or "multiLoad" dicts, recursively + // -Merges inputDict.subDict("solverDomainName") last + // outputDict - overwrites any existing entries + // inputDict - the "multiSolver" subdict + void buildDictionary + ( + dictionary& outputDict, + const dictionary& inputDict, + const word& solverDomainName + ); + // Change all catalogued multiDicts to another solverDomain void swapDictionaries(const word& solverDomainName); - + // When setting up for a different solverDomain, the boundary // conditions are allowed to change. This function copies all valid // case/intoSolverDomain/inital/0 files, and overwrites the @@ -167,9 +186,9 @@ class multiSolver // Rereads modified dictionaries and sets the controls void readIfModified(); - + // Converts a fileName with the naming convention: - // solverDomain@superLoop@globalOffset@fileName + // solverDomain@superLoop@globalOffset@globalIndex@fileName // to a timeCluster timeCluster parseConditionedFile ( @@ -196,7 +215,7 @@ public: misLatestTimeInStartDomainInStartSuperLoop }; - //- Final stop at control options + //- Final stop at control options enum finalStopAtControls { mfsEndTime, @@ -209,7 +228,7 @@ public: }; // solverDomains enumerations - + //- Time value start from control options enum startFromControls { @@ -218,7 +237,7 @@ public: mtsLatestTimeThisDomain, mtsLatestTimeAllDomains }; - + //- Stop at control options enum stopAtControls { @@ -234,67 +253,71 @@ public: protected: // multiSolverControl data - + label superLoop_; - + word currentSolverDomain_; static const NamedEnum initialStartFromControlsNames_; initialStartFromControls initialStartFrom_; - + scalar initialStartTime_; word startDomain_; label startSuperLoop_; - + static const NamedEnum finalStopAtControlsNames_; finalStopAtControls finalStopAt_; word endDomain_; - + scalar finalEndTime_; label endSuperLoop_; - + bool multiDictsRunTimeModifiable_; scalar globalTimeOffset_; + //- Each solverDomain / superLoop combination is assigned a unique + // index that increments chronologically + label globalIndex_; + // solverDomains data // This data is transient, changing between solver domains - + static const NamedEnum startFromControlsNames_; startFromControls startFrom_; - + scalar startTime_; - + static const NamedEnum stopAtControlsNames_; stopAtControls stopAt_; - + scalar endTime_; - + label purgeWriteSuperLoops_; scalar deltaT_; - + label iterations_; - + scalar elapsedTime_; - + wordList storeFields_; - + public: TypeName("multiSolver"); - + //- The default multiSolver dictionary name static word multiControlDictName; - + /* Not implemented yet //- Indicates whether the 'solverSignal' option for the finalStopAt setting // in the multiControlDict is permitted. Default false. Set this to true @@ -311,7 +334,8 @@ public: const fileName& rootPath, const fileName& caseName, const word& systemName = "system", - const word& constantName = "constant" + const word& constantName = "constant", + bool showSplash = true ); //- Construct reading the multiControlDict from file @@ -321,7 +345,8 @@ public: const fileName& rootPath, const fileName& caseName, const word& systemName = "system", - const word& constantName = "constant" + const word& constantName = "constant", + bool showSplash = true ); @@ -330,16 +355,20 @@ public: // Member functions - + // Access - // Database + //- Version number + word version() const; + // Database + inline const Time& multiDictRegistry() const; - inline const IOdictionary multiControlDict() const; - - + inline const IOdictionary& multiControlDict() const; + + inline const wordList& prefixes() const; + // multiSolverControl data inline const label& superLoop() const; @@ -347,7 +376,7 @@ public: inline const word& currentSolverDomain() const; inline const initialStartFromControls& initialStartFrom() const; - + inline const word& startDomain() const; inline const scalar& initialStartTime() const; @@ -355,39 +384,43 @@ public: inline const finalStopAtControls& finalStopAt() const; inline const word& endDomain() const; - + inline const scalar& finalEndTime() const; inline const label& startSuperLoop() const; - + inline const label& endSuperLoop() const; - + inline const bool& multiDictsRunTimeModifiable() const; inline const scalar& globalTimeOffset() const; // Write permission inline scalar& globalTimeOffset(); - + + inline const label& globalIndex() const; + // solverDomains data inline const startFromControls& startFrom() const; - + inline const stopAtControls& stopAt() const; - + inline const scalar& startTime() const; inline const scalar& endTime() const; - + inline scalar& endTime(); + inline const label& iterations() const; - + inline const scalar& elapsedTime() const; - + inline const wordList& storeFields() const; - + inline const label& purgeWriteSuperLoops() const; inline const scalar& deltaT() const; - + inline scalar& deltaT(); + // Solver (and pre/post-processor) interface functions @@ -398,6 +431,11 @@ public: // reconstructPar void postCondition(const word& processor = word::null); + // Return the source data that multiControlDict currently points to + // Returns "default" solverDomain if initial conditions are to be + // used and no solverDomain is set yet. + timeCluster initialDataSource() const; + // Switch to another solver domain void setSolverDomain(const word& solverDomainName); @@ -407,6 +445,9 @@ public: // Stop the run at the next setSolverDomain inline void setFinished(); + // Archive the last set of data into case/multiSolver + void finalize(); + // Increment the superLoop (prefix) multiSolver& operator++(); @@ -421,7 +462,7 @@ public: //- Return true if end of run bool end() const; - + // Time functions // The multiSolver time directory structure should have the form: @@ -431,22 +472,22 @@ public: // | |-initial {initial directory, superLoop -1} // | |-0 {superLoop} // | |-1 {superLoop} - // | | '-multiSolverTime {auto-generated dictionary} + // | | |-multiSolverTime {auto-generated file} + // | | '-0.01, etc.. {time directories} // | '-2, etc.. // |-prefix2, etc.. - // - // *** All time functions are located in *** - // *** multiSolverTimeFunctions.C *** // Create a list of all superLoops in a directory, (usually in // case/prefix). Only looks for integer directory names, does not // check for valid time subdirectories. + // *** Located in multiSolverTimeFunctions.C *** static labelList findSuperLoops(const fileName& path); // Find the closest global time to a given value in a // timeClusterList. Assumes timeClusters do not overlap global time // values (as they shouldn't). If exact is true, this function // throws a FatalError when no exact match is found. + // *** Located in multiSolverTimeFunctions.C *** static timeCluster findClosestGlobalTime ( const scalar value, @@ -459,6 +500,7 @@ public: // If overlaps exist, it uses only the latest superloop. If exact // is true, this function throws a FatalError when no exact match // is found. + // *** Located in multiSolverTimeFunctions.C *** static timeCluster findClosestLocalTime ( const scalar value, @@ -467,18 +509,37 @@ public: ); // Find the latest global time + // *** Located in multiSolverTimeFunctions.C *** static timeCluster findLatestGlobalTime ( const timeClusterList& tcl ); // Find the latest global time + // *** Located in multiSolverTimeFunctions.C *** static timeCluster findLatestLocalTime ( const timeClusterList& tcl ); + // Find the timeCluster with the given globalIndex. Returns an + // empty timeCluster if not found. + // *** Located in multiSolverTimeFunctions.C *** + static timeCluster findGlobalIndex + ( + const label& index, + const timeClusterList& tcl + ); + + // Adds all earlier times in the same superLoop directory to the + // time cluster + void includePreviousTimes + ( + timeCluster& tc + ) const; + // Find the path to a specific entry in a time cluster + // *** Located in multiSolverTimeFunctions.C *** fileName findInstancePath ( const timeCluster& tc, @@ -486,15 +547,21 @@ public: ) const; // Find the largest superLoop + // *** Located in multiSolverTimeFunctions.C *** static label findMaxSuperLoopValue(const timeClusterList& tcl); // Find the timeClusterList index for the timeClusterList that has // the largest superLoop - static labelList findMaxSuperLoopIndices(const timeClusterList& tcl); + // *** Located in multiSolverTimeFunctions.C *** + static labelList findMaxSuperLoopIndices + ( + const timeClusterList& tcl + ); // Checks if any of the time ranges overlap one another in a // timeClusterList. (If startTime = previous end, this is okay.) // True means they do not overlap. + // *** Located in multiSolverTimeFunctions.C *** static bool nonOverlapping ( const timeClusterList& tcl, @@ -503,15 +570,17 @@ public: // Maps the time directories in a single superLoop directory // Include a processor name, and it uses the processorN directory + // *** Located in multiSolverTimeFunctions.C *** timeCluster readSuperLoopTimes ( const word& solverDomain, const label superLoop, const word& processor = word::null ) const; - + // Maps the time directories in a single solverDomain // Include a processor name, and it uses the processorN directory + // *** Located in multiSolverTimeFunctions.C *** timeClusterList readSolverDomainTimes ( const word& solverDomain, @@ -521,6 +590,7 @@ public: // Create a snapshot of all the multiSolver time directories // Give it a processor name, and it searches instead in the // processor directory + // *** Located in multiSolverTimeFunctions.C *** timeClusterList readAllTimes ( const word processor = word::null @@ -531,14 +601,16 @@ public: // time values overlap when forced to useGlobalTime. // loadStoreFields will copy storeFields into every time folder // even though they do not change. + // *** Located in multiSolverTimeFunctions.C *** bool loadTimeClusterList ( const timeClusterList& tcl, const bool useGlobalTime = true, const bool loadStoreFields = true - ) const; + ); // Move all the time directories from sourcePath to archivePath + // *** Located in multiSolverTimeFunctions.C *** static void archiveTimeDirs ( const fileName& sourcePath, @@ -547,6 +619,7 @@ public: ); // Delete all time directories in path, do not delete "constant" + // *** Located in multiSolverTimeFunctions.C *** static void purgeTimeDirs(const fileName& path); }; @@ -559,4 +632,8 @@ public: #include "multiSolverI.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/multiSolver/multiSolver/multiSolverI.H b/src/multiSolver/multiSolver/multiSolverI.H index 986ae9f9b..b0969182d 100644 --- a/src/multiSolver/multiSolver/multiSolverI.H +++ b/src/multiSolver/multiSolver/multiSolverI.H @@ -36,12 +36,18 @@ inline const Time& multiSolver::multiDictRegistry() const } -inline const IOdictionary multiSolver::multiControlDict() const +inline const IOdictionary& multiSolver::multiControlDict() const { return multiControlDict_; } +inline const wordList& multiSolver::prefixes() const +{ + return prefixes_; +} + + inline const label& multiSolver::superLoop() const { return superLoop_; @@ -54,7 +60,8 @@ inline const word& multiSolver::currentSolverDomain() const } -inline const multiSolver::initialStartFromControls& multiSolver::initialStartFrom() const +inline const multiSolver::initialStartFromControls& + multiSolver::initialStartFrom() const { return initialStartFrom_; } @@ -120,6 +127,12 @@ inline scalar& multiSolver::globalTimeOffset() } +inline const label& multiSolver::globalIndex() const +{ + return globalIndex_; +} + + inline const multiSolver::startFromControls& multiSolver::startFrom() const { return startFrom_; @@ -135,13 +148,19 @@ inline const scalar& multiSolver::startTime() const { return startTime_; } - + inline const scalar& multiSolver::endTime() const { return endTime_; } +inline scalar& multiSolver::endTime() +{ + return endTime_; +} + + inline const label& multiSolver::iterations() const { return iterations_; @@ -172,9 +191,15 @@ inline const scalar& multiSolver::deltaT() const } +inline scalar& multiSolver::deltaT() +{ + return deltaT_; +} + + void Foam::multiSolver::setFinished() { - finished_ = true; + forcedEnd_ = true; } } // End namespace Foam diff --git a/src/multiSolver/multiSolver/multiSolverInit.H b/src/multiSolver/multiSolver/multiSolverInit.H index 3e1eabdf1..af63d5f74 100644 --- a/src/multiSolver/multiSolver/multiSolverInit.H +++ b/src/multiSolver/multiSolver/multiSolverInit.H @@ -1,34 +1,34 @@ // Common elements in the constructor initialization list for multiSolver - // Quenching compiler warning - // HR, 18/Jul/2013 multiDicts_(0), multiSolverControl_(multiControlDict_.subDict("multiSolverControl")), solverDomains_(multiControlDict_.subDict("solverDomains")), currentSolverDomainDict_(), prefixes_(solverDomains_.toc()), - finished_(false), + initialized_(false), + forcedEnd_(false), noSaveSinceSuperLoopIncrement_(false), manageLocalRoot_(false), - + superLoop_(0), currentSolverDomain_("default"), initialStartFrom_(misLatestTime), -// startDomain_, initialStartTime_(0), + startDomain_("default"), startSuperLoop_(0), finalStopAt_(mfsEndTime), // endDomain_, finalEndTime_(0), endSuperLoop_(0), - + multiDictsRunTimeModifiable_(true), globalTimeOffset_(0), - + globalIndex_(0), + purgeWriteSuperLoops_(prefixes_.size()), // timeValueStartFrom_, diff --git a/src/multiSolver/multiSolver/multiSolverSetControls.C b/src/multiSolver/multiSolver/multiSolverSetControls.C index 58875cd2f..637a7865d 100644 --- a/src/multiSolver/multiSolver/multiSolverSetControls.C +++ b/src/multiSolver/multiSolver/multiSolverSetControls.C @@ -38,7 +38,7 @@ void Foam::multiSolver::setMultiSolverControls() multiSolverControl_.lookup("initialStartFrom") ); } - + if (multiSolverControl_.found("startTime")) { initialStartTime_ = readScalar(multiSolverControl_.lookup("startTime")); @@ -72,7 +72,7 @@ void Foam::multiSolver::setMultiSolverControls() { startDomain_ = word(multiSolverControl_.lookup("startDomain")); } - else if + else if ( (initialStartFrom_ == misFirstTimeInStartDomain) || (initialStartFrom_ == misFirstTimeInStartDomainInStartSuperLoop) @@ -93,7 +93,7 @@ void Foam::multiSolver::setMultiSolverControls() << "'latestTimeInStartDomainInStartSuperLoop'." << abort(FatalError); } - + finalStopAt_ = mfsEndTime; if (multiSolverControl_.found("finalStopAt")) { @@ -102,7 +102,7 @@ void Foam::multiSolver::setMultiSolverControls() multiSolverControl_.lookup("finalStopAt") ); } - + if (multiSolverControl_.found("endDomain")) { endDomain_ = word(multiSolverControl_.lookup("endDomain")); @@ -160,10 +160,10 @@ void Foam::multiSolver::setMultiSolverControls() << "'latestTimeInStartDomainInStartSuperLoop'." << abort(FatalError); } - + if (multiSolverControl_.found("endSuperLoop")) { - endSuperLoop_ = + endSuperLoop_ = readLabel(multiSolverControl_.lookup("endSuperLoop")); } else if @@ -200,7 +200,7 @@ void Foam::multiSolver::setMultiSolverControls() << "other than 'default'." << abort(FatalError); } - + dictionary solverDomainsDefault ( solverDomains_.found("default") @@ -213,11 +213,12 @@ void Foam::multiSolver::setMultiSolverControls() void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) { currentSolverDomainDict_.clear(); - if (solverDomains_.found("default")) - { - currentSolverDomainDict_.merge(solverDomains_.subDict("default")); - } - currentSolverDomainDict_.merge(solverDomains_.subDict(solverDomainName)); + buildDictionary + ( + currentSolverDomainDict_, + solverDomains_, + solverDomainName + ); startFrom_ = mtsLatestTimeAllDomains; if (currentSolverDomainDict_.found("startFrom")) @@ -234,7 +235,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) if (startTime_ < 0) { FatalErrorIn("multiSolver::setSolverDomainControls") - << "'startTime' in multiControlDict/solverDomains/" + << "'startTime' in multiControlDict/solverDomains/" << solverDomainName << " cannot be negative." << abort(FatalError); } @@ -247,7 +248,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) << "is set to 'startTime'." << abort(FatalError); } - + stopAt_ = msaEndTime; if (currentSolverDomainDict_.found("stopAt")) { @@ -271,7 +272,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) << abort(FatalError); } } - + endTime_ = 0; if (currentSolverDomainDict_.found("endTime")) { @@ -293,7 +294,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) << "when stopAt is set to iterations." << abort(FatalError); } - + if (currentSolverDomainDict_.found("elapsedTime")) { elapsedTime_ = readScalar(currentSolverDomainDict_.lookup("elapsedTime")); @@ -314,7 +315,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) currentSolverDomainDict_.lookup("storeFields") ); } - + purgeWriteSuperLoops_ = 0; if (currentSolverDomainDict_.found("purgeWriteSuperLoops")) { @@ -323,7 +324,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) currentSolverDomainDict_.lookup("purgeWriteSuperLoops") ); } - + if (currentSolverDomainDict_.found("deltaT")) { deltaT_ = readScalar @@ -338,7 +339,7 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) << solverDomainName << "' or 'default'. deltaT is required." << abort(FatalError); } - + if ( currentSolverDomainDict_.found("timeFormat") @@ -354,6 +355,4 @@ void Foam::multiSolver::setSolverDomainControls(const word& solverDomainName) } } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - diff --git a/src/multiSolver/multiSolver/multiSolverSetInitialSolverDomain.C b/src/multiSolver/multiSolver/multiSolverSetInitialSolverDomain.C index 5b9010ebf..834d43ae6 100644 --- a/src/multiSolver/multiSolver/multiSolverSetInitialSolverDomain.C +++ b/src/multiSolver/multiSolver/multiSolverSetInitialSolverDomain.C @@ -43,6 +43,17 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName) // Purge all time directories from case directory root purgeTimeDirs(multiDictRegistry_.path()); + + // Purge any constant/superLoopData/ + fileName superLoopDataPath + ( + multiDictRegistry_.path()/multiDictRegistry_.constant() + /"superLoopData" + ); + if (exists(superLoopDataPath)) + { + rmDir(superLoopDataPath); + } // Read initial settings and determine data source (from which path the // initial data is copied, the starting superLoop_, and the current @@ -59,100 +70,26 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName) // subdictionary. // 4. endTime is determined by the solverDomains subdictionary // a. unless the finalStopAt trumps it - timeCluster tcSource; - switch (initialStartFrom_) - { - case misFirstTime: - tcSource = findClosestGlobalTime - ( - 0, readSuperLoopTimes(currentSolverDomain_, -1) - ); - break; - case misFirstTimeInStartDomain: - tcSource = findClosestGlobalTime - ( - 0, readSuperLoopTimes(startDomain_, -1) - ); - break; - case misFirstTimeInStartDomainInStartSuperLoop: - tcSource = findClosestGlobalTime - ( - 0, readSuperLoopTimes(startDomain_, startSuperLoop_) - ); - break; - case misStartTime: - if (initialStartTime_ == 0) - { - tcSource = findClosestGlobalTime - ( - initialStartTime_, - readSuperLoopTimes(currentSolverDomain_, -1) - ); - } - else - { - tcSource = findClosestGlobalTime - ( - initialStartTime_, readAllTimes() - ); - } - break; - case misStartTimeInStartDomain: - tcSource = findClosestLocalTime - ( - initialStartTime_, readSolverDomainTimes(startDomain_) - ); - break; - case misStartTimeInStartDomainInStartSuperLoop: - tcSource = findClosestLocalTime - ( - initialStartTime_, - readSuperLoopTimes(startDomain_, startSuperLoop_) - ); - break; - case misLatestTime: - tcSource = findLatestGlobalTime(readAllTimes()); - break; - case misLatestTimeInStartDomain: - tcSource = findLatestLocalTime(readSolverDomainTimes(startDomain_)); - break; - case misLatestTimeInStartDomainInStartSuperLoop: - tcSource = findLatestLocalTime - ( - readSuperLoopTimes(startDomain_, startSuperLoop_) - ); - break; - } - if (!tcSource.times().size()) - { - // No relevant data found, set to initial conditions - tcSource = timeCluster - ( - Time::findTimes - ( - multiDictRegistry_.path()/"multiSolver"/currentSolverDomain_ - /"initial" - ), - 0, - -1, // superLoop of -1 signifies "initial" directory - currentSolverDomain_ - ); - } + // Find initial data source + timeCluster tcSource(initialDataSource()); - fileName sourcePath(findInstancePath(tcSource, 0)); + fileName sourcePath(findInstancePath(tcSource, tcSource.size() - 1)); superLoop_ = tcSource.superLoop(); + globalIndex_ = tcSource.globalIndex(); + // If starting from initial conditions, superLoop_ = -1 if (superLoop_ < 0) superLoop_ = 0; - scalar globalTime(tcSource.globalValue(0)); - scalar localStartTime(tcSource.localValue(0)); + scalar globalTime(tcSource.globalValue(tcSource.size() - 1)); + scalar localStartTime(tcSource.localValue(tcSource.size() -1)); // Now to apply the exceptions if currentSolverDomain_ != data source // solverDomain (see long comment above). if (sourcePath.path().path().name() != currentSolverDomain_) { superLoop_++; - + globalIndex_++; + switch (startFrom_) { case mtsFirstTime: @@ -182,13 +119,18 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName) startTime_ = localStartTime; globalTimeOffset_ = globalTime - startTime_; - + // Give multiDictRegistry a time value (required for regIOobject::write() // to case/[timeValue] multiDictRegistry_.setTime(startTime_, 0); - // Copy the source data to case/[localTime] - cp(sourcePath, multiDictRegistry_.path()); + // Copy the source data and any previous time directories to + // case/[localTime] + forAll(tcSource, i) + { + fileName copyMe(findInstancePath(tcSource, i)); + cp(copyMe, multiDictRegistry_.path()); + } mv ( multiDictRegistry_.path()/sourcePath.name(), @@ -222,7 +164,7 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName) ), currentSolverDomainDict_ ); - + // Remove multiSolver-specific values from dictionary newControlDict.remove("startFrom"); newControlDict.remove("startTime"); @@ -234,8 +176,31 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName) newControlDict.remove("timePrecision"); newControlDict.remove("storeFields"); newControlDict.remove("elapsedTime"); - + // Add values to obtain the desired behaviour + // Start with timePrecision, it may affect writePrecision, which affects + // all other settings + if (multiSolverControl_.found("timePrecision")) + { + unsigned int newPrecision + ( + readUint(multiSolverControl_.lookup("timePrecision")) + ); + + // Increase writePrecision if less than timePrecision, otherwise + // resuming a run will fail + if (IOstream::defaultPrecision() < (newPrecision + 1)) + { + IOstream::defaultPrecision(newPrecision + 1); + } + + newControlDict.set + ( + "timePrecision", + newPrecision + ); + } + newControlDict.set("startFrom", "startTime"); newControlDict.set("startTime", startTime_); newControlDict.set("stopAt", stopAtSetting); @@ -248,18 +213,20 @@ void Foam::multiSolver::setInitialSolverDomain(const word& solverDomainName) word(multiSolverControl_.lookup("timeFormat")) ); } - if (multiSolverControl_.found("timePrecision")) - { - newControlDict.set - ( - "timePrecision", - readScalar(multiSolverControl_.lookup("timePrecision")) - ); - } // Write the dictionary to the case directory newControlDict.regIOobject::write(); + // Copy files in the superLoop/superLoopData directory of tcSource to + // constant/superLoopData + cp + ( + sourcePath.path()/"superLoopData", + multiDictRegistry_.path()/multiDictRegistry_.constant() + ); + swapDictionaries(currentSolverDomain_); + initialized_ = true; } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/multiSolver/multiSolver/multiSolverSetNextSolverDomain.C b/src/multiSolver/multiSolver/multiSolverSetNextSolverDomain.C index 02d301a08..e47c6787d 100644 --- a/src/multiSolver/multiSolver/multiSolverSetNextSolverDomain.C +++ b/src/multiSolver/multiSolver/multiSolverSetNextSolverDomain.C @@ -77,13 +77,16 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName) ) ); multiSolverTime.set("globalOffset", globalTimeOffset_); - + multiSolverTime.set("globalIndex", globalIndex_); + + globalIndex_++; + // Write multiSolverTime to the case/constant directory, then move to // archivePath multiSolverTime.regIOobject::write(); mv(multiDictRegistry_.constantPath()/"multiSolverTime", archivePath); - - // tcSource is where the latest data has been moved to + + // tcSource is to where the latest data has been moved timeCluster tcSource ( findLatestLocalTime @@ -128,7 +131,7 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName) localStartTime = globalTime; break; } - + startTime_ = localStartTime; globalTimeOffset_ = globalTime - startTime_; @@ -138,7 +141,7 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName) word stopAtSetting("endTime"); - if (!finished_) + if (!checkGlobalEnd()) { // Copy the source data to case/[localTime] cp(sourcePath, multiDictRegistry_.path()); @@ -168,14 +171,14 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName) 0 ) ); - + forAll (previousStoreFields, i) { // Copy the stored fields to case/[localTime]. if (exists(storedSourcePath/previousStoreFields[i])) { fileName storedSource(storedSourcePath/previousStoreFields[i]); - + cp ( storedSource, @@ -190,15 +193,15 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName) << previousStoreFields[i] << " from " << previousSolverDomain << " to " << currentSolverDomain_ << " in superLoop " - << saveToSuperLoop << ". File not found. This may occur " - << "if " << previousSolverDomain << " is the first " - << "solverDomain to be initialized, and you did not put " - << "the stored fields into its 0/0 directory." + << saveToSuperLoop << ". File not found. This may " + << "occur if " << previousSolverDomain << " is the " + << "first solverDomain to be initialized, and you did " + << "not put the stored fields into its 0/0 directory." << abort(FatalError); } } - } - + } + swapBoundaryConditions ( multiDictRegistry_.path()/Time::timeName(startTime_), @@ -207,8 +210,26 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName) // Determine localEndTime and stopAtSetting stopAtSetting = setLocalEndTime(); + + // This is the new solverDomain's archive path + fileName nextArchivePath + ( + multiDictRegistry_.path()/"multiSolver"/solverDomainName/name + ( + superLoop_ + ) + ); + + // Copy constant/superLoopData to multiSolver/solverDomainName/superLoop/ + // of the new solver domain. + cp + ( + multiDictRegistry_.path()/multiDictRegistry_.constant() + /"superLoopData", + nextArchivePath + ); } - else //finished_ + else // global end { stopAtSetting = "noWriteNow"; } @@ -227,7 +248,7 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName) ), currentSolverDomainDict_ ); - + // Remove multiSolver-specific values from dictionary newControlDict.remove("startFrom"); newControlDict.remove("startTime"); @@ -239,28 +260,27 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName) newControlDict.remove("timePrecision"); newControlDict.remove("storeFields"); newControlDict.remove("elapsedTime"); - + // Add values to obtain the desired behaviour newControlDict.set("startFrom", "startTime"); newControlDict.set("startTime", startTime_); newControlDict.set("stopAt", stopAtSetting); newControlDict.set("endTime", endTime_); - if (multiSolverControl_.found("timeFormat")) + switch (multiDictRegistry_.format()) { - newControlDict.set - ( - "timeFormat", - word(multiSolverControl_.lookup("timeFormat")) - ); - } - if (multiSolverControl_.found("timePrecision")) - { - newControlDict.set - ( - "timePrecision", - readScalar(multiSolverControl_.lookup("timePrecision")) - ); + case Time::general: + newControlDict.set("timeFormat", "general"); + break; + case Time::fixed: + newControlDict.set("timeFormat", "fixed"); + break; + case Time::scientific: + newControlDict.set("timeFormat", "scientific"); + break; + default: + break; } + newControlDict.set("timePrecision", multiDictRegistry_.precision()); // Write the dictionary to the case directory newControlDict.regIOobject::write(); @@ -275,3 +295,4 @@ void Foam::multiSolver::setNextSolverDomain(const word& solverDomainName) } } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/multiSolver/multiSolver/multiSolverTimeFunctions.C b/src/multiSolver/multiSolver/multiSolverTimeFunctions.C index db50324f7..94b407e65 100644 --- a/src/multiSolver/multiSolver/multiSolverTimeFunctions.C +++ b/src/multiSolver/multiSolver/multiSolverTimeFunctions.C @@ -34,7 +34,7 @@ Foam::labelList Foam::multiSolver::findSuperLoops(const fileName& path) labelList superLoopList(dirEntries.size()); label nSuperLoops(0); - + // Loop through dirEntries, checking for valid integers, sort entries forAll(dirEntries, de) { @@ -47,7 +47,7 @@ Foam::labelList Foam::multiSolver::findSuperLoops(const fileName& path) IStringStream superLoopStream(dirEntries[de]); token superLoopToken(superLoopStream); - + // Check if directory is an integer if (superLoopToken.isLabel() && superLoopStream.eof()) { @@ -72,7 +72,7 @@ Foam::timeCluster Foam::multiSolver::findClosestGlobalTime label underShoot(-1); label best(-1); label initial(-1); - + // Find closest global minimum that does not exceed value forAll(tcl, i) { @@ -117,7 +117,7 @@ Foam::timeCluster Foam::multiSolver::findClosestGlobalTime } else { - + FatalErrorIn("multiSolver::findClosestGlobalTime") << "The timeClusterList passed to this function has no non-" << "empty instantLists. Use timeClusterList::purgeEmpties " @@ -125,7 +125,7 @@ Foam::timeCluster Foam::multiSolver::findClosestGlobalTime << abort(FatalError); } } - + label timeIndex ( Time::findClosestTimeIndex @@ -133,7 +133,7 @@ Foam::timeCluster Foam::multiSolver::findClosestGlobalTime tcl[best].times(), value - tcl[best].globalOffset() ) ); - + if (exact && (maxDiff < -VSMALL)) { FatalErrorIn("multiSolver::findClosestGlobalTime") @@ -169,7 +169,7 @@ Foam::timeCluster Foam::multiSolver::findClosestLocalTime tclDummy = tcl.selectiveSubList(findMaxSuperLoopIndices(tcl)); tclPtr = & tclDummy; } - + for (label i = 0; i < tclPtr->size(); i++) { if (!tclPtr->operator[](i).times().size()) continue; @@ -205,7 +205,7 @@ Foam::timeCluster Foam::multiSolver::findClosestLocalTime // "initial" directory is the only match best = initial; } - + if (best == -1) { if (minDiff != -1) @@ -215,7 +215,7 @@ Foam::timeCluster Foam::multiSolver::findClosestLocalTime } else { - + FatalErrorIn("multiSolver::findClosestLocalTime") << "The timeClusterList passed to this function has no non-" << "empty instantLists. Use timeClusterList::purgeEmpties " @@ -223,7 +223,7 @@ Foam::timeCluster Foam::multiSolver::findClosestLocalTime << abort(FatalError); } } - + label timeIndex ( Time::findClosestTimeIndex @@ -251,13 +251,13 @@ Foam::timeCluster Foam::multiSolver::findLatestGlobalTime timeCluster bestMax(0); timeCluster currentMax; - + forAll(tcl, i) { if (tcl[i].times().size() == 0) continue; - + currentMax = tcl[i](tcl[i].globalMaxIndex()); - if + if ( (currentMax.globalValue(0) > bestMax.globalValue(0)) || ( @@ -306,7 +306,7 @@ Foam::timeCluster Foam::multiSolver::findLatestLocalTime { if (tclPtr->operator[](i).times().size() == 0) continue; - currentMax = + currentMax = tclPtr->operator[](i)(tclPtr->operator[](i).localMaxIndex()); if @@ -330,11 +330,59 @@ Foam::timeCluster Foam::multiSolver::findLatestLocalTime << " return value to prevent this." << abort(FatalError); } - + return bestMax; } +Foam::timeCluster Foam::multiSolver::findGlobalIndex +( + const label& index, + const timeClusterList& tcl +) +{ + forAll(tcl, i) + { + if (tcl[i].globalIndex() == index) + { + return tcl[i]; + } + } + return timeCluster(); +} + + +void Foam::multiSolver::includePreviousTimes +( + timeCluster& tc +) const +{ + scalar minTime(VGREAT); + forAll(tc, i) + { + minTime = min(tc[i].value(), minTime); + } + if (minTime != VGREAT) + { + fileName thePath(findInstancePath(tc, 0).path()); + instantList il(Time::findTimes(thePath)); + forAll(il, i) + { + if (il[i].value() < minTime) + { + label newIndex(tc.size()); + tc.setSize(newIndex + 1); + tc[newIndex] = il[i]; + } + } + if (tc.size() > 1) + { + std::sort(&tc[0], tc.end(), instant::less()); + } + } +} + + Foam::fileName Foam::multiSolver::findInstancePath ( const timeCluster& tc, @@ -369,7 +417,8 @@ Foam::fileName Foam::multiSolver::findInstancePath } -Foam::label Foam::multiSolver::findMaxSuperLoopValue(const timeClusterList& tcl) +Foam::label + Foam::multiSolver::findMaxSuperLoopValue(const timeClusterList& tcl) { if (!tcl.size()) { @@ -383,7 +432,8 @@ Foam::label Foam::multiSolver::findMaxSuperLoopValue(const timeClusterList& tcl) } -Foam::labelList Foam::multiSolver::findMaxSuperLoopIndices(const timeClusterList& tcl) +Foam::labelList + Foam::multiSolver::findMaxSuperLoopIndices(const timeClusterList& tcl) { label currentMax(-2); labelList bestIndices(0); @@ -507,9 +557,10 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes currentPath/"multiSolverTime" ); IFstream mstFile(mstFileName); - + bool mstFileGood(false); scalar globalOffset(0); + label globalIndex(0); if (mstFile.good()) { @@ -518,6 +569,8 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes { globalOffset = readScalar(mstDict.lookup("globalOffset")); + globalIndex = + readLabel(mstDict.lookup("globalIndex")); mstFileGood = true; } } @@ -534,6 +587,7 @@ Foam::timeCluster Foam::multiSolver::readSuperLoopTimes ( Time::findTimes(currentPath), globalOffset, + globalIndex, superLoop, solverDomain ); @@ -549,7 +603,7 @@ Foam::timeClusterList Foam::multiSolver::readSolverDomainTimes { timeClusterList tcl(0); label nTimeClusters(0); - + fileName locale; if (processor.size()) { @@ -563,9 +617,9 @@ Foam::timeClusterList Foam::multiSolver::readSolverDomainTimes ( multiDictRegistry_.path()/locale/solverDomain ); - + labelList superLoopList(multiSolver::findSuperLoops(currentPath)); - + // Loop through superLoopList, check for valid data, store in tcl forAll(superLoopList, sl) { @@ -576,7 +630,7 @@ Foam::timeClusterList Foam::multiSolver::readSolverDomainTimes // If there are no time directories, ignore this superLoop if (tc.times().size() == 0) continue; - + // Store timeCluster tcl.setSize(++nTimeClusters); tcl[nTimeClusters - 1] = tc; @@ -609,7 +663,7 @@ bool Foam::multiSolver::loadTimeClusterList const Foam::timeClusterList& tcl, const bool useGlobalTime, const bool loadStoreFields -) const +) { if (!nonOverlapping(tcl, useGlobalTime)) return false; @@ -628,30 +682,28 @@ bool Foam::multiSolver::loadTimeClusterList currentPath/il[Time::findClosestTimeIndex(il, -1.0)].name() ); + setSolverDomainPostProcessing(tcl[i].solverDomainName()); + if ( loadStoreFields - && solverDomains_ - .subDict(tcl[i].solverDomainName()) - .found("storeFields") + && currentSolverDomainDict_.found("storeFields") ) { - storeFields = wordList(solverDomains_ - .subDict(tcl[i].solverDomainName()) - .lookup("storeFields")); + storeFields = wordList(currentSolverDomainDict_.lookup("storeFields")); } else { storeFields.clear(); } - + forAll(tcl[i].times(), j) { fileName storeFieldsDestination ( multiDictRegistry_.path()/tcl[i].times()[j].name() ); - + cp ( currentPath/tcl[i].times()[j].name(), @@ -664,7 +716,7 @@ bool Foam::multiSolver::loadTimeClusterList ( tcl[i].globalValue(j) ); - + mv ( multiDictRegistry_.path()/tcl[i].times()[j].name(), @@ -719,14 +771,14 @@ void Foam::multiSolver::archiveTimeDirs { labelList allSL(findSuperLoops(archivePath.path())); label currentSL(atoi(archivePath.name().c_str())); - + sort(allSL); label i = 0; while (allSL[i] < currentSL) { i++; } - + for (label j = 1; j <= (i - purgeWrite); j++) { rmDir(archivePath.path()/name(allSL[j])); @@ -753,6 +805,4 @@ void Foam::multiSolver::purgeTimeDirs(const Foam::fileName& path) } } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - diff --git a/src/multiSolver/multiTime/multiTime.C b/src/multiSolver/multiTime/multiTime.C new file mode 100644 index 000000000..65ae907e4 --- /dev/null +++ b/src/multiSolver/multiTime/multiTime.C @@ -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() +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/multiSolver/multiTime/multiTime.H b/src/multiSolver/multiTime/multiTime.H new file mode 100644 index 000000000..67679dfdb --- /dev/null +++ b/src/multiSolver/multiTime/multiTime.H @@ -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 + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/multiSolver/timeCluster/timeCluster.C b/src/multiSolver/timeCluster/timeCluster.C index 92030f15f..c9277712b 100644 --- a/src/multiSolver/timeCluster/timeCluster.C +++ b/src/multiSolver/timeCluster/timeCluster.C @@ -41,6 +41,7 @@ Foam::timeCluster::timeCluster ( const instantList& times, const scalar globalOffset, + const label globalIndex, const label superLoop, const word& solverDomainName, const word& preConName @@ -48,6 +49,7 @@ Foam::timeCluster::timeCluster : instantList(times), globalOffset_(globalOffset), + globalIndex_(globalIndex), superLoop_(superLoop), solverDomainName_(solverDomainName), preConName_(preConName) @@ -61,6 +63,7 @@ Foam::timeCluster::timeCluster : instantList(1, tc[index]), globalOffset_(tc.globalOffset_), + globalIndex_(tc.globalIndex_), superLoop_(tc.superLoop_), solverDomainName_(tc.solverDomainName_), preConName_(tc.preConName_) @@ -71,6 +74,7 @@ Foam::timeCluster::timeCluster(const Foam::scalar t) : instantList(1, instant(0)), globalOffset_(0), + globalIndex_(0), superLoop_(0), solverDomainName_(word::null), preConName_(word::null) @@ -223,6 +227,7 @@ Foam::timeCluster Foam::timeCluster::operator()(const Foam::label index) const Foam::Istream& Foam::operator>>(Istream& is, timeCluster& I) { return is >> I.globalOffset_ + >> I.globalIndex_ >> I.superLoop_ >> I.solverDomainName_ >> I.preConName_ @@ -233,11 +238,11 @@ Foam::Istream& Foam::operator>>(Istream& is, timeCluster& I) Foam::Ostream& Foam::operator<<(Ostream& os, const timeCluster& I) { return os << "/* globalOffset: */\t" << I.globalOffset_ << nl + << "/* globalIndex: */\t" << I.globalIndex_ << nl << "/* superLoop: */\t" << I.superLoop_ << nl << "/* solverDomain: */\t" << I.solverDomainName_ << nl << "/* preConName: */\t" << I.preConName_ << nl << "/* Instant list: */\t" << I.times(); } - // ************************************************************************* // diff --git a/src/multiSolver/timeCluster/timeCluster.H b/src/multiSolver/timeCluster/timeCluster.H index eeafc7f2a..4d2413fe0 100644 --- a/src/multiSolver/timeCluster/timeCluster.H +++ b/src/multiSolver/timeCluster/timeCluster.H @@ -72,9 +72,10 @@ class timeCluster // Private data scalar globalOffset_; + label globalIndex_; label superLoop_; word solverDomainName_; - + // PreConditioned file name - used only for pre and post conditioning // a data set for parallel runs word preConName_; @@ -110,6 +111,7 @@ public: ( const instantList& times, const scalar globalOffset, + const label globalIndex, const label superLoop, const word& solverDomainName, const word& preConName = word::null @@ -123,7 +125,7 @@ public: const timeCluster& tc, const label index ); - + //- Construct a time cluster given a scalar value. This constructs // a timeCluster with a single instant of time at value t, and whose // other values are zero or empty. @@ -143,6 +145,11 @@ public: inline scalar& globalOffset(); + //- Global index + inline label globalIndex() const; + + inline label& globalIndex(); + //- SuperLoop inline label superLoop() const; @@ -159,43 +166,43 @@ public: inline word& preConName(); // Derived values - + //- Global value at index scalar globalValue(const label& index) const; //- Search for and return global min value. If empty, // returns VGREAT. scalar globalMinValue() const; - + //- Search for and return global max value. If empty, // returns 0. scalar globalMaxValue() const; //- Search for and return index of global min value label globalMinIndex() const; - + //- Search for and return index of global max value label globalMaxIndex() const; - + //- Global closest time scalar globalFindClosestTimeValue(const scalar) const; - + //- Global closest time index label globalFindClosestTimeIndex(const scalar) const; - + //- Local value at index scalar localValue(const label& index) const; //- Search for and return local min value scalar localMinValue() const; - + //- Search for and return local max value scalar localMaxValue() const; //- Search for and return index of global min value. If empty, // returns VGREAT label localMinIndex() const; - + //- Search for and return index of global max value. If empty, // returns 0. label localMaxIndex() const; @@ -205,9 +212,9 @@ public: //-Local closest time index label localFindClosestTimeIndex(const scalar) const; - + // Operators - + //- Chip off a single instant given an index, return as timeCluster // This retains superLoop, solverDomain, etc.. with a timevalue timeCluster operator()(const label index) const; @@ -228,6 +235,8 @@ public: #include "timeClusterI.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/multiSolver/timeCluster/timeClusterI.H b/src/multiSolver/timeCluster/timeClusterI.H index 1fbb528c5..ee0bd2cb2 100644 --- a/src/multiSolver/timeCluster/timeClusterI.H +++ b/src/multiSolver/timeCluster/timeClusterI.H @@ -52,6 +52,16 @@ inline scalar& timeCluster::globalOffset() return globalOffset_; } +inline label timeCluster::globalIndex() const +{ + return globalIndex_; +} + +inline label& timeCluster::globalIndex() +{ + return globalIndex_; +} + inline label timeCluster::superLoop() const { return superLoop_; diff --git a/src/multiSolver/timeCluster/timeClusterList.C b/src/multiSolver/timeCluster/timeClusterList.C index 40a368937..5cdb84209 100644 --- a/src/multiSolver/timeCluster/timeClusterList.C +++ b/src/multiSolver/timeCluster/timeClusterList.C @@ -85,7 +85,7 @@ void Foam::timeClusterList::append(const timeClusterList& tclIn) { label wasSize = this->size(); this->setSize(tclIn.size() + this->size()); - + for (label i = 0; i < tclIn.size(); i++) { this->operator[](i + wasSize) = tclIn[i]; @@ -97,7 +97,7 @@ void Foam::timeClusterList::append(const timeCluster& tcIn) { label wasSize = this->size(); this->setSize(this->size() + 1); - + this->operator[](wasSize) = tcIn; } @@ -105,7 +105,7 @@ void Foam::timeClusterList::append(const timeCluster& tcIn) bool Foam::timeClusterList::purgeEmpties() { if (!this->size()) return false; - + label empties(0); for (label i = 0; i < this->size(); i++) { @@ -133,7 +133,7 @@ Foam::timeClusterList Foam::timeClusterList::selectiveSubList ) const { timeClusterList tcl(indices.size()); - + forAll(indices, i) { if (indices[i] > this->size()) @@ -151,6 +151,4 @@ Foam::timeClusterList Foam::timeClusterList::selectiveSubList return tcl; } - - // ************************************************************************* // diff --git a/src/multiSolver/timeCluster/timeClusterList.H b/src/multiSolver/timeCluster/timeClusterList.H index 741886b2b..8a2c13038 100644 --- a/src/multiSolver/timeCluster/timeClusterList.H +++ b/src/multiSolver/timeCluster/timeClusterList.H @@ -60,7 +60,7 @@ public: static const char* const typeName; // Constructors - + //- Null constructor timeClusterList(); @@ -72,7 +72,7 @@ public: //- Construct with given size and value for all elements. timeClusterList(const label, const timeCluster&); - + //- Construct as a sublist of another timeClusterList. This is not // like the SubList in that this is not a new class, rather it is only // producing a new copy that contains the specified entries. @@ -82,7 +82,7 @@ public: timeClusterList(Istream&); // Member functions - + //- Sort by global time void globalSort(); @@ -91,7 +91,7 @@ public: //- Append a timeCluster on the end of this list void append(const timeCluster& tcIn); - + //- Remove timeClusters with empty instantLists return false if all are // empty bool purgeEmpties(); diff --git a/tutorials/multiSolver/README b/tutorials/multiSolver/README new file mode 100644 index 000000000..3175cba57 --- /dev/null +++ b/tutorials/multiSolver/README @@ -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 diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/polyMesh/blockMeshDict b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/polyMesh/blockMeshDict index bbd6a8f4d..a60e689e8 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/polyMesh/blockMeshDict +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/polyMesh/blockMeshDict @@ -16,7 +16,7 @@ FoamFile convertToMeters 0.1; -vertices +vertices ( (0 0 0) (1.5 0 0) @@ -42,7 +42,7 @@ vertices ); -blocks +blocks ( hex (0 1 2 3 10 11 12 13) (20 20 1) simpleGrading (1 1 1) hex (1 4 7 2 11 14 17 12) (20 20 1) simpleGrading (1 1 1) @@ -50,11 +50,11 @@ blocks hex (2 7 9 8 12 17 19 18) (20 20 1) simpleGrading (1 1 1) ); -edges +edges ( ); -patches +patches ( wall steetWalls ( @@ -83,7 +83,7 @@ patches ) ); -mergePatchPairs +mergePatchPairs ( ); diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/polyMesh/boundary b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/polyMesh/boundary index 78f5dbbec..e8c021289 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/polyMesh/boundary +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5-dev | -| \\ / A nd | Revision: exported | -| \\/ M anipulation | Web: http://www.OpenFOAM.org | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/transportProperties b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/transportProperties index 3172e58df..8b77bab3b 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/transportProperties +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/constant/transportProperties @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.7.1 | -| \\ / A nd | Web: www.OpenFOAM.com | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/multiTransportProperties b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/multiTransportProperties new file mode 100644 index 000000000..0599658c6 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/multiTransportProperties @@ -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; + } +} diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/polyMesh/blockMeshDict b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/polyMesh/blockMeshDict new file mode 100644 index 000000000..a60e689e8 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/polyMesh/blockMeshDict @@ -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 +( +); + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/polyMesh/boundary b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/polyMesh/boundary new file mode 100644 index 000000000..e8c021289 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/polyMesh/boundary @@ -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; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/transportProperties b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/transportProperties new file mode 100644 index 000000000..8b77bab3b --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/constant/transportProperties @@ -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; + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/T b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/T new file mode 100644 index 000000000..556bfb014 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/T @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/U b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/U new file mode 100644 index 000000000..8d7f4f69f --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/U @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/p b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/p new file mode 100644 index 000000000..e81e0d965 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam1/initial/0/p @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/T b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/T new file mode 100644 index 000000000..a92cb7ba0 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/T @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/U b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/U new file mode 100644 index 000000000..09f264f0d --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/U @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/p b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/p new file mode 100644 index 000000000..d1964aafa --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/icoFoam2/initial/0/p @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/scalarTransportFoam/initial/0/T b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/scalarTransportFoam/initial/0/T new file mode 100644 index 000000000..96280f0c7 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/scalarTransportFoam/initial/0/T @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/scalarTransportFoam/initial/0/U b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/scalarTransportFoam/initial/0/U new file mode 100644 index 000000000..d0187a768 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/multiSolver/scalarTransportFoam/initial/0/U @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/controlDict b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/controlDict new file mode 100644 index 000000000..132d74cc6 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/controlDict @@ -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; + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/decomposeParDict b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/decomposeParDict new file mode 100644 index 000000000..641cc6b85 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/decomposeParDict @@ -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 ( ); + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/fvSchemes b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/fvSchemes new file mode 100644 index 000000000..20d1f8484 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/fvSchemes @@ -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 ; +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/fvSolution b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/fvSolution new file mode 100644 index 000000000..f92dfe669 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/fvSolution @@ -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; +} + + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiControlDict b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiControlDict new file mode 100644 index 000000000..a3e116162 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiControlDict @@ -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; + } +} diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiFvSchemes b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiFvSchemes new file mode 100644 index 000000000..36ca427a5 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiFvSchemes @@ -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; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiFvSolution b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiFvSolution new file mode 100644 index 000000000..133de7424 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/parTeeFitting2d/system/multiFvSolution @@ -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; + } + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/controlDict b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/controlDict index e6dddb44c..132d74cc6 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/controlDict +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/controlDict @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.7.1 | -| \\ / A nd | Web: www.OpenFOAM.com | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/decomposeParDict b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/decomposeParDict new file mode 100644 index 000000000..641cc6b85 --- /dev/null +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/decomposeParDict @@ -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 ( ); + +// ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/fvSchemes b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/fvSchemes index 3a9c54797..20d1f8484 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/fvSchemes +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/fvSchemes @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.7.1 | -| \\ / A nd | Web: www.OpenFOAM.com | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/fvSolution b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/fvSolution index 2e430db2b..f92dfe669 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/fvSolution +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/fvSolution @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.7.1 | -| \\ / A nd | Web: www.OpenFOAM.com | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/multiFvSolution b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/multiFvSolution index 1bdfe9325..133de7424 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/multiFvSolution +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/system/multiFvSolution @@ -76,7 +76,7 @@ multiSolver pRefValue 0; } } - + scalarTransportFoam { solvers From 6a3bd4a7403120da2629f57814788aecf0783122 Mon Sep 17 00:00:00 2001 From: "David L. F. Gaden" Date: Thu, 29 Aug 2013 17:06:58 -0500 Subject: [PATCH 2/2] Updated tutorial file changes --- .../multiSolver/icoFoam1/initial/0/T | 12 +++++++----- .../multiSolver/icoFoam1/initial/0/U | 16 +++++++++------- .../multiSolver/icoFoam1/initial/0/p | 16 +++++++++------- .../multiSolver/icoFoam2/initial/0/T | 10 ++++++---- .../multiSolver/icoFoam2/initial/0/U | 16 +++++++++------- .../multiSolver/icoFoam2/initial/0/p | 16 +++++++++------- .../multiSolver/scalarTransportFoam/initial/0/T | 12 +++++++----- .../multiSolver/scalarTransportFoam/initial/0/U | 16 +++++++++------- 8 files changed, 65 insertions(+), 49 deletions(-) diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/T b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/T index 664e75477..556bfb014 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/T +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/T @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -10,7 +10,8 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + location "-1"; + object icoFoam1@-1@0@T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -36,7 +37,7 @@ boundaryField { type zeroGradient; } - northBranch // inlet + northBranch { type fixedValue; value uniform 1; @@ -47,4 +48,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/U b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/U index 3c3f5d721..8d7f4f69f 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/U +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/U @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -10,7 +10,8 @@ FoamFile version 2.0; format ascii; class volVectorField; - object U; + location "-1"; + object icoFoam1@-1@0@U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -30,16 +31,16 @@ boundaryField type fixedValue; value uniform (0 0 0); } - westStreet // closed + westStreet { type fixedValue; value uniform (0 0 0); } - eastStreet // outlet + eastStreet { type zeroGradient; } - northBranch // inlet + northBranch { type fixedValue; value uniform (0 -1 0); @@ -50,4 +51,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/p b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/p index 5c502aada..e81e0d965 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/p +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam1/initial/0/p @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -10,7 +10,8 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + location "-1"; + object icoFoam1@-1@0@p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -28,16 +29,16 @@ boundaryField { type zeroGradient; } - westStreet // closed + westStreet { type zeroGradient; } - eastStreet // outlet + eastStreet { type fixedValue; value uniform 0; } - northBranch // inlet + northBranch { type zeroGradient; } @@ -47,4 +48,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/T b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/T index 807d685ae..a92cb7ba0 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/T +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/T @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -10,7 +10,8 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + location "-1"; + object icoFoam2@-1@0@T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,4 +48,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/U b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/U index e172533fc..09f264f0d 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/U +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/U @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -10,7 +10,8 @@ FoamFile version 2.0; format ascii; class volVectorField; - object U; + location "-1"; + object icoFoam2@-1@0@U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -30,16 +31,16 @@ boundaryField type fixedValue; value uniform (0 0 0); } - westStreet // outlet + westStreet { type zeroGradient; } - eastStreet // inlet + eastStreet { type fixedValue; value uniform (-1 0 0); } - northBranch // outlet + northBranch { type zeroGradient; } @@ -49,4 +50,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/p b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/p index 1e9db6433..d1964aafa 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/p +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/icoFoam2/initial/0/p @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -10,7 +10,8 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + location "-1"; + object icoFoam2@-1@0@p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -28,16 +29,16 @@ boundaryField { type zeroGradient; } - westStreet // outlet + westStreet { type fixedValue; value uniform 0; } - eastStreet // inlet + eastStreet { type zeroGradient; } - northBranch // outlet + northBranch { type fixedValue; value uniform 0; @@ -48,4 +49,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/scalarTransportFoam/initial/0/T b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/scalarTransportFoam/initial/0/T index 664e75477..96280f0c7 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/scalarTransportFoam/initial/0/T +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/scalarTransportFoam/initial/0/T @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -10,7 +10,8 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + location "-1"; + object scalarTransportFoam@-1@0@T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -36,7 +37,7 @@ boundaryField { type zeroGradient; } - northBranch // inlet + northBranch { type fixedValue; value uniform 1; @@ -47,4 +48,5 @@ boundaryField } } + // ************************************************************************* // diff --git a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/scalarTransportFoam/initial/0/U b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/scalarTransportFoam/initial/0/U index 9a06af3c1..d0187a768 100644 --- a/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/scalarTransportFoam/initial/0/U +++ b/tutorials/multiSolver/multiSolverDemo/teeFitting2d/multiSolver/scalarTransportFoam/initial/0/U @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -10,7 +10,8 @@ FoamFile version 2.0; format ascii; class volVectorField; - object U; + location "-1"; + object scalarTransportFoam@-1@0@U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -30,15 +31,15 @@ boundaryField type fixedValue; value uniform (0 0 0); } - westStreet // outlet + westStreet { type zeroGradient; } - eastStreet // closed + eastStreet { type zeroGradient; } - northBranch // inlet + northBranch { type fixedValue; value uniform (0 -1 0); @@ -49,4 +50,5 @@ boundaryField } } + // ************************************************************************* //