Feature ILUCp and BlockILUCp preconditioning, extended addr update and clean-up
This commit is contained in:
parent
daf6ed2e18
commit
182e6bf702
30 changed files with 632 additions and 254 deletions
|
@ -77,7 +77,11 @@ UNARY_FUNCTION(sphericalTensorType, cmptType, expandScalar) \
|
||||||
\
|
\
|
||||||
UNARY_FUNCTION(tensorType, vectorType, expandLinear) \
|
UNARY_FUNCTION(tensorType, vectorType, expandLinear) \
|
||||||
UNARY_FUNCTION(diagTensorType, vectorType, expandLinear) \
|
UNARY_FUNCTION(diagTensorType, vectorType, expandLinear) \
|
||||||
UNARY_FUNCTION(sphericalTensorType, vectorType, expandLinear)
|
UNARY_FUNCTION(sphericalTensorType, vectorType, expandLinear) \
|
||||||
|
\
|
||||||
|
UNARY_FUNCTION(vectorType, tensorType, sumToDiag) \
|
||||||
|
UNARY_FUNCTION(vectorType, tensorType, sumMagToDiag)
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,7 +65,10 @@ UNARY_FUNCTION(sphericalTensorType, cmptType, expandScalar) \
|
||||||
\
|
\
|
||||||
UNARY_FUNCTION(tensorType, vectorType, expandLinear) \
|
UNARY_FUNCTION(tensorType, vectorType, expandLinear) \
|
||||||
UNARY_FUNCTION(diagTensorType, vectorType, expandLinear) \
|
UNARY_FUNCTION(diagTensorType, vectorType, expandLinear) \
|
||||||
UNARY_FUNCTION(sphericalTensorType, vectorType, expandLinear)
|
UNARY_FUNCTION(sphericalTensorType, vectorType, expandLinear) \
|
||||||
|
\
|
||||||
|
UNARY_FUNCTION(vectorType, tensorType, sumToDiag) \
|
||||||
|
UNARY_FUNCTION(vectorType, tensorType, sumMagToDiag)
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -85,6 +85,25 @@ void expandLinear(Field<tensor>& res, const UList<vector>& f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void sumToDiag(Field<vector>& res, const UList<tensor>& f)
|
||||||
|
{
|
||||||
|
forAll (res, i)
|
||||||
|
{
|
||||||
|
sumToDiag(res[i], f[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void sumMagToDiag(Field<vector>& res, const UList<tensor>& f)
|
||||||
|
{
|
||||||
|
forAll (res, i)
|
||||||
|
{
|
||||||
|
sumMagToDiag(res[i], f[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -54,6 +54,9 @@ void expandScalar(Field<vector>& res, const UList<scalar>& f);
|
||||||
void expandScalar(Field<tensor>& res, const UList<scalar>& f);
|
void expandScalar(Field<tensor>& res, const UList<scalar>& f);
|
||||||
void expandLinear(Field<tensor>& res, const UList<vector>& f);
|
void expandLinear(Field<tensor>& res, const UList<vector>& f);
|
||||||
|
|
||||||
|
void sumToDiag(Field<vector>& res, const UList<tensor>& f);
|
||||||
|
void sumMagToDiag(Field<vector>& res, const UList<tensor>& f);
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -76,12 +76,15 @@ Foam::coarseBlockAmgLevel<Type>::coarseBlockAmgLevel
|
||||||
BlockLduSmoother<Type>::New
|
BlockLduSmoother<Type>::New
|
||||||
(
|
(
|
||||||
matrixPtr_,
|
matrixPtr_,
|
||||||
dict,
|
dict
|
||||||
"coarseSmoother"
|
// ,"coarseSmoother"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Ax_()
|
Ax_()
|
||||||
{}
|
{
|
||||||
|
Info<< "Coarse AMG level check" << endl;
|
||||||
|
matrixPtr_->check();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -71,12 +71,15 @@ Foam::fineBlockAmgLevel<Type>::fineBlockAmgLevel
|
||||||
BlockLduSmoother<Type>::New
|
BlockLduSmoother<Type>::New
|
||||||
(
|
(
|
||||||
matrix,
|
matrix,
|
||||||
dict,
|
dict
|
||||||
"fineSmoother"
|
// ,"fineSmoother"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Ax_()
|
Ax_()
|
||||||
{}
|
{
|
||||||
|
Info<< "Fine AMG level check" << endl;
|
||||||
|
matrix_.check();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -227,9 +227,8 @@ public:
|
||||||
BlockLduMatrix(BlockLduMatrix<Type>&, bool reUse);
|
BlockLduMatrix(BlockLduMatrix<Type>&, bool reUse);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
//- Destructor
|
||||||
|
virtual ~BlockLduMatrix();
|
||||||
virtual ~BlockLduMatrix();
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
|
@ -307,9 +307,14 @@ void Foam::BlockLduMatrix<Type>::check() const
|
||||||
typedef typename TypeCoeffField::linearTypeField linearTypeField;
|
typedef typename TypeCoeffField::linearTypeField linearTypeField;
|
||||||
typedef typename TypeCoeffField::squareTypeField squareTypeField;
|
typedef typename TypeCoeffField::squareTypeField squareTypeField;
|
||||||
|
|
||||||
// Copy the diagonal
|
// TODO: Account for coupled boundary patch coeffs
|
||||||
TypeCoeffField DiagCopy(this->diag().size());
|
// HJ, 29/Oct/2015
|
||||||
// TypeCoeffField DiagCopy = this->diag();
|
|
||||||
|
// Get original diag
|
||||||
|
const TypeCoeffField& d = this->diag();
|
||||||
|
|
||||||
|
// Copy the diagonal. It is initialised to zero
|
||||||
|
TypeCoeffField SumOffDiag(d.size());
|
||||||
|
|
||||||
const unallocLabelList& l = lduAddr().lowerAddr();
|
const unallocLabelList& l = lduAddr().lowerAddr();
|
||||||
const unallocLabelList& u = lduAddr().upperAddr();
|
const unallocLabelList& u = lduAddr().upperAddr();
|
||||||
|
@ -323,67 +328,110 @@ void Foam::BlockLduMatrix<Type>::check() const
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
Upper.activeType() == blockCoeffBase::SQUARE
|
Upper.activeType() == blockCoeffBase::SQUARE
|
||||||
|| DiagCopy.activeType() == blockCoeffBase::SQUARE
|
|| d.activeType() == blockCoeffBase::SQUARE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Note: For a square coefficient, the matrix needs to be analysed
|
||||||
|
// row-by-row, including the contribution of the off-diagonal
|
||||||
|
// elements in the diagonal matrix
|
||||||
|
|
||||||
|
// Get result as linear
|
||||||
|
linearTypeField& activeSumOffDiag = SumOffDiag.asLinear();
|
||||||
|
|
||||||
|
// Do diagonal elements
|
||||||
|
|
||||||
|
// Create the diagonal matrix element without the diagonal
|
||||||
|
const squareTypeField& activeDiag = d.asSquare();
|
||||||
|
|
||||||
|
linearTypeField diagDiag(activeDiag.size());
|
||||||
|
squareTypeField luDiag(activeDiag.size());
|
||||||
|
|
||||||
|
// Take out the diagonal from the diag as a linear type
|
||||||
|
contractLinear(diagDiag, activeDiag);
|
||||||
|
|
||||||
|
// Expand diagonal only to full square type and store into luDiag
|
||||||
|
expandLinear(luDiag, diagDiag);
|
||||||
|
|
||||||
|
// Keep only off-diagonal in luDiag
|
||||||
|
luDiag = activeDiag - luDiag;
|
||||||
|
|
||||||
|
sumMagToDiag(activeSumOffDiag, luDiag);
|
||||||
|
|
||||||
|
// Do the off-diagonal elements by collapsing each row
|
||||||
|
// into the linear form
|
||||||
|
|
||||||
const squareTypeField& activeUpper = Upper.asSquare();
|
const squareTypeField& activeUpper = Upper.asSquare();
|
||||||
squareTypeField& activeDiagCopy = DiagCopy.asSquare();
|
|
||||||
|
|
||||||
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
||||||
{
|
{
|
||||||
activeDiagCopy[l[coeffI]] += activeUpper[coeffI].T();
|
activeSumOffDiag[l[coeffI]] +=
|
||||||
activeDiagCopy[u[coeffI]] += activeUpper[coeffI];
|
sumMagToDiag(activeUpper[coeffI].T());
|
||||||
|
|
||||||
|
activeSumOffDiag[u[coeffI]] +=
|
||||||
|
sumMagToDiag(activeUpper[coeffI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "void BlockLduMatrix<Type>::check() const : "
|
// Check diagonal dominance
|
||||||
<< "Symmetric matrix: raw matrix difference: "
|
|
||||||
<< sum(mag(activeDiagCopy))
|
diagDiag = cmptMag(diagDiag);
|
||||||
<< " scaled: "
|
|
||||||
<< sum(mag(activeDiagCopy))/sum(mag(this->diag().asSquare()))
|
// Divide diagonal with sum of off-diagonals
|
||||||
|
cmptDivide(diagDiag, diagDiag, activeSumOffDiag);
|
||||||
|
|
||||||
|
InfoIn("void BlockLduMatrix<Type>::check() const)")
|
||||||
|
<< "Symmetric matrix: " << activeDiag.size()
|
||||||
|
<< " diagonal dominance sym square: "
|
||||||
|
<< Foam::min(diagDiag)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
Upper.activeType() == blockCoeffBase::LINEAR
|
Upper.activeType() == blockCoeffBase::LINEAR
|
||||||
|| DiagCopy.activeType() == blockCoeffBase::LINEAR
|
|| d.activeType() == blockCoeffBase::LINEAR
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const linearTypeField& activeDiag = d.asLinear();
|
||||||
|
|
||||||
const linearTypeField& activeUpper = Upper.asLinear();
|
const linearTypeField& activeUpper = Upper.asLinear();
|
||||||
linearTypeField& activeDiagCopy = DiagCopy.asLinear();
|
linearTypeField& activeSumOffDiag = SumOffDiag.asLinear();
|
||||||
|
|
||||||
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
||||||
{
|
{
|
||||||
activeDiagCopy[l[coeffI]] += activeUpper[coeffI];
|
activeSumOffDiag[l[coeffI]] += cmptMag(activeUpper[coeffI]);
|
||||||
activeDiagCopy[u[coeffI]] += activeUpper[coeffI];
|
activeSumOffDiag[u[coeffI]] += cmptMag(activeUpper[coeffI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "void BlockLduMatrix<Type>::check() const : "
|
linearTypeField diagDiag = cmptMag(activeDiag);
|
||||||
<< "Symmetric matrix: raw matrix difference: "
|
|
||||||
<< sum(mag(activeDiagCopy))
|
cmptDivide(diagDiag, diagDiag, activeSumOffDiag);
|
||||||
<< " scaled: "
|
|
||||||
<< sum(mag(activeDiagCopy))/sum(mag(this->diag().asLinear()))
|
InfoIn("void BlockLduMatrix<Type>::check() const)")
|
||||||
|
<< "Symmetric matrix: " << activeDiag.size()
|
||||||
|
<< " diagonal dominance sym linear: "
|
||||||
|
<< Foam::min(diagDiag)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
Upper.activeType() == blockCoeffBase::SCALAR
|
Upper.activeType() == blockCoeffBase::SCALAR
|
||||||
|| DiagCopy.activeType() == blockCoeffBase::SCALAR
|
|| d.activeType() == blockCoeffBase::SCALAR
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const scalarTypeField& activeDiag = d.asScalar();
|
||||||
|
|
||||||
const scalarTypeField& activeUpper = Upper.asScalar();
|
const scalarTypeField& activeUpper = Upper.asScalar();
|
||||||
scalarTypeField& activeDiagCopy = DiagCopy.asScalar();
|
scalarTypeField& activeSumOffDiag = SumOffDiag.asScalar();
|
||||||
|
|
||||||
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
||||||
{
|
{
|
||||||
activeDiagCopy[l[coeffI]] += activeUpper[coeffI];
|
activeSumOffDiag[l[coeffI]] += cmptMag(activeUpper[coeffI]);
|
||||||
activeDiagCopy[u[coeffI]] += activeUpper[coeffI];
|
activeSumOffDiag[u[coeffI]] += cmptMag(activeUpper[coeffI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "void BlockLduMatrix<Type>::check() const : "
|
InfoIn("void BlockLduMatrix<Type>::check() const)")
|
||||||
<< "Symmetric matrix: raw matrix difference: "
|
<< "Symmetric matrix: " << activeDiag.size()
|
||||||
<< sum(mag(activeDiagCopy))
|
<< " diagonal dominance sym scalar: "
|
||||||
<< " scaled: "
|
<< Foam::min(mag(activeDiag)/activeSumOffDiag)
|
||||||
<< sum(mag(activeDiagCopy))/sum(mag(this->diag().asScalar()))
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -398,78 +446,121 @@ void Foam::BlockLduMatrix<Type>::check() const
|
||||||
(
|
(
|
||||||
Lower.activeType() == blockCoeffBase::SQUARE
|
Lower.activeType() == blockCoeffBase::SQUARE
|
||||||
|| Upper.activeType() == blockCoeffBase::SQUARE
|
|| Upper.activeType() == blockCoeffBase::SQUARE
|
||||||
|| DiagCopy.activeType() == blockCoeffBase::SQUARE
|
|| d.activeType() == blockCoeffBase::SQUARE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Note: For a square coefficient, the matrix needs to be analysed
|
||||||
|
// row-by-row, including the contribution of the off-diagonal
|
||||||
|
// elements in the diagonal matrix
|
||||||
|
|
||||||
|
// Get result as linear
|
||||||
|
linearTypeField& activeSumOffDiag = SumOffDiag.asLinear();
|
||||||
|
|
||||||
|
// Do diagonal elements
|
||||||
|
|
||||||
|
// Create the diagonal matrix element without the diagonal
|
||||||
|
const squareTypeField& activeDiag = d.asSquare();
|
||||||
|
|
||||||
|
linearTypeField diagDiag(activeDiag.size());
|
||||||
|
squareTypeField luDiag(activeDiag.size());
|
||||||
|
|
||||||
|
// Take out the diagonal from the diag as a linear type
|
||||||
|
contractLinear(diagDiag, activeDiag);
|
||||||
|
|
||||||
|
// Expand diagonal only to full square type and store into luDiag
|
||||||
|
expandLinear(luDiag, diagDiag);
|
||||||
|
|
||||||
|
// Keep only off-diagonal in luDiag
|
||||||
|
luDiag = activeDiag - luDiag;
|
||||||
|
|
||||||
|
sumMagToDiag(activeSumOffDiag, luDiag);
|
||||||
|
|
||||||
|
// Do the off-diagonal elements by collapsing each row
|
||||||
|
// into the linear form
|
||||||
|
|
||||||
const squareTypeField& activeLower = Lower.asSquare();
|
const squareTypeField& activeLower = Lower.asSquare();
|
||||||
const squareTypeField& activeUpper = Upper.asSquare();
|
const squareTypeField& activeUpper = Upper.asSquare();
|
||||||
squareTypeField& activeDiagCopy = DiagCopy.asSquare();
|
|
||||||
|
|
||||||
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
||||||
{
|
{
|
||||||
activeDiagCopy[l[coeffI]] += activeLower[coeffI];
|
activeSumOffDiag[l[coeffI]] +=
|
||||||
activeDiagCopy[u[coeffI]] += activeUpper[coeffI];
|
sumMagToDiag(activeLower[coeffI]);
|
||||||
|
|
||||||
|
activeSumOffDiag[u[coeffI]] +=
|
||||||
|
sumMagToDiag(activeUpper[coeffI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "void BlockLduMatrix<Type>::check() const : "
|
// Check diagonal dominance
|
||||||
<< "Asymmetric matrix: raw matrix difference: "
|
|
||||||
<< sum(mag(activeDiagCopy))
|
diagDiag = cmptMag(diagDiag);
|
||||||
<< " scaled: "
|
|
||||||
<< sum(mag(activeDiagCopy))/sum(mag(this->diag().asSquare()))
|
// Divide diagonal with sum of off-diagonals
|
||||||
|
cmptDivide(diagDiag, diagDiag, activeSumOffDiag);
|
||||||
|
|
||||||
|
InfoIn("void BlockLduMatrix<Type>::check() const)")
|
||||||
|
<< "Asymmetric matrix: " << activeDiag.size()
|
||||||
|
<< " diagonal dominance assym square: "
|
||||||
|
<< Foam::min(diagDiag)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
Lower.activeType() == blockCoeffBase::LINEAR
|
Lower.activeType() == blockCoeffBase::LINEAR
|
||||||
|| Upper.activeType() == blockCoeffBase::LINEAR
|
|| Upper.activeType() == blockCoeffBase::LINEAR
|
||||||
|| DiagCopy.activeType() == blockCoeffBase::LINEAR
|
|| d.activeType() == blockCoeffBase::LINEAR
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const linearTypeField& activeDiag = d.asLinear();
|
||||||
|
|
||||||
const linearTypeField& activeLower = Lower.asLinear();
|
const linearTypeField& activeLower = Lower.asLinear();
|
||||||
const linearTypeField& activeUpper = Upper.asLinear();
|
const linearTypeField& activeUpper = Upper.asLinear();
|
||||||
linearTypeField& activeDiagCopy = DiagCopy.asLinear();
|
linearTypeField& activeSumOffDiag = SumOffDiag.asLinear();
|
||||||
|
|
||||||
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
||||||
{
|
{
|
||||||
activeDiagCopy[l[coeffI]] += activeLower[coeffI];
|
activeSumOffDiag[l[coeffI]] += cmptMag(activeLower[coeffI]);
|
||||||
activeDiagCopy[u[coeffI]] += activeUpper[coeffI];
|
activeSumOffDiag[u[coeffI]] += cmptMag(activeUpper[coeffI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "void BlockLduMatrix<Type>::check() const : "
|
linearTypeField diagDiag = cmptMag(activeDiag);
|
||||||
<< "Asymmetric matrix: raw matrix difference: "
|
|
||||||
<< sum(mag(activeDiagCopy))
|
cmptDivide(diagDiag, diagDiag, activeSumOffDiag);
|
||||||
<< " scaled: "
|
|
||||||
<< sum(mag(activeDiagCopy))/sum(mag(this->diag().asLinear()))
|
InfoIn("void BlockLduMatrix<Type>::check() const)")
|
||||||
|
<< "Asymmetric matrix: " << activeDiag.size()
|
||||||
|
<< " diagonal dominance assym linear: "
|
||||||
|
<< Foam::min(diagDiag)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
Lower.activeType() == blockCoeffBase::SCALAR
|
Lower.activeType() == blockCoeffBase::SCALAR
|
||||||
|| Upper.activeType() == blockCoeffBase::SCALAR
|
|| Upper.activeType() == blockCoeffBase::SCALAR
|
||||||
|| DiagCopy.activeType() == blockCoeffBase::SCALAR
|
|| d.activeType() == blockCoeffBase::SCALAR
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const scalarTypeField& activeDiag = d.asScalar();
|
||||||
|
|
||||||
const scalarTypeField& activeLower = Lower.asScalar();
|
const scalarTypeField& activeLower = Lower.asScalar();
|
||||||
const scalarTypeField& activeUpper = Upper.asScalar();
|
const scalarTypeField& activeUpper = Upper.asScalar();
|
||||||
scalarTypeField& activeDiagCopy = DiagCopy.asScalar();
|
scalarTypeField& activeSumOffDiag = SumOffDiag.asScalar();
|
||||||
|
|
||||||
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
for (register label coeffI = 0; coeffI < l.size(); coeffI++)
|
||||||
{
|
{
|
||||||
activeDiagCopy[l[coeffI]] += activeLower[coeffI];
|
activeSumOffDiag[l[coeffI]] += cmptMag(activeLower[coeffI]);
|
||||||
activeDiagCopy[u[coeffI]] += activeUpper[coeffI];
|
activeSumOffDiag[u[coeffI]] += cmptMag(activeUpper[coeffI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "void BlockLduMatrix<Type>::check() const : "
|
InfoIn("void BlockLduMatrix<Type>::check() const)")
|
||||||
<< "Asymmetric matrix: raw matrix difference: "
|
<< "Asymmetric matrix: " << activeDiag.size()
|
||||||
<< sum(mag(activeDiagCopy))
|
<< " diagonal dominance assym scalar: "
|
||||||
<< " scaled: "
|
<< Foam::min(mag(activeDiag)/activeSumOffDiag)
|
||||||
<< sum(mag(activeDiagCopy))/sum(mag(this->diag().asScalar()))
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "void BlockLduMatrix<Type>::check() const : "
|
InfoIn("void BlockLduMatrix<Type>::check() const)")
|
||||||
<< "Diagonal matrix" << endl;
|
<< "Diagonal matrix" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,13 @@ void Foam::extendedBlockLduMatrix<Type>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
if (blockLdum.diagonal())
|
if (blockLdum.diagonal())
|
||||||
{
|
{
|
||||||
WarningIn("extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)")
|
WarningIn
|
||||||
<< "Attempted to create extended lower/upper coeffs for block "
|
(
|
||||||
|
"void extendedBlockLduMatrix<Type>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<Type>& blockLdum\n"
|
||||||
|
")"
|
||||||
|
) << "Attempted to create extended lower/upper coeffs for block "
|
||||||
<< "matrix that is diagonal."
|
<< "matrix that is diagonal."
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +113,10 @@ void Foam::extendedBlockLduMatrix<Type>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<Type>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<Type>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix upper coeffs type morphing."
|
<< " block matrix upper coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -195,7 +203,10 @@ void Foam::extendedBlockLduMatrix<Type>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<Type>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<Type>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix upper/lower coeffs type morphing."
|
<< " block matrix upper/lower coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -210,27 +221,24 @@ template<class Type>
|
||||||
Foam::extendedBlockLduMatrix<Type>::extendedBlockLduMatrix
|
Foam::extendedBlockLduMatrix<Type>::extendedBlockLduMatrix
|
||||||
(
|
(
|
||||||
const BlockLduMatrix<Type>& blockLdum,
|
const BlockLduMatrix<Type>& blockLdum,
|
||||||
const label extensionLevel,
|
const extendedLduAddressing& extLduAddr
|
||||||
const polyMesh& polyMesh
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
basicBlockLduMatrix_(blockLdum),
|
basicBlockLduMatrix_(blockLdum),
|
||||||
extLduAddr_
|
extLduAddr_(extLduAddr),
|
||||||
(
|
|
||||||
extendedLduAddressing::New
|
|
||||||
(
|
|
||||||
polyMesh,
|
|
||||||
blockLdum.lduAddr(),
|
|
||||||
extensionLevel
|
|
||||||
)
|
|
||||||
),
|
|
||||||
extendedLowerPtr_(NULL),
|
extendedLowerPtr_(NULL),
|
||||||
extendedUpperPtr_(NULL)
|
extendedUpperPtr_(NULL)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "extendedBlockLduMatrix(lduMatrix&, label, polyMesh&) :"
|
InfoIn
|
||||||
"Constructing extendedBlockLduMatrix."
|
(
|
||||||
|
"extendedBlockLduMatrix<Type>::extendedBlockLduMatrix\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<Type>& blockLdum,\n"
|
||||||
|
" const extendedLduAddressing& extLduAddr\n"
|
||||||
|
")"
|
||||||
|
) << "Constructing extendedBlockLduMatrix."
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,8 @@ SourceFiles
|
||||||
#define extendedBlockLduMatrix_H
|
#define extendedBlockLduMatrix_H
|
||||||
|
|
||||||
#include "extendedLduAddressing.H"
|
#include "extendedLduAddressing.H"
|
||||||
#include "polyMesh.H"
|
|
||||||
#include "className.H"
|
|
||||||
#include "BlockLduMatrix.H"
|
#include "BlockLduMatrix.H"
|
||||||
|
#include "className.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -103,8 +102,7 @@ public:
|
||||||
extendedBlockLduMatrix
|
extendedBlockLduMatrix
|
||||||
(
|
(
|
||||||
const BlockLduMatrix<Type>&,
|
const BlockLduMatrix<Type>&,
|
||||||
const label,
|
const extendedLduAddressing&
|
||||||
const polyMesh&
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,13 @@ void Foam::extendedBlockLduMatrix<Foam::sphericalTensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
if (blockLdum.diagonal())
|
if (blockLdum.diagonal())
|
||||||
{
|
{
|
||||||
WarningIn("extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)")
|
WarningIn
|
||||||
<< "Attempted to create extended lower/upper coeffs for block "
|
(
|
||||||
|
"void extendedBlockLduMatrix<sphericalTensor>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<sphericalTensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
|
) << "Attempted to create extended lower/upper coeffs for block "
|
||||||
<< "matrix that is diagonal."
|
<< "matrix that is diagonal."
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +107,11 @@ void Foam::extendedBlockLduMatrix<Foam::sphericalTensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<sphericalTensor>::"
|
||||||
|
"mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<sphericalTensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix upper coeffs type morphing."
|
<< " block matrix upper coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -158,7 +167,11 @@ void Foam::extendedBlockLduMatrix<Foam::sphericalTensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<sphericalTensor>::"
|
||||||
|
"mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<sphericalTensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix lower coeffs type morphing."
|
<< " block matrix lower coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -229,7 +242,11 @@ void Foam::extendedBlockLduMatrix<Foam::sphericalTensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<sphericalTensor>::"
|
||||||
|
"mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<sphericalTensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix upper/lower coeffs type morphing."
|
<< " block matrix upper/lower coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
|
|
@ -41,8 +41,13 @@ void Foam::extendedBlockLduMatrix<Foam::symmTensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
if (blockLdum.diagonal())
|
if (blockLdum.diagonal())
|
||||||
{
|
{
|
||||||
WarningIn("extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)")
|
WarningIn
|
||||||
<< "Attempted to create extended lower/upper coeffs for block "
|
(
|
||||||
|
"void extendedBlockLduMatrix<symmTensor>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<symmTensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
|
) << "Attempted to create extended lower/upper coeffs for block "
|
||||||
<< "matrix that is diagonal."
|
<< "matrix that is diagonal."
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +107,11 @@ void Foam::extendedBlockLduMatrix<Foam::symmTensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<symmTensor>::"
|
||||||
|
"mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<symmTensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix upper coeffs type morphing."
|
<< " block matrix upper coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -158,7 +167,11 @@ void Foam::extendedBlockLduMatrix<Foam::symmTensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<symmTensor>::"
|
||||||
|
"mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<symmTensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix lower coeffs type morphing."
|
<< " block matrix lower coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -188,7 +201,8 @@ void Foam::extendedBlockLduMatrix<Foam::symmTensor>::mapOffDiagCoeffs
|
||||||
if (upper.activeType() == blockCoeffBase::SCALAR)
|
if (upper.activeType() == blockCoeffBase::SCALAR)
|
||||||
{
|
{
|
||||||
// Helper type definition
|
// Helper type definition
|
||||||
typedef typename CoeffField<symmTensor>::scalarTypeField activeType;
|
typedef typename CoeffField<symmTensor>::scalarTypeField
|
||||||
|
activeType;
|
||||||
|
|
||||||
// Get references to fields
|
// Get references to fields
|
||||||
const activeType& activeUpper = upper.asScalar();
|
const activeType& activeUpper = upper.asScalar();
|
||||||
|
@ -207,7 +221,8 @@ void Foam::extendedBlockLduMatrix<Foam::symmTensor>::mapOffDiagCoeffs
|
||||||
else if (upper.activeType() == blockCoeffBase::LINEAR)
|
else if (upper.activeType() == blockCoeffBase::LINEAR)
|
||||||
{
|
{
|
||||||
// Helper type definition
|
// Helper type definition
|
||||||
typedef typename CoeffField<symmTensor>::linearTypeField activeType;
|
typedef typename CoeffField<symmTensor>::linearTypeField
|
||||||
|
activeType;
|
||||||
|
|
||||||
// Get references to fields
|
// Get references to fields
|
||||||
const activeType& activeUpper = upper.asLinear();
|
const activeType& activeUpper = upper.asLinear();
|
||||||
|
@ -227,7 +242,10 @@ void Foam::extendedBlockLduMatrix<Foam::symmTensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<symmTensor>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<symmTensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix upper/lower coeffs type morphing."
|
<< " block matrix upper/lower coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
|
|
@ -41,8 +41,13 @@ void Foam::extendedBlockLduMatrix<Foam::tensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
if (blockLdum.diagonal())
|
if (blockLdum.diagonal())
|
||||||
{
|
{
|
||||||
WarningIn("extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)")
|
WarningIn
|
||||||
<< "Attempted to create extended lower/upper coeffs for block "
|
(
|
||||||
|
"void extendedBlockLduMatrix<tensor>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<tensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
|
) << "Attempted to create extended lower/upper coeffs for block "
|
||||||
<< "matrix that is diagonal."
|
<< "matrix that is diagonal."
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +72,8 @@ void Foam::extendedBlockLduMatrix<Foam::tensor>::mapOffDiagCoeffs
|
||||||
if (upper.activeType() == blockCoeffBase::SCALAR)
|
if (upper.activeType() == blockCoeffBase::SCALAR)
|
||||||
{
|
{
|
||||||
// Helper type definition
|
// Helper type definition
|
||||||
typedef typename CoeffField<tensor>::scalarTypeField activeType;
|
typedef typename CoeffField<tensor>::scalarTypeField
|
||||||
|
activeType;
|
||||||
|
|
||||||
// Get references to fields
|
// Get references to fields
|
||||||
const activeType& activeUpper = upper.asScalar();
|
const activeType& activeUpper = upper.asScalar();
|
||||||
|
@ -83,7 +89,8 @@ void Foam::extendedBlockLduMatrix<Foam::tensor>::mapOffDiagCoeffs
|
||||||
else if (upper.activeType() == blockCoeffBase::LINEAR)
|
else if (upper.activeType() == blockCoeffBase::LINEAR)
|
||||||
{
|
{
|
||||||
// Helper type definition
|
// Helper type definition
|
||||||
typedef typename CoeffField<tensor>::linearTypeField activeType;
|
typedef typename CoeffField<tensor>::linearTypeField
|
||||||
|
activeType;
|
||||||
|
|
||||||
// Get references to fields
|
// Get references to fields
|
||||||
const activeType& activeUpper = upper.asLinear();
|
const activeType& activeUpper = upper.asLinear();
|
||||||
|
@ -100,7 +107,10 @@ void Foam::extendedBlockLduMatrix<Foam::tensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<tensor>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<tensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix upper coeffs type morphing."
|
<< " block matrix upper coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -121,7 +131,8 @@ void Foam::extendedBlockLduMatrix<Foam::tensor>::mapOffDiagCoeffs
|
||||||
if (lower.activeType() == blockCoeffBase::SCALAR)
|
if (lower.activeType() == blockCoeffBase::SCALAR)
|
||||||
{
|
{
|
||||||
// Helper type definition
|
// Helper type definition
|
||||||
typedef typename CoeffField<tensor>::scalarTypeField activeType;
|
typedef typename CoeffField<tensor>::scalarTypeField
|
||||||
|
activeType;
|
||||||
|
|
||||||
// Get references to fields
|
// Get references to fields
|
||||||
const activeType& activeLower = lower.asScalar();
|
const activeType& activeLower = lower.asScalar();
|
||||||
|
@ -137,7 +148,8 @@ void Foam::extendedBlockLduMatrix<Foam::tensor>::mapOffDiagCoeffs
|
||||||
else if (lower.activeType() == blockCoeffBase::LINEAR)
|
else if (lower.activeType() == blockCoeffBase::LINEAR)
|
||||||
{
|
{
|
||||||
// Helper type definition
|
// Helper type definition
|
||||||
typedef typename CoeffField<tensor>::linearTypeField activeType;
|
typedef typename CoeffField<tensor>::linearTypeField
|
||||||
|
activeType;
|
||||||
|
|
||||||
// Get references to fields
|
// Get references to fields
|
||||||
const activeType& activeLower = lower.asLinear();
|
const activeType& activeLower = lower.asLinear();
|
||||||
|
@ -154,7 +166,10 @@ void Foam::extendedBlockLduMatrix<Foam::tensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<tensor>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<tensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix lower coeffs type morphing."
|
<< " block matrix lower coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -223,7 +238,10 @@ void Foam::extendedBlockLduMatrix<Foam::tensor>::mapOffDiagCoeffs
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"extendedBlockLduMatrix(lduMatrix&, label, polyMesh&)"
|
"void extendedBlockLduMatrix<tensor>::mapOffDiagCoeffs\n"
|
||||||
|
"(\n"
|
||||||
|
" const BlockLduMatrix<tensor>& blockLdum\n"
|
||||||
|
")"
|
||||||
) << "Problem between ordinary block matrix and extended"
|
) << "Problem between ordinary block matrix and extended"
|
||||||
<< " block matrix upper/lower coeffs type morphing."
|
<< " block matrix upper/lower coeffs type morphing."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
|
|
@ -67,7 +67,6 @@ void Foam::BlockGaussSeidelPrecon<Type>::calcInvDiag()
|
||||||
// For square diagonal invert diagonal only and store the rest
|
// For square diagonal invert diagonal only and store the rest
|
||||||
// info LUDiag coefficient. This avoids full inverse of the
|
// info LUDiag coefficient. This avoids full inverse of the
|
||||||
// diagonal matrix. HJ, 20/Aug/2015
|
// diagonal matrix. HJ, 20/Aug/2015
|
||||||
Info<< "Square diag inverse" << endl;
|
|
||||||
|
|
||||||
// Get reference to active diag
|
// Get reference to active diag
|
||||||
const squareTypeField& activeDiag = d.asSquare();
|
const squareTypeField& activeDiag = d.asSquare();
|
||||||
|
@ -83,7 +82,7 @@ void Foam::BlockGaussSeidelPrecon<Type>::calcInvDiag()
|
||||||
// Expand diagonal only to full square type and store into luDiag
|
// Expand diagonal only to full square type and store into luDiag
|
||||||
expandLinear(luDiag, lf);
|
expandLinear(luDiag, lf);
|
||||||
|
|
||||||
// Keep only off-diagonal in ldDiag.
|
// Keep only off-diagonal in luDiag.
|
||||||
// Note change of sign to avoid multiplication with -1 when moving
|
// Note change of sign to avoid multiplication with -1 when moving
|
||||||
// to the other side. HJ, 20/Aug/2015
|
// to the other side. HJ, 20/Aug/2015
|
||||||
luDiag -= activeDiag;
|
luDiag -= activeDiag;
|
||||||
|
|
|
@ -65,8 +65,10 @@ void Foam::BlockILUCpPrecon<Type>::calcActiveTypeFactorization
|
||||||
const extendedLduAddressing& addr = extBlockMatrix_.extendedLduAddr();
|
const extendedLduAddressing& addr = extBlockMatrix_.extendedLduAddr();
|
||||||
|
|
||||||
// Get upper/lower extended addressing
|
// Get upper/lower extended addressing
|
||||||
const label* const __restrict__ uPtr = addr.extendedUpperAddr().begin();
|
const label* const __restrict__ uPtr =
|
||||||
const label* const __restrict__ lPtr = addr.extendedLowerAddr().begin();
|
addr.extendedUpperAddr().begin();
|
||||||
|
const label* const __restrict__ lPtr =
|
||||||
|
addr.extendedLowerAddr().begin();
|
||||||
|
|
||||||
// Get extended owner start addressing
|
// Get extended owner start addressing
|
||||||
const label* const __restrict__ ownStartPtr =
|
const label* const __restrict__ ownStartPtr =
|
||||||
|
@ -87,8 +89,8 @@ void Foam::BlockILUCpPrecon<Type>::calcActiveTypeFactorization
|
||||||
LDUType* __restrict__ zPtr = z.begin();
|
LDUType* __restrict__ zPtr = z.begin();
|
||||||
LDUType* __restrict__ wPtr = w.begin();
|
LDUType* __restrict__ wPtr = w.begin();
|
||||||
|
|
||||||
// Define start and end face ("virtual" face when extended addressing is
|
// Define start and end face ("virtual" face when extended addressing
|
||||||
// used) of this row/column.
|
// is used) of this row/column.
|
||||||
register label fStart, fEnd, fLsrStart, fLsrEnd;
|
register label fStart, fEnd, fLsrStart, fLsrEnd;
|
||||||
|
|
||||||
// Crout LU factorization
|
// Crout LU factorization
|
||||||
|
@ -505,17 +507,15 @@ Foam::BlockILUCpPrecon<Type>::BlockILUCpPrecon
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
BlockLduPrecon<Type>(matrix),
|
BlockLduPrecon<Type>(matrix),
|
||||||
preconDiag_(matrix.diag()),
|
|
||||||
p_(readLabel(dict.lookup("fillInLevel"))),
|
|
||||||
extBlockMatrix_
|
extBlockMatrix_
|
||||||
(
|
(
|
||||||
matrix,
|
matrix,
|
||||||
p_,
|
matrix.mesh().lduAddr().extendedAddr
|
||||||
matrix.mesh().thisDb().time().template lookupObject<polyMesh>
|
|
||||||
(
|
(
|
||||||
polyMesh::defaultRegion
|
readLabel(dict.lookup("fillInLevel"))
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
|
preconDiag_(matrix.diag())
|
||||||
{
|
{
|
||||||
calcFactorization();
|
calcFactorization();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,15 +62,12 @@ class BlockILUCpPrecon
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
|
//- Extended ldu matrix
|
||||||
|
mutable extendedBlockLduMatrix<Type> extBlockMatrix_;
|
||||||
|
|
||||||
//- Preconditioned diagonal
|
//- Preconditioned diagonal
|
||||||
mutable CoeffField<Type> preconDiag_;
|
mutable CoeffField<Type> preconDiag_;
|
||||||
|
|
||||||
//- Fill in level
|
|
||||||
const label p_;
|
|
||||||
|
|
||||||
//- Extended lduMarix
|
|
||||||
mutable extendedBlockLduMatrix<Type> extBlockMatrix_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ License
|
||||||
|
|
||||||
#include "extendedLduAddressing.H"
|
#include "extendedLduAddressing.H"
|
||||||
#include "mapPolyMesh.H"
|
#include "mapPolyMesh.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -38,21 +39,10 @@ namespace Foam
|
||||||
|
|
||||||
Foam::extendedLduAddressing::extendedLduAddressing
|
Foam::extendedLduAddressing::extendedLduAddressing
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
|
||||||
const lduAddressing& lduAddr,
|
const lduAddressing& lduAddr,
|
||||||
const label extensionLevel
|
const label extensionLevel
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
MeshObject<polyMesh, extendedLduAddressing>(mesh),
|
|
||||||
lowerAddr_
|
|
||||||
(
|
|
||||||
labelList::subList
|
|
||||||
(
|
|
||||||
mesh.faceOwner(),
|
|
||||||
mesh.nInternalFaces()
|
|
||||||
)
|
|
||||||
),
|
|
||||||
upperAddr_(mesh.faceNeighbour()),
|
|
||||||
lduAddr_(lduAddr),
|
lduAddr_(lduAddr),
|
||||||
p_(extensionLevel),
|
p_(extensionLevel),
|
||||||
extendedLowerPtr_(NULL),
|
extendedLowerPtr_(NULL),
|
||||||
|
@ -146,6 +136,44 @@ void Foam::extendedLduAddressing::markNeighbours
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::extendedLduAddressing::calcCellCells
|
||||||
|
(
|
||||||
|
labelListList& cellCellAddr
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Algorithm taken from primiteMeshCellCells.C in calcCellCells() member
|
||||||
|
// function.
|
||||||
|
labelList ncc(lduAddr_.size(), 0);
|
||||||
|
|
||||||
|
const unallocLabelList& own = lowerAddr();
|
||||||
|
const unallocLabelList& nei = upperAddr();
|
||||||
|
|
||||||
|
forAll (nei, faceI)
|
||||||
|
{
|
||||||
|
ncc[own[faceI]]++;
|
||||||
|
ncc[nei[faceI]]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Size the list
|
||||||
|
cellCellAddr.setSize(ncc.size());
|
||||||
|
|
||||||
|
forAll (cellCellAddr, cellI)
|
||||||
|
{
|
||||||
|
cellCellAddr[cellI].setSize(ncc[cellI]);
|
||||||
|
}
|
||||||
|
ncc = 0;
|
||||||
|
|
||||||
|
forAll (nei, faceI)
|
||||||
|
{
|
||||||
|
label ownCellI = own[faceI];
|
||||||
|
label neiCellI = nei[faceI];
|
||||||
|
|
||||||
|
cellCellAddr[ownCellI][ncc[ownCellI]++] = neiCellI;
|
||||||
|
cellCellAddr[neiCellI][ncc[neiCellI]++] = ownCellI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::extendedLduAddressing::calcExtendedLowerUpper() const
|
void Foam::extendedLduAddressing::calcExtendedLowerUpper() const
|
||||||
{
|
{
|
||||||
if (extendedLowerPtr_ && extendedUpperPtr_)
|
if (extendedLowerPtr_ && extendedUpperPtr_)
|
||||||
|
@ -168,19 +196,16 @@ void Foam::extendedLduAddressing::calcExtendedLowerUpper() const
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get polyMesh reference
|
// Allocate dynamic lists for extended owner/neighbour, which are later
|
||||||
const polyMesh& mesh = this->mesh();
|
// used to define ordinary labelLists (extendedLower, extendedUpper)
|
||||||
|
|
||||||
// Allocate dynamic lists for extended owner/neighbour, which are later used
|
|
||||||
// to define ordinary labelLists (extendedLower, extendedUpper)
|
|
||||||
// Helper type definition
|
// Helper type definition
|
||||||
typedef DynamicList<label> DynamicLabelList;
|
typedef DynamicList<label> DynamicLabelList;
|
||||||
|
|
||||||
// Get the number of faces
|
// Get the number of faces
|
||||||
const label nFaces = upperAddr_.size();;
|
const label nFaces = upperAddr().size();
|
||||||
|
|
||||||
// Allocate extended owner/neighbour with 4*nFaces*extensionLevel as a guess
|
// Allocate extended owner/neighbour with 4*nFaces*extensionLevel as a
|
||||||
// (based on hex mesh assumption) to prevent excessive resizing
|
// guess (based on hex mesh assumption) to prevent excessive resizing
|
||||||
DynamicLabelList dExtOwn(4*nFaces*p_);
|
DynamicLabelList dExtOwn(4*nFaces*p_);
|
||||||
DynamicLabelList dExtNei(4*nFaces*p_);
|
DynamicLabelList dExtNei(4*nFaces*p_);
|
||||||
|
|
||||||
|
@ -188,10 +213,12 @@ void Foam::extendedLduAddressing::calcExtendedLowerUpper() const
|
||||||
HashSet<label> extCellNbrs(32*p_);
|
HashSet<label> extCellNbrs(32*p_);
|
||||||
|
|
||||||
// Get number of cells in the mesh
|
// Get number of cells in the mesh
|
||||||
const label nCells = mesh.nCells();
|
const label nCells = lduAddr_.size();
|
||||||
|
|
||||||
// Get a list of cells neighbouring each cell
|
// Get a list of cells neighbouring each cell.
|
||||||
const labelListList& cellCells = mesh.cellCells();
|
// Note optimisation to avoid a copy
|
||||||
|
labelListList cellCells;
|
||||||
|
calcCellCells(cellCells);
|
||||||
|
|
||||||
// Loop through cells
|
// Loop through cells
|
||||||
for (label cellI = 0; cellI < nCells; ++cellI)
|
for (label cellI = 0; cellI < nCells; ++cellI)
|
||||||
|
@ -234,8 +261,8 @@ void Foam::extendedLduAddressing::calcFaceMap() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get reference to ordinary owner/neighbour addressing
|
// Get reference to ordinary owner/neighbour addressing
|
||||||
const unallocLabelList& own = lduAddr().lowerAddr();
|
const unallocLabelList& own = lowerAddr();
|
||||||
const unallocLabelList& nbr = lduAddr().upperAddr();
|
const unallocLabelList& nbr = upperAddr();
|
||||||
|
|
||||||
// Allocate memory for faceMap
|
// Allocate memory for faceMap
|
||||||
faceMapPtr_ = new labelList(own.size(), -1);
|
faceMapPtr_ = new labelList(own.size(), -1);
|
||||||
|
@ -289,7 +316,7 @@ void Foam::extendedLduAddressing::calcExtendedLosort() const
|
||||||
// Scan the extended neighbour list to find out how many times the cell
|
// Scan the extended neighbour list to find out how many times the cell
|
||||||
// appears as a neighbour of the face. Done this way to avoid guessing
|
// appears as a neighbour of the face. Done this way to avoid guessing
|
||||||
// and resizing list
|
// and resizing list
|
||||||
const label matrixSize = mesh().nCells();
|
const label matrixSize = lduAddr_.size();
|
||||||
labelList nNbrOfFace(matrixSize, 0);
|
labelList nNbrOfFace(matrixSize, 0);
|
||||||
|
|
||||||
const unallocLabelList& nbr = extendedUpperAddr();
|
const unallocLabelList& nbr = extendedUpperAddr();
|
||||||
|
@ -429,7 +456,7 @@ void Foam::extendedLduAddressing::calcExtendedLosortStart() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up last lookup by hand
|
// Set up last lookup by hand
|
||||||
lsrtStart[this->mesh().nCells()] = nbr.size();
|
lsrtStart[lduAddr_.size()] = nbr.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,15 +25,15 @@ Class
|
||||||
Foam::extendedLduAddressing
|
Foam::extendedLduAddressing
|
||||||
|
|
||||||
Description
|
Description
|
||||||
The class contains data and calculates demand driven extended ldu addressing
|
The class contains data and calculates demand driven extended ldu
|
||||||
of arbitrary level. Level 0 is not allowed as it is the same as ordinary
|
addressing of arbitrary level. Level 0 is not allowed as it is the same
|
||||||
lduAddressing. Level 1 considers neighbours of neighbours for a given cell,
|
as ordinary lduAddressing. Level 1 considers neighbours of neighbours
|
||||||
etc.
|
for a given cell, etc.
|
||||||
|
|
||||||
The addressing is completely defined with extended variants of:
|
The addressing is completely defined with extended variants of:
|
||||||
owner/neighbour, losort, ownerStart and losortStart: all being demand-driven
|
owner/neighbour, losort, ownerStart and losortStart: all being
|
||||||
data. In order to define extended owner/neighbour lists, additional
|
demand-driven data. In order to define extended owner/neighbour lists,
|
||||||
"virtual" faces are assumed between cells not sharing a face.
|
additional "virtual" faces are assumed between cells not sharing a face.
|
||||||
|
|
||||||
Author
|
Author
|
||||||
Vuko Vukcevic, FMENA Zagreb. All rights reserved
|
Vuko Vukcevic, FMENA Zagreb. All rights reserved
|
||||||
|
@ -46,9 +46,8 @@ SourceFiles
|
||||||
#ifndef extendedLduAddressing_H
|
#ifndef extendedLduAddressing_H
|
||||||
#define extendedLduAddressing_H
|
#define extendedLduAddressing_H
|
||||||
|
|
||||||
#include "MeshObject.H"
|
|
||||||
#include "polyMesh.H"
|
|
||||||
#include "lduAddressing.H"
|
#include "lduAddressing.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -62,17 +61,9 @@ class mapPolyMesh;
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class extendedLduAddressing
|
class extendedLduAddressing
|
||||||
:
|
|
||||||
public MeshObject<polyMesh, extendedLduAddressing>
|
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Lower as a subList of allOwner
|
|
||||||
labelList::subList lowerAddr_;
|
|
||||||
|
|
||||||
//- Upper as a reference to neighbour
|
|
||||||
const labelList& upperAddr_;
|
|
||||||
|
|
||||||
//- Reference to basic lduAddressing
|
//- Reference to basic lduAddressing
|
||||||
const lduAddressing& lduAddr_;
|
const lduAddressing& lduAddr_;
|
||||||
|
|
||||||
|
@ -121,7 +112,7 @@ class extendedLduAddressing
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// masterCellI - searching for extended neighbours of this cell
|
// masterCellI - searching for extended neighbours of this cell
|
||||||
// nbrCells - neighbouring cells of a cell (based on level)
|
// nbrCells - neighbouring cells of a cell (based on level)
|
||||||
// cellCells - mesh data to avoid function calls
|
// cellCells - passing as a parameter for minor optimisation
|
||||||
// extendedNbrs - HashSet containing labels of extended neighbours
|
// extendedNbrs - HashSet containing labels of extended neighbours
|
||||||
// curLevel - current level needed for recursion control
|
// curLevel - current level needed for recursion control
|
||||||
void markNeighbours
|
void markNeighbours
|
||||||
|
@ -136,6 +127,10 @@ class extendedLduAddressing
|
||||||
|
|
||||||
// Calculation of demand driven data
|
// Calculation of demand driven data
|
||||||
|
|
||||||
|
//- Calculate cells cells using lower/upper addressing
|
||||||
|
// into provided storage
|
||||||
|
void calcCellCells(labelListList& cc) const;
|
||||||
|
|
||||||
//- Calculate extended lower/upper
|
//- Calculate extended lower/upper
|
||||||
void calcExtendedLowerUpper() const;
|
void calcExtendedLowerUpper() const;
|
||||||
|
|
||||||
|
@ -160,10 +155,9 @@ public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct given polyMesh
|
//- Construct given lduAddressing
|
||||||
extendedLduAddressing
|
extendedLduAddressing
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
|
||||||
const lduAddressing& lduAddr,
|
const lduAddressing& lduAddr,
|
||||||
const label extensionLevel
|
const label extensionLevel
|
||||||
);
|
);
|
||||||
|
@ -178,22 +172,22 @@ public:
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- Return basic lduAddressing
|
||||||
|
const lduAddressing& lduAddr() const
|
||||||
|
{
|
||||||
|
return lduAddr_;
|
||||||
|
}
|
||||||
|
|
||||||
//- Return lower addressing (i.e. lower label = upper triangle)
|
//- Return lower addressing (i.e. lower label = upper triangle)
|
||||||
const unallocLabelList& lowerAddr() const
|
const unallocLabelList& lowerAddr() const
|
||||||
{
|
{
|
||||||
return lowerAddr_;
|
return lduAddr_.lowerAddr();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return upper addressing (i.e. upper label)
|
//- Return upper addressing (i.e. upper label)
|
||||||
const unallocLabelList& upperAddr() const
|
const unallocLabelList& upperAddr() const
|
||||||
{
|
{
|
||||||
return upperAddr_;
|
return lduAddr_.upperAddr();
|
||||||
}
|
|
||||||
|
|
||||||
//- Return basic lduAddressing
|
|
||||||
const lduAddressing& lduAddr() const
|
|
||||||
{
|
|
||||||
return lduAddr_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return extended lower addressing
|
//- Return extended lower addressing
|
||||||
|
|
|
@ -24,6 +24,7 @@ License
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "lduAddressing.H"
|
#include "lduAddressing.H"
|
||||||
|
#include "extendedLduAddressing.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
@ -169,6 +170,18 @@ void Foam::lduAddressing::calcLosortStart() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::lduAddressing::lduAddressing(const label nEqns)
|
||||||
|
:
|
||||||
|
size_(nEqns),
|
||||||
|
losortPtr_(NULL),
|
||||||
|
ownerStartPtr_(NULL),
|
||||||
|
losortStartPtr_(NULL),
|
||||||
|
extendedAddr_(5)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::lduAddressing::~lduAddressing()
|
Foam::lduAddressing::~lduAddressing()
|
||||||
|
@ -248,4 +261,27 @@ Foam::label Foam::lduAddressing::triIndex(const label a, const label b) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::extendedLduAddressing&
|
||||||
|
Foam::lduAddressing::extendedAddr(const label p) const
|
||||||
|
{
|
||||||
|
if (p == 0 || p > 4)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"const Foam::extendedLduAddressing& "
|
||||||
|
"Foam::lduAddressing::extendedAddr(const label p) const"
|
||||||
|
) << "Currently supported extended addressing fill-in only "
|
||||||
|
<< "between order 1 and 4"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!extendedAddr_.set(p))
|
||||||
|
{
|
||||||
|
extendedAddr_.set(p, new extendedLduAddressing(*this, p));
|
||||||
|
}
|
||||||
|
|
||||||
|
return extendedAddr_[p];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -104,8 +104,11 @@ SourceFiles
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class extendedLduAddressing;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class lduAddressing Declaration
|
Class lduAddressing Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class lduAddressing
|
class lduAddressing
|
||||||
|
@ -127,6 +130,9 @@ class lduAddressing
|
||||||
//- Losort start addressing
|
//- Losort start addressing
|
||||||
mutable labelList* losortStartPtr_;
|
mutable labelList* losortStartPtr_;
|
||||||
|
|
||||||
|
//- Extended addressing with p-order fill-in
|
||||||
|
mutable PtrList<extendedLduAddressing> extendedAddr_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
@ -149,18 +155,11 @@ class lduAddressing
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
lduAddressing(const label nEqns)
|
lduAddressing(const label nEqns);
|
||||||
:
|
|
||||||
size_(nEqns),
|
|
||||||
losortPtr_(NULL),
|
|
||||||
ownerStartPtr_(NULL),
|
|
||||||
losortStartPtr_(NULL)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
//- Destructor
|
||||||
|
virtual ~lduAddressing();
|
||||||
virtual ~lduAddressing();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
@ -200,6 +199,9 @@ public:
|
||||||
|
|
||||||
//- Return off-diagonal index given owner and neighbour label
|
//- Return off-diagonal index given owner and neighbour label
|
||||||
label triIndex(const label a, const label b) const;
|
label triIndex(const label a, const label b) const;
|
||||||
|
|
||||||
|
//- Return extended addressing given p index
|
||||||
|
const extendedLduAddressing& extendedAddr(const label p) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,20 +38,11 @@ namespace Foam
|
||||||
Foam::extendedLduMatrix::extendedLduMatrix
|
Foam::extendedLduMatrix::extendedLduMatrix
|
||||||
(
|
(
|
||||||
const lduMatrix& ldum,
|
const lduMatrix& ldum,
|
||||||
const label extensionLevel,
|
const extendedLduAddressing& extLduAddr
|
||||||
const polyMesh& polyMesh
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
basicLduMatrix_(ldum),
|
basicLduMatrix_(ldum),
|
||||||
extLduAddr_
|
extLduAddr_(extLduAddr),
|
||||||
(
|
|
||||||
extendedLduAddressing::New
|
|
||||||
(
|
|
||||||
polyMesh,
|
|
||||||
ldum.lduAddr(),
|
|
||||||
extensionLevel
|
|
||||||
)
|
|
||||||
),
|
|
||||||
extendedLowerPtr_(NULL),
|
extendedLowerPtr_(NULL),
|
||||||
extendedUpperPtr_(NULL)
|
extendedUpperPtr_(NULL)
|
||||||
{
|
{
|
||||||
|
@ -102,10 +93,10 @@ Foam::extendedLduMatrix::extendedLduMatrix
|
||||||
const label nExtFaces = extLduAddr_.extendedUpperAddr().size();
|
const label nExtFaces = extLduAddr_.extendedUpperAddr().size();
|
||||||
|
|
||||||
// Allocate extended upper and lower
|
// Allocate extended upper and lower
|
||||||
extendedUpperPtr_ = new scalarField(nExtFaces, 0.0);
|
extendedUpperPtr_ = new scalarField(nExtFaces, scalar(0));
|
||||||
scalarField& extUpper = *extendedUpperPtr_;
|
scalarField& extUpper = *extendedUpperPtr_;
|
||||||
|
|
||||||
extendedLowerPtr_ = new scalarField(nExtFaces, 0.0);
|
extendedLowerPtr_ = new scalarField(nExtFaces, scalar(0));
|
||||||
scalarField& extLower = *extendedLowerPtr_;
|
scalarField& extLower = *extendedLowerPtr_;
|
||||||
|
|
||||||
// Get upper and lower coeffs from underlying lduMatrix
|
// Get upper and lower coeffs from underlying lduMatrix
|
||||||
|
@ -154,7 +145,7 @@ Foam::scalarField& Foam::extendedLduMatrix::extendedLower()
|
||||||
extendedLowerPtr_ = new scalarField
|
extendedLowerPtr_ = new scalarField
|
||||||
(
|
(
|
||||||
extLduAddr_.extendedLowerAddr().size(),
|
extLduAddr_.extendedLowerAddr().size(),
|
||||||
0.0
|
scalar(0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +167,7 @@ Foam::scalarField& Foam::extendedLduMatrix::extendedUpper()
|
||||||
extendedUpperPtr_ = new scalarField
|
extendedUpperPtr_ = new scalarField
|
||||||
(
|
(
|
||||||
extLduAddr_.extendedUpperAddr().size(),
|
extLduAddr_.extendedUpperAddr().size(),
|
||||||
0.0
|
scalar(0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,8 @@ SourceFiles
|
||||||
#define extendedLduMatrix_H
|
#define extendedLduMatrix_H
|
||||||
|
|
||||||
#include "extendedLduAddressing.H"
|
#include "extendedLduAddressing.H"
|
||||||
#include "polyMesh.H"
|
|
||||||
#include "className.H"
|
|
||||||
#include "lduMatrix.H"
|
#include "lduMatrix.H"
|
||||||
|
#include "className.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -88,12 +87,15 @@ public:
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct given lduMatrix, extension level and polyMesh
|
//- Construct given lduMatrix, extension level and polyMesh
|
||||||
extendedLduMatrix(const lduMatrix&, const label, const polyMesh&);
|
extendedLduMatrix
|
||||||
|
(
|
||||||
|
const lduMatrix&,
|
||||||
|
const extendedLduAddressing&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
//- Destructor
|
||||||
|
~extendedLduMatrix();
|
||||||
~extendedLduMatrix();
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
|
@ -104,13 +104,14 @@ inline TensorN<Cmpt, length> TensorN<Cmpt, length>::T() const
|
||||||
return transpose;
|
return transpose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return tensor diagonal
|
//- Return tensor diagonal
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline DiagTensorN<Cmpt, length> TensorN<Cmpt, length>::diag() const
|
inline DiagTensorN<Cmpt, length> TensorN<Cmpt, length>::diag() const
|
||||||
{
|
{
|
||||||
DiagTensorN<Cmpt, length> dt;
|
DiagTensorN<Cmpt, length> dt;
|
||||||
|
|
||||||
label diagI=0;
|
label diagI = 0;
|
||||||
for (label i = 0; i < TensorN<Cmpt, length>::rowLength; i++)
|
for (label i = 0; i < TensorN<Cmpt, length>::rowLength; i++)
|
||||||
{
|
{
|
||||||
dt[i] = this->v_[diagI];
|
dt[i] = this->v_[diagI];
|
||||||
|
@ -120,6 +121,7 @@ inline DiagTensorN<Cmpt, length> TensorN<Cmpt, length>::diag() const
|
||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Negative sum the vertical off-diagonal components
|
//- Negative sum the vertical off-diagonal components
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline TensorN<Cmpt, length> TensorN<Cmpt, length>::negSumDiag() const
|
inline TensorN<Cmpt, length> TensorN<Cmpt, length>::negSumDiag() const
|
||||||
|
@ -153,6 +155,7 @@ inline TensorN<Cmpt, length> TensorN<Cmpt, length>::negSumDiag() const
|
||||||
return negsumdiag;
|
return negsumdiag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Assign to a SphericalTensorN
|
//- Assign to a SphericalTensorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline void
|
inline void
|
||||||
|
@ -502,7 +505,11 @@ operator+(const TensorN<Cmpt, length>& t1, const TensorN<Cmpt, length>& t2)
|
||||||
//- Addition of TensorN and DiagTensorN
|
//- Addition of TensorN and DiagTensorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline TensorN<Cmpt, length>
|
inline TensorN<Cmpt, length>
|
||||||
operator+(const TensorN<Cmpt, length>& t1, const DiagTensorN<Cmpt, length>& dt2)
|
operator+
|
||||||
|
(
|
||||||
|
const TensorN<Cmpt, length>& t1,
|
||||||
|
const DiagTensorN<Cmpt, length>& dt2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
TensorN<Cmpt, length> result(t1);
|
TensorN<Cmpt, length> result(t1);
|
||||||
|
|
||||||
|
@ -520,7 +527,11 @@ operator+(const TensorN<Cmpt, length>& t1, const DiagTensorN<Cmpt, length>& dt2)
|
||||||
//- Addition of DiagTensorN and TensorN
|
//- Addition of DiagTensorN and TensorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline TensorN<Cmpt, length>
|
inline TensorN<Cmpt, length>
|
||||||
operator+(const DiagTensorN<Cmpt, length>& dt1, const TensorN<Cmpt, length>& t2)
|
operator+
|
||||||
|
(
|
||||||
|
const DiagTensorN<Cmpt, length>& dt1,
|
||||||
|
const TensorN<Cmpt, length>& t2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
TensorN<Cmpt, length> result(t2);
|
TensorN<Cmpt, length> result(t2);
|
||||||
|
|
||||||
|
@ -602,7 +613,11 @@ operator-(const TensorN<Cmpt, length>& t1, const TensorN<Cmpt, length>& t2)
|
||||||
//- Subtraction of TensorN and DiagTensorN
|
//- Subtraction of TensorN and DiagTensorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline TensorN<Cmpt, length>
|
inline TensorN<Cmpt, length>
|
||||||
operator-(const TensorN<Cmpt, length>& t1, const DiagTensorN<Cmpt, length>& dt2)
|
operator-
|
||||||
|
(
|
||||||
|
const TensorN<Cmpt, length>& t1,
|
||||||
|
const DiagTensorN<Cmpt, length>& dt2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
TensorN<Cmpt, length> result(t1);
|
TensorN<Cmpt, length> result(t1);
|
||||||
|
|
||||||
|
@ -620,7 +635,11 @@ operator-(const TensorN<Cmpt, length>& t1, const DiagTensorN<Cmpt, length>& dt2)
|
||||||
//- Subtraction of DiagTensorN and TensorN
|
//- Subtraction of DiagTensorN and TensorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline TensorN<Cmpt, length>
|
inline TensorN<Cmpt, length>
|
||||||
operator-(const DiagTensorN<Cmpt, length>& dt1, const TensorN<Cmpt, length>& t2)
|
operator-
|
||||||
|
(
|
||||||
|
const DiagTensorN<Cmpt, length>& dt1,
|
||||||
|
const TensorN<Cmpt, length>& t2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
TensorN<Cmpt, length> result(-t2);
|
TensorN<Cmpt, length> result(-t2);
|
||||||
|
|
||||||
|
@ -709,7 +728,11 @@ operator/(const TensorN<Cmpt, length>& t1, const TensorN<Cmpt, length>& t2)
|
||||||
//- Inner Product of a DiagTensorN and an inverse TensorN
|
//- Inner Product of a DiagTensorN and an inverse TensorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline TensorN<Cmpt, length>
|
inline TensorN<Cmpt, length>
|
||||||
operator/(const DiagTensorN<Cmpt, length>& dt1, const TensorN<Cmpt, length>& t2)
|
operator/
|
||||||
|
(
|
||||||
|
const DiagTensorN<Cmpt, length>& dt1,
|
||||||
|
const TensorN<Cmpt, length>& t2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return dt1 & inv(t2);
|
return dt1 & inv(t2);
|
||||||
}
|
}
|
||||||
|
@ -718,7 +741,11 @@ operator/(const DiagTensorN<Cmpt, length>& dt1, const TensorN<Cmpt, length>& t2)
|
||||||
//- Inner Product of a TensorN and an inverse DiagTensorN
|
//- Inner Product of a TensorN and an inverse DiagTensorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline TensorN<Cmpt, length>
|
inline TensorN<Cmpt, length>
|
||||||
operator/(const TensorN<Cmpt, length>& t1, const DiagTensorN<Cmpt, length>& dt2)
|
operator/
|
||||||
|
(
|
||||||
|
const TensorN<Cmpt, length>& t1,
|
||||||
|
const DiagTensorN<Cmpt, length>& dt2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return t1 & inv(dt2);
|
return t1 & inv(dt2);
|
||||||
}
|
}
|
||||||
|
@ -972,6 +999,7 @@ inline DiagTensorN<Cmpt, length> diag(const TensorN<Cmpt, length>& t)
|
||||||
return t.diag();
|
return t.diag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return tensor diagonal
|
//- Return tensor diagonal
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline TensorN<Cmpt, length> negSumDiag(const TensorN<Cmpt, length>& t)
|
inline TensorN<Cmpt, length> negSumDiag(const TensorN<Cmpt, length>& t)
|
||||||
|
|
|
@ -70,6 +70,8 @@ public:
|
||||||
static const char* const typeName;
|
static const char* const typeName;
|
||||||
static const VectorN zero;
|
static const VectorN zero;
|
||||||
static const VectorN one;
|
static const VectorN one;
|
||||||
|
static const VectorN max;
|
||||||
|
static const VectorN min;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
|
@ -43,6 +43,12 @@ const VectorN<Cmpt, length> VectorN<Cmpt, length>::zero(0);
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
const VectorN<Cmpt, length> VectorN<Cmpt, length>::one(1);
|
const VectorN<Cmpt, length> VectorN<Cmpt, length>::one(1);
|
||||||
|
|
||||||
|
template <class Cmpt, int length>
|
||||||
|
const VectorN<Cmpt, length> VectorN<Cmpt, length>::max(VGREAT);
|
||||||
|
|
||||||
|
template <class Cmpt, int length>
|
||||||
|
const VectorN<Cmpt, length> VectorN<Cmpt, length>::min(-VGREAT);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,9 @@ UNARY_TEMPLATE_FUNCTION(TensorN, VectorN, expandLinear)
|
||||||
UNARY_TEMPLATE_FUNCTION(DiagTensorN, VectorN, expandLinear)
|
UNARY_TEMPLATE_FUNCTION(DiagTensorN, VectorN, expandLinear)
|
||||||
UNARY_TEMPLATE_FUNCTION(SphericalTensorN, VectorN, expandLinear)
|
UNARY_TEMPLATE_FUNCTION(SphericalTensorN, VectorN, expandLinear)
|
||||||
|
|
||||||
|
UNARY_TEMPLATE_FUNCTION(VectorN, TensorN, sumToDiag)
|
||||||
|
UNARY_TEMPLATE_FUNCTION(VectorN, TensorN, sumMagToDiag)
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Return the Average of a vector of as a scalar
|
//- Return the average of a vector of as a scalar
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline void contractScalar(Cmpt& result, const VectorN<Cmpt, length>& t)
|
inline void contractScalar(Cmpt& result, const VectorN<Cmpt, length>& t)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ inline void contractScalar(Cmpt& result, const VectorN<Cmpt, length>& t)
|
||||||
result += t[i];
|
result += t[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Modified 2009/11/3 by I. Clifford
|
// Modified 2009/11/3 by I. Clifford
|
||||||
result *= 1.0/VectorN<Cmpt, length>::nComponents;
|
result *= 1.0/VectorN<Cmpt, length>::nComponents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ inline void contractScalar(Cmpt& result, const TensorN<Cmpt, length>& t)
|
||||||
j += TensorN<Cmpt, length>::rowLength+1;
|
j += TensorN<Cmpt, length>::rowLength+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Modified 2009/11/3 by I. Clifford
|
// Modified 2009/11/3 by I. Clifford
|
||||||
result *= 1.0/TensorN<Cmpt, length>::rowLength;
|
result *= 1.0/TensorN<Cmpt, length>::rowLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,11 @@ inline Cmpt contractScalar(const DiagTensorN<Cmpt, length>& t)
|
||||||
|
|
||||||
//- Return the diagonal of a SphericalTensorN as a scalar
|
//- Return the diagonal of a SphericalTensorN as a scalar
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline void contractScalar(Cmpt& result, const SphericalTensorN<Cmpt, length>& t)
|
inline void contractScalar
|
||||||
|
(
|
||||||
|
Cmpt& result,
|
||||||
|
const SphericalTensorN<Cmpt, length>& t
|
||||||
|
)
|
||||||
{
|
{
|
||||||
result = t[0];
|
result = t[0];
|
||||||
}
|
}
|
||||||
|
@ -134,7 +138,7 @@ inline Cmpt contractScalar(const SphericalTensorN<Cmpt, length>& t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the diagonal of a TensorN as a vector
|
//- Return the diagonal of a TensorN as a vectorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline void contractLinear
|
inline void contractLinear
|
||||||
(
|
(
|
||||||
|
@ -142,16 +146,16 @@ inline void contractLinear
|
||||||
const TensorN<Cmpt, length>& t
|
const TensorN<Cmpt, length>& t
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int j=0;
|
int j = 0;
|
||||||
for (int i = 0; i < TensorN<Cmpt, length>::rowLength; i++)
|
for (int i = 0; i < TensorN<Cmpt, length>::rowLength; i++)
|
||||||
{
|
{
|
||||||
result[i] = t[j];
|
result[i] = t[j];
|
||||||
j += TensorN<Cmpt, length>::rowLength+1;
|
j += TensorN<Cmpt, length>::rowLength + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the diagonal of a TensorN as a vector
|
//- Return the diagonal of a TensorN as a vectorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline VectorN<Cmpt, length> contractLinear(const TensorN<Cmpt, length>& t)
|
inline VectorN<Cmpt, length> contractLinear(const TensorN<Cmpt, length>& t)
|
||||||
{
|
{
|
||||||
|
@ -161,7 +165,7 @@ inline VectorN<Cmpt, length> contractLinear(const TensorN<Cmpt, length>& t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the diagonal of a DiagTensorN as a vector
|
//- Return the diagonal of a DiagTensorN as a vectorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline void contractLinear
|
inline void contractLinear
|
||||||
(
|
(
|
||||||
|
@ -176,7 +180,7 @@ inline void contractLinear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the diagonal of a DiagTensorN as a vector
|
//- Return the diagonal of a DiagTensorN as a vectorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline VectorN<Cmpt, length> contractLinear(const DiagTensorN<Cmpt, length>& t)
|
inline VectorN<Cmpt, length> contractLinear(const DiagTensorN<Cmpt, length>& t)
|
||||||
{
|
{
|
||||||
|
@ -186,7 +190,7 @@ inline VectorN<Cmpt, length> contractLinear(const DiagTensorN<Cmpt, length>& t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the diagonal of a SphericalTensorN as a vector
|
//- Return the diagonal of a SphericalTensorN as a vectorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline void contractLinear
|
inline void contractLinear
|
||||||
(
|
(
|
||||||
|
@ -201,7 +205,7 @@ inline void contractLinear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the diagonal of a SphericalTensorN as a vector
|
//- Return the diagonal of a SphericalTensorN as a vectorN
|
||||||
template <class Cmpt, int length>
|
template <class Cmpt, int length>
|
||||||
inline VectorN<Cmpt, length> contractLinear
|
inline VectorN<Cmpt, length> contractLinear
|
||||||
(
|
(
|
||||||
|
@ -311,6 +315,64 @@ inline void expandLinear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Sum row elements of a TensorN as a vectorN
|
||||||
|
template <class Cmpt, int length>
|
||||||
|
inline void sumToDiag
|
||||||
|
(
|
||||||
|
VectorN<Cmpt, length>& result,
|
||||||
|
const TensorN<Cmpt, length>& t
|
||||||
|
)
|
||||||
|
{
|
||||||
|
result = VectorN<Cmpt, length>::zero;
|
||||||
|
|
||||||
|
for (int i = 0; i < TensorN<Cmpt, length>::rowLength; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < TensorN<Cmpt, length>::rowLength; j++)
|
||||||
|
{
|
||||||
|
result[i] += t(i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Sum row elements of a TensorN as a vectorN
|
||||||
|
template <class Cmpt, int length>
|
||||||
|
inline VectorN<Cmpt, length> sumToDiag(const TensorN<Cmpt, length>& t)
|
||||||
|
{
|
||||||
|
VectorN<Cmpt, length> result;
|
||||||
|
sumToDiag(result, t);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Sum magnitudes of row elements of a TensorN as a vectorN
|
||||||
|
template <class Cmpt, int length>
|
||||||
|
inline void sumMagToDiag
|
||||||
|
(
|
||||||
|
VectorN<Cmpt, length>& result,
|
||||||
|
const TensorN<Cmpt, length>& t
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < TensorN<Cmpt, length>::rowLength; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < TensorN<Cmpt, length>::rowLength; j++)
|
||||||
|
{
|
||||||
|
result[i] += Foam::mag(t(i, j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Sum magnitudes of row elements of a TensorN as a vectorN
|
||||||
|
template <class Cmpt, int length>
|
||||||
|
inline VectorN<Cmpt, length> sumMagToDiag(const TensorN<Cmpt, length>& t)
|
||||||
|
{
|
||||||
|
VectorN<Cmpt, length> result;
|
||||||
|
sumMagToDiag(result, t);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
|
@ -110,6 +110,54 @@ inline void expandLinear(Tensor<Cmpt>& result, const Vector<Cmpt>& v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Sum row elements of a tensor as a vector
|
||||||
|
template <class Cmpt>
|
||||||
|
inline void sumToDiag(Vector<Cmpt>& result, const Tensor<Cmpt>& t)
|
||||||
|
{
|
||||||
|
result = Vector<Cmpt>
|
||||||
|
(
|
||||||
|
t.xx() + t.xy() + t.xz(),
|
||||||
|
t.yx() + t.yy() + t.yz(),
|
||||||
|
t.zx() + t.zy() + t.zz()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Sum row elements of a TensorN as a vectorN
|
||||||
|
template <class Cmpt>
|
||||||
|
inline Vector<Cmpt> sumToDiag(const Tensor<Cmpt>& t)
|
||||||
|
{
|
||||||
|
Vector<Cmpt> result;
|
||||||
|
sumToDiag(result, t);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Sum row elements of a tensor as a vector
|
||||||
|
template <class Cmpt>
|
||||||
|
inline void sumMagToDiag(Vector<Cmpt>& result, const Tensor<Cmpt>& t)
|
||||||
|
{
|
||||||
|
result = Vector<Cmpt>
|
||||||
|
(
|
||||||
|
Foam::mag(t.xx()) + Foam::mag(t.xy()) + Foam::mag(t.xz()),
|
||||||
|
Foam::mag(t.yx()) + Foam::mag(t.yy()) + Foam::mag(t.yz()),
|
||||||
|
Foam::mag(t.zx()) + Foam::mag(t.zy()) + Foam::mag(t.zz())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Sum magnitudes of row elements of a TensorN as a vectorN
|
||||||
|
template <class Cmpt>
|
||||||
|
inline Vector<Cmpt> sumMagToDiag(const Tensor<Cmpt>& t)
|
||||||
|
{
|
||||||
|
Vector<Cmpt> result;
|
||||||
|
sumMagToDiag(result, t);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -50,8 +50,8 @@ namespace Foam
|
||||||
addILUCpPreconditionerAsymMatrixConstructorToTable_;
|
addILUCpPreconditionerAsymMatrixConstructorToTable_;
|
||||||
|
|
||||||
// Add to symmetric constructor table as well. Cholesky with fill in would
|
// 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
|
// yield the same sparseness pattern as the original matrix,
|
||||||
// implemented. VV, 10/Sep/2015.
|
// hence it is not implemented. VV, 10/Sep/2015.
|
||||||
lduPreconditioner::
|
lduPreconditioner::
|
||||||
addsymMatrixConstructorToTable<ILUCp>
|
addsymMatrixConstructorToTable<ILUCp>
|
||||||
addILUCpPreconditionerSymMatrixConstructorToTable_;
|
addILUCpPreconditionerSymMatrixConstructorToTable_;
|
||||||
|
@ -69,8 +69,10 @@ void Foam::ILUCp::calcFactorization()
|
||||||
const extendedLduAddressing& addr = extMatrix_.extendedLduAddr();
|
const extendedLduAddressing& addr = extMatrix_.extendedLduAddr();
|
||||||
|
|
||||||
// Get upper/lower extended addressing
|
// Get upper/lower extended addressing
|
||||||
const label* const __restrict__ uPtr = addr.extendedUpperAddr().begin();
|
const label* const __restrict__ uPtr =
|
||||||
const label* const __restrict__ lPtr = addr.extendedLowerAddr().begin();
|
addr.extendedUpperAddr().begin();
|
||||||
|
const label* const __restrict__ lPtr =
|
||||||
|
addr.extendedLowerAddr().begin();
|
||||||
|
|
||||||
// Get extended owner start addressing
|
// Get extended owner start addressing
|
||||||
const label* const __restrict__ ownStartPtr =
|
const label* const __restrict__ ownStartPtr =
|
||||||
|
@ -94,8 +96,8 @@ void Foam::ILUCp::calcFactorization()
|
||||||
// Get number of rows
|
// Get number of rows
|
||||||
const label nRows = preconDiag_.size();
|
const label nRows = preconDiag_.size();
|
||||||
|
|
||||||
// Define start and end face ("virtual" face when extended addressing is
|
// Define start and end face ("virtual" face when extended addressing
|
||||||
// used) of this row/column.
|
// is used) of this row/column.
|
||||||
register label fStart, fEnd, fLsrStart, fLsrEnd;
|
register label fStart, fEnd, fLsrStart, fLsrEnd;
|
||||||
|
|
||||||
// Crout LU factorization
|
// Crout LU factorization
|
||||||
|
@ -239,17 +241,15 @@ Foam::ILUCp::ILUCp
|
||||||
coupleIntCoeffs,
|
coupleIntCoeffs,
|
||||||
interfaces
|
interfaces
|
||||||
),
|
),
|
||||||
preconDiag_(matrix_.diag()),
|
|
||||||
p_(readLabel(dict.lookup("fillInLevel"))),
|
|
||||||
extMatrix_
|
extMatrix_
|
||||||
(
|
(
|
||||||
matrix,
|
matrix,
|
||||||
p_,
|
matrix.mesh().lduAddr().extendedAddr
|
||||||
matrix.mesh().thisDb().time().lookupObject
|
(
|
||||||
<
|
readLabel(dict.lookup("fillInLevel"))
|
||||||
polyMesh
|
)
|
||||||
>(polyMesh::defaultRegion)
|
|
||||||
),
|
),
|
||||||
|
preconDiag_(matrix_.diag()),
|
||||||
zDiag_(0),
|
zDiag_(0),
|
||||||
z_(preconDiag_.size(), 0),
|
z_(preconDiag_.size(), 0),
|
||||||
w_(preconDiag_.size(), 0)
|
w_(preconDiag_.size(), 0)
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class ILUCp Declaration
|
Class ILUCp Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class ILUCp
|
class ILUCp
|
||||||
|
@ -60,15 +60,12 @@ class ILUCp
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
|
//- Extended ldu matrix
|
||||||
|
extendedLduMatrix extMatrix_;
|
||||||
|
|
||||||
//- Preconditioned diagonal
|
//- Preconditioned diagonal
|
||||||
scalarField preconDiag_;
|
scalarField preconDiag_;
|
||||||
|
|
||||||
//- Fill in level
|
|
||||||
const label p_;
|
|
||||||
|
|
||||||
//- Extended lduMatrix
|
|
||||||
extendedLduMatrix extMatrix_;
|
|
||||||
|
|
||||||
//- Temporary working diagonal
|
//- Temporary working diagonal
|
||||||
scalar zDiag_;
|
scalar zDiag_;
|
||||||
|
|
||||||
|
|
Reference in a new issue