Minor extendedLdu matrices consistency rewrite compared to ldu matrices
This commit is contained in:
parent
03347200a9
commit
22a2e59c3b
3 changed files with 71 additions and 166 deletions
|
@ -45,10 +45,8 @@ void Foam::extendedBlockLduMatrix<Type>::mapOffDiagCoeffs
|
|||
// Get reference to faceMap in extended addressing
|
||||
const unallocLabelList& faceMap = extLduAddr_.faceMap();
|
||||
|
||||
// Avoid assuming it's upper if the matrix is symmetric
|
||||
if (blockLdum.thereIsUpper())
|
||||
{
|
||||
// Allocate extended upper only
|
||||
// Matrix is considered symmetric if the upper is allocated and lower
|
||||
// is not allocated. Allocating extended upper only.
|
||||
extendedUpperPtr_ = new TypeCoeffField
|
||||
(
|
||||
extLduAddr_.extendedUpperAddr().size()
|
||||
|
@ -117,77 +115,6 @@ void Foam::extendedBlockLduMatrix<Type>::mapOffDiagCoeffs
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Allocate extended lower only
|
||||
extendedLowerPtr_ = new TypeCoeffField
|
||||
(
|
||||
extLduAddr_.extendedLowerAddr().size()
|
||||
);
|
||||
TypeCoeffField& extLower = *extendedLowerPtr_;
|
||||
|
||||
// Get lower coeffs from underlying lduMatrix
|
||||
const TypeCoeffField& lower = blockLdum.lower();
|
||||
|
||||
if (lower.activeType() == blockCoeffBase::SCALAR)
|
||||
{
|
||||
// Helper type definition
|
||||
typedef typename CoeffField<Type>::scalarTypeField activeType;
|
||||
|
||||
// Get references to fields
|
||||
const activeType& activeLower = lower.asScalar();
|
||||
activeType& activeExtLower = extLower.asScalar();
|
||||
|
||||
// Copy non-zero coeffs from basic lduMatrix into corresponding
|
||||
// positions
|
||||
forAll (lower, faceI)
|
||||
{
|
||||
activeExtLower[faceMap[faceI]] = activeLower[faceI];
|
||||
}
|
||||
}
|
||||
else if (lower.activeType() == blockCoeffBase::LINEAR)
|
||||
{
|
||||
// Helper type definition
|
||||
typedef typename CoeffField<Type>::linearTypeField activeType;
|
||||
|
||||
// Get references to fields
|
||||
const activeType& activeLower = lower.asLinear();
|
||||
activeType& activeExtLower = extLower.asLinear();
|
||||
|
||||
// Copy non-zero coeffs from basic lduMatrix into corresponding
|
||||
// positions
|
||||
forAll (lower, faceI)
|
||||
{
|
||||
activeExtLower[faceMap[faceI]] = activeLower[faceI];
|
||||
}
|
||||
}
|
||||
else if (lower.activeType() == blockCoeffBase::SQUARE)
|
||||
{
|
||||
// Helper type definition
|
||||
typedef typename CoeffField<Type>::squareTypeField activeType;
|
||||
|
||||
// Get references to fields
|
||||
const activeType& activeLower = lower.asSquare();
|
||||
activeType& activeExtLower = extLower.asSquare();
|
||||
|
||||
// Copy non-zero coeffs from basic lduMatrix into corresponding
|
||||
// positions
|
||||
forAll (lower, faceI)
|
||||
{
|
||||
activeExtLower[faceMap[faceI]] = activeLower[faceI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
||||
) << "Problem between ordinary block matrix and extended"
|
||||
<< " block matrix lower coeffs type morphing."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get reference to faceMap in extended addressing
|
||||
const unallocLabelList& faceMap = extLduAddr_.faceMap();
|
||||
|
|
|
@ -74,10 +74,8 @@ Foam::extendedLduMatrix::extendedLduMatrix
|
|||
// Get reference to faceMap in extended addressing
|
||||
const unallocLabelList& faceMap = extLduAddr_.faceMap();
|
||||
|
||||
// Avoid assuming it's upper if the matrix is symmetric
|
||||
if (ldum.hasUpper())
|
||||
{
|
||||
// Allocate extended upper only
|
||||
// Matrix is considered symmetric if the upper is allocated and lower
|
||||
// is not allocated. Allocating extended upper only.
|
||||
extendedUpperPtr_ = new scalarField
|
||||
(
|
||||
extLduAddr_.extendedUpperAddr().size(),
|
||||
|
@ -96,27 +94,6 @@ Foam::extendedLduMatrix::extendedLduMatrix
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Allocate extended lower only
|
||||
extendedLowerPtr_ = new scalarField
|
||||
(
|
||||
extLduAddr_.extendedLowerAddr().size(),
|
||||
0.0
|
||||
);
|
||||
scalarField& extLower = *extendedLowerPtr_;
|
||||
|
||||
// Get lower coeffs from underlying lduMatrix
|
||||
const scalarField& lower = ldum.lower();
|
||||
|
||||
// Copy non-zero coeffs from basic lduMatrix into corresponding
|
||||
// positions
|
||||
forAll (lower, faceI)
|
||||
{
|
||||
extLower[faceMap[faceI]] = lower[faceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get reference to faceMap in extended addressing
|
||||
const unallocLabelList& faceMap = extLduAddr_.faceMap();
|
||||
|
|
|
@ -49,8 +49,9 @@ namespace Foam
|
|||
addasymMatrixConstructorToTable<ILUCp>
|
||||
addILUCpPreconditionerAsymMatrixConstructorToTable_;
|
||||
|
||||
// Add to symmetric constructor table as well until we implement Choleskyp
|
||||
// preconditioner. VV, 27/Jun/2015.
|
||||
// Add to symmetric constructor table as well. Cholesky with fill in would
|
||||
// yield the same sparseness pattern as the original matrix, hence it is not
|
||||
// implemented. VV, 10/Sep/2015.
|
||||
lduPreconditioner::
|
||||
addsymMatrixConstructorToTable<ILUCp>
|
||||
addILUCpPreconditionerSymMatrixConstructorToTable_;
|
||||
|
|
Reference in a new issue