[lL]duMatrixOperations: Added support for scaling symmetric matrices

Note: non-uniform scaling of a symmetric matrix generates an asymmetric matrix
This commit is contained in:
Henry 2015-01-02 19:33:39 +00:00
parent 5bd23e9560
commit 88effc40de
2 changed files with 14 additions and 20 deletions

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -412,23 +412,20 @@ void Foam::LduMatrix<Type, DType, LUType>::operator*=
*sourcePtr_ *= sf; *sourcePtr_ *= sf;
} }
if (upperPtr_) // Non-uniform scaling causes a symmetric matrix
// to become asymmetric
if (symmetric() || asymmetric())
{ {
Field<LUType>& upper = *upperPtr_; Field<LUType>& upper = this->upper();
Field<LUType>& lower = this->lower();
const unallocLabelList& l = lduAddr().lowerAddr(); const unallocLabelList& l = lduAddr().lowerAddr();
const unallocLabelList& u = lduAddr().upperAddr();
for (register label face=0; face<upper.size(); face++) for (register label face=0; face<upper.size(); face++)
{ {
upper[face] *= sf[l[face]]; upper[face] *= sf[l[face]];
} }
}
if (lowerPtr_)
{
Field<LUType>& lower = *lowerPtr_;
const unallocLabelList& u = lduAddr().upperAddr();
for (register label face=0; face<lower.size(); face++) for (register label face=0; face<lower.size(); face++)
{ {

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -306,23 +306,20 @@ void Foam::lduMatrix::operator*=(const scalarField& sf)
*diagPtr_ *= sf; *diagPtr_ *= sf;
} }
if (upperPtr_) // Non-uniform scaling causes a symmetric matrix
// to become asymmetric
if (symmetric() || asymmetric())
{ {
scalarField& upper = *upperPtr_; scalarField& upper = this->upper();
scalarField& lower = this->lower();
const labelUList& l = lduAddr().lowerAddr(); const labelUList& l = lduAddr().lowerAddr();
const labelUList& u = lduAddr().upperAddr();
for (register label face=0; face<upper.size(); face++) for (register label face=0; face<upper.size(); face++)
{ {
upper[face] *= sf[l[face]]; upper[face] *= sf[l[face]];
} }
}
if (lowerPtr_)
{
scalarField& lower = *lowerPtr_;
const labelUList& u = lduAddr().upperAddr();
for (register label face=0; face<lower.size(); face++) for (register label face=0; face<lower.size(); face++)
{ {