diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C index 155b08a0f895056ed40e5555c31a8cc52f5ef694..80e7e78fbba68faa4f1c7ab1d7a97831d99231f8 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,6 +47,7 @@ Description #include "radiationModel.H" #include "fvOptions.H" #include "coordinateSystem.H" +#include "loopControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -89,11 +90,10 @@ int main(int argc, char *argv[]) } } - // --- PIMPLE loop - for (int oCorr=0; oCorr<nOuterCorr; oCorr++) + for (int oCorr=0; oCorr<nOuterCorr; ++oCorr) { - bool finalIter = oCorr == nOuterCorr-1; + const bool finalIter = (oCorr == nOuterCorr-1); forAll(fluidRegions, i) { @@ -113,6 +113,35 @@ int main(int argc, char *argv[]) #include "solveSolid.H" } + // Additional loops for energy solution only + if (!oCorr && nOuterCorr > 1) + { + loopControl looping(runTime, pimple, "energyCoupling"); + + while (looping.loop()) + { + Info<< nl << looping << nl; + + forAll(fluidRegions, i) + { + Info<< "\nSolving for fluid region " + << fluidRegions[i].name() << endl; + #include "setRegionFluidFields.H" + #include "readFluidMultiRegionPIMPLEControls.H" + frozenFlow = true; + #include "solveFluid.H" + } + + forAll(solidRegions, i) + { + Info<< "\nSolving for solid region " + << solidRegions[i].name() << endl; + #include "setRegionSolidFields.H" + #include "readSolidMultiRegionPIMPLEControls.H" + #include "solveSolid.H" + } + } + } } runTime.write(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index ea89befe12bf76afaa8f6f2daff58665542b9fb4..20aa2d59cd2b8462b3a48fbc693c7e735b5de48a 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,6 +42,7 @@ Description #include "radiationModel.H" #include "fvOptions.H" #include "coordinateSystem.H" +#include "loopControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,7 +58,6 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "initContinuityErrs.H" - while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; @@ -80,6 +80,35 @@ int main(int argc, char *argv[]) #include "solveSolid.H" } + // Additional loops for energy solution only + { + loopControl looping(runTime, "SIMPLE", "energyCoupling"); + + while (looping.loop()) + { + Info<< nl << looping << nl; + + forAll(fluidRegions, i) + { + Info<< "\nSolving for fluid region " + << fluidRegions[i].name() << endl; + #include "setRegionFluidFields.H" + #include "readFluidMultiRegionSIMPLEControls.H" + frozenFlow = true; + #include "solveFluid.H" + } + + forAll(solidRegions, i) + { + Info<< "\nSolving for solid region " + << solidRegions[i].name() << endl; + #include "setRegionSolidFields.H" + #include "readSolidMultiRegionSIMPLEControls.H" + #include "solveSolid.H" + } + } + } + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H index 6cde0ec06bb153112f0da3cbdc1bf63c3e42e1e9..119c2ad7ea83e8099128d43417c7931cf8ecedc2 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H @@ -12,6 +12,14 @@ volScalarField& p = thermo.p(); const volScalarField& psi = thermo.psi(); + volScalarField& p_rgh = p_rghFluid[i]; + + const dimensionedVector& g = gFluid[i]; + const volScalarField& gh = ghFluid[i]; + const surfaceScalarField& ghf = ghfFluid[i]; + + radiation::radiationModel& rad = radiation[i]; + IOMRFZoneList& MRF = MRFfluid[i]; fv::options& fvOptions = fluidFvOptions[i]; @@ -22,14 +30,7 @@ initialMassFluid[i] ); - radiation::radiationModel& rad = radiation[i]; + bool frozenFlow = frozenFlowFluid[i]; const label pRefCell = pRefCellFluid[i]; const scalar pRefValue = pRefValueFluid[i]; - const bool frozenFlow = frozenFlowFluid[i]; - - volScalarField& p_rgh = p_rghFluid[i]; - - const dimensionedVector& g = gFluid[i]; - const volScalarField& gh = ghFluid[i]; - const surfaceScalarField& ghf = ghfFluid[i]; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H index 0600a1c65087524b1e38a03e59e97707ebe5f1d5..2b6306e5c2d04894a612d591053b718bdc193665 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H @@ -1,5 +1,5 @@ { - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=nNonOrthCorr; ++nonOrth) { fvScalarMatrix hEqn ( @@ -20,9 +20,9 @@ fvOptions.correct(h); } -} -thermo.correct(); + thermo.correct(); -Info<< "Min/max T:" << min(thermo.T()).value() << ' ' - << max(thermo.T()).value() << endl; + Info<< "Min/max T:" << min(thermo.T()).value() << ' ' + << max(thermo.T()).value() << endl; +} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H index 87e372fcae3b5deef8b5df76ba8de942ade4ee93..15aba4cb27fc9a4542cef4289bb7d7b402a03ee7 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H @@ -19,8 +19,8 @@ List<bool> frozenFlowFluid(fluidRegions.size(), false); PtrList<IOMRFZoneList> MRFfluid(fluidRegions.size()); PtrList<fv::options> fluidFvOptions(fluidRegions.size()); -List<label> refCellFluid(fluidRegions.size()); -List<scalar> refValueFluid(fluidRegions.size()); +List<label> pRefCellFluid(fluidRegions.size()); +List<scalar> pRefValueFluid(fluidRegions.size()); // Populate fluid field pointer lists forAll(fluidRegions, i) @@ -252,8 +252,8 @@ forAll(fluidRegions, i) turbulence[i].validate(); - refCellFluid[i] = 0; - refValueFluid[i] = 0.0; + pRefCellFluid[i] = 0; + pRefValueFluid[i] = 0.0; if (p_rghFluid[i].needReference()) { @@ -262,8 +262,8 @@ forAll(fluidRegions, i) thermoFluid[i].p(), p_rghFluid[i], pimpleDict, - refCellFluid[i], - refValueFluid[i] + pRefCellFluid[i], + pRefValueFluid[i] ); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H index 5edd27ac5e506079d003e29b1979d5606c81eb3d..e725968af3be0f093d92e740affe1e8ff5cb7585 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H @@ -32,7 +32,8 @@ initialMassFluid[i] ); - const bool frozenFlow = frozenFlowFluid[i]; + bool frozenFlow = frozenFlowFluid[i]; + + const label pRefCell = pRefCellFluid[i]; + const scalar pRefValue = pRefValueFluid[i]; - const label pRefCell = refCellFluid[i]; - const scalar pRefValue = refValueFluid[i]; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidMeshes.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidMeshes.H index 101d98ebe632a87102ea669fd3381b812204afef..39644ceee7c3fb368f921f09deb8c59c107a2086 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidMeshes.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidMeshes.H @@ -1,10 +1,10 @@ - const wordList solidsNames(rp["solid"]); + const wordList solidNames(rp["solid"]); - PtrList<fvMesh> solidRegions(solidsNames.size()); + PtrList<fvMesh> solidRegions(solidNames.size()); - forAll(solidsNames, i) + forAll(solidNames, i) { - Info<< "Create solid mesh for region " << solidsNames[i] + Info<< "Create solid mesh for region " << solidNames[i] << " for time = " << runTime.timeName() << nl << endl; solidRegions.set @@ -14,7 +14,7 @@ ( IOobject ( - solidsNames[i], + solidNames[i], runTime.timeName(), runTime, IOobject::MUST_READ diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H index 30a670768fff800ad521fc9e03c4d990584691d3..791e0d64057cf428b80b158dd4357f84a4264ffa 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H @@ -4,7 +4,7 @@ if (finalIter) } { - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + for (int nonOrth=0; nonOrth<=nNonOrthCorr; ++nonOrth) { fvScalarMatrix hEqn ( @@ -26,12 +26,12 @@ if (finalIter) fvOptions.correct(h); } -} -thermo.correct(); + thermo.correct(); -Info<< "Min/max T:" << min(thermo.T()).value() << ' ' - << max(thermo.T()).value() << endl; + Info<< "Min/max T:" << min(thermo.T()).value() << ' ' + << max(thermo.T()).value() << endl; +} if (finalIter) { diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C index 51e1323ec8d16fd288a4740990e7e417b4d7ad66..a13a04415738dd7d72f62ce955c6c14135ab9d54 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C @@ -141,6 +141,12 @@ bool Foam::functionObject::read(const dictionary& dict) } +bool Foam::functionObject::execute(const label) +{ + return true; +} + + bool Foam::functionObject::end() { return true; diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index febb76de10c336143a5fea9979514ceef0e70cdd..3f47feba8c4537e65248ed233827c9b498d78359 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H @@ -222,13 +222,19 @@ public: const word& name() const; //- Read and set the function object if its data have changed - virtual bool read(const dictionary&); + virtual bool read(const dictionary& dict); //- Called at each ++ or += of the time-loop. // postProcess overrides the usual executeControl behaviour and // forces execution (used in post-processing mode) virtual bool execute() = 0; + //- Execute using the specified subIndex. + // The base implementation is a no-op. + // \param subIndex an execution sub-index corresponding to a + // sub-cycle or something similar. + virtual bool execute(const label subIndex); + //- Called at each ++ or += of the time-loop. // postProcess overrides the usual writeControl behaviour and // forces writing always (used in post-processing mode) @@ -245,9 +251,11 @@ public: virtual bool filesModified() const; //- Update for changes of mesh + // The base implementation is a no-op. virtual void updateMesh(const mapPolyMesh& mpm); //- Update for changes of mesh + // The base implementation is a no-op. virtual void movePoints(const polyMesh& mesh); }; diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 31bf1d40d7689d167b20d9e30f01cc78c87d1918..98174a669e72bb39c6272e7e6f9537062074f3b4 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -32,6 +32,7 @@ License //#include "IFstream.H" #include "dictionaryEntry.H" #include "stringOps.H" +#include "wordRes.H" #include "Tuple2.H" #include "etcFiles.H" #include "IOdictionary.H" @@ -579,6 +580,7 @@ bool Foam::functionObjectList::execute() } } } + // Force writing of state dictionary after function object execution if (time_.writeTime()) { @@ -600,6 +602,49 @@ bool Foam::functionObjectList::execute() } +bool Foam::functionObjectList::execute(const label subIndex) +{ + bool ok = execution_; + + if (ok) + { + forAll(*this, obji) + { + functionObject& funcObj = operator[](obji); + + ok = funcObj.execute(subIndex) && ok; + } + } + + return ok; +} + + +bool Foam::functionObjectList::execute +( + const wordRes& functionNames, + const label subIndex +) +{ + bool ok = execution_; + + if (ok && functionNames.size()) + { + forAll(*this, obji) + { + functionObject& funcObj = operator[](obji); + + if (functionNames.match(funcObj.name())) + { + ok = funcObj.execute(subIndex) && ok; + } + } + } + + return ok; +} + + bool Foam::functionObjectList::end() { bool ok = true; diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H index c90318727b9bff4165809a885ce4d19c591eeb08..e32b01e25b0adfd46addf6d0dcd1fcf87ea9787f 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H @@ -52,8 +52,10 @@ SourceFiles namespace Foam { -class mapPolyMesh; +// Forward declarations class argList; +class mapPolyMesh; +class wordRes; /*---------------------------------------------------------------------------*\ Class functionObjectList Declaration @@ -94,19 +96,19 @@ class functionObjectList void createStateDict() const; //- Remove and return the function object pointer by name, - // and returns the old index via the parameter. + //- and returns the old index via the parameter. // Returns a nullptr (and index -1) if it didn't exist - functionObject* remove(const word&, label& oldIndex); + functionObject* remove(const word& key, label& oldIndex); //- Search the specified directory for functionObject - // configuration files, add to the given map and recurse + //- configuration files, add to the given map and recurse static void listDir(const fileName& dir, HashSet<word>& foMap); //- Disallow default bitwise copy construct - functionObjectList(const functionObjectList&); + functionObjectList(const functionObjectList&) = delete; //- Disallow default bitwise assignment - void operator=(const functionObjectList&); + void operator=(const functionObjectList&) = delete; public: @@ -114,7 +116,7 @@ public: // Static data members //- Default relative path to the directory structure - // containing the functionObject dictionary files + //- containing the functionObject dictionary files static fileName functionObjectDictPath; @@ -188,7 +190,7 @@ public: label findObjectID(const word& name) const; //- Print a list of functionObject configuration files in - // user/group/shipped directories. + //- user/group/shipped directories. // The search scheme allows for version-specific and // version-independent files using the following hierarchy: // - \b user settings: @@ -205,7 +207,7 @@ public: static void list(); //- Search for functionObject dictionary file in - // user/group/shipped directories. + //- user/group/shipped directories. // The search scheme allows for version-specific and // version-independent files using the following hierarchy: // - \b user settings: @@ -258,6 +260,18 @@ public: // forces execution (used in post-processing mode) bool execute(); + //- Execute function objects using the specified subIndex. + // \param subIndex an execution sub-index corresponding to a + // sub-cycle or something similar + bool execute(const label subIndex); + + //- Execute a subset of function objects using the specified subIndex. + // \param functionNames names or regex of existing functions to + // execute + // \param subIndex an execution sub-index corresponding to a + // sub-cycle or something similar + bool execute(const wordRes& functionNames, const label subIndex); + //- Called when Time::run() determines that the time-loop exits bool end(); diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C index bbb495cb98da121dfc0a0d83e3dfe406983742e8..96e088fe2dd271a7bd56cd54d0fcb5a61f2b30fa 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.C @@ -450,6 +450,18 @@ bool Foam::functionObjects::timeControl::execute() } +bool Foam::functionObjects::timeControl::execute(const label subIndex) +{ + if (active()) + { + // Call underlying function object directly + foPtr_->execute(subIndex); + } + + return true; +} + + bool Foam::functionObjects::timeControl::write() { if (active() && (postProcess || writeControl_.execute())) @@ -726,10 +738,8 @@ bool Foam::functionObjects::timeControl::read(const dictionary& dict) return true; } - else - { - return false; - } + + return false; } diff --git a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H index 4b4bca78e1617f296dbaa7dbbbb6601a1b0eddf0..18a3e51461c38f68a1e2f53c53c682eb6f5edc4d 100644 --- a/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/timeControl/timeControlFunctionObject.H @@ -206,6 +206,9 @@ public: // forces execution (used in post-processing mode) virtual bool execute(); + //- Execute using the specified subIndex. + virtual bool execute(const label subIndex); + //- Called at each ++ or += of the time-loop. // postProcess overrides the usual writeControl behaviour and // forces writing (used in post-processing mode) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index db88df52ae7abd5bd5f9f49e836c00cc74db6c03..e7023dea211fa34aad9980e68153641fa7c9545d 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -425,6 +425,7 @@ $(coupling)/externalFileCoupler.C solutionControl = $(general)/solutionControl $(solutionControl)/solutionControl/solutionControl.C +$(solutionControl)/loopControl/loopControl.C $(solutionControl)/simpleControl/simpleControl.C $(solutionControl)/pimpleControl/pimpleControl.C $(solutionControl)/pisoControl/pisoControl.C diff --git a/src/finiteVolume/cfdTools/general/solutionControl/loopControl/fvSolution b/src/finiteVolume/cfdTools/general/solutionControl/loopControl/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..19d8b0fe0b132a7cad73c67ba050df55c0c0d164 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/solutionControl/loopControl/fvSolution @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +SIMPLE +{ + energyCoupling + { + // (Max) number of loops + iterations 200; + + // The interval to execute onLoop function-objects + interval 0; + + // Convergence criteria to terminate loop + convergence + { + "h" 1e-3; + } + + // Names of function objects to fire with execute(int) when looping + onLoop ( ); + + // Names of function objects to fire with execute(int) when converged + onConverged ( ); + + // Names of function objects to fire with execute(int) when loop ends + // without convergence + onEnd ( ); + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/loopControl/loopControl.C b/src/finiteVolume/cfdTools/general/solutionControl/loopControl/loopControl.C new file mode 100644 index 0000000000000000000000000000000000000000..f4531243686f3f9e9513f8745c7c0beffdfddc94 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/solutionControl/loopControl/loopControl.C @@ -0,0 +1,280 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "loopControl.H" +#include "fvSolution.H" +#include "wordRes.H" +#include "solutionControl.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::loopControl::clear() +{ + total_ = 0; + interval_ = 0; + + convergenceDict_.clear(); + onLoop_.clear(); + onConverged_.clear(); + onEnd_.clear(); + + converged_ = false; +} + + +void Foam::loopControl::read(const dictionary& dict) +{ + clear(); + + bool enabled = dict.lookupOrDefault("enabled", true); + + if (enabled) + { + scalar timeStart; + if (dict.readIfPresent("timeStart", timeStart)) + { + timeStart = time_.userTimeToTime(timeStart); + + enabled = + ( + enabled + && time_.value() >= (timeStart - 0.5*time_.deltaTValue()) + ); + } + + scalar timeEnd; + if (dict.readIfPresent("timeEnd", timeEnd)) + { + timeEnd = time_.userTimeToTime(timeEnd); + + enabled = + ( + enabled + && time_.value() <= (timeEnd + 0.5*time_.deltaTValue()) + ); + } + } + + if (!enabled) + { + return; + } + + dict.readIfPresent("iterations", total_); + dict.readIfPresent("interval", interval_); + + convergenceDict_ = dict.subOrEmptyDict("convergence"); + + dict.readIfPresent("onLoop", onLoop_); + dict.readIfPresent("onConverged", onConverged_); + dict.readIfPresent("onEnd", onEnd_); +} + + +bool Foam::loopControl::checkConverged() const +{ + if (convergenceDict_.empty()) + { + return false; + } + + HashTable<const fvMesh*> meshes = time_.lookupClass<const fvMesh>(); + + bool achieved = true; + bool checked = false; // safety that some checks were indeed performed + + forAllConstIters(meshes, meshIter) + { + const fvMesh& regionMesh = *(meshIter.object()); + + const dictionary& solverDict = regionMesh.solverPerformanceDict(); + + forAllConstIters(solverDict, iter) + { + const entry& dataDictEntry = *iter; + + const word& variableName = dataDictEntry.keyword(); + + const scalar absTol = + convergenceDict_.lookupOrDefault<scalar>(variableName, -1); + + if (absTol > 0) + { + // Treat like a SIMPLE control + + Pair<scalar> residuals = + solutionControl::maxResidual + ( + regionMesh, + dataDictEntry + ); + + checked = true; + achieved = achieved && (residuals.first() < absTol); + } + } + } + + return checked && achieved; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::loopControl::loopControl +( + Time& runTime, + const label nCycles, + const word& loopName +) +: + subLoopTime(runTime, nCycles), + name_(loopName), + interval_(0), + convergenceDict_(), + onLoop_(), + onConverged_(), + onEnd_(), + converged_(false) +{} + + +Foam::loopControl::loopControl +( + Time& runTime, + const dictionary& algorithmDict, + const word& dictName +) +: + loopControl(runTime, 0, dictName) +{ + // The loop sub-dictionary + const dictionary* dictptr = algorithmDict.subDictPtr(dictName); + + if (dictptr) + { + // Info<< dictName << *dictptr << endl; + read(*dictptr); + } +} + + +Foam::loopControl::loopControl +( + Time& runTime, + const word& algorithmName, + const word& dictName +) +: + loopControl(runTime, 0, dictName) +{ + fvSolution fvsol(time_); + + // Eg, PIMPLE or SIMPLE from <system/fvSolution> + const dictionary* dictptr = + fvsol.solutionDict().subDictPtr(algorithmName); + + if (dictptr) + { + // The loop sub-dictionary + dictptr = dictptr->subDictPtr(dictName); + + if (dictptr) + { + // Info<< dictName << *dictptr << endl; + read(*dictptr); + } + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::loopControl::~loopControl() +{ + stop(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::loopControl::loop() +{ + bool active = (index_ < total_); // as per status() + + if (active) + { + operator++(); + + converged_ = checkConverged(); + + if (converged_) + { + time_.functionObjects().execute(onConverged_, index_); + stop(); + return false; + } + else if + ( + interval_ && !(index_ % interval_) + && !onLoop_.empty() + ) + { + time_.functionObjects().execute(onLoop_, index_); + } + } + else if (index_) + { + // Not active, the loop condition has now exiting on the last subloop + + if (!converged_ && !onEnd_.empty()) + { + time_.functionObjects().execute(onEnd_, index_); + } + } + + return active; +} + + +// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const loopControl& ctrl) +{ + os << ctrl.name() << ": "; + if (ctrl.nCycles() && ctrl.index() <= ctrl.nCycles()) + { + os << ctrl.index() << '/' << ctrl.nCycles(); + } + else + { + os << "off"; + } + + return os; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/loopControl/loopControl.H b/src/finiteVolume/cfdTools/general/solutionControl/loopControl/loopControl.H new file mode 100644 index 0000000000000000000000000000000000000000..ced72d57e3035d5d644c7d548062d47f65622e51 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/solutionControl/loopControl/loopControl.H @@ -0,0 +1,227 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::loopControl + +Description + A class for managing arbitrary loops with the ability to invoke + function object execution. + +Usage + Examples of function object specification: + \verbatim + SIMPLE + { + energyCoupling + { + iterations 100; + onLoop (); + onConverged ( externalCoupled "loopThings.*" ); + + convergence + { + "h" 1e-3; + } + } + } + + Where the loop entries comprise: + \table + Property | Description | Required | Default + enabled | active/deactive loop | no | true + iteration | times to loop | no | 0 + timeStart | begin time for loop activation | no | -VGREAT + timeEnd | end time of loop activation | no | VGREAT + interval | sub-interval to execute onLoop | no | 0 + onLoop | function object names to call at executeInterval | no + onConverged | function object names to call when converged | no + onEnd | function object names to call when loop ends | no + convergence | dictionary of convergence values to check | no + \endtable + + The function object names listed by \c onLoop, \c onConverged, \c onEnd + must implement an \c execute(int) method. + If the time controls \c timeStart or \c timeEnd are used for the loop, + these values are only inspected upon creation, not during execution. + +SeeAlso + fvSolution + +SourceFiles + loopControl.C + +\*---------------------------------------------------------------------------*/ + +#ifndef loopControl_H +#define loopControl_H + +#include "subLoopTime.H" +#include "dictionary.H" +#include "wordReList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class loopControl Declaration +\*---------------------------------------------------------------------------*/ + +class loopControl +: + public subLoopTime +{ + // Private Member Functions + + //- Reset + void clear(); + + //- Read settings from dictionary + void read(const dictionary& dict); + + //- Execute specified function names + bool checkConverged() const; + + //- Disallow default bitwise copy construct + loopControl(const loopControl&) = delete; + + //- Disallow default bitwise assignment + void operator=(const loopControl&) = delete; + +protected: + + // Protected data + + //- Name of the loop control (the lookup dictionary name). + word name_; + + //- The interval to execute onLoop function-objects + label interval_; + + //- Dictionary for checking convergence (all regions) + dictionary convergenceDict_; + + //- Function object names to fire during the loop (at executeInterval) + List<wordRe> onLoop_; + + //- Function object names to fire on convergence + List<wordRe> onConverged_; + + //- Function object names to fire when the loop exits without + //- convergence + List<wordRe> onEnd_; + + //- Convergence tests passed + bool converged_; + +public: + + // Constructors + + //- Construct from time with fixed number of cycles + // \param runTime the top-level time + // \param nCycles the number of times to loop + // \param loopName the name of the loop + loopControl + ( + Time& runTime, + const label nCycles, + const word& dictName = "loop" + ); + + //- Construct from fvSolution dictionary based on time and the name + //- of the controlling algorithm + // \param runTime the top-level time + // \param algorithmName the name of the fvSolution dictionary, + // typically PIMPLE or SIMPLE + // \param dictName the name of the control dictionary + loopControl + ( + Time& runTime, + const word& algorithmName, + const word& dictName = "loop" + ); + + //- Construct from fvSolution dictionary based on time and the name + //- of the controlling algorithm + // \param runTime the top-level time + // \param algorithmDict the fvSolution algorithm dictionary, + // typically PIMPLE or SIMPLE + // \param dictName the name of the control dictionary + loopControl + ( + Time& runTime, + const dictionary& algorithmDict, + const word& dictName = "loop" + ); + + + //- Destructor + ~loopControl(); + + + // Member Functions + + //- Name of the loop control + inline const word& name() const + { + return name_; + } + + //- The interval to execute onLoop function-objects + inline label interval() const + { + return interval_; + } + + //- True if looping is active, increments the index and executes + //- the onLoop and onConverged functions. + // Example usage, + // \code + // while (control.loop()) + // { + // solve; + // } + // \endcode + bool loop(); + + + // IOstream operators + + //- Write name and state (on/off, index/total) to Ostream + friend Ostream& operator<<(Ostream& os, const loopControl& ctrl); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/functionObjects/field/externalCoupled/externalCoupled.C b/src/functionObjects/field/externalCoupled/externalCoupled.C index 5d18e58c335c465239f2a42e3b65083c0a0c61f1..7e702381dc90bb6fe583f962e50218f30b5c6a19 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupled.C +++ b/src/functionObjects/field/externalCoupled/externalCoupled.C @@ -127,7 +127,7 @@ void Foam::functionObjects::externalCoupled::readColumns List<scalarField> values(nColumns); // Number of rows to read for processor proci - label procNRows = globalFaces.localSize(proci); + const label procNRows = globalFaces.localSize(proci); forAll(values, columni) { @@ -195,7 +195,7 @@ void Foam::functionObjects::externalCoupled::readLines for (label proci = 0; proci < Pstream::nProcs(); ++proci) { // Number of rows to read for processor proci - label procNRows = globalFaces.localSize(proci); + const label procNRows = globalFaces.localSize(proci); UOPstream toProc(proci, pBufs); @@ -369,19 +369,17 @@ Foam::word Foam::functionObjects::externalCoupled::compositeName return regionNames[0]; } } - else - { - // Enforce lexical ordering - checkOrder(regionNames); - word composite(regionNames[0]); - for (label i = 1; i < regionNames.size(); i++) - { - composite += "_" + regionNames[i]; - } + // Enforce lexical ordering + checkOrder(regionNames); - return composite; + word composite(regionNames[0]); + for (label i = 1; i < regionNames.size(); ++i) + { + composite += "_" + regionNames[i]; } + + return composite; } @@ -418,8 +416,7 @@ void Foam::functionObjects::externalCoupled::initCoupling() UPtrList<const fvMesh> meshes(regionNames.size()); forAll(regionNames, regi) { - const word& regionName = regionNames[regi]; - meshes.set(regi, &time_.lookupObject<fvMesh>(regionName)); + meshes.set(regi, time_.lookupObjectPtr<fvMesh>(regionNames[regi])); } const labelList& groups = regionToGroups_[compName]; @@ -484,6 +481,9 @@ void Foam::functionObjects::externalCoupled::performCoupling() // Signal external source to wait (by creating the lock file) useMaster(); + // Update information about last triggering + lastTrigger_ = time_.timeIndex(); + // Process any abort information sent from slave if ( @@ -491,6 +491,9 @@ void Foam::functionObjects::externalCoupled::performCoupling() && action != Time::stopAtControls::saUnknown ) { + Info<< type() << ": slave requested action " + << Time::stopAtControlNames[action] << endl; + time_.stopAt(action); } } @@ -508,6 +511,8 @@ Foam::functionObjects::externalCoupled::externalCoupled functionObject(name), externalFileCoupler(), time_(runTime), + calcFrequency_(-1), + lastTrigger_(-1), initialisedCoupling_(false) { read(dict); @@ -523,7 +528,12 @@ Foam::functionObjects::externalCoupled::externalCoupled bool Foam::functionObjects::externalCoupled::execute() { - if (!initialisedCoupling_ || time_.timeIndex() % calcFrequency_ == 0) + // Not initialized or overdue + if + ( + !initialisedCoupling_ + || (time_.timeIndex() >= lastTrigger_ + calcFrequency_) + ) { performCoupling(); } @@ -532,6 +542,14 @@ bool Foam::functionObjects::externalCoupled::execute() } +bool Foam::functionObjects::externalCoupled::execute(const label subIndex) +{ + performCoupling(); + + return true; +} + + bool Foam::functionObjects::externalCoupled::end() { functionObject::end(); @@ -552,6 +570,8 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict) calcFrequency_ = dict.lookupOrDefault("calcFrequency", 1); + // Leave trigger intact + // Get names of all fvMeshes (and derived types) wordList allRegionNames(time_.lookupClass<fvMesh>().sortedToc()); @@ -613,21 +633,21 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict) Info<< type() << ": Communicating with regions:" << endl; for (const word& compName : regionGroupNames_) { - Info<< "Region: " << compName << endl << incrIndent; + Info<< "Region: " << compName << nl << incrIndent; const labelList& groups = regionToGroups_[compName]; for (const label groupi : groups) { const wordRe& groupName = groupNames_[groupi]; Info<< indent << "patchGroup: " << groupName << "\t" - << endl + << nl << incrIndent << indent << "Reading fields: " << groupReadFields_[groupi] - << endl + << nl << indent << "Writing fields: " << groupWriteFields_[groupi] - << endl + << nl << decrIndent; } Info<< decrIndent; @@ -671,10 +691,9 @@ void Foam::functionObjects::externalCoupled::readDataMaster() // Get the meshes for the region-group UPtrList<const fvMesh> meshes(regionNames.size()); - forAll(regionNames, j) + forAll(regionNames, regi) { - const word& regionName = regionNames[j]; - meshes.set(j, &time_.lookupObject<fvMesh>(regionName)); + meshes.set(regi, time_.lookupObjectPtr<fvMesh>(regionNames[regi])); } const labelList& groups = regionToGroups_[compName]; @@ -716,10 +735,9 @@ void Foam::functionObjects::externalCoupled::writeDataMaster() const // Get the meshes for the region-group UPtrList<const fvMesh> meshes(regionNames.size()); - forAll(regionNames, j) + forAll(regionNames, regi) { - const word& regionName = regionNames[j]; - meshes.set(j, &time_.lookupObject<fvMesh>(regionName)); + meshes.set(regi, time_.lookupObjectPtr<fvMesh>(regionNames[regi])); } const labelList& groups = regionToGroups_[compName]; diff --git a/src/functionObjects/field/externalCoupled/externalCoupled.H b/src/functionObjects/field/externalCoupled/externalCoupled.H index 516d7c4d520ae9e0eb7d8cd4bb4478c2e449bd1f..1d8a0834f3ac73280cd75e4db03104ca54abb8c6 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupled.H +++ b/src/functionObjects/field/externalCoupled/externalCoupled.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,9 +29,10 @@ Group Description This functionObject provides a simple interface for explicit coupling with - an external application. The coupling is through plain text files - where OpenFOAM boundary data is read/written as one line per face - (data from all processors collated): + an external application. + + The coupling is through plain text files where OpenFOAM boundary data + is read/written as one line per face (data from all processors collated): \verbatim # Patch: <patch name> <fld1> <fld2> .. <fldn> //face0 @@ -167,7 +168,7 @@ namespace functionObjects { /*---------------------------------------------------------------------------*\ - Class externalCoupled Declaration + Class functionObjects::externalCoupled Declaration \*---------------------------------------------------------------------------*/ class externalCoupled @@ -200,6 +201,9 @@ private: //- Calculation frequency label calcFrequency_; + //- The last timeIndex when coupling was triggered + label lastTrigger_; + //- Names of (composite) regions DynamicList<word> regionGroupNames_; @@ -232,7 +236,6 @@ private: const wordRe& groupName ); - //- Read data for a single region, single field template<class Type> bool readData @@ -326,6 +329,9 @@ public: //- Called at each ++ or += of the time-loop virtual bool execute(); + //- Manual execute (sub-loop or when converged) + virtual bool execute(const label subIndex); + //- Called when Time::run() determines that the time-loop exits virtual bool end(); diff --git a/src/functionObjects/field/externalCoupled/externalCoupledMixed/externalCoupledMixedFvPatchField.H b/src/functionObjects/field/externalCoupled/externalCoupledMixed/externalCoupledMixedFvPatchField.H index bb5db25f61f3a2b90660248af2d68ee179e3927d..07539e1a311de1449cef3f033edebfa031a7e911 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupledMixed/externalCoupledMixedFvPatchField.H +++ b/src/functionObjects/field/externalCoupled/externalCoupledMixed/externalCoupledMixedFvPatchField.H @@ -28,18 +28,23 @@ Group grpGenericBoundaryConditions grpCoupledBoundaryConditions Description - This boundary condition extends the mixed boundary condition with - serialisation through + Extends the mixed boundary condition with serialisation functions. + + The serialisation functions: + - writeHeader - writeData - readData - functions. It is used for coupling to external applications in combination + + It is used for coupling to external applications in combination with the externalCoupled functionObject. The default output is one line per face, with columns - <value> <snGrad> <refValue> <refGrad> <valueFraction> + \verbatim + <value> <snGrad> <refValue> <refGrad> <valueFraction> + \endverbatim -Notes - readData,writeData are not callbacks for regIOobject (since fvPatchField +Note + readData, writeData are not callbacks for regIOobject (since fvPatchField not derived from it). They do however do exactly the same - streaming of data. diff --git a/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.H b/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.H index 0a9f39bd2f2ac6edb03b74eb682fc3d2a42eeadf..340407905712bfa8ce4f4219c43f5a6f8f8631da 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.H +++ b/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.H @@ -29,33 +29,35 @@ Group Description This boundary condition provides a temperatue interface to an external - application. Values are transferred as plain text files, where OpenFOAM - data is written as: + application. + + Values are transferred as plain text files, where OpenFOAM data are + written as follows: \verbatim - # Patch: \<patch name\> - \<magSf1\> \<value1\> \<qDot1\> \<htc1\> - \<magSf2\> \<value2\> \<qDot2\> \<htc2\> - \<magSf3\> \<value3\> \<qDot3\> \<htc2\> + # Patch: <patch name> + <magSf1> <value1> <qDot1> <htc1> + <magSf2> <value2> <qDot2> <htc2> + <magSf3> <value3> <qDot3> <htc2> ... - \<magSfN\> \<valueN\> \<qDotN\> \<htcN\> + <magSfN> <valueN> <qDotN> <htcN> \endverbatim and received as the constituent pieces of the `mixed' condition, i.e. \verbatim - # Patch: \<patch name\> - \<value1\> \<gradient1\> \<valueFracion1\> - \<value2\> \<gradient2\> \<valueFracion2\> - \<value3\> \<gradient3\> \<valueFracion3\> + # Patch: <patch name> + <value1> <gradient1> <valueFracion1> + <value2> <gradient2> <valueFracion2> + <value3> <gradient3> <valueFracion3> ... - \<valueN\> \<gradientN\> \<valueFracionN\> + <valueN> <gradientN> <valueFracionN> \endverbatim Data is sent/received as a single file for all patches from the directory \verbatim - $FOAM_CASE/\<commsDir\> + $FOAM_CASE/<commsDir> \endverbatim At start-up, the boundary creates a lock file, i.e.. @@ -68,7 +70,7 @@ Description update, boundary values are written to file, e.g. \verbatim - \<fileName\>.out + <fileName>.out \endverbatim The lock file is then removed, instructing the external source to take @@ -76,13 +78,14 @@ Description should create the return values, e.g. to file \verbatim - \<fileName\>.in + <fileName>.in \endverbatim ... and then re-instate the lock file. The boundary condition will then read the return values, and pass program execution back to OpenFOAM. - To be used in combination with the externalCoupled functionObject. + To be used in combination with the functionObjects::externalCoupled + functionObject. SeeAlso externalCoupledFunctionObject diff --git a/src/regionModels/regionModel/regionProperties/regionProperties.H b/src/regionModels/regionModel/regionProperties/regionProperties.H index 937285ace4387890a398024fe28817a987af51d6..54e703344c8cfce1f5cd098e5958850306081d66 100644 --- a/src/regionModels/regionModel/regionProperties/regionProperties.H +++ b/src/regionModels/regionModel/regionProperties/regionProperties.H @@ -28,7 +28,7 @@ Description Simple class to hold region information for coupled region simulations. Gives per physics ('fluid', 'solid') the names of the regions. There - is no assumption on this level that one region should only have one + is no assumption on this level that a region should only have a single set of physics. SourceFiles @@ -57,10 +57,10 @@ class regionProperties { //- Disallow default bitwise copy construct - regionProperties(const regionProperties&); + regionProperties(const regionProperties&) = delete; //- Disallow default bitwise assignment - void operator=(const regionProperties&); + void operator=(const regionProperties&) = delete; public: diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/T b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/T similarity index 96% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/T rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/T index d28373b3da5a80c18fcda22b57a4769b98a3226d..65205f56ce74e9ac5fb6c418fa6e25eb3134939b 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/T +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/T @@ -23,7 +23,7 @@ boundaryField ".*" { type calculated; - value uniform 300; + value $internalField; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/U b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/U similarity index 95% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/U rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/U index 7ec4f2907c0f90e9c0b201b13fdcca7edfdb5a82..049f4930b8e3e1e464665f77f30e6d796e0ab706 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/U +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/U @@ -23,7 +23,7 @@ boundaryField ".*" { type calculated; - value uniform (0.01 0 0); + value $internalField; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/epsilon b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/epsilon similarity index 96% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/epsilon rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/epsilon index ee4ec0c64b525509961dd656ef7d8f3736e6631d..ffcdd13d9d4cfae36fc0aeef47201603fc82bdeb 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/epsilon +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/epsilon @@ -23,9 +23,8 @@ boundaryField ".*" { type calculated; - value uniform 0.01; + value $internalField; } } - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/k b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/k similarity index 96% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/k rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/k index a2aae944737f621cbd8775fb1c32b67e5a1fbfb4..e1e1fb1a546b775a6abddf5931d89cf95b39b04e 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/k +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/k @@ -23,9 +23,8 @@ boundaryField ".*" { type calculated; - value uniform 0.1; + value $internalField; } } - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/p b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/p similarity index 96% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/p rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/p index e54b106a156a05c93da2cd2de7ce16202c9f4694..24b94d43e759af18d92568c2def36374b6322050 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/p +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/p @@ -23,7 +23,7 @@ boundaryField ".*" { type calculated; - value uniform 1e5; + value $internalField; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/p_rgh b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/p_rgh similarity index 96% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/p_rgh rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/p_rgh index a9074ce903da41c51a37943960f41b955d45feb2..2e144189ab8ac0ee30efc01152fce0f9818b769c 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/0/p_rgh +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/0/p_rgh @@ -23,7 +23,7 @@ boundaryField ".*" { type calculated; - value uniform 1e5; + value $internalField; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/Allclean b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/Allclean similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/Allclean rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/Allclean diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/Allrun similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/Allrun rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/Allrun diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/Allrun.pre b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/Allrun.pre similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/Allrun.pre rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/Allrun.pre diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/README.txt b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/README.txt similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/README.txt rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/README.txt diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/bottomWater/g b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/bottomWater/g similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/bottomWater/g rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/bottomWater/g diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/bottomWater/radiationProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/bottomWater/radiationProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/bottomWater/radiationProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/bottomWater/radiationProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/bottomWater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/bottomWater/thermophysicalProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/bottomWater/thermophysicalProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/bottomWater/thermophysicalProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/bottomWater/turbulenceProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/bottomWater/turbulenceProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/bottomWater/turbulenceProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/bottomWater/turbulenceProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/heater/radiationProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/heater/radiationProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/heater/radiationProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/heater/radiationProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/heater/thermophysicalProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/heater/thermophysicalProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/heater/thermophysicalProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/leftSolid/radiationProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/leftSolid/radiationProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/leftSolid/radiationProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/leftSolid/radiationProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/leftSolid/thermophysicalProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/leftSolid/thermophysicalProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/leftSolid/thermophysicalProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/regionProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/regionProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/regionProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/regionProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/rightSolid/radiationProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/rightSolid/radiationProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/rightSolid/radiationProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/rightSolid/radiationProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/rightSolid/thermophysicalProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/rightSolid/thermophysicalProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/rightSolid/thermophysicalProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/topAir/g b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/topAir/g similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/topAir/g rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/topAir/g diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/topAir/radiationProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/topAir/radiationProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/topAir/radiationProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/topAir/radiationProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/topAir/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/topAir/thermophysicalProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/topAir/thermophysicalProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/topAir/thermophysicalProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/topAir/turbulenceProperties b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/topAir/turbulenceProperties similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/constant/topAir/turbulenceProperties rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/constant/topAir/turbulenceProperties diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/externalSolver b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/externalSolver similarity index 83% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/externalSolver rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/externalSolver index aba9a811432b879333477a690bd2f0ecc1222cf0..3b7080915d6f44926d15d9e63b96f71251d872e9 100755 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/externalSolver +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/externalSolver @@ -23,6 +23,9 @@ waitSec=5 timeOut=100 nSteps=1000 # maximum number of time steps. Note: should be more than # number of iterations on the OpenFOAM side + +stopAt=600 # external solver signals OpenFOAM to stop + refGrad=0 valueFraction=1 @@ -42,6 +45,13 @@ useMaster() echo "status=openfoam" >| ${lockFile} } +# Lock file with special content to stop OpenFOAM master +stopMasterNow() +{ + log "writeNow terminate via lock file '${lockFile}'" + echo "action=writeNow" >| ${lockFile} +} + init() { @@ -120,10 +130,20 @@ do log "updating ${dataFile}.in from ${dataFile}.out" - awk '{if( $1 != "#" ){print $1+1 " 0 1"}}' \ - ${dataFile}.out >| ${dataFile}.in + if [ -f "${dataFile}.out" ] + then + awk '{if( $1 != "#" ){print $1+1 " 0 1"}}' \ + ${dataFile}.out >| ${dataFile}.in + else + log "Warning: no such file ${dataFile}.out" + fi - useMaster + if [ "${stopAt:-0}" -eq $step ] + then + stopMasterNow + else + useMaster + fi fi done diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/README b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/README similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/README rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/README diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/blockMeshDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/blockMeshDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/blockMeshDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/blockMeshDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/bottomWater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/bottomWater/changeDictionaryDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/bottomWater/changeDictionaryDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/bottomWater/changeDictionaryDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/bottomWater/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/bottomWater/decomposeParDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/bottomWater/decomposeParDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/bottomWater/decomposeParDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/bottomWater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/bottomWater/fvSchemes similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/bottomWater/fvSchemes rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/bottomWater/fvSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/bottomWater/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/bottomWater/fvSolution similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/bottomWater/fvSolution rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/bottomWater/fvSolution diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/controlDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/controlDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/controlDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/controlDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/decomposeParDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/decomposeParDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/decomposeParDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/externalCoupled b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/externalCoupled similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/externalCoupled rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/externalCoupled diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/fvSchemes similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/fvSchemes rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/fvSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/fvSolution similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/fvSolution rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/fvSolution diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/heater/changeDictionaryDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/heater/changeDictionaryDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/heater/changeDictionaryDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/heater/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/heater/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..91ef8baa9e4462c98d8c4cacd8dc2529a008fdba --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/heater/decomposeParDict @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method scotch; + +simpleCoeffs +{ + n (2 2 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (2 2 1); + delta 0.001; + order xyz; +} + +scotchCoeffs +{ +} + +manualCoeffs +{ + dataFile "decompositionData"; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/heater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/heater/fvSchemes similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/heater/fvSchemes rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/heater/fvSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/heater/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/heater/fvSolution similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/heater/fvSolution rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/heater/fvSolution diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/leftSolid/changeDictionaryDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/leftSolid/changeDictionaryDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/leftSolid/changeDictionaryDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/heater/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/leftSolid/decomposeParDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/heater/decomposeParDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/leftSolid/decomposeParDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/leftSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/leftSolid/fvSchemes similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/leftSolid/fvSchemes rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/leftSolid/fvSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/leftSolid/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/leftSolid/fvSolution similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/leftSolid/fvSolution rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/leftSolid/fvSolution diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/rightSolid/changeDictionaryDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/rightSolid/changeDictionaryDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/rightSolid/changeDictionaryDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/leftSolid/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/rightSolid/decomposeParDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/leftSolid/decomposeParDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/rightSolid/decomposeParDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/rightSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/rightSolid/fvSchemes similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/rightSolid/fvSchemes rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/rightSolid/fvSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/rightSolid/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/rightSolid/fvSolution similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/rightSolid/fvSolution rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/rightSolid/fvSolution diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topAir/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topAir/changeDictionaryDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topAir/changeDictionaryDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topAir/changeDictionaryDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/rightSolid/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topAir/decomposeParDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/rightSolid/decomposeParDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topAir/decomposeParDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topAir/fvSchemes similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topAir/fvSchemes rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topAir/fvSchemes diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topAir/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topAir/fvSolution similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topAir/fvSolution rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topAir/fvSolution diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topoSetDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topoSetDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topoSetDict rename to tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledHeater/system/topoSetDict diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/Allclean b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..3f7a0cb7a67b96849bf0e2d135638aa63e10c843 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/Allclean @@ -0,0 +1,24 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions + +cleanCase + +rm -rf comms +rm -rf VTK +rm -rf constant/cellToRegion + +rm -rf 0/bottomWater +rm -rf 0/topAir +rm -rf 0/heater +rm -rf 0/leftSolid +rm -rf 0/rightSolid +rm -f 0/cellToRegion + +rm -rf constant/bottomWater/polyMesh +rm -rf constant/topAir/polyMesh +rm -rf constant/heater/polyMesh +rm -rf constant/leftSolid/polyMesh +rm -rf constant/rightSolid/polyMesh + +#------------------------------------------------------------------------------ diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..25b14f2bb7ce56d0986ac0f2526c653f2d10fde8 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/Allrun @@ -0,0 +1,33 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions + +./Allrun.pre + +# Remove lock file on interrupt +trap '\rm -f comms/OpenFOAM.lock 2>/dev/null' INT + +#-- Run on single processor +#runApplication $(getApplication) & +# Simulated external solver +#runApplication ./externalSolver + +# Decompose +runApplication decomposePar -allRegions + +## Can verify parallel operation of createExternalCoupledPatchGeometry +# \rm -f log.createExternalCoupledPatchGeometry +# runParallel createExternalCoupledPatchGeometry \ +# -regions '(topAir heater)' coupleGroup \ +# -commsDir $PWD/comms + +# Run OpenFOAM +runParallel $(getApplication) & + +# Simulated external solver +runApplication ./externalSolver + +# Reconstruct +runApplication reconstructPar -allRegions + +#------------------------------------------------------------------------------ diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/Allrun.pre b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..854fddc385643c8005d66559a5b51920063398f3 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/Allrun.pre @@ -0,0 +1,30 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory +. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions + +runApplication blockMesh +runApplication topoSet +runApplication splitMeshRegions -cellZones -overwrite + +# remove fluid fields from solid regions (important for post-processing) +for i in heater leftSolid rightSolid +do + rm -f 0*/$i/{nut,alphat,epsilon,k,U,p_rgh} +done + + +for i in bottomWater topAir heater leftSolid rightSolid +do + changeDictionary -region $i > log.changeDictionary.$i 2>&1 +done + +# Create coupling geometry +runApplication createExternalCoupledPatchGeometry \ + -regions '(topAir heater)' coupleGroup + +# echo +# echo "creating files for paraview post-processing" +# echo +# paraFoam -touchAll 2>/dev/null + +#------------------------------------------------------------------------------ diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/README.txt b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0ca34a87367b7e25321f9cba9cadf2ce5cd54f7 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/README.txt @@ -0,0 +1,3 @@ +Modification of the heatTransfer chtMultiRegionFoam tutorial that demonstrates +the externalCoupled functionObject in combination with the ./externalSolver +script to simulate coupling to an external code. diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/g b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/g new file mode 100644 index 0000000000000000000000000000000000000000..0cbbdeb5c3b8b6cb79bf89aba9a3cfcbc9dd7b0e --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/g @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 -9.81 0); + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/radiationProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/radiationProperties new file mode 100644 index 0000000000000000000000000000000000000000..bcd3190ac259e3876d30325843f22168fcb3d19a --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/radiationProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object radiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation off; + +radiationModel none; + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..c1602d4d09f80a423551df30c6e7d50c8b78bf34 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/thermophysicalProperties @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState rhoConst; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + molWeight 18; + } + equationOfState + { + rho 1000; + } + thermodynamics + { + Cp 4181; + Hf 0; + } + transport + { + mu 959e-6; + Pr 6.62; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/turbulenceProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..e011578c36f3d257f1f59ac0726fd79ce34075e8 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/bottomWater/turbulenceProperties @@ -0,0 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/heater/radiationProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/heater/radiationProperties new file mode 100644 index 0000000000000000000000000000000000000000..1593a12a7406b6886038a18f7bdb6a2d8c0ef12d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/heater/radiationProperties @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object radiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation off; + +radiationModel none; + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/heater/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..7be4f18cd18573b0427cb5ed171c84e5f81667d7 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/heater/thermophysicalProperties @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heSolidThermo; + mixture pureMixture; + transport constIso; + thermo hConst; + equationOfState rhoConst; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + molWeight 50; + } + + transport + { + kappa 80; + } + + thermodynamics + { + Hf 0; + Cp 450; + } + + equationOfState + { + rho 8000; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/leftSolid/radiationProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/leftSolid/radiationProperties new file mode 120000 index 0000000000000000000000000000000000000000..08087c37b4d0f37d8df26e11ea195b102f43e32d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/leftSolid/radiationProperties @@ -0,0 +1 @@ +../heater/radiationProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/leftSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/leftSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/regionProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/regionProperties new file mode 100644 index 0000000000000000000000000000000000000000..9540cdb9bafbc1a0ca75bd88b3cc744b60bdb56b --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/regionProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object regionProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +regions +( + fluid (bottomWater topAir) + solid (heater leftSolid rightSolid) +); + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/rightSolid/radiationProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/rightSolid/radiationProperties new file mode 120000 index 0000000000000000000000000000000000000000..08087c37b4d0f37d8df26e11ea195b102f43e32d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/rightSolid/radiationProperties @@ -0,0 +1 @@ +../heater/radiationProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/rightSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/rightSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/g b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/g new file mode 120000 index 0000000000000000000000000000000000000000..fea37570067f9f5dbf14e5011717bb654a2f9899 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/g @@ -0,0 +1 @@ +../bottomWater/g \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/radiationProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/radiationProperties new file mode 120000 index 0000000000000000000000000000000000000000..583b06cb0b1ff1d19e180d6045ab4f2202a6503a --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/radiationProperties @@ -0,0 +1 @@ +../bottomWater/radiationProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..3f94dc8ad766c106e2be38f3bc54fb29364abbbc --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/thermophysicalProperties @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState perfectGas; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + molWeight 28.9; + } + thermodynamics + { + Cp 1000; + Hf 0; + } + transport + { + mu 1.8e-05; + Pr 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/turbulenceProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/turbulenceProperties new file mode 120000 index 0000000000000000000000000000000000000000..ec52cbd5927f5085eeac5ce87f82bd0b9641eeb2 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/constant/topAir/turbulenceProperties @@ -0,0 +1 @@ +../bottomWater/turbulenceProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/externalSolver b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/externalSolver new file mode 100755 index 0000000000000000000000000000000000000000..5afbca0ff4cb56db6ff86b38a065df55c93653ab --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/externalSolver @@ -0,0 +1,156 @@ +#!/bin/sh +# +# Dummy external solver to communicate with OpenFOAM via externalCoupled +# functionObject +# +# Functionality is hard-coded for this particular test case +# - patch temperatures increased by 1K on each step +# +cd ${0%/*} || exit 1 # Run from this directory + +# Check for unassigned variables +set -u + +echo "Executing dummy external solver" + +commsDir="comms" +patchDir="heater_topAir/coupleGroup" +fieldName="T" + +lockFile="${commsDir}/OpenFOAM.lock" +dataFile="${commsDir}/${patchDir}/${fieldName}" +waitSec=5 +timeOut=100 +nSteps=1000 # maximum number of time steps. Note: should be more than + # number of iterations on the OpenFOAM side + +stopAt=300 # external solver signals OpenFOAM to stop + +refGrad=0 +valueFraction=1 + +# Remove any old junk +\rm -f $lockFile 2>/dev/null + +log() +{ + echo "External: $@" +} + + +# Create lock file to pass control to OpenFOAM +useMaster() +{ + log "creating lock file '${lockFile}'" + echo "status=openfoam" >| ${lockFile} +} + +# Lock file with special content to stop OpenFOAM master +stopMasterNow() +{ + log "writeNow terminate via lock file '${lockFile}'" + echo "action=writeNow" >| ${lockFile} +} + + +init() +{ + log "init - creating ${dataFile}.in" + cat /dev/null >| "${dataFile}.in" + + # Hard-coded for patch of size 8 (heater/minY) + local n1=8 + local refValue1=500 + + log "init - adding $n1 data elements with refValue $refValue1" + for i in $(seq 1 $n1) + do + echo "$refValue1 $refGrad $valueFraction" + done >> "${dataFile}.in" + + # Hard-coded for patch of size 40 (topAir/minX) + local n2=40 + local refValue2=300 + log "init - adding $n2 data elements with refValue $refValue2" + for i in $(seq 1 $n2) + do + echo "$refValue2 $refGrad $valueFraction" + done >> "${dataFile}.in" + + # Verify line count? + # log "init ($(wc -l ${dataFile}.in))" + + # Give time for T.in file to flush + sleep 1 + + useMaster +} + + +# Create the comms directory +mkdir -p ${commsDir}/${patchDir} + +# Tutorial case uses 'initByExternal' option, so we must provide initial values +init + + +totalWait=0 +step=0 +while [ $step -lt $nSteps ] +do + if [ -f $lockFile ] + then + if grep -q "status=done" ${lockFile} + then + log "found lock file '${lockFile}' with 'status=done' - finished" + break + elif [ -s $lockFile ] + then + log "found lock file '${lockFile}' containing '$(< $lockFile)' - waiting" + else + log "found lock file '${lockFile}' - waiting" + fi + + totalWait=$(expr $totalWait + $waitSec) + if [ $totalWait -gt $timeOut ] + then + log "timeout" + break + else + sleep $waitSec + fi + else + totalWait=0 + step=$(expr $step + 1) + log "step $step" + log "lock not present - taking control" + + log "sleeping for $waitSec secs to simulate external process" + sleep $waitSec + + log "updating ${dataFile}.in from ${dataFile}.out" + + if [ -f "${dataFile}.out" ] + then + ##awk '{if( $1 != "#" ){print $1+0.1 " 0 1"}}' \ + awk '{if( $1 != "#" ){print $1 " 0 1"}}' \ + ${dataFile}.out >| ${dataFile}.in + else + log "Warning: no such file ${dataFile}.out" + fi + + if [ "${stopAt:-0}" -eq $step ] + then + stopMasterNow + else + useMaster + fi + fi +done + +log "done" + +# Remove the lock file too +\rm -f $lockFile 2>/dev/null + +#------------------------------------------------------------------------------ diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/README b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/README new file mode 100644 index 0000000000000000000000000000000000000000..5a81b9a5708b0346c6cdd4bd2f6835feb3700bc1 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/README @@ -0,0 +1,3 @@ +fvSolution is used for outer correctors specification. +fvSchemes is only so that pre-processing activities can proceed + diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/blockMeshDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..2ba9dce030268362add167d187e275c6af67bdcb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/blockMeshDict @@ -0,0 +1,96 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 1; + +vertices +( + (-0.1 -0.04 -0.05) + ( 0.1 -0.04 -0.05) + ( 0.1 0.04 -0.05) + (-0.1 0.04 -0.05) + (-0.1 -0.04 0.05) + ( 0.1 -0.04 0.05) + ( 0.1 0.04 0.05) + (-0.1 0.04 0.05) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (30 10 10) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + maxY + { + type wall; + faces + ( + (3 7 6 2) + ); + } + minX + { + type patch; + faces + ( + (0 4 7 3) + ); + } + maxX + { + type patch; + faces + ( + (2 6 5 1) + ); + } + minY + { + type wall; + faces + ( + (1 5 4 0) + ); + } + minZ + { + type wall; + faces + ( + (0 3 2 1) + ); + } + maxZ + { + type wall; + faces + ( + (4 5 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomAir/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..74cc264e050eebd85a9e1d4d5cfa4e7982361b15 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomAir/fvSchemes @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + + div(phi,U) bounded Gauss upwind; + div(phi,K) bounded Gauss upwind; + div(phi,h) bounded Gauss upwind; + div(phi,k) bounded Gauss upwind; + div(phi,K) bounded Gauss upwind; + div(phi,epsilon) bounded Gauss upwind; + div(phi,R) bounded Gauss upwind; + div(R) Gauss linear; + div(Ji,Ii_h) Gauss linearUpwind grad(U); + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear uncorrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default uncorrected; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomAir/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomAir/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..8cc4a0bb1a990792450cdcef66be309332f383f0 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomAir/fvSolution @@ -0,0 +1,81 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + rho + { + solver PCG + preconditioner DIC; + tolerance 1e-7; + relTol 0; + } + + p_rgh + { + solver GAMG; + tolerance 1e-7; + relTol 0.01; + + smoother GaussSeidel; + + } + + "(U|h|k|epsilon|G|Ii)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-7; + relTol 0.1; + } + + G + { + $p_rgh; + tolerance 1e-05; + relTol 0.1; + } +} + +SIMPLE +{ + momentumPredictor yes; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 100000; + rhoMin 0.2; + rhoMax 2; +} + +relaxationFactors +{ + fields + { + rho 1.0; + p_rgh 0.7; + } + equations + { + U 0.3; + h 0.7; + "(k|epsilon|omega)" 0.7; + G 0.7; + "ILambda.*" 0.7; + qr 0.7; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/changeDictionaryDict new file mode 100644 index 0000000000000000000000000000000000000000..3ea8a7089750158ebaa24780080130b5be0c1b6a --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/changeDictionaryDict @@ -0,0 +1,169 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +U +{ + internalField uniform (0.001 0 0); + + boundaryField + { + minX + { + type fixedValue; + value uniform (0.001 0 0); + } + + maxX + { + type inletOutlet; + inletValue uniform (0 0 0); + } + + ".*" + { + type fixedValue; + value uniform (0 0 0); + } + } +} + +T +{ + internalField uniform 300; + + boundaryField + { + minX + { + type fixedValue; + value uniform 300; + } + + maxX + { + type inletOutlet; + inletValue uniform 300; + } + + ".*" + { + type zeroGradient; + value uniform 300; + } + + "bottomWater_to_.*" + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + Tnbr T; + kappaMethod fluidThermo; + value uniform 300; + } + } +} + +epsilon +{ + internalField uniform 0.01; + + boundaryField + { + minX + { + type fixedValue; + value uniform 0.01; + } + + maxX + { + type inletOutlet; + inletValue uniform 0.01; + } + + ".*" + { + type epsilonWallFunction; + value uniform 0.01; + } + } +} + +k +{ + internalField uniform 0.1; + + boundaryField + { + minX + { + type inletOutlet; + inletValue uniform 0.1; + } + + maxX + { + type zeroGradient; + value uniform 0.1; + } + + ".*" + { + type kqRWallFunction; + value uniform 0.1; + } + } +} + +p_rgh +{ + internalField uniform 0; + + boundaryField + { + minX + { + type zeroGradient; + value uniform 0; + } + + maxX + { + type fixedValue; + value uniform 0; + } + + ".*" + { + type fixedFluxPressure; + value uniform 0; + } + } +} + +p +{ + internalField uniform 0; + + boundaryField + { + ".*" + { + type calculated; + value uniform 0; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topAir/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/decomposeParDict similarity index 100% rename from tutorials/heatTransfer/chtMultiRegionFoam/externalCoupledMultiRegionHeater/system/topAir/decomposeParDict rename to tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/decomposeParDict diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..66d505fb4cc0fe5a2cf0eb861d3a87a1dd7017e2 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/fvSchemes @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + + div(phi,U) Gauss upwind; + div(phi,K) Gauss linear; + div(phi,h) Gauss upwind; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,R) Gauss upwind; + div(R) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..1505a23d229f042c30ef56eab20ae13bc5ee4137 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater/fvSolution @@ -0,0 +1,87 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + rho + { + solver PCG; + preconditioner DIC; + tolerance 1e-7; + relTol 0.1; + } + + rhoFinal + { + $rho; + tolerance 1e-7; + relTol 0; + } + + p_rgh + { + solver GAMG; + tolerance 1e-7; + relTol 0.01; + + smoother GaussSeidel; + } + + p_rghFinal + { + $p_rgh; + tolerance 1e-7; + relTol 0; + } + + "(U|h|k|epsilon|R)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-7; + relTol 0.1; + } + + "(U|h|k|epsilon|R)Final" + { + $U; + tolerance 1e-7; + relTol 0; + } +} + +SIMPLE +{ + momentumPredictor on; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + fields + { + rho 1.0; + p_rgh 0.7; + } + equations + { + "U.*" 0.5; + "h.*" 0.5; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/controlDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..d5f9881d1dc8b99fa5a3f059807f421e3320f5d3 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/controlDict @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Library defines new boundary conditions +libs ("libfieldFunctionObjects.so"); + +application chtMultiRegionSimpleFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 500; + +deltaT 1; + +writeControl timeStep; + +writeInterval 100; + +purgeWrite 10; + +writeFormat ascii; + +writePrecision 8; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +functions +{ + #include "externalCoupled" +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..bc03b02cb93adbd3e57ecbbaa5db708dc1c8a3f9 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/decomposeParDict @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +//- Keep owner and neighbour on same processor for faces in zones: +// preserveFaceZones (heater solid1 solid3); + +method scotch; +// method hierarchical; +// method simple; +// method manual; + +coeffs +{ + n (2 2 1); + //delta 0.001; // default=0.001 + //order xyz; // default=xzy + dataFile "decompositionData"; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/externalCoupled b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/externalCoupled new file mode 100644 index 0000000000000000000000000000000000000000..806e5b8a5178904240ae3093ec46bbd1f8dafba6 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/externalCoupled @@ -0,0 +1,39 @@ +// -*- C++ -*- + +// control for external coupled simulation +externalCoupled +{ + libs ("libfieldFunctionObjects.so"); + + type externalCoupled; + + // Directory to use for communication + commsDir "${FOAM_CASE}/comms"; + + // Does external process start first + initByExternal true; + + // Additional output + log true; + + regions + { + // Region name (wildcards allowed) + "(topAir|heater)" + { + // In topAir adjust the minX patch (fixedValue) + + // Patch or patchGroup + coupleGroup + { + // Fields to output in commsDir + writeFields (T); + // Fields to read from commsDir + readFields (T); + } + } + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..9288e0ae16b2f8a504719494e3b36aa7225a66bf --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/fvSchemes @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ +} + +gradSchemes +{ +} + +divSchemes +{ +} + +laplacianSchemes +{ +} + +interpolationSchemes +{ +} + +snGradSchemes +{ +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..14653b73e5a761f5d8b27ce972b16230d0814a34 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/fvSolution @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +SIMPLE +{ + energyCoupling + { + iterations 50; + + interval 0; + + // Convergence criteria to stop looping + convergence + { + h 1e-3; + } + + // Names of function objects to fire with execute(int) when looping + onLoop ( ); + + // Names of function objects to fire with execute(int) when converged + onConverged ( externalCoupled ); + + // Names of function objects to fire with execute(int) when loop ends + // without convergence + onEnd ( ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/changeDictionaryDict new file mode 100644 index 0000000000000000000000000000000000000000..54a32080ab7b44a7841aed1d40b351212e1d66a0 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/changeDictionaryDict @@ -0,0 +1,71 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +boundary +{ + minY + { + type patch; + inGroups (coupleGroup); + } + minZ + { + type patch; + } + maxZ + { + type patch; + } +} + +T +{ + internalField uniform 300; + + boundaryField + { + ".*" + { + type zeroGradient; + value uniform 300; + } + "heater_to_.*" + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + Tnbr T; + kappaMethod solidThermo; + value uniform 300; + } + + heater_to_leftSolid + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + Tnbr T; + kappaMethod solidThermo; + thicknessLayers (1e-3); + kappaLayers (5e-4); + value uniform 300; + } + + minY + { + type fixedValue; + value uniform 500; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/decomposeParDict new file mode 120000 index 0000000000000000000000000000000000000000..46638e60f61f453fde97c51772ad6111792db0f6 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/decomposeParDict @@ -0,0 +1 @@ +../decomposeParDict \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..fde16caf52a888284422ed5bd924215bf1d2e596 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/fvSchemes @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; +} + +laplacianSchemes +{ + default none; + laplacian(alpha,h) Gauss linear uncorrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default uncorrected; +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..4fe045c7b69a1e9179f4184c8f4207bf296237f2 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/heater/fvSolution @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + h + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0.1; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + equations + { + h 0.7; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/changeDictionaryDict new file mode 100644 index 0000000000000000000000000000000000000000..3d47a8640d653cad783f944a3c0886eab67fbcfa --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/changeDictionaryDict @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +boundary +{ + minZ + { + type patch; + } + maxZ + { + type patch; + } +} + +T +{ + internalField uniform 300; + + boundaryField + { + ".*" + { + type zeroGradient; + value uniform 300; + } + "leftSolid_to_.*" + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + Tnbr T; + kappaMethod solidThermo; + value uniform 300; + } + + leftSolid_to_heater + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + Tnbr T; + kappaMethod solidThermo; + thicknessLayers (1e-3); + kappaLayers (5e-4); + value uniform 300; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/decomposeParDict new file mode 120000 index 0000000000000000000000000000000000000000..46638e60f61f453fde97c51772ad6111792db0f6 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/decomposeParDict @@ -0,0 +1 @@ +../decomposeParDict \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/fvSchemes new file mode 120000 index 0000000000000000000000000000000000000000..63236f302cfd79847ce312cced35784fa149c827 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/fvSchemes @@ -0,0 +1 @@ +../heater/fvSchemes \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..4fe045c7b69a1e9179f4184c8f4207bf296237f2 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/leftSolid/fvSolution @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + h + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0.1; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + equations + { + h 0.7; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/changeDictionaryDict new file mode 100644 index 0000000000000000000000000000000000000000..184cf95c4e8b8fcd75b505e7eb25b5bc48a9f36a --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/changeDictionaryDict @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +boundary +{ + minZ + { + type patch; + } + maxZ + { + type patch; + } +} + +T +{ + internalField uniform 300; + + boundaryField + { + ".*" + { + type zeroGradient; + value uniform 300; + } + "rightSolid_to_.*" + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + Tnbr T; + kappaMethod solidThermo; + value uniform 300; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/decomposeParDict new file mode 120000 index 0000000000000000000000000000000000000000..46638e60f61f453fde97c51772ad6111792db0f6 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/decomposeParDict @@ -0,0 +1 @@ +../decomposeParDict \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/fvSchemes new file mode 120000 index 0000000000000000000000000000000000000000..63236f302cfd79847ce312cced35784fa149c827 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/fvSchemes @@ -0,0 +1 @@ +../heater/fvSchemes \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..4fe045c7b69a1e9179f4184c8f4207bf296237f2 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/rightSolid/fvSolution @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + h + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0.1; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + equations + { + h 0.7; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/changeDictionaryDict new file mode 100644 index 0000000000000000000000000000000000000000..5bd5490849d6cb75c72f10e5ad41e99a0ae06c59 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/changeDictionaryDict @@ -0,0 +1,175 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object changeDictionaryDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +boundary +{ + minX + { + inGroups (coupleGroup); + } +} + +U +{ + internalField uniform (0.1 0 0); + + boundaryField + { + ".*" + { + type fixedValue; + value uniform (0 0 0); + } + minX + { + type fixedValue; + value uniform ( 0.1 0 0 ); + } + maxX + { + type inletOutlet; + inletValue uniform ( 0 0 0 ); + value uniform ( 0.1 0 0 ); + } + } +} + +T +{ + internalField uniform 300; + + boundaryField + { + ".*" + { + type zeroGradient; + } + + minX + { + type fixedValue; + value uniform 300; + } + maxX + { + type inletOutlet; + inletValue uniform 300; + value uniform 300; + } + + "topAir_to_.*" + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + Tnbr T; + kappaMethod fluidThermo; + value uniform 300; + } + } +} + +epsilon +{ + internalField uniform 0.01; + + boundaryField + { + ".*" + { + type epsilonWallFunction; + value uniform 0.01; + } + + minX + { + type fixedValue; + value uniform 0.01; + } + maxX + { + type inletOutlet; + inletValue uniform 0.01; + value uniform 0.01; + } + } +} + +k +{ + internalField uniform 0.1; + + boundaryField + { + ".*" + { + type kqRWallFunction; + value uniform 0.1; + } + + minX + { + type fixedValue; + value uniform 0.1; + } + maxX + { + type inletOutlet; + inletValue uniform 0.1; + value uniform 0.1; + } + } +} + +p_rgh +{ + internalField uniform 1e5; + + boundaryField + { + ".*" + { + type fixedFluxPressure; + value uniform 1e5; + } + + maxX + { + type fixedValue; + value uniform 1e5; + } + } +} + +p +{ + internalField uniform 1e5; + + boundaryField + { + ".*" + { + type calculated; + value uniform 1e5; + } + + maxX + { + type calculated; + value uniform 1e5; + } + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/decomposeParDict new file mode 120000 index 0000000000000000000000000000000000000000..46638e60f61f453fde97c51772ad6111792db0f6 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/decomposeParDict @@ -0,0 +1 @@ +../decomposeParDict \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/fvSchemes new file mode 120000 index 0000000000000000000000000000000000000000..ff6aeb82d395e30f059d8a111d447f5dff18b137 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/fvSchemes @@ -0,0 +1 @@ +../bottomAir/fvSchemes \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..8cc4a0bb1a990792450cdcef66be309332f383f0 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topAir/fvSolution @@ -0,0 +1,81 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + rho + { + solver PCG + preconditioner DIC; + tolerance 1e-7; + relTol 0; + } + + p_rgh + { + solver GAMG; + tolerance 1e-7; + relTol 0.01; + + smoother GaussSeidel; + + } + + "(U|h|k|epsilon|G|Ii)" + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-7; + relTol 0.1; + } + + G + { + $p_rgh; + tolerance 1e-05; + relTol 0.1; + } +} + +SIMPLE +{ + momentumPredictor yes; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 100000; + rhoMin 0.2; + rhoMax 2; +} + +relaxationFactors +{ + fields + { + rho 1.0; + p_rgh 0.7; + } + equations + { + U 0.3; + h 0.7; + "(k|epsilon|omega)" 0.7; + G 0.7; + "ILambda.*" 0.7; + qr 0.7; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topoSetDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topoSetDict new file mode 100644 index 0000000000000000000000000000000000000000..4926649aada67e50978dd7539b041daba0129572 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/topoSetDict @@ -0,0 +1,178 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + // Heater + { + name heaterCellSet; + type cellSet; + action new; + source boxToCell; + sourceInfo + { + box (-0.01001 0 -100 )(0.01001 0.00999 100); + } + } + { + name heaterCellSet; + type cellSet; + action add; + source boxToCell; + sourceInfo + { + box (-0.01001 -100 -0.01001)(0.01001 0.00999 0.01001); + } + } + { + name heater; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set heaterCellSet; + } + } + + // leftSolid + { + name leftSolidCellSet; + type cellSet; + action new; + source boxToCell; + sourceInfo + { + box (-100 0 -100 )(-0.01001 0.00999 100); + } + } + { + name leftSolid; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set leftSolidCellSet; + } + } + + // rightSolid + { + name rightSolidCellSet; + type cellSet; + action new; + source boxToCell; + sourceInfo + { + box (0.01001 0 -100 )(100 0.00999 100); + } + } + { + name rightSolid; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set rightSolidCellSet; + } + } + + // topAir + { + name topAirCellSet; + type cellSet; + action new; + source boxToCell; + sourceInfo + { + box (-100 0.00999 -100 )(100 100 100); + } + } + { + name topAir; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set topAirCellSet; + } + } + + + // bottomWater is all the other cells + { + name bottomWaterCellSet; + type cellSet; + action new; + source cellToCell; + sourceInfo + { + set heaterCellSet; + } + } + { + name bottomWaterCellSet; + type cellSet; + action add; + source cellToCell; + sourceInfo + { + set leftSolidCellSet; + } + } + { + name bottomWaterCellSet; + type cellSet; + action add; + source cellToCell; + sourceInfo + { + set rightSolidCellSet; + } + } + { + name bottomWaterCellSet; + type cellSet; + action add; + source cellToCell; + sourceInfo + { + set topAirCellSet; + } + } + { + name bottomWaterCellSet; + type cellSet; + action invert; + } + { + name bottomWater; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set bottomWaterCellSet; + } + } +); + + +// ************************************************************************* //