LduMatrixOperations: 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:20:19 +00:00
parent cd01692afd
commit ee6f3909bd
2 changed files with 8 additions and 11 deletions

View file

@ -101,7 +101,7 @@ int main(int argc, char *argv[])
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rAU = 1.0/UEqn.A(); volScalarField rAU(1.0/UEqn.A());
U = rAU*UEqn.H(); U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf()) phi = (fvc::interpolate(U) & mesh.Sf())

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++)
{ {