mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
fvMatrix: Improved the relaxation of the matrix in the case that the diagonal is initially negative
This commit is contained in:
@ -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 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -596,7 +596,7 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
|
|||||||
scalar sumNon = 0.0;
|
scalar sumNon = 0.0;
|
||||||
forAll(D, celli)
|
forAll(D, celli)
|
||||||
{
|
{
|
||||||
scalar d = (sumOff[celli] - D[celli])/D[celli];
|
scalar d = (sumOff[celli] - D[celli])/mag(D[celli]);
|
||||||
|
|
||||||
if (d > 0)
|
if (d > 0)
|
||||||
{
|
{
|
||||||
@ -621,8 +621,11 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
|
|||||||
|
|
||||||
|
|
||||||
// Ensure the matrix is diagonally dominant...
|
// Ensure the matrix is diagonally dominant...
|
||||||
// (assumes that the central coefficient is positive)
|
// Assumes that the central coefficient is positive and ensures it is
|
||||||
max(D, D, sumOff);
|
forAll(D, celli)
|
||||||
|
{
|
||||||
|
D[celli] = max(mag(D[celli]), sumOff[celli]);
|
||||||
|
}
|
||||||
|
|
||||||
// ... then relax
|
// ... then relax
|
||||||
D /= alpha;
|
D /= alpha;
|
||||||
|
|||||||
Reference in New Issue
Block a user