Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
ccefe8bb
Commit
ccefe8bb
authored
Nov 09, 2011
by
mattijs
Browse files
ENH: fvMatrix: debug printing of diagonal dominance
parent
03baed76
Changes
2
Show whitespace changes
Inline
Side-by-side
src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C
View file @
ccefe8bb
...
...
@@ -587,7 +587,41 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
}
}
if
(
debug
)
{
// Calculate amount of non-dominance.
label
nNon
=
0
;
scalar
maxNon
=
0
.
0
;
scalar
sumNon
=
0
.
0
;
forAll
(
D
,
celli
)
{
scalar
d
=
(
sumOff
[
celli
]
-
D
[
celli
])
/
D
[
celli
];
if
(
d
>
0
)
{
nNon
++
;
maxNon
=
max
(
maxNon
,
d
);
sumNon
+=
d
;
}
}
reduce
(
nNon
,
sumOp
<
label
>
());
reduce
(
maxNon
,
maxOp
<
scalar
>
());
reduce
(
sumNon
,
sumOp
<
scalar
>
());
sumNon
/=
returnReduce
(
D
.
size
(),
sumOp
<
label
>
());
InfoIn
(
"fvMatrix<Type>::relax(const scalar alpha)"
)
<<
"Matrix dominance test for "
<<
psi_
.
name
()
<<
nl
<<
" number of non-dominant cells : "
<<
nNon
<<
nl
<<
" maximum relative non-dominance : "
<<
maxNon
<<
nl
<<
" average relative non-dominance : "
<<
sumNon
<<
nl
<<
endl
;
}
// Ensure the matrix is diagonally dominant...
// (assumes that the central coefficient is positive)
max
(
D
,
D
,
sumOff
);
// ... then relax
...
...
src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H
View file @
ccefe8bb
...
...
@@ -364,6 +364,7 @@ public:
// alpha = 1 : diagonally equal
// alpha < 1 : diagonally dominant
// alpha = 0 : do nothing
// Note: Requires positive diagonal.
void
relax
(
const
scalar
alpha
);
//- Relax matrix (for steady-state solution).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment