diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixOperations.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixOperations.C index a157d7ec6..3477177f0 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixOperations.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixOperations.C @@ -30,6 +30,11 @@ License template void Foam::LduMatrix::sumDiag() { + if (!lowerPtr_ && !upperPtr_) + { + return; + } + const Field& Lower = const_cast(*this).lower(); const Field& Upper = const_cast(*this).upper(); Field& Diag = diag(); @@ -48,6 +53,11 @@ void Foam::LduMatrix::sumDiag() template void Foam::LduMatrix::negSumDiag() { + if (!lowerPtr_ && !upperPtr_) + { + return; + } + const Field& Lower = const_cast(*this).lower(); const Field& Upper = const_cast(*this).upper(); Field& Diag = diag(); @@ -69,6 +79,11 @@ void Foam::LduMatrix::sumMagOffDiag Field& sumOff ) const { + if (!lowerPtr_ && !upperPtr_) + { + return; + } + const Field& Lower = const_cast(*this).lower(); const Field& Upper = const_cast(*this).upper(); diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixOperations.C index c14078b26..1b89bf17c 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-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,6 +32,11 @@ Description void Foam::lduMatrix::sumDiag() { + if (!lowerPtr_ && !upperPtr_) + { + return; + } + const scalarField& Lower = const_cast(*this).lower(); const scalarField& Upper = const_cast(*this).upper(); scalarField& Diag = diag(); @@ -49,6 +54,11 @@ void Foam::lduMatrix::sumDiag() void Foam::lduMatrix::negSumDiag() { + if (!lowerPtr_ && !upperPtr_) + { + return; + } + const scalarField& Lower = const_cast(*this).lower(); const scalarField& Upper = const_cast(*this).upper(); scalarField& Diag = diag(); @@ -69,6 +79,11 @@ void Foam::lduMatrix::sumMagOffDiag scalarField& sumOff ) const { + if (!lowerPtr_ && !upperPtr_) + { + return; + } + const scalarField& Lower = const_cast(*this).lower(); const scalarField& Upper = const_cast(*this).upper();