From ab6615c060b684b61ce5024c7cf678903637bb34 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 11 Aug 2022 12:24:32 +0100 Subject: [PATCH] BUG: overset: support GAMG. Fixes #2559 Note that there is no support for using GAMG with mass-correction. --- .../pairGAMGAgglomerate.C | 12 +++++ .../oversetGAMGInterface.C | 50 ++++++++++++++++++- .../system/fvSolution | 12 ++++- 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomerate.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomerate.C index c866c774b4..0d44f20186 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomerate.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomerate.C @@ -36,6 +36,18 @@ void Foam::pairGAMGAgglomeration::agglomerate const scalarField& faceWeights ) { + const label nFaces = mesh.lduAddr().lowerAddr().size(); + if (faceWeights.size() != nFaces) + { + FatalErrorInFunction + << "Supplied number of face weights " << faceWeights.size() + << " does not correspond to the number of faces " << nFaces << endl + << "This may be because of using a geometry-based" + << " agglomeration method instead of a matrix-based one" + << exit(FatalError); + } + + // Start geometric agglomeration from the given faceWeights scalarField* faceWeightsPtr = const_cast(&faceWeights); diff --git a/src/overset/oversetCoupledPolyPatch/oversetGAMGInterface/oversetGAMGInterface.C b/src/overset/oversetCoupledPolyPatch/oversetGAMGInterface/oversetGAMGInterface.C index cd6014803b..25cca9cf96 100644 --- a/src/overset/oversetCoupledPolyPatch/oversetGAMGInterface/oversetGAMGInterface.C +++ b/src/overset/oversetCoupledPolyPatch/oversetGAMGInterface/oversetGAMGInterface.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -61,7 +61,53 @@ Foam::oversetGAMGInterface::oversetGAMGInterface index, coarseInterfaces ) -{} +{ + // Problem: + // - we only want the oversetGAMGInterfaceField + // - but this needs a oversetGAMGInterface of at least size 1 + // (since faceRestrictAddressing cannot have -1 or so in it - it + // can only have >= 0 i.e. we cannot agglomerate into nothing) + // - note that the end result is not used - the (current) corresponding + // oversetGAMGInterfaceField has dummy updateInterfaceMatrix. + + // Construct face agglomeration from cell agglomeration. Code same as + // in e.g. cyclicAMIGAMGInterface. + { + // From coarse face to cell + DynamicList