From bf5f0562960f9ecc07e9ad4a7983fc482040a37c Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 9 Dec 2021 14:06:45 +0000 Subject: [PATCH] fvMeshDistributors: New library for mesh redistribution and load-balancing Basic support is now provided for dynamic mesh redistribution, particularly for load-balancing. The mesh distributor is selected in the optional 'distributor' entry in dynamicMeshDict, for example in the multiphase/interFoam/RAS/floatingObject tutorial case when run in parallel using the new Allrun-parallel script distributor { type decomposer; libs ("libfvMeshDistributors.so"); redistributionInterval 10; } in which the 'decomposer' form of redistribution is selected to call the mesh decomposition method specified in decomposeParDict to re-decompose the mesh for redistribution. The redistributionInterval entry specifies how frequently mesh redistribution takes place, in the above every 10th time-step. An optional maxImbalance entry is also provided to control redistribution based on the cell distribution imbalance: Class Foam::fvMeshDistributor::decomposer Description Dynamic mesh redistribution using the decomposer Usage Example of single field based refinement in all cells: \verbatim distributor { type decomposer; libs ("libfvMeshDistributors.so"); // How often to redistribute redistributionInterval 10; // Maximum fractional cell distribution imbalance // before rebalancing maxImbalance 0.1; } \endverbatim Currently mesh refinement/unrefinement and motion with redistribution is supported but many aspects of OpenFOAM are not yet and will require further development, in particular fvModels and Lagrangian. Also only the geometry-based simple and hierarchical decomposition method are well behaved for redistribution, scotch and ptScotch cause dramatic changes in mesh distribution with a corresponding heavy communications overhead limiting their usefulness or at least the frequency with which they should be called to redistribute the mesh. --- src/Allwmake | 1 + src/OpenFOAM/meshes/polyMesh/polyMeshIO.C | 3 - .../fvMeshDistribute/fvMeshDistribute.C | 67 +----- .../fvMeshDistribute/fvMeshDistribute.H | 15 +- .../fvMeshDistributeTemplates.C | 25 --- src/fvMeshDistributors/Make/files | 3 + src/fvMeshDistributors/Make/options | 14 ++ .../decomposer/fvMeshDistributorDecomposer.C | 200 ++++++++++++++++++ .../decomposer/fvMeshDistributorDecomposer.H | 148 +++++++++++++ .../reconstruct/reconstruct/processorMeshes.C | 26 +-- .../interFoam/RAS/floatingObject/0/U | 2 + .../RAS/floatingObject/0/alpha.water.orig | 2 + .../interFoam/RAS/floatingObject/0/epsilon | 2 + .../interFoam/RAS/floatingObject/0/k | 2 + .../interFoam/RAS/floatingObject/0/nut | 2 + .../interFoam/RAS/floatingObject/0/p_rgh | 2 + .../RAS/floatingObject/0/pointDisplacement | 2 + .../interFoam/RAS/floatingObject/Allrun | 5 +- .../RAS/floatingObject/Allrun-parallel | 17 ++ .../floatingObject/constant/dynamicMeshDict | 10 + .../RAS/floatingObject/system/blockMeshDict | 8 + .../floatingObject/system/decomposeParDict | 4 +- 22 files changed, 443 insertions(+), 117 deletions(-) create mode 100644 src/fvMeshDistributors/Make/files create mode 100644 src/fvMeshDistributors/Make/options create mode 100644 src/fvMeshDistributors/decomposer/fvMeshDistributorDecomposer.C create mode 100644 src/fvMeshDistributors/decomposer/fvMeshDistributorDecomposer.H create mode 100755 tutorials/multiphase/interFoam/RAS/floatingObject/Allrun-parallel diff --git a/src/Allwmake b/src/Allwmake index 0e2409efc8..aa6a860e35 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -48,6 +48,7 @@ parallel/Allwmake $targetType $* wmake $targetType fvMeshMovers wmake $targetType fvMeshTopoChangers +wmake $targetType fvMeshDistributors wmake $targetType conversion wmake $targetType sampling diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C index 2c7aff329e..26d5fb5e26 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C @@ -206,9 +206,6 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate() if (boundaryChanged) { - WarningInFunction - << "boundary changed, proceed with care." << endl; - boundary_.clear(); boundary_.setSize(newBoundary.size()); diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index b42fd7ac6b..3c4058d460 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -218,7 +218,6 @@ Foam::labelList Foam::fvMeshDistribute::select } -// Check all procs have same names and in exactly same order. void Foam::fvMeshDistribute::checkEqualWordList ( const string& msg, @@ -264,7 +263,6 @@ Foam::wordList Foam::fvMeshDistribute::mergeWordList(const wordList& procNames) } -// Print some info on mesh. void Foam::fvMeshDistribute::printMeshInfo(const fvMesh& mesh) { Pout<< "Primitives:" << nl @@ -351,7 +349,6 @@ void Foam::fvMeshDistribute::printCoupleInfo } -// Finds (non-empty) patch that exposed internal and proc faces can be put into. Foam::label Foam::fvMeshDistribute::findInternalPatch() const { const polyBoundaryMesh& patches = mesh_.boundaryMesh(); @@ -369,42 +366,23 @@ Foam::label Foam::fvMeshDistribute::findInternalPatch() const } } - if (internalPatchi != -1) - { - return internalPatchi; - } - - label nonEmptyPatchi = -1; - - forAllReverse(patches, patchi) - { - const polyPatch& pp = patches[patchi]; - - if (!isA(pp) && !pp.coupled()) - { - nonEmptyPatchi = patchi; - break; - } - } - - if (nonEmptyPatchi == -1) + if (internalPatchi == -1) { FatalErrorInFunction - << "Cannot find a patch which is neither of type empty nor" - << " coupled in patches " << patches.names() << endl - << "There has to be at least one such patch for" - << " distribution to work" << abort(FatalError); + << "Cannot find a internal patch in " << patches.names() << nl + << " of types " << patches.types() << nl + << " An internal patch must be provided for the exposed " + " internal faces." << exit(FatalError); } if (debug) { - Pout<< "findInternalPatch : using patch " << nonEmptyPatchi - << " name:" << patches[nonEmptyPatchi].name() - << " type:" << patches[nonEmptyPatchi].type() - << " to put exposed faces into." << endl; + Pout<< "findInternalPatch : using patch " << internalPatchi + << " name:" << patches[internalPatchi].name() + << " type:" << patches[internalPatchi].type() + << " for the exposed internal faces." << endl; } - // Do additional test for processor patches intermingled with non-proc // patches. label procPatchi = -1; @@ -427,12 +405,10 @@ Foam::label Foam::fvMeshDistribute::findInternalPatch() const } } - return nonEmptyPatchi; + return internalPatchi; } -// Delete all processor patches. Move any processor faces into the last -// non-processor patch. Foam::autoPtr Foam::fvMeshDistribute::deleteProcPatches ( const label destinationPatch @@ -504,7 +480,6 @@ Foam::autoPtr Foam::fvMeshDistribute::deleteProcPatches } -// Repatch the mesh. Foam::autoPtr Foam::fvMeshDistribute::repatch ( const labelList& newPatchID, // per boundary face -1 or new patchID @@ -621,11 +596,6 @@ Foam::autoPtr Foam::fvMeshDistribute::repatch } -// Detect shared points. Need processor patches to be present. -// Background: when adding bits of mesh one can get points which -// share the same position but are only detectable to be topologically -// the same point when doing parallel analysis. This routine will -// merge those points. Foam::autoPtr Foam::fvMeshDistribute::mergeSharedPoints ( const labelList& pointToGlobalMaster, @@ -1006,7 +976,6 @@ void Foam::fvMeshDistribute::getCouplingData } -// Subset the neighbourCell/neighbourProc fields void Foam::fvMeshDistribute::subsetCouplingData ( const fvMesh& mesh, @@ -1085,8 +1054,6 @@ void Foam::fvMeshDistribute::subsetCouplingData } -// Find cells on mesh whose faceID/procID match the neighbour cell/proc of -// domainMesh. Store the matching face. void Foam::fvMeshDistribute::findCouples ( const primitiveMesh& mesh, @@ -1161,7 +1128,6 @@ void Foam::fvMeshDistribute::findCouples } -// Map data on boundary faces to new mesh (resulting from adding two meshes) Foam::labelList Foam::fvMeshDistribute::mapBoundaryData ( const primitiveMesh& mesh, // mesh after adding @@ -1235,7 +1201,6 @@ Foam::labelList Foam::fvMeshDistribute::mapPointData } -// Remove cells. Add all exposed faces to patch oldInternalPatchi Foam::autoPtr Foam::fvMeshDistribute::doRemoveCells ( const labelList& cellsToRemove, @@ -1320,8 +1285,6 @@ void Foam::fvMeshDistribute::mapFields(const mapPolyMesh& map) } -// Delete and add processor patches. Changes mesh and returns per neighbour proc -// the processor patchID. void Foam::fvMeshDistribute::addProcPatches ( const labelList& nbrProc, // Processor that neighbour is now on @@ -1424,7 +1387,6 @@ void Foam::fvMeshDistribute::addProcPatches } -// Get boundary faces to be repatched. Is -1 or new patchID Foam::labelList Foam::fvMeshDistribute::getBoundaryPatch ( const labelList& nbrProc, // new processor per boundary face @@ -1455,7 +1417,6 @@ Foam::labelList Foam::fvMeshDistribute::getBoundaryPatch } -// Send mesh and coupling data. void Foam::fvMeshDistribute::sendMesh ( const label domain, @@ -1624,7 +1585,6 @@ void Foam::fvMeshDistribute::sendMesh } -// Receive mesh. Opposite of sendMesh Foam::autoPtr Foam::fvMeshDistribute::receiveMesh ( const label domain, @@ -1749,7 +1709,6 @@ Foam::autoPtr Foam::fvMeshDistribute::receiveMesh // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::fvMeshDistribute::fvMeshDistribute(fvMesh& mesh) : mesh_(mesh) @@ -2002,12 +1961,8 @@ Foam::autoPtr Foam::fvMeshDistribute::distribute const wordList dimTensors(mesh_.names(volTensorField::Internal::typeName)); checkEqualWordList("volTensorField::Internal", dimTensors); - - // Find patch to temporarily put exposed and processor faces into. - label oldInternalPatchi = findInternalPatch(); - - + const label oldInternalPatchi = findInternalPatch(); // Delete processor patches, starting from the back. Move all faces into // oldInternalPatchi. diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H index 1c91257343..d098eb0c5d 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H @@ -103,7 +103,7 @@ class fvMeshDistribute // Patch handling - //- Find patch to put exposed internal faces into + //- Find internal patch to put exposed internal faces into label findInternalPatch() const; //- Save boundary fields @@ -138,8 +138,11 @@ class fvMeshDistribute void correctProcessorPatchFields(); //- Delete all processor patches. Move any processor faces into - // patchi. - autoPtr deleteProcPatches(const label patchi); + // destinationPatch + autoPtr deleteProcPatches + ( + const label destinationPatch + ); //- Repatch the mesh. This is only necessary for the proc // boundary faces. newPatchID is over all boundary faces: -1 or @@ -154,6 +157,12 @@ class fvMeshDistribute //- Merge any local points that were remotely coupled. // constructPointMap is adapted for the new point labels. + // + // Detect shared points. Need processor patches to be present. + // Background: when adding bits of mesh one can get points which + // share the same position but are only detectable to be + // topologically the same point when doing parallel analysis. This + // routine will merge those points. autoPtr mergeSharedPoints ( const labelList& pointToGlobalMaster, diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C index b7b63a7ab3..6f5886878a 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C @@ -313,31 +313,6 @@ void Foam::fvMeshDistribute::correctProcessorPatchFields() } -namespace Foam -{ - -template -inline Type max -( - const pointPatchField& f -) -{ - return pTraits::min; -} - - -template -inline Type min -( - const pointPatchField& f -) -{ - return pTraits::max; -} - -} - - template void Foam::fvMeshDistribute::sendFields ( diff --git a/src/fvMeshDistributors/Make/files b/src/fvMeshDistributors/Make/files new file mode 100644 index 0000000000..522b9903e4 --- /dev/null +++ b/src/fvMeshDistributors/Make/files @@ -0,0 +1,3 @@ +decomposer/fvMeshDistributorDecomposer.C + +LIB = $(FOAM_LIBBIN)/libfvMeshDistributors diff --git a/src/fvMeshDistributors/Make/options b/src/fvMeshDistributors/Make/options new file mode 100644 index 0000000000..8bec7b534e --- /dev/null +++ b/src/fvMeshDistributors/Make/options @@ -0,0 +1,14 @@ +EXE_INC = \ + -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ + -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -ldecompositionMethods \ + -L$(FOAM_LIBBIN)/dummy -lscotchDecomp -lptscotchDecomp \ + -ltriSurface \ + -lmeshTools \ + -ldynamicMesh \ + -lfiniteVolume diff --git a/src/fvMeshDistributors/decomposer/fvMeshDistributorDecomposer.C b/src/fvMeshDistributors/decomposer/fvMeshDistributorDecomposer.C new file mode 100644 index 0000000000..8f3c2be898 --- /dev/null +++ b/src/fvMeshDistributors/decomposer/fvMeshDistributorDecomposer.C @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 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 "fvMeshDistributorDecomposer.H" +#include "decompositionMethod.H" +#include "fvMeshDistribute.H" +#include "mapDistributePolyMesh.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fvMeshDistributors +{ + defineTypeNameAndDebug(decomposer, 0); + addToRunTimeSelectionTable + ( + fvMeshDistributor, + decomposer, + fvMesh + ); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::fvMeshDistributors::decomposer::readDict() +{ + const dictionary& decomposerDict(dict()); + + redistributionInterval_ = + decomposerDict.lookupOrDefault("redistributionInterval", 10); + + maxImbalance_ = + decomposerDict.lookupOrDefault("maxImbalance", 0.1); +} + + +void Foam::fvMeshDistributors::decomposer::redecompose() +{ + fvMesh& mesh = this->mesh(); + + IOdictionary decompositionDict + ( + IOobject + ( + "decomposeParDict", + mesh.time().system(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ); + + labelList finalDecomp; + + // Create decompositionMethod and new decomposition + { + autoPtr decomposer + ( + decompositionMethod::New + ( + decompositionDict + ) + ); + + if (!decomposer().parallelAware()) + { + WarningInFunction + << "You have selected decomposition method " + << decomposer().typeName + << " which does" << endl + << "not synchronise the decomposition across" + << " processor patches." << endl + << " You might want to select a decomposition method which" + << " is aware of this. Continuing." + << endl; + } + + finalDecomp = decomposer().decompose(mesh, mesh.cellCentres()); + } + + // Mesh distribution engine + fvMeshDistribute distributor(mesh); + + // Do actual sending/receiving of mesh + autoPtr map = distributor.distribute(finalDecomp); + + mesh.distribute(map); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fvMeshDistributors::decomposer::decomposer(fvMesh& mesh) +: + fvMeshDistributor(mesh), + redistributionInterval_(1), + maxImbalance_(0.1), + timeIndex_(-1) +{ + readDict(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fvMeshDistributors::decomposer::~decomposer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::fvMeshDistributors::decomposer::update() +{ + if + ( + Pstream::nProcs() > 1 + && mesh().time().timeIndex() > 1 + && timeIndex_ != mesh().time().timeIndex() + && mesh().time().timeIndex() % redistributionInterval_ == 0 + ) + { + timeIndex_ = mesh().time().timeIndex(); + + const scalar idealNCells = + mesh().globalData().nTotalCells()/Pstream::nProcs(); + + const scalar imbalance = returnReduce + ( + mag(1 - mesh().nCells()/idealNCells), + maxOp() + ); + + if (imbalance > maxImbalance_) + { + if (debug) + { + Info<< "Redistributing mesh with imbalance " + << imbalance << endl; + } + + redecompose(); + + return true; + } + else + { + return false; + } + } + else + { + return false; + } +} + + +void Foam::fvMeshDistributors::decomposer::updateMesh(const mapPolyMesh&) +{} + + +void Foam::fvMeshDistributors::decomposer::distribute +( + const mapDistributePolyMesh& +) +{} + + +bool Foam::fvMeshDistributors::decomposer::write(const bool write) const +{ + return true; +} + + +// ************************************************************************* // diff --git a/src/fvMeshDistributors/decomposer/fvMeshDistributorDecomposer.H b/src/fvMeshDistributors/decomposer/fvMeshDistributorDecomposer.H new file mode 100644 index 0000000000..62bbf331db --- /dev/null +++ b/src/fvMeshDistributors/decomposer/fvMeshDistributorDecomposer.H @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 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::fvMeshDistributor::decomposer + +Description + Dynamic mesh redistribution using the decomposer + +Usage + Example of single field based refinement in all cells: + \verbatim + distributor + { + type decomposer; + + libs ("libfvMeshDistributors.so"); + + // How often to redistribute + redistributionInterval 10; + + // Maximum fractional cell distribution imbalance + // before rebalancing + maxImbalance 0.1; + } + \endverbatim + +SourceFiles + fvMeshDistributorDecomposer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fvMeshDistributorDecomposer_H +#define fvMeshDistributorDecomposer_H + +#include "fvMeshDistributor.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fvMeshDistributors +{ + +/*---------------------------------------------------------------------------*\ + Class decomposer Declaration +\*---------------------------------------------------------------------------*/ + +class decomposer +: + public fvMeshDistributor +{ + // Private Member Data + + //- Time-step interval between redistribution calls + label redistributionInterval_; + + //- Maximum imbalance between the ideal number of cells per processor + // and the maximum or minimum as a ratio mag(1 - nCells/idealNcells) + scalar maxImbalance_; + + //- The time index used for updating + label timeIndex_; + + + // Private Member Functions + + //- Read the projection parameters from dictionary + void readDict(); + + //- Re-decompose the mesh for redistribution + void redecompose(); + + +public: + + //- Runtime type information + TypeName("decomposer"); + + + // Constructors + + //- Construct from fvMesh + explicit decomposer(fvMesh& mesh); + + //- Disallow default bitwise copy construction + decomposer(const decomposer&) = delete; + + + //- Destructor + virtual ~decomposer(); + + + // Member Functions + + //- Distribute the mesh + virtual bool update(); + + //- Update corresponding to the given map + virtual void updateMesh(const mapPolyMesh&); + + //- Update corresponding to the given distribution map + virtual void distribute(const mapDistributePolyMesh&); + + + // Writing + + //- Write using given format, version and compression + virtual bool write(const bool write = true) const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const decomposer&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fvMeshDistributors +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/parallel/reconstruct/reconstruct/processorMeshes.C b/src/parallel/reconstruct/reconstruct/processorMeshes.C index 9a48f49abf..91001f23bd 100644 --- a/src/parallel/reconstruct/reconstruct/processorMeshes.C +++ b/src/parallel/reconstruct/reconstruct/processorMeshes.C @@ -161,33 +161,10 @@ Foam::fvMesh::readUpdateState Foam::processorMeshes::readUpdate() // Check if any new meshes need to be read. fvMesh::readUpdateState procStat = meshes_[proci].readUpdate(); - /* - if (procStat != fvMesh::UNCHANGED) - { - Info<< "Processor " << proci - << " at time " << databases_[proci].timeName() - << " detected mesh change " << procStat - << endl; - } - */ - - // Combine into overall mesh change status - if (stat == fvMesh::UNCHANGED) + if (procStat > stat) { stat = procStat; } - else if (stat != procStat) - { - FatalErrorInFunction - << "Processor " << proci - << " has a different polyMesh at time " - << databases_[proci].timeName() - << " compared to any previous processors." << nl - << "Please check time " << databases_[proci].timeName() - << " directories on all processors for consistent" - << " mesh files." - << exit(FatalError); - } } if @@ -199,6 +176,7 @@ Foam::fvMesh::readUpdateState Foam::processorMeshes::readUpdate() // Reread all meshes and addressing read(); } + return stat; } diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/0/U b/tutorials/multiphase/interFoam/RAS/floatingObject/0/U index 7e5bcb0d30..dcf27fa5d0 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/0/U +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/0/U @@ -20,6 +20,8 @@ internalField uniform (0 0 0); boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + stationaryWalls { type noSlip; diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/0/alpha.water.orig b/tutorials/multiphase/interFoam/RAS/floatingObject/0/alpha.water.orig index 1108f9cccf..cf54889bbe 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/0/alpha.water.orig +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/0/alpha.water.orig @@ -20,6 +20,8 @@ internalField uniform 0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + stationaryWalls { type zeroGradient; diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/0/epsilon b/tutorials/multiphase/interFoam/RAS/floatingObject/0/epsilon index 0e93f14a4f..d2182047a6 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/0/epsilon +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/0/epsilon @@ -20,6 +20,8 @@ internalField uniform 0.1; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + stationaryWalls { type epsilonWallFunction; diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/0/k b/tutorials/multiphase/interFoam/RAS/floatingObject/0/k index 2be72396d0..c9a5e07552 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/0/k +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/0/k @@ -20,6 +20,8 @@ internalField uniform 0.1; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + stationaryWalls { type kqRWallFunction; diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/0/nut b/tutorials/multiphase/interFoam/RAS/floatingObject/0/nut index 174318d4bf..8b84f997ec 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/0/nut +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/0/nut @@ -20,6 +20,8 @@ internalField uniform 0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + stationaryWalls { type nutkWallFunction; diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/0/p_rgh b/tutorials/multiphase/interFoam/RAS/floatingObject/0/p_rgh index df105a5ddb..df542cb740 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/0/p_rgh +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/0/p_rgh @@ -20,6 +20,8 @@ internalField uniform 0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + stationaryWalls { type fixedFluxPressure; diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/0/pointDisplacement b/tutorials/multiphase/interFoam/RAS/floatingObject/0/pointDisplacement index c2c6f03095..72995e5fdb 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/0/pointDisplacement +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/0/pointDisplacement @@ -20,6 +20,8 @@ internalField uniform (0 0 0); boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + stationaryWalls { type fixedValue; diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun b/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun index 4c6b10300f..f81376c68e 100755 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun @@ -4,13 +4,10 @@ cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -# Set application name -application=$(getApplication) - runApplication blockMesh runApplication topoSet runApplication subsetMesh -overwrite c0 -patch floatingObject -noFields runApplication setFields -runApplication $application +runApplication $(getApplication) #------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun-parallel b/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun-parallel new file mode 100755 index 0000000000..4ed0931e77 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/Allrun-parallel @@ -0,0 +1,17 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh +runApplication topoSet +runApplication subsetMesh -overwrite c0 -patch floatingObject -noFields +runApplication setFields + +runApplication decomposePar +runParallel $(getApplication) +runApplication reconstructParMesh +runApplication reconstructPar + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/constant/dynamicMeshDict b/tutorials/multiphase/interFoam/RAS/floatingObject/constant/dynamicMeshDict index 6f4578706d..eded4d5818 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/constant/dynamicMeshDict +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/constant/dynamicMeshDict @@ -120,4 +120,14 @@ topoChanger } +distributor +{ + type decomposer; + + libs ("libfvMeshDistributors.so"); + + redistributionInterval 10; +} + + // ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/system/blockMeshDict b/tutorials/multiphase/interFoam/RAS/floatingObject/system/blockMeshDict index de389efb52..f59fbe29cb 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/system/blockMeshDict +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/system/blockMeshDict @@ -46,6 +46,7 @@ boundary (0 4 7 3) ); } + atmosphere { type patch; @@ -54,11 +55,18 @@ boundary (4 5 6 7) ); } + floatingObject { type wall; faces (); } + + internal + { + type internal; + faces (); + } ); diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/system/decomposeParDict b/tutorials/multiphase/interFoam/RAS/floatingObject/system/decomposeParDict index 0cd9c5abdd..9b79ad6ccd 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/system/decomposeParDict +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/system/decomposeParDict @@ -16,7 +16,7 @@ FoamFile numberOfSubdomains 8; -method scotch; +method hierarchical; simpleCoeffs { @@ -25,7 +25,7 @@ simpleCoeffs hierarchicalCoeffs { - n (2 2 1); + n (2 2 2); order xyz; }