diff --git a/src/fvMeshDistributors/Make/files b/src/fvMeshDistributors/Make/files index 77358a2b2c..c50e905d01 100644 --- a/src/fvMeshDistributors/Make/files +++ b/src/fvMeshDistributors/Make/files @@ -1,3 +1,4 @@ distributor/fvMeshDistributorsDistributor.C +loadBalancer/fvMeshDistributorsLoadBalancer.C LIB = $(FOAM_LIBBIN)/libfvMeshDistributors diff --git a/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.C b/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.C index 056fe9be4a..5e003e2de4 100644 --- a/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.C +++ b/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,16 +60,13 @@ void Foam::fvMeshDistributors::distributor::readDict() } -void Foam::fvMeshDistributors::distributor::distribute() +void Foam::fvMeshDistributors::distributor::distribute +( + const labelList& distribution +) { fvMesh& mesh = this->mesh(); - // Create new decomposition distribution - labelList distribution - ( - distributor_->decompose(mesh, mesh.cellCentres()) - ); - // Mesh distribution engine fvMeshDistribute distributor(mesh); @@ -114,22 +111,26 @@ Foam::fvMeshDistributors::distributor::~distributor() bool Foam::fvMeshDistributors::distributor::update() { + const fvMesh& mesh = this->mesh(); + + bool redistributed = false; + if ( Pstream::nProcs() > 1 - && mesh().time().timeIndex() > 1 - && timeIndex_ != mesh().time().timeIndex() - && mesh().time().timeIndex() % redistributionInterval_ == 0 + && mesh.time().timeIndex() > 1 + && timeIndex_ != mesh.time().timeIndex() + && mesh.time().timeIndex() % redistributionInterval_ == 0 ) { - timeIndex_ = mesh().time().timeIndex(); + timeIndex_ = mesh.time().timeIndex(); const scalar idealNCells = - mesh().globalData().nTotalCells()/Pstream::nProcs(); + mesh.globalData().nTotalCells()/Pstream::nProcs(); const scalar imbalance = returnReduce ( - mag(1 - mesh().nCells()/idealNCells), + mag(1 - mesh.nCells()/idealNCells), maxOp() ); @@ -137,19 +138,19 @@ bool Foam::fvMeshDistributors::distributor::update() { Info<< "Redistributing mesh with imbalance " << imbalance << endl; - distribute(); + // Create new decomposition distribution + const labelList distribution + ( + distributor_->decompose(mesh, mesh.cellCentres()) + ); - return true; - } - else - { - return false; + distribute(distribution); + + redistributed = true; } } - else - { - return false; - } + + return redistributed; } diff --git a/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.H b/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.H index e7f1e9f3d8..115c636984 100644 --- a/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.H +++ b/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,7 +73,9 @@ class distributor : public fvMeshDistributor { - // Private Member Data +protected: + + // Protected Member Data //- Cache the decomposer/distributor autoPtr distributor_; @@ -89,13 +91,13 @@ class distributor label timeIndex_; - // Private Member Functions + // Protected Member Functions //- Read the projection parameters from dictionary void readDict(); //- Distribute the mesh and mesh data - void distribute(); + void distribute(const labelList& distribution); public: diff --git a/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.C b/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.C new file mode 100644 index 0000000000..fe82081c60 --- /dev/null +++ b/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.C @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +#include "fvMeshDistributorsLoadBalancer.H" +#include "decompositionMethod.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fvMeshDistributors +{ + defineTypeNameAndDebug(loadBalancer, 0); + addToRunTimeSelectionTable + ( + fvMeshDistributor, + loadBalancer, + fvMesh + ); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::fvMeshDistributors::loadBalancer::readDict() +{ + distributor::readDict(); + + const dictionary& distributorDict(dict()); + + multiConstraint_ = + distributorDict.lookupOrDefault("multiConstraint", true); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fvMeshDistributors::loadBalancer::loadBalancer(fvMesh& mesh) +: + distributor(mesh) +{ + readDict(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fvMeshDistributors::loadBalancer::~loadBalancer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::fvMeshDistributors::loadBalancer::update() +{ + const fvMesh& mesh = this->mesh(); + + bool redistributed = false; + + if + ( + Pstream::nProcs() > 1 + && mesh.time().timeIndex() > 1 + && timeIndex_ != mesh.time().timeIndex() + ) + { + timeIndex_ = mesh.time().timeIndex(); + + const scalar timeStepCpuTime = cpuTime_.cpuTimeIncrement(); + + // Chemistry CPU load per cell + volScalarField::Internal& chemistryCpuTimeReg = + mesh.lookupObjectRef + ( + "chemistryCpuTime" + ); + + const scalarField& chemistryCpuTime = chemistryCpuTimeReg.field(); + + if (mesh.time().timeIndex() % redistributionInterval_ == 0) + { + timeIndex_ = mesh.time().timeIndex(); + + const scalar sumCpuLoad(sum(chemistryCpuTime)); + + const scalar cellCFDCpuTime = returnReduce + ( + (timeStepCpuTime - sumCpuLoad)/mesh.nCells(), + minOp() + ); + + // Total CPU time for this processor + const scalar processorCpuTime = + mesh.nCells()*cellCFDCpuTime + sumCpuLoad; + + // Average processor CPU time + const scalar averageProcessorCpuTime = + returnReduce(processorCpuTime, sumOp()) + /Pstream::nProcs(); + + Pout<< "imbalance " + << " " << sumCpuLoad + << " " << mesh.nCells()*cellCFDCpuTime + << " " << processorCpuTime + << " " << averageProcessorCpuTime << endl; + + const scalar imbalance = returnReduce + ( + mag(1 - processorCpuTime/averageProcessorCpuTime), + maxOp() + ); + + scalarField weights; + + if (multiConstraint_) + { + const int nWeights = 2; + + weights.setSize(nWeights*mesh.nCells()); + + forAll(chemistryCpuTime, i) + { + weights[nWeights*i] = cellCFDCpuTime; + weights[nWeights*i + 1] = chemistryCpuTime[i]; + } + } + else + { + weights = chemistryCpuTime + cellCFDCpuTime; + } + + if (imbalance > maxImbalance_) + { + Info<< "Redistributing mesh with imbalance " + << imbalance << endl; + + // Create new decomposition distribution + const labelList distribution + ( + distributor_->decompose(mesh, mesh.cellCentres(), weights) + ); + + distribute(distribution); + + redistributed = true; + } + } + + chemistryCpuTimeReg.checkOut(); + } + + return redistributed; +} + + +// ************************************************************************* // diff --git a/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.H b/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.H new file mode 100644 index 0000000000..ef060f6400 --- /dev/null +++ b/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\/ 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 . + +Class + Foam::fvMeshDistributors::loadBalancer + +Description + Dynamic mesh redistribution using the distributor specified in + decomposeParDict + +Usage + Example of single field based refinement in all cells: + \verbatim + distributor + { + type loadBalancer; + + libs ("libfvMeshDistributors.so"); + + // How often to redistribute + redistributionInterval 10; + + // Maximum fractional cell distribution imbalance + // before rebalancing + maxImbalance 0.1; + } + \endverbatim + +SourceFiles + fvMeshDistributorsloadBalancer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fvMeshDistributorsLoadBalancer_H +#define fvMeshDistributorsLoadBalancer_H + +#include "fvMeshDistributorsDistributor.H" +#include "cpuTime.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fvMeshDistributors +{ + +/*---------------------------------------------------------------------------*\ + Class loadBalancer Declaration +\*---------------------------------------------------------------------------*/ + +class loadBalancer +: + public distributor +{ + // Private Member Data + + //- CPU time consumed during the time-step + cpuTime cpuTime_; + + //- Enable multi-constraint load-balancing in which separate weights + // are provided to the distrubutor for each of the CPU loads. + // When disabled the CPU loads are summed and a single weight per cell + // is provided to the distrubutor. + // Defaults to true. + Switch multiConstraint_; + + + // Private Member Functions + + //- Read the projection parameters from dictionary + void readDict(); + + +public: + + //- Runtime type information + TypeName("loadBalancer"); + + + // Constructors + + //- Construct from fvMesh + explicit loadBalancer(fvMesh& mesh); + + + //- Destructor + virtual ~loadBalancer(); + + + // Member Functions + + //- Distribute the + virtual bool update(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fvMeshDistributors +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/parallel/decompose/zoltanDecomp/zoltanDecomp.C b/src/parallel/decompose/zoltanDecomp/zoltanDecomp.C index aa8bda2b64..7f0556eb3e 100644 --- a/src/parallel/decompose/zoltanDecomp/zoltanDecomp.C +++ b/src/parallel/decompose/zoltanDecomp/zoltanDecomp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,13 +92,23 @@ static void get_vertex_list const Foam::pointField& points = vertexData.first(); const Foam::scalarField& weights = vertexData.second(); + if (wgt_dim != weights.size()/points.size()) + { + *ierr = ZOLTAN_FATAL; + return; + } + Foam::globalIndex globalMap(points.size()); for (Foam::label i=0; i::chemistryModel basicChemistryModel(thermo), ODESystem(), log_(this->lookupOrDefault("log", false)), + loadBalancing_(this->lookupOrDefault("loadBalancing", false)), jacobianType_ ( this->found("jacobian") @@ -709,14 +710,43 @@ Foam::scalar Foam::chemistryModel::solve const DeltaTType& deltaT ) { + if (loadBalancing_) + { + if + ( + !this->mesh().objectRegistry::template + foundObject("chemistryCpuTime") + ) + { + regIOobject::store + ( + volScalarField::Internal::New + ( + "chemistryCpuTime", + this->mesh(), + dimensionedScalar(dimTime, 0) + ).ptr() + ); + } + } + + volScalarField::Internal& chemistryCpuTime = + loadBalancing_ + ? this->mesh().objectRegistry::template + lookupObjectRef + ( + "chemistryCpuTime" + ) + : const_cast(volScalarField::Internal::null()); + tabulation_.reset(); const basicSpecieMixture& composition = this->thermo().composition(); // CPU time analysis - const clockTime clockTime_ = clockTime(); - clockTime_.timeIncrement(); - scalar solveChemistryCpuTime_ = 0; + cpuTime cpuTime_; + cpuTime solveCpuTime_; + scalar totalSolveCpuTime_ = 0; basicChemistryModel::correct(); @@ -810,8 +840,8 @@ Foam::scalar Foam::chemistryModel::solve if (log_) { - // Reset the time - clockTime_.timeIncrement(); + // Reset the solve time + solveCpuTime_.cpuTimeIncrement(); } // Calculate the chemical source terms @@ -845,7 +875,7 @@ Foam::scalar Foam::chemistryModel::solve if (log_) { - solveChemistryCpuTime_ += clockTime_.timeIncrement(); + totalSolveCpuTime_ += solveCpuTime_.cpuTimeIncrement(); } // If tabulation is used, we add the information computed here to @@ -880,13 +910,18 @@ Foam::scalar Foam::chemistryModel::solve { RR_[i][celli] = (Y_[i]*rho - Y0[i]*rho0)/deltaT[celli]; } + + if (loadBalancing_) + { + chemistryCpuTime[celli] += cpuTime_.cpuTimeIncrement(); + } } if (log_) { cpuSolveFile_() << this->time().userTimeValue() - << " " << solveChemistryCpuTime_ << endl; + << " " << totalSolveCpuTime_ << endl; } mechRed_.update(); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H index c5c5a9a470..0c09e576cd 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,6 +130,9 @@ class chemistryModel //- Switch to select performance logging Switch log_; + //- Switch to enable loadBalancing performance logging + Switch loadBalancing_; + //- Type of the Jacobian to be calculated const jacobianType jacobianType_; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.C b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.C index 61621eae6c..e3345b9b55 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,7 +42,6 @@ Foam::chemistryReductionMethod::chemistryReductionMethod activeSpecies_(chemistry.nSpecie(), true), log_(false), tolerance_(NaN), - clockTime_(clockTime()), sumnActiveSpecies_(0), sumn_(0), reduceMechCpuTime_(0) @@ -64,7 +63,6 @@ Foam::chemistryReductionMethod::chemistryReductionMethod activeSpecies_(chemistry.nSpecie(), false), log_(coeffsDict_.lookupOrDefault("log", false)), tolerance_(coeffsDict_.lookupOrDefault("tolerance", 1e-4)), - clockTime_(clockTime()), sumnActiveSpecies_(0), sumn_(0), reduceMechCpuTime_(0) @@ -91,7 +89,7 @@ void Foam::chemistryReductionMethod::initReduceMechanism() { if (log_) { - clockTime_.timeIncrement(); + cpuTime_.cpuTimeIncrement(); } } @@ -162,7 +160,7 @@ void Foam::chemistryReductionMethod::endReduceMechanism { sumnActiveSpecies_ += nActiveSpecies_; sumn_++; - reduceMechCpuTime_ += clockTime_.timeIncrement(); + reduceMechCpuTime_ += cpuTime_.cpuTimeIncrement(); } } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.H b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.H index 99d073626c..7f321aedc1 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,7 @@ SourceFiles #include "IOdictionary.H" #include "DynamicField.H" #include "Switch.H" -#include "clockTime.H" +#include "cpuTime.H" #include "OFstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -101,8 +101,8 @@ private: //- Tolerance for the mechanism reduction algorithm scalar tolerance_; - //- Clock time for logging - const clockTime clockTime_; + //- CPU time for logging + cpuTime cpuTime_; //- ... int64_t sumnActiveSpecies_; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/tabulation/ISAT/ISAT.C b/src/thermophysicalModels/chemistryModel/chemistryModel/tabulation/ISAT/ISAT.C index 0ead5424b2..a0e5b9074c 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/tabulation/ISAT/ISAT.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/tabulation/ISAT/ISAT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,7 +83,6 @@ Foam::chemistryTabulationMethods::ISAT::ISAT addNewLeafCpuTime_(0), growCpuTime_(0), searchISATCpuTime_(0), - clockTime_(clockTime()), tabulationResults_ ( IOobject @@ -411,7 +410,7 @@ bool Foam::chemistryTabulationMethods::ISAT::retrieve { if (log_) { - clockTime_.timeIncrement(); + cpuTime_.cpuTimeIncrement(); } bool retrieved(false); @@ -480,7 +479,7 @@ bool Foam::chemistryTabulationMethods::ISAT::retrieve if (log_) { - searchISATCpuTime_ += clockTime_.timeIncrement(); + searchISATCpuTime_ += cpuTime_.cpuTimeIncrement(); } return retrieved; @@ -499,7 +498,7 @@ Foam::label Foam::chemistryTabulationMethods::ISAT::add { if (log_) { - clockTime_.timeIncrement(); + cpuTime_.cpuTimeIncrement(); } label growthOrAddFlag = 1; @@ -518,7 +517,7 @@ Foam::label Foam::chemistryTabulationMethods::ISAT::add if (log_) { - growCpuTime_ += clockTime_.timeIncrement(); + growCpuTime_ += cpuTime_.cpuTimeIncrement(); } // the structure of the tree is not modified, return false @@ -607,7 +606,7 @@ Foam::label Foam::chemistryTabulationMethods::ISAT::add if (log_) { - addNewLeafCpuTime_ += clockTime_.timeIncrement(); + addNewLeafCpuTime_ += cpuTime_.cpuTimeIncrement(); } return growthOrAddFlag; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/tabulation/ISAT/ISAT.H b/src/thermophysicalModels/chemistryModel/chemistryModel/tabulation/ISAT/ISAT.H index 18ad424ee0..39de603239 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/tabulation/ISAT/ISAT.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/tabulation/ISAT/ISAT.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -119,7 +119,7 @@ class ISAT scalar growCpuTime_; scalar searchISATCpuTime_; - const clockTime clockTime_; + cpuTime cpuTime_; autoPtr nRetrievedFile_; autoPtr nGrowthFile_; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/CH4 b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/CH4 index 546e1555d1..dd073ae9c8 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/CH4 +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/CH4 @@ -20,6 +20,8 @@ internalField uniform 0.0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type fixedValue; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/CO2 b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/CO2 index 91dc342491..7e18197b05 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/CO2 +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/CO2 @@ -20,6 +20,8 @@ internalField uniform 0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type fixedValue; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/H2O b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/H2O index 80941de980..994ebde5b2 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/H2O +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/H2O @@ -20,6 +20,8 @@ internalField uniform 0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type fixedValue; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/N2 b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/N2 index c9a4638101..4dfe393fde 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/N2 +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/N2 @@ -20,6 +20,8 @@ internalField uniform 1; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type fixedValue; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/O2 b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/O2 index c5095d4f5b..e52664ee96 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/O2 +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/O2 @@ -20,6 +20,8 @@ internalField uniform 0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type fixedValue; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/T b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/T index f324c8baa1..eaefdcbe50 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/T +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/T @@ -20,6 +20,8 @@ internalField uniform 2000; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type fixedValue; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/U b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/U index b7735ceb61..51cb98aba2 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/U +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/U @@ -20,6 +20,8 @@ internalField uniform (0 0 0); boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type fixedValue; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/Ydefault b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/Ydefault index d863aee185..bd69207b03 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/Ydefault +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/Ydefault @@ -20,6 +20,8 @@ internalField uniform 0.0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type fixedValue; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/alphat b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/alphat index 267fee86e5..fdc7eb0a80 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/alphat +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/alphat @@ -20,6 +20,8 @@ internalField uniform 0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type fixedValue; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/p b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/p index 6877d0f8be..8a50265545 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/p +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/0/p @@ -20,6 +20,8 @@ internalField uniform 1e5; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + fuel { type zeroGradient; diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun new file mode 100755 index 0000000000..584588fe35 --- /dev/null +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh + +runApplication $(getApplication) + +#------------------------------------------------------------------------------ diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun-parallel b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun-parallel new file mode 100755 index 0000000000..6da005ee8b --- /dev/null +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/Allrun-parallel @@ -0,0 +1,12 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh +runApplication decomposePar + +runParallel $(getApplication) + +#------------------------------------------------------------------------------ diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/constant/chemistryProperties b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/constant/chemistryProperties index 71a7822f41..837b17eedd 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/constant/chemistryProperties +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/constant/chemistryProperties @@ -21,6 +21,8 @@ chemistryType chemistry on; +loadBalancing on; + initialChemicalTimeStep 1e-07; odeCoeffs diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/constant/dynamicMeshDict b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/constant/dynamicMeshDict new file mode 100644 index 0000000000..1757f79d30 --- /dev/null +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/constant/dynamicMeshDict @@ -0,0 +1,27 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +distributor +{ + type loadBalancer; + + libs ("libfvMeshDistributors.so"); + + multiConstraint true; + redistributionInterval 10; +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/dynamicMeshDict b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/dynamicMeshDict new file mode 100644 index 0000000000..1757f79d30 --- /dev/null +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/dynamicMeshDict @@ -0,0 +1,27 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +distributor +{ + type loadBalancer; + + libs ("libfvMeshDistributors.so"); + + multiConstraint true; + redistributionInterval 10; +} + + +// ************************************************************************* // diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/system/blockMeshDict b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/system/blockMeshDict index 91996e6d38..913cebe27f 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/system/blockMeshDict +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/system/blockMeshDict @@ -68,6 +68,12 @@ boundary (0 3 2 1) ); } + + internal + { + type internal; + faces (); + } ); diff --git a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/system/decomposeParDict b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/system/decomposeParDict index 8ccf806c30..dbbaa151a2 100644 --- a/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/system/decomposeParDict +++ b/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D_GRI/system/decomposeParDict @@ -14,14 +14,22 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 4; +numberOfSubdomains 12; -method hierarchical; +decomposer hierarchical; +distributor zoltan; +libs ("libzoltanDecomp.so"); hierarchicalCoeffs { - n (2 2 1); + n (6 2 1); order xyz; } +zoltanCoeffs +{ + lb_method rcb; +} + + // ************************************************************************* //