From 56192f21b95b842f1e55b53ff0e73f94f5c22551 Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Fri, 2 Jan 2015 15:38:52 +0000
Subject: [PATCH] lduMatrixOperations: Added support for scaling symmetric
 matrices Note: non-uniform scaling of a symmetric matrix generates an
 asymmetric matrix

---
 .../lduMatrix/lduMatrix/lduMatrixOperations.C   | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C
index 108f60d7e5b..53e6dd26eb0 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C
+++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -306,23 +306,20 @@ void Foam::lduMatrix::operator*=(const scalarField& 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& u = lduAddr().upperAddr();
 
         for (register label face=0; face<upper.size(); 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++)
         {
-- 
GitLab