Incorrect algorithm in void Foam::fvMatrix<Type>::setValuesFromList
Summary
Incorrect algorithm in void Foam::fvMatrix<Type>::setValuesFromList
in file src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C:L226
What is the current bug behaviour?
within Loop forAll(cellLabels, i)
, the source_ is first set by source_[celli] = value*Diag[celli];
.
Then the value of source_[nei[facei]]
is immediatly changed by the -=
operator.
However, nei[face]
might be behind celli
, therefore this modification might be overwritten by the upcoming celli loop.
What is the expected correct behavior?
I think we should split the single loop forAll(cellLabels, i)
into two.
The first loop is to set the initial value of psi
and source_
, and the second loop is to do the -=
operation.
Relevant logs and/or images
Environment information
- OpenFOAM version : all versions
- Operating system : N/A
- Hardware info : N/A
- Compiler : N/A
Possible fixes
forAll(cellLabels, i)
{
const label celli = cellLabels[i];
const Type& value = values[i];
psi[celli] = value;
source_[celli] = value*Diag[celli];
}
forAll(cellLabels, i)
{
const label celli = cellLabels[i];
const Type& value = values[i];
if (symmetric() || asymmetric())
{
...
}
}
Edited by Zhao Wu