BUG: overset: support GAMG. Fixes #2559

Note that there is no support for using GAMG with mass-correction.
This commit is contained in:
mattijs 2022-08-11 12:24:32 +01:00 committed by Kutalmis Bercin
parent b48fd4f38a
commit ab6615c060
3 changed files with 70 additions and 4 deletions

View File

@ -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<scalarField*>(&faceWeights);

View File

@ -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<label> dynFaceCells(localRestrictAddressing.size());
// From face to coarse face
DynamicList<label> dynFaceRestrictAddressing
(
localRestrictAddressing.size()
);
Map<label> masterToCoarseFace(localRestrictAddressing.size());
for (const label curMaster : localRestrictAddressing)
{
const auto iter = masterToCoarseFace.cfind(curMaster);
if (iter.found())
{
// Already have coarse face
dynFaceRestrictAddressing.append(iter.val());
}
else
{
// New coarse face
const label coarseI = dynFaceCells.size();
dynFaceRestrictAddressing.append(coarseI);
dynFaceCells.append(curMaster);
masterToCoarseFace.insert(curMaster, coarseI);
}
}
faceCells_.transfer(dynFaceCells);
faceRestrictAddressing_.transfer(dynFaceRestrictAddressing);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -18,10 +18,18 @@ solvers
{
T
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-10;
relTol 0;
solver PBiCGStab;
preconditioner DILU;
//// Note: GAMG not supported with massCorrection switched on
//solver GAMG;
//smoother GaussSeidel;
//nCellsInCoarsestLevel 1;
//// Important: overset adds faces so use matrix-based agglomerator
//agglomerator algebraicPair;
}
cellDisplacement