diff --git a/src/OpenFOAM/dimensionSet/dimensionSets.C b/src/OpenFOAM/dimensionSet/dimensionSets.C
index 2a76260c57a528a5ba57e13664f795df7cd7cdf4..85ccde69470b1df5279441a7ba7f95eb65a7092f 100644
--- a/src/OpenFOAM/dimensionSet/dimensionSets.C
+++ b/src/OpenFOAM/dimensionSet/dimensionSets.C
@@ -234,17 +234,17 @@ Foam::dimensionSets::dimensionSets
         valid_ = true;
 
         // Determine conversion from basic units to write units
-        for (label rowI = 0; rowI < conversion_.n(); rowI++)
+        for (label rowI = 0; rowI < conversion_.m(); rowI++)
         {
             scalar* row = conversion_[rowI];
 
-            for (label columnI = 0; columnI < conversion_.m(); columnI++)
+            for (label columnI = 0; columnI < conversion_.n(); columnI++)
             {
                 const dimensionedScalar& dSet = units_[columnI];
                 row[columnI] = dSet.dimensions()[rowI];
             }
         }
-        conversionPivots_.setSize(conversion_.n());
+        conversionPivots_.setSize(conversion_.m());
         LUDecompose(conversion_, conversionPivots_);
     }
 }
diff --git a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C
index d6bc7f7b71a29f939ba50dbdc382368f91e590e3..69844cd403eb4c690cec018270b88208cdd6d24c 100644
--- a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C
+++ b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -38,7 +38,7 @@ template<class Type>
 template<class Form>
 Foam::DiagonalMatrix<Type>::DiagonalMatrix(const Matrix<Form, Type>& a)
 :
-    List<Type>(min(a.n(), a.m()))
+    List<Type>(min(a.m(), a.n()))
 {
     forAll(*this, i)
     {
diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C
index b5e37d441baadb8879f4c3d97d9d42451709a95f..dc682092022c3935d870d937c09e1e261369b0c4 100644
--- a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C
+++ b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -43,7 +43,7 @@ Foam::LUscalarMatrix::LUscalarMatrix(const scalarSquareMatrix& matrix)
 :
     scalarSquareMatrix(matrix),
     comm_(Pstream::worldComm),
-    pivotIndices_(n())
+    pivotIndices_(m())
 {
     LUDecompose(*this, pivotIndices_);
 }
@@ -144,8 +144,8 @@ Foam::LUscalarMatrix::LUscalarMatrix
 
     if (Pstream::master(comm_))
     {
-        label nRows = n();
-        label nColumns = m();
+        label nRows = m();
+        label nColumns = n();
 
         if (debug)
         {
@@ -180,7 +180,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
             Pout<< endl;
         }
 
-        pivotIndices_.setSize(n());
+        pivotIndices_.setSize(m());
         LUDecompose(*this, pivotIndices_);
     }
 }
@@ -387,10 +387,10 @@ void Foam::LUscalarMatrix::convert
 
 void Foam::LUscalarMatrix::printDiagonalDominance() const
 {
-    for (label i=0; i<n(); i++)
+    for (label i=0; i<m(); i++)
     {
         scalar sum = 0.0;
-        for (label j=0; j<n(); j++)
+        for (label j=0; j<m(); j++)
         {
             if (i != j)
             {
diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrixTemplates.C b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrixTemplates.C
index 8948d37675089671a2343cddd6f0074ad5308888..4d327faeee5110e139ef819ab97ab706f821e659 100644
--- a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrixTemplates.C
+++ b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrixTemplates.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-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,7 +32,7 @@ void Foam::LUscalarMatrix::solve(Field<Type>& sourceSol) const
 {
     if (Pstream::parRun())
     {
-        Field<Type> completeSourceSol(n());
+        Field<Type> completeSourceSol(m());
 
         if (Pstream::master(comm_))
         {
diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.C b/src/OpenFOAM/matrices/Matrix/Matrix.C
index d06cef41e62deba87cbd465dfd52c27174ba2054..39761e49da08dfcae691db7f42e4c848ae85d471 100644
--- a/src/OpenFOAM/matrices/Matrix/Matrix.C
+++ b/src/OpenFOAM/matrices/Matrix/Matrix.C
@@ -96,9 +96,9 @@ Foam::Matrix<Form, Type>::Matrix(const label n, const label m, const Type& a)
     {
         Type* v = v_[0];
 
-        label nm = nRows_*nCols_;
+        label mn = nRows_*nCols_;
 
-        for (label i=0; i<nm; i++)
+        for (label i=0; i<mn; i++)
         {
             v[i] = a;
         }
@@ -119,8 +119,8 @@ Foam::Matrix<Form, Type>::Matrix(const Matrix<Form, Type>& a)
         Type* v = v_[0];
         const Type* av = a.v_[0];
 
-        label nm = nRows_*nCols_;
-        for (label i=0; i<nm; i++)
+        label mn = nRows_*nCols_;
+        for (label i=0; i<mn; i++)
         {
             v[i] = av[i];
         }
@@ -162,11 +162,11 @@ template<class Form, class Type>
 Form Foam::Matrix<Form, Type>::T() const
 {
     const Matrix<Form, Type>& A = *this;
-    Form At(m(), n());
+    Form At(n(), m());
 
-    for (label i=0; i<n(); i++)
+    for (label i=0; i<m(); i++)
     {
-        for (label j=0; j<m(); j++)
+        for (label j=0; j<n(); j++)
         {
             At[j][i] = A[i][j];
         }
@@ -185,8 +185,8 @@ void Foam::Matrix<Form, Type>::operator=(const Type& t)
     {
         Type* v = v_[0];
 
-        label nm = nRows_*nCols_;
-        for (label i=0; i<nm; i++)
+        label mn = nRows_*nCols_;
+        for (label i=0; i<mn; i++)
         {
             v[i] = t;
         }
@@ -200,7 +200,7 @@ void Foam::Matrix<Form, Type>::operator=(const Matrix<Form, Type>& a)
     if (this == &a)
     {
         FatalErrorInFunction
-            << "attempted assignment to self"
+            << "attempted assigmnent to self"
             << abort(FatalError);
     }
 
@@ -217,8 +217,8 @@ void Foam::Matrix<Form, Type>::operator=(const Matrix<Form, Type>& a)
         Type* v = v_[0];
         const Type* av = a.v_[0];
 
-        label nm = nRows_*nCols_;
-        for (label i=0; i<nm; i++)
+        label mn = nRows_*nCols_;
+        for (label i=0; i<mn; i++)
         {
             v[i] = av[i];
         }
@@ -231,14 +231,14 @@ void Foam::Matrix<Form, Type>::operator=(const Matrix<Form, Type>& a)
 template<class Form, class Type>
 const Type& Foam::max(const Matrix<Form, Type>& a)
 {
-    label nm = a.n()*a.m();
+    label mn = a.m()*a.n();
 
-    if (nm)
+    if (mn)
     {
         label curMaxI = 0;
         const Type* v = a[0];
 
-        for (label i=1; i<nm; i++)
+        for (label i=1; i<mn; i++)
         {
             if (v[i] > v[curMaxI])
             {
@@ -263,14 +263,14 @@ const Type& Foam::max(const Matrix<Form, Type>& a)
 template<class Form, class Type>
 const Type& Foam::min(const Matrix<Form, Type>& a)
 {
-    label nm = a.n()*a.m();
+    label mn = a.m()*a.n();
 
-    if (nm)
+    if (mn)
     {
         label curMinI = 0;
         const Type* v = a[0];
 
-        for (label i=1; i<nm; i++)
+        for (label i=1; i<mn; i++)
         {
             if (v[i] < v[curMinI])
             {
@@ -297,15 +297,15 @@ const Type& Foam::min(const Matrix<Form, Type>& a)
 template<class Form, class Type>
 Form Foam::operator-(const Matrix<Form, Type>& a)
 {
-    Form na(a.n(), a.m());
+    Form na(a.m(), a.n());
 
-    if (a.n() && a.m())
+    if (a.m() && a.n())
     {
         Type* nav = na[0];
         const Type* av = a[0];
 
-        label nm = a.n()*a.m();
-        for (label i=0; i<nm; i++)
+        label mn = a.m()*a.n();
+        for (label i=0; i<mn; i++)
         {
             nav[i] = -av[i];
         }
@@ -318,30 +318,30 @@ Form Foam::operator-(const Matrix<Form, Type>& a)
 template<class Form, class Type>
 Form Foam::operator+(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
 {
-    if (a.n() != b.n())
+    if (a.m() != b.m())
     {
         FatalErrorInFunction
             << "attempted add matrices with different number of rows: "
-            << a.n() << ", " << b.n()
+            << a.m() << ", " << b.m()
             << abort(FatalError);
     }
 
-    if (a.m() != b.m())
+    if (a.n() != b.n())
     {
         FatalErrorInFunction
             << "attempted add matrices with different number of columns: "
-            << a.m() << ", " << b.m()
+            << a.n() << ", " << b.n()
             << abort(FatalError);
     }
 
-    Form ab(a.n(), a.m());
+    Form ab(a.m(), a.n());
 
     Type* abv = ab[0];
     const Type* av = a[0];
     const Type* bv = b[0];
 
-    label nm = a.n()*a.m();
-    for (label i=0; i<nm; i++)
+    label mn = a.m()*a.n();
+    for (label i=0; i<mn; i++)
     {
         abv[i] = av[i] + bv[i];
     }
@@ -353,30 +353,30 @@ Form Foam::operator+(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
 template<class Form, class Type>
 Form Foam::operator-(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
 {
-    if (a.n() != b.n())
+    if (a.m() != b.m())
     {
         FatalErrorInFunction
             << "attempted add matrices with different number of rows: "
-            << a.n() << ", " << b.n()
+            << a.m() << ", " << b.m()
             << abort(FatalError);
     }
 
-    if (a.m() != b.m())
+    if (a.n() != b.n())
     {
         FatalErrorInFunction
             << "attempted add matrices with different number of columns: "
-            << a.m() << ", " << b.m()
+            << a.n() << ", " << b.n()
             << abort(FatalError);
     }
 
-    Form ab(a.n(), a.m());
+    Form ab(a.m(), a.n());
 
     Type* abv = ab[0];
     const Type* av = a[0];
     const Type* bv = b[0];
 
-    label nm = a.n()*a.m();
-    for (label i=0; i<nm; i++)
+    label mn = a.m()*a.n();
+    for (label i=0; i<mn; i++)
     {
         abv[i] = av[i] - bv[i];
     }
@@ -388,15 +388,15 @@ Form Foam::operator-(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
 template<class Form, class Type>
 Form Foam::operator*(const scalar s, const Matrix<Form, Type>& a)
 {
-    Form sa(a.n(), a.m());
+    Form sa(a.m(), a.n());
 
-    if (a.n() && a.m())
+    if (a.m() && a.n())
     {
         Type* sav = sa[0];
         const Type* av = a[0];
 
-        label nm = a.n()*a.m();
-        for (label i=0; i<nm; i++)
+        label mn = a.m()*a.n();
+        for (label i=0; i<mn; i++)
         {
             sav[i] = s*av[i];
         }
@@ -409,24 +409,24 @@ Form Foam::operator*(const scalar s, const Matrix<Form, Type>& a)
 template<class Form, class Type>
 Form Foam::operator*(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
 {
-    if (a.m() != b.n())
+    if (a.n() != b.m())
     {
         FatalErrorInFunction
             << "attempted to multiply incompatible matrices:" << nl
-            << "Matrix A : " << a.n() << " rows, " << a.m() << " columns" << nl
-            << "Matrix B : " << b.n() << " rows, " << b.m() << " columns" << nl
+            << "Matrix A : " << a.m() << " rows, " << a.n() << " columns" << nl
+            << "Matrix B : " << b.m() << " rows, " << b.n() << " columns" << nl
             << "In order to multiply matrices, columns of A must equal "
             << "rows of B"
             << abort(FatalError);
     }
 
-    Form ab(a.n(), b.m(), scalar(0));
+    Form ab(a.m(), b.n(), scalar(0));
 
-    for (label i = 0; i < ab.n(); i++)
+    for (label i = 0; i < ab.m(); i++)
     {
-        for (label j = 0; j < ab.m(); j++)
+        for (label j = 0; j < ab.n(); j++)
         {
-            for (label l = 0; l < b.n(); l++)
+            for (label l = 0; l < b.m(); l++)
             {
                 ab[i][j] += a[i][l]*b[l][j];
             }
diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.H b/src/OpenFOAM/matrices/Matrix/Matrix.H
index 87652bdd6b040ba74ab080bccbadc585bf619fce..49bf41fc6fc0e6af714c0a7e44b62211bbfa0e4f 100644
--- a/src/OpenFOAM/matrices/Matrix/Matrix.H
+++ b/src/OpenFOAM/matrices/Matrix/Matrix.H
@@ -125,10 +125,10 @@ public:
         // Access
 
             //- Return the number of rows
-            inline label n() const;
+            inline label m() const;
 
             //- Return the number of columns
-            inline label m() const;
+            inline label n() const;
 
             //- Return the number of elements in matrix (n*m)
             inline label size() const;
diff --git a/src/OpenFOAM/matrices/Matrix/MatrixI.H b/src/OpenFOAM/matrices/Matrix/MatrixI.H
index 5286b98f421fec78a8e97efd1783e447e73a2765..fbfd44628192341c771b0aaf726111710b1fc57e 100644
--- a/src/OpenFOAM/matrices/Matrix/MatrixI.H
+++ b/src/OpenFOAM/matrices/Matrix/MatrixI.H
@@ -53,14 +53,14 @@ inline const Foam::Matrix<Form, Type>& Foam::Matrix<Form, Type>::null()
 
 //- Return the number of rows
 template<class Form, class Type>
-inline Foam::label Foam::Matrix<Form, Type>::n() const
+inline Foam::label Foam::Matrix<Form, Type>::m() const
 {
     return nRows_;
 }
 
 
 template<class Form, class Type>
-inline Foam::label Foam::Matrix<Form, Type>::m() const
+inline Foam::label Foam::Matrix<Form, Type>::n() const
 {
     return nCols_;
 }
diff --git a/src/OpenFOAM/matrices/Matrix/MatrixIO.C b/src/OpenFOAM/matrices/Matrix/MatrixIO.C
index 60df6849371131352a8a668b5485c5cf246464bd..edf2c54b22dddf1339d2011d94a755004ae2edcb 100644
--- a/src/OpenFOAM/matrices/Matrix/MatrixIO.C
+++ b/src/OpenFOAM/matrices/Matrix/MatrixIO.C
@@ -62,7 +62,7 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix<Form, Type>& M)
         M.nRows_ = firstToken.labelToken();
         M.nCols_ = readLabel(is);
 
-        label nm = M.nRows_*M.nCols_;
+        label mn = M.nRows_*M.nCols_;
 
         // Read list contents depending on data format
         if (is.format() == IOstream::ASCII || !contiguous<Type>())
@@ -70,7 +70,7 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix<Form, Type>& M)
             // Read beginning of contents
             char listDelimiter = is.readBeginList("Matrix");
 
-            if (nm)
+            if (mn)
             {
                 M.allocate();
                 Type* v = M.v_[0];
@@ -80,11 +80,11 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix<Form, Type>& M)
                     label k = 0;
 
                     // loop over rows
-                    for (label i=0; i<M.n(); i++)
+                    for (label i=0; i<M.m(); i++)
                     {
                         listDelimiter = is.readBeginList("MatrixRow");
 
-                        for (label j=0; j<M.m(); j++)
+                        for (label j=0; j<M.n(); j++)
                         {
                             is >> v[k++];
 
@@ -109,7 +109,7 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix<Form, Type>& M)
                         "reading the single entry"
                     );
 
-                    for (label i=0; i<nm; i++)
+                    for (label i=0; i<mn; i++)
                     {
                         v[i] = element;
                     }
@@ -121,12 +121,12 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix<Form, Type>& M)
         }
         else
         {
-            if (nm)
+            if (mn)
             {
                 M.allocate();
                 Type* v = M.v_[0];
 
-                is.read(reinterpret_cast<char*>(v), nm*sizeof(Type));
+                is.read(reinterpret_cast<char*>(v), mn*sizeof(Type));
 
                 is.fatalCheck
                 (
@@ -151,24 +151,24 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix<Form, Type>& M)
 template<class Form, class Type>
 Foam::Ostream& Foam::operator<<(Ostream& os, const Matrix<Form, Type>& M)
 {
-    label nm = M.nRows_*M.nCols_;
+    label mn = M.nRows_*M.nCols_;
 
-    os  << M.n() << token::SPACE << M.m();
+    os  << M.m() << token::SPACE << M.n();
 
     // Write list contents depending on data format
     if (os.format() == IOstream::ASCII || !contiguous<Type>())
     {
-        if (nm)
+        if (mn)
         {
             bool uniform = false;
 
             const Type* v = M.v_[0];
 
-            if (nm > 1 && contiguous<Type>())
+            if (mn > 1 && contiguous<Type>())
             {
                 uniform = true;
 
-                for (label i=0; i< nm; i++)
+                for (label i=0; i< mn; i++)
                 {
                     if (v[i] != v[0])
                     {
@@ -189,7 +189,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Matrix<Form, Type>& M)
                 // Write end of contents delimiter
                 os << token::END_BLOCK;
             }
-            else if (nm < 10 && contiguous<Type>())
+            else if (mn < 10 && contiguous<Type>())
             {
                 // Write size of list and start contents delimiter
                 os  << token::BEGIN_LIST;
@@ -197,12 +197,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Matrix<Form, Type>& M)
                 label k = 0;
 
                 // loop over rows
-                for (label i=0; i< M.n(); i++)
+                for (label i=0; i< M.m(); i++)
                 {
                     os  << token::BEGIN_LIST;
 
                     // Write row
-                    for (label j=0; j< M.m(); j++)
+                    for (label j=0; j< M.n(); j++)
                     {
                         if (j > 0) os << token::SPACE;
                         os << v[k++];
@@ -222,12 +222,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Matrix<Form, Type>& M)
                 label k = 0;
 
                 // loop over rows
-                for (label i=0; i< M.n(); i++)
+                for (label i=0; i< M.m(); i++)
                 {
                     os  << nl << token::BEGIN_LIST;
 
                     // Write row
-                    for (label j=0; j< M.m(); j++)
+                    for (label j=0; j< M.n(); j++)
                     {
                         os << nl << v[k++];
                     }
@@ -246,9 +246,9 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Matrix<Form, Type>& M)
     }
     else
     {
-        if (nm)
+        if (mn)
         {
-            os.write(reinterpret_cast<const char*>(M.v_[0]), nm*sizeof(Type));
+            os.write(reinterpret_cast<const char*>(M.v_[0]), mn*sizeof(Type));
         }
     }
 
diff --git a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.C b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.C
index 439257fcb6a9f9b5ee28416558c058303c541c11..e8e7dd0e8c2f8a953f9e827782007be09e886a1f 100644
--- a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.C
+++ b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2013-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -37,7 +37,7 @@ Foam::scalar Foam::detDecomposed
 {
     scalar diagProduct = 1.0;
 
-    for (label i = 0; i < matrix.n(); ++i)
+    for (label i = 0; i < matrix.m(); ++i)
     {
         diagProduct *= matrix[i][i];
     }
@@ -51,7 +51,7 @@ Foam::scalar Foam::det(const SquareMatrix<Type>& matrix)
 {
     SquareMatrix<Type> matrixTmp = matrix;
 
-    labelList pivotIndices(matrix.n());
+    labelList pivotIndices(matrix.m());
     label sign;
     LUDecompose(matrixTmp, pivotIndices, sign);
 
@@ -62,7 +62,7 @@ Foam::scalar Foam::det(const SquareMatrix<Type>& matrix)
 template<class Type>
 Foam::scalar Foam::det(SquareMatrix<Type>& matrix)
 {
-    labelList pivotIndices(matrix.n());
+    labelList pivotIndices(matrix.m());
     label sign;
     LUDecompose(matrix, pivotIndices, sign);
 
diff --git a/src/OpenFOAM/matrices/SymmetricSquareMatrix/SymmetricSquareMatrix.C b/src/OpenFOAM/matrices/SymmetricSquareMatrix/SymmetricSquareMatrix.C
index bb6bea65c7a3a0cb0712752dca88ca0201b99af1..1ab99b1240be98f54adbfe566d51185c4fdcb209 100644
--- a/src/OpenFOAM/matrices/SymmetricSquareMatrix/SymmetricSquareMatrix.C
+++ b/src/OpenFOAM/matrices/SymmetricSquareMatrix/SymmetricSquareMatrix.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-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -33,9 +33,9 @@ Foam::SymmetricSquareMatrix<Type> Foam::invDecomposed
     const SymmetricSquareMatrix<Type>& matrix
 )
 {
-    SymmetricSquareMatrix<Type> inv(matrix.n(), matrix.n(), 0.0);
+    SymmetricSquareMatrix<Type> inv(matrix.m(), matrix.m(), 0.0);
 
-    for (label i = 0; i < matrix.n(); ++i)
+    for (label i = 0; i < matrix.m(); ++i)
     {
         inv[i][i] = 1.0/matrix[i][i];
 
@@ -75,7 +75,7 @@ Foam::scalar Foam::detDecomposed(const SymmetricSquareMatrix<Type>& matrix)
 {
     scalar diagProduct = 1.0;
 
-    for (label i = 0; i < matrix.n(); ++i)
+    for (label i = 0; i < matrix.m(); ++i)
     {
         diagProduct *= matrix[i][i];
     }
diff --git a/src/OpenFOAM/matrices/scalarMatrices/SVD/SVD.C b/src/OpenFOAM/matrices/scalarMatrices/SVD/SVD.C
index 3b3092f3a65c67478d25b7a62eb97396bd3c3572..bbe1e214839f89aef8dc0ed420462689e9c7391f 100644
--- a/src/OpenFOAM/matrices/scalarMatrices/SVD/SVD.C
+++ b/src/OpenFOAM/matrices/scalarMatrices/SVD/SVD.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -33,39 +33,39 @@ License
 Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
 :
     U_(A),
-    V_(A.m(), A.m()),
-    S_(A.m()),
-    VSinvUt_(A.m(), A.n()),
+    V_(A.n(), A.n()),
+    S_(A.n()),
+    VSinvUt_(A.n(), A.m()),
     nZeros_(0)
 {
     // SVDcomp to find U_, V_ and S_ - the singular values
 
-    const label Um = U_.m();
     const label Un = U_.n();
+    const label Um = U_.m();
 
-    scalarList rv1(Um);
+    scalarList rv1(Un);
     scalar g = 0;
     scalar scale = 0;
     scalar s = 0;
     scalar anorm = 0;
     label l = 0;
 
-    for (label i = 0; i < Um; i++)
+    for (label i = 0; i < Un; i++)
     {
         l = i+2;
         rv1[i] = scale*g;
         g = s = scale = 0;
 
-        if (i < Un)
+        if (i < Um)
         {
-            for (label k = i; k < Un; k++)
+            for (label k = i; k < Um; k++)
             {
                 scale += mag(U_[k][i]);
             }
 
             if (scale != 0)
             {
-                for (label k = i; k < Un; k++)
+                for (label k = i; k < Um; k++)
                 {
                     U_[k][i] /= scale;
                     s += U_[k][i]*U_[k][i];
@@ -76,22 +76,22 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
                 scalar h = f*g - s;
                 U_[i][i] = f - g;
 
-                for (label j = l-1; j < Um; j++)
+                for (label j = l-1; j < Un; j++)
                 {
                     s = 0;
-                    for (label k = i; k < Un; k++)
+                    for (label k = i; k < Um; k++)
                     {
                         s += U_[k][i]*U_[k][j];
                     }
 
                     f = s/h;
-                    for (label k = i; k < A.n(); k++)
+                    for (label k = i; k < A.m(); k++)
                     {
                         U_[k][j] += f*U_[k][i];
                     }
                 }
 
-                for (label k = i; k < Un; k++)
+                for (label k = i; k < Um; k++)
                 {
                     U_[k][i] *= scale;
                 }
@@ -102,16 +102,16 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
 
         g = s = scale = 0;
 
-        if (i+1 <= Un && i != Um)
+        if (i+1 <= Um && i != Un)
         {
-            for (label k = l-1; k < Um; k++)
+            for (label k = l-1; k < Un; k++)
             {
                 scale += mag(U_[i][k]);
             }
 
             if (scale != 0)
             {
-                for (label k=l-1; k < Um; k++)
+                for (label k=l-1; k < Un; k++)
                 {
                     U_[i][k] /= scale;
                     s += U_[i][k]*U_[i][k];
@@ -122,25 +122,25 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
                 scalar h = f*g - s;
                 U_[i][l-1] = f - g;
 
-                for (label k = l-1; k < Um; k++)
+                for (label k = l-1; k < Un; k++)
                 {
                     rv1[k] = U_[i][k]/h;
                 }
 
-                for (label j = l-1; j < Un; j++)
+                for (label j = l-1; j < Um; j++)
                 {
                     s = 0;
-                    for (label k = l-1; k < Um; k++)
+                    for (label k = l-1; k < Un; k++)
                     {
                         s += U_[j][k]*U_[i][k];
                     }
 
-                    for (label k = l-1; k < Um; k++)
+                    for (label k = l-1; k < Un; k++)
                     {
                         U_[j][k] += s*rv1[k];
                     }
                 }
-                for (label k = l-1; k < Um; k++)
+                for (label k = l-1; k < Un; k++)
                 {
                     U_[i][k] *= scale;
                 }
@@ -150,33 +150,33 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
         anorm = max(anorm, mag(S_[i]) + mag(rv1[i]));
     }
 
-    for (label i = Um-1; i >= 0; i--)
+    for (label i = Un-1; i >= 0; i--)
     {
-        if (i < Um-1)
+        if (i < Un-1)
         {
             if (g != 0)
             {
-                for (label j = l; j < Um; j++)
+                for (label j = l; j < Un; j++)
                 {
                     V_[j][i] = (U_[i][j]/U_[i][l])/g;
                 }
 
-                for (label j=l; j < Um; j++)
+                for (label j=l; j < Un; j++)
                 {
                     s = 0;
-                    for (label k = l; k < Um; k++)
+                    for (label k = l; k < Un; k++)
                     {
                         s += U_[i][k]*V_[k][j];
                     }
 
-                    for (label k = l; k < Um; k++)
+                    for (label k = l; k < Un; k++)
                     {
                         V_[k][j] += s*V_[k][i];
                     }
                 }
             }
 
-            for (label j = l; j < Um;j++)
+            for (label j = l; j < Un;j++)
             {
                 V_[i][j] = V_[j][i] = 0.0;
             }
@@ -187,12 +187,12 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
         l = i;
     }
 
-    for (label i = min(Um, Un) - 1; i >= 0; i--)
+    for (label i = min(Un, Um) - 1; i >= 0; i--)
     {
         l = i+1;
         g = S_[i];
 
-        for (label j = l; j < Um; j++)
+        for (label j = l; j < Un; j++)
         {
             U_[i][j] = 0.0;
         }
@@ -201,30 +201,30 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
         {
             g = 1.0/g;
 
-            for (label j = l; j < Um; j++)
+            for (label j = l; j < Un; j++)
             {
                 s = 0;
-                for (label k = l; k < Un; k++)
+                for (label k = l; k < Um; k++)
                 {
                     s += U_[k][i]*U_[k][j];
                 }
 
                 scalar f = (s/U_[i][i])*g;
 
-                for (label k = i; k < Un; k++)
+                for (label k = i; k < Um; k++)
                 {
                     U_[k][j] += f*U_[k][i];
                 }
             }
 
-            for (label j = i; j < Un; j++)
+            for (label j = i; j < Um; j++)
             {
                 U_[j][i] *= g;
             }
         }
         else
         {
-            for (label j = i; j < Un; j++)
+            for (label j = i; j < Um; j++)
             {
                 U_[j][i] = 0.0;
             }
@@ -233,22 +233,22 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
         ++U_[i][i];
     }
 
-    for (label k = Um-1; k >= 0; k--)
+    for (label k = Un-1; k >= 0; k--)
     {
         for (label its = 0; its < 35; its++)
         {
             bool flag = true;
 
-            label nm;
+            label mn;
             for (l = k; l >= 0; l--)
             {
-                nm = l-1;
+                mn = l-1;
                 if (mag(rv1[l]) + anorm == anorm)
                 {
                     flag = false;
                     break;
                 }
-                if (mag(S_[nm]) + anorm == anorm) break;
+                if (mag(S_[mn]) + anorm == anorm) break;
             }
 
             if (flag)
@@ -269,11 +269,11 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
                     c = g*h;
                     s = -f*h;
 
-                    for (label j = 0; j < Un; j++)
+                    for (label j = 0; j < Um; j++)
                     {
-                        scalar y = U_[j][nm];
+                        scalar y = U_[j][mn];
                         scalar z = U_[j][i];
-                        U_[j][nm] = y*c + z*s;
+                        U_[j][mn] = y*c + z*s;
                         U_[j][i] = z*c - y*s;
                     }
                 }
@@ -287,21 +287,21 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
                 {
                     S_[k] = -z;
 
-                    for (label j = 0; j < Um; j++) V_[j][k] = -V_[j][k];
+                    for (label j = 0; j < Un; j++) V_[j][k] = -V_[j][k];
                 }
                 break;
             }
             if (its == 34)
             {
                 WarningInFunction
-                    << "no convergence in 35 SVD iterations"
+                    << "No convergence in 35 SVD iterations"
                     << endl;
             }
 
             scalar x = S_[l];
-            nm = k-1;
-            scalar y = S_[nm];
-            g = rv1[nm];
+            mn = k-1;
+            scalar y = S_[mn];
+            g = rv1[mn];
             scalar h = rv1[k];
             scalar f = ((y - z)*(y + z) + (g - h)*(g + h))/(2.0*h*y);
             g = sqrtSumSqr(f, scalar(1));
@@ -309,7 +309,7 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
             scalar c = 1.0;
             s = 1.0;
 
-            for (label j = l; j <= nm; j++)
+            for (label j = l; j <= mn; j++)
             {
                 label i = j + 1;
                 g = rv1[i];
@@ -325,7 +325,7 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
                 h = y*s;
                 y *= c;
 
-                for (label jj = 0; jj < Um; jj++)
+                for (label jj = 0; jj < Un; jj++)
                 {
                     x = V_[jj][j];
                     z = V_[jj][i];
@@ -344,7 +344,7 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
                 f = c*g + s*y;
                 x = c*y - s*g;
 
-                for (label jj=0; jj < Un; jj++)
+                for (label jj=0; jj < Um; jj++)
                 {
                     y = U_[jj][j];
                     z = U_[jj][i];
@@ -358,7 +358,7 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
         }
     }
 
-    // zero singular values that are less than minCondition*maxS
+    // Zero singular values that are less than minCondition*maxS
     const scalar minS = minCondition*S_[findMax(S_)];
     forAll(S_, i)
     {
@@ -370,17 +370,18 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
         }
     }
 
-    // now multiply out to find the pseudo inverse of A, VSinvUt_
+    // Now multiply out to find the pseudo inverse of A, VSinvUt_
     multiply(VSinvUt_, V_, inv(S_), U_.T());
 
     // test SVD
-    /*scalarRectangularMatrix SVDA(A.n(), A.m());
+    /*
+    scalarRectangularMatrix SVDA(A.m(), A.n());
     multiply(SVDA, U_, S_, transpose(V_));
     scalar maxDiff = 0;
     scalar diff = 0;
-    for (label i = 0; i < A.n(); i++)
+    for (label i = 0; i < A.m(); i++)
     {
-        for (label j = 0; j < A.m(); j++)
+        for (label j = 0; j < A.n(); j++)
         {
             diff = mag(A[i][j] - SVDA[i][j]);
             if (diff > maxDiff) maxDiff = diff;
diff --git a/src/OpenFOAM/matrices/scalarMatrices/SVD/SVD.H b/src/OpenFOAM/matrices/scalarMatrices/SVD/SVD.H
index d1e38c9082e5d53a499dd39fc7e084019c864bd5..2f4a9dcb1984acfea2c99115ce183b257ba961c9 100644
--- a/src/OpenFOAM/matrices/scalarMatrices/SVD/SVD.H
+++ b/src/OpenFOAM/matrices/scalarMatrices/SVD/SVD.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -45,7 +45,6 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-
 /*---------------------------------------------------------------------------*\
                       Class SVD Declaration
 \*---------------------------------------------------------------------------*/
diff --git a/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.C b/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.C
index 46f4a3ee1d60bcb33245f703eba4ff111fbf3889..46e972f729e46c94059b137cbe293e467464bc51 100644
--- a/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.C
+++ b/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -46,17 +46,17 @@ void Foam::LUDecompose
     label& sign
 )
 {
-    label n = matrix.n();
-    scalar vv[n];
+    label m = matrix.m();
+    scalar vv[m];
     sign = 1;
 
-    for (label i=0; i<n; i++)
+    for (label i=0; i<m; i++)
     {
         scalar largestCoeff = 0.0;
         scalar temp;
         const scalar* __restrict__ matrixi = matrix[i];
 
-        for (label j=0; j<n; j++)
+        for (label j=0; j<m; j++)
         {
             if ((temp = mag(matrixi[j])) > largestCoeff)
             {
@@ -73,7 +73,7 @@ void Foam::LUDecompose
         vv[i] = 1.0/largestCoeff;
     }
 
-    for (label j=0; j<n; j++)
+    for (label j=0; j<m; j++)
     {
         scalar* __restrict__ matrixj = matrix[j];
 
@@ -92,7 +92,7 @@ void Foam::LUDecompose
         label iMax = 0;
 
         scalar largestCoeff = 0.0;
-        for (label i=j; i<n; i++)
+        for (label i=j; i<m; i++)
         {
             scalar* __restrict__ matrixi = matrix[i];
             scalar sum = matrixi[j];
@@ -118,7 +118,7 @@ void Foam::LUDecompose
         {
             scalar* __restrict__ matrixiMax = matrix[iMax];
 
-            for (label k=0; k<n; k++)
+            for (label k=0; k<m; k++)
             {
                 Swap(matrixj[k], matrixiMax[k]);
             }
@@ -132,11 +132,11 @@ void Foam::LUDecompose
             matrixj[j] = SMALL;
         }
 
-        if (j != n-1)
+        if (j != m-1)
         {
             scalar rDiag = 1.0/matrixj[j];
 
-            for (label i=j+1; i<n; i++)
+            for (label i=j+1; i<m; i++)
             {
                 matrix[i][j] *= rDiag;
             }
@@ -148,7 +148,7 @@ void Foam::LUDecompose
 void Foam::LUDecompose(scalarSymmetricSquareMatrix& matrix)
 {
     // Store result in upper triangular part of matrix
-    label size = matrix.n();
+    label size = matrix.m();
 
     // Set upper triangular parts to zero.
     for (label j = 0; j < size; j++)
@@ -205,32 +205,32 @@ void Foam::multiply
     const scalarRectangularMatrix& C
 )
 {
-    if (A.m() != B.n())
+    if (A.n() != B.m())
     {
         FatalErrorInFunction
-            << "A and B must have identical inner dimensions but A.m = "
-            << A.m() << " and B.n = " << B.n()
+            << "A and B must have identical inner dimensions but A.n = "
+            << A.n() << " and B.m = " << B.m()
             << abort(FatalError);
     }
 
-    if (B.m() != C.n())
+    if (B.n() != C.m())
     {
         FatalErrorInFunction
-            << "B and C must have identical inner dimensions but B.m = "
-            << B.m() << " and C.n = " << C.n()
+            << "B and C must have identical inner dimensions but B.n = "
+            << B.n() << " and C.m = " << C.m()
             << abort(FatalError);
     }
 
-    ans = scalarRectangularMatrix(A.n(), C.m(), scalar(0));
+    ans = scalarRectangularMatrix(A.m(), C.n(), scalar(0));
 
-    for (label i = 0; i < A.n(); i++)
+    for (label i = 0; i < A.m(); i++)
     {
-        for (label g = 0; g < C.m(); g++)
+        for (label g = 0; g < C.n(); g++)
         {
-            for (label l = 0; l < C.n(); l++)
+            for (label l = 0; l < C.m(); l++)
             {
                 scalar ab = 0;
-                for (label j = 0; j < A.m(); j++)
+                for (label j = 0; j < A.n(); j++)
                 {
                     ab += A[i][j]*B[j][l];
                 }
@@ -249,29 +249,29 @@ void Foam::multiply
     const scalarRectangularMatrix& C
 )
 {
-    if (A.m() != B.size())
+    if (A.n() != B.size())
     {
         FatalErrorInFunction
-            << "A and B must have identical inner dimensions but A.m = "
-            << A.m() << " and B.n = " << B.size()
+            << "A and B must have identical inner dimensions but A.n = "
+            << A.n() << " and B.m = " << B.size()
             << abort(FatalError);
     }
 
-    if (B.size() != C.n())
+    if (B.size() != C.m())
     {
         FatalErrorInFunction
-            << "B and C must have identical inner dimensions but B.m = "
-            << B.size() << " and C.n = " << C.n()
+            << "B and C must have identical inner dimensions but B.n = "
+            << B.size() << " and C.m = " << C.m()
             << abort(FatalError);
     }
 
-    ans = scalarRectangularMatrix(A.n(), C.m(), scalar(0));
+    ans = scalarRectangularMatrix(A.m(), C.n(), scalar(0));
 
-    for (label i = 0; i < A.n(); i++)
+    for (label i = 0; i < A.m(); i++)
     {
-        for (label g = 0; g < C.m(); g++)
+        for (label g = 0; g < C.n(); g++)
         {
-            for (label l = 0; l < C.n(); l++)
+            for (label l = 0; l < C.m(); l++)
             {
                 ans[i][g] += C[l][g] * A[i][l]*B[l];
             }
diff --git a/src/OpenFOAM/matrices/scalarMatrices/scalarMatricesTemplates.C b/src/OpenFOAM/matrices/scalarMatrices/scalarMatricesTemplates.C
index 5f70c83b91e08801d00b896ada858daff408df1d..59ca2d34e5c71416935eee26efd9b99bc8366579 100644
--- a/src/OpenFOAM/matrices/scalarMatrices/scalarMatricesTemplates.C
+++ b/src/OpenFOAM/matrices/scalarMatrices/scalarMatricesTemplates.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -36,16 +36,16 @@ void Foam::solve
     List<Type>& sourceSol
 )
 {
-    label n = tmpMatrix.n();
+    label m = tmpMatrix.m();
 
     // Elimination
-    for (label i=0; i<n; i++)
+    for (label i=0; i<m; i++)
     {
         label iMax = i;
         scalar largestCoeff = mag(tmpMatrix[iMax][i]);
 
         // Swap entries around to find a good pivot
-        for (label j=i+1; j<n; j++)
+        for (label j=i+1; j<m; j++)
         {
             if (mag(tmpMatrix[j][i]) > largestCoeff)
             {
@@ -58,7 +58,7 @@ void Foam::solve
         {
             //Info<< "Pivoted on " << i << " " << iMax << endl;
 
-            for (label k=i; k<n; k++)
+            for (label k=i; k<m; k++)
             {
                 Swap(tmpMatrix[i][k], tmpMatrix[iMax][k]);
             }
@@ -74,11 +74,11 @@ void Foam::solve
         }
 
         // Reduce to upper triangular form
-        for (label j=i+1; j<n; j++)
+        for (label j=i+1; j<m; j++)
         {
             sourceSol[j] -= sourceSol[i]*(tmpMatrix[j][i]/tmpMatrix[i][i]);
 
-            for (label k=n-1; k>=i; k--)
+            for (label k=m-1; k>=i; k--)
             {
                 tmpMatrix[j][k] -=
                     tmpMatrix[i][k]*tmpMatrix[j][i]/tmpMatrix[i][i];
@@ -87,11 +87,11 @@ void Foam::solve
     }
 
     // Back-substitution
-    for (label j=n-1; j>=0; j--)
+    for (label j=m-1; j>=0; j--)
     {
         Type ntempvec = pTraits<Type>::zero;
 
-        for (label k=j+1; k<n; k++)
+        for (label k=j+1; k<m; k++)
         {
             ntempvec += tmpMatrix[j][k]*sourceSol[k];
         }
@@ -123,11 +123,11 @@ void Foam::LUBacksubstitute
     List<Type>& sourceSol
 )
 {
-    label n = luMatrix.n();
+    label m = luMatrix.m();
 
     label ii = 0;
 
-    for (label i=0; i<n; i++)
+    for (label i=0; i<m; i++)
     {
         label ip = pivotIndices[i];
         Type sum = sourceSol[ip];
@@ -149,12 +149,12 @@ void Foam::LUBacksubstitute
         sourceSol[i] = sum;
     }
 
-    for (label i=n-1; i>=0; i--)
+    for (label i=m-1; i>=0; i--)
     {
         Type sum = sourceSol[i];
         const scalar* __restrict__ luMatrixi = luMatrix[i];
 
-        for (label j=i+1; j<n; j++)
+        for (label j=i+1; j<m; j++)
         {
             sum -= luMatrixi[j]*sourceSol[j];
         }
@@ -171,11 +171,11 @@ void Foam::LUBacksubstitute
     List<Type>& sourceSol
 )
 {
-    label n = luMatrix.n();
+    label m = luMatrix.m();
 
     label ii = 0;
 
-    for (label i=0; i<n; i++)
+    for (label i=0; i<m; i++)
     {
         Type sum = sourceSol[i];
         const scalar* __restrict__ luMatrixi = luMatrix[i];
@@ -195,12 +195,12 @@ void Foam::LUBacksubstitute
         sourceSol[i] = sum/luMatrixi[i];
     }
 
-    for (label i=n-1; i>=0; i--)
+    for (label i=m-1; i>=0; i--)
     {
         Type sum = sourceSol[i];
         const scalar* __restrict__ luMatrixi = luMatrix[i];
 
-        for (label j=i+1; j<n; j++)
+        for (label j=i+1; j<m; j++)
         {
             sum -= luMatrixi[j]*sourceSol[j];
         }
@@ -217,7 +217,7 @@ void Foam::LUsolve
     List<Type>& sourceSol
 )
 {
-    labelList pivotIndices(matrix.n());
+    labelList pivotIndices(matrix.m());
     LUDecompose(matrix, pivotIndices);
     LUBacksubstitute(matrix, pivotIndices, sourceSol);
 }
@@ -243,21 +243,21 @@ void Foam::multiply
     const Matrix<Form, Type>& B
 )
 {
-    if (A.m() != B.n())
+    if (A.n() != B.m())
     {
         FatalErrorInFunction
-            << "A and B must have identical inner dimensions but A.m = "
-            << A.m() << " and B.n = " << B.n()
+            << "A and B must have identical inner dimensions but A.n = "
+            << A.n() << " and B.m = " << B.m()
             << abort(FatalError);
     }
 
-    ans = Matrix<Form, Type>(A.n(), B.m(), scalar(0));
+    ans = Matrix<Form, Type>(A.m(), B.n(), scalar(0));
 
-    for (label i = 0; i < A.n(); i++)
+    for (label i = 0; i < A.m(); i++)
     {
-        for (label j = 0; j < B.m(); j++)
+        for (label j = 0; j < B.n(); j++)
         {
-            for (label l = 0; l < B.n(); l++)
+            for (label l = 0; l < B.m(); l++)
             {
                 ans[i][j] += A[i][l]*B[l][j];
             }
diff --git a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C
index 727db535d5b61cc9ac13e4a981dce9feeb11caf4..960ba0d563a90dd70e171f0725804bf363e3a154 100644
--- a/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C
+++ b/src/OpenFOAM/matrices/simpleMatrix/simpleMatrix.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -106,7 +106,7 @@ void Foam::simpleMatrix<Type>::operator=(const simpleMatrix<Type>& m)
             << abort(FatalError);
     }
 
-    if (n() != m.n())
+    if (m() != m.m())
     {
         FatalErrorInFunction
             << "Different size matrices"
diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C
index 96f5c8745c8f81ad6b72ff5b04726ee05d3df3f5..8820a78e6ccfee84ab2eeaa12861a66876c28f0a 100644
--- a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C
+++ b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradData.C
@@ -120,7 +120,7 @@ void Foam::CentredFitSnGradData<Polynomial>::calcFit
     }
 
     // Additional weighting for constant and linear terms
-    for (label i = 0; i < B.n(); i++)
+    for (label i = 0; i < B.m(); i++)
     {
         B[i][0] *= wts[0];
         B[i][1] *= wts[0];
@@ -172,13 +172,13 @@ void Foam::CentredFitSnGradData<Polynomial>::calcFit
             wts[0] *= 10;
             wts[1] *= 10;
 
-            for (label j = 0; j < B.m(); j++)
+            for (label j = 0; j < B.n(); j++)
             {
                 B[0][j] *= 10;
                 B[1][j] *= 10;
             }
 
-            for (label i = 0; i < B.n(); i++)
+            for (label i = 0; i < B.m(); i++)
             {
                 B[i][0] *= 10;
                 B[i][1] *= 10;
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C
index ba213d0d08e6289378da8bbb21f4b912ee255ee1..bc86903cbcb5f10cc37ae0da34be054dbbdcdec6 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/FitData/FitData.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -194,7 +194,7 @@ void Foam::FitData<FitDataType, ExtendedStencil, Polynomial>::calcFit
     }
 
     // Additional weighting for constant and linear terms
-    for (label i = 0; i < B.n(); i++)
+    for (label i = 0; i < B.m(); i++)
     {
         B[i][0] *= wts[0];
         B[i][1] *= wts[0];
@@ -267,13 +267,13 @@ void Foam::FitData<FitDataType, ExtendedStencil, Polynomial>::calcFit
                 wts[1] *= 10;
             }
 
-            for (label j = 0; j < B.m(); j++)
+            for (label j = 0; j < B.n(); j++)
             {
                 B[0][j] *= 10;
                 B[1][j] *= 10;
             }
 
-            for (label i = 0; i < B.n(); i++)
+            for (label i = 0; i < B.m(); i++)
             {
                 B[i][0] *= 10;
                 B[i][1] *= 10;
diff --git a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C
index 56dd5733706beb7c4ea34e515ae252ac91213a29..71e34ab46db920c9b4b3a13fa18560e336bbd5a0 100644
--- a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C
+++ b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C
@@ -232,7 +232,7 @@ void Foam::radiation::viewFactor::initialise()
                 )
             );
 
-            pivotIndices_.setSize(CLU_().n());
+            pivotIndices_.setSize(CLU_().m());
         }
     }
 }