Residual calculation bug fix
This commit is contained in:
parent
1c66fd0798
commit
cc9053b3cb
1 changed files with 6 additions and 4 deletions
|
@ -95,7 +95,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
|
||||||
{
|
{
|
||||||
if (validComponents[cmpt] == -1) continue;
|
if (validComponents[cmpt] == -1) continue;
|
||||||
|
|
||||||
// copy field and source
|
// Copy field and source
|
||||||
|
|
||||||
scalarField psiCmpt = psi_.internalField().component(cmpt);
|
scalarField psiCmpt = psi_.internalField().component(cmpt);
|
||||||
addBoundaryDiag(diag(), cmpt);
|
addBoundaryDiag(diag(), cmpt);
|
||||||
|
@ -191,7 +191,9 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve()
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type> > Foam::fvMatrix<Type>::residual() const
|
Foam::tmp<Foam::Field<Type> > Foam::fvMatrix<Type>::residual() const
|
||||||
{
|
{
|
||||||
tmp<Field<Type> > tres(source_);
|
// Bug fix: Creating a tmp out of a const reference will change the field
|
||||||
|
// HJ, 15/Apr/2011
|
||||||
|
tmp<Field<Type> > tres(new Field<Type>(source_));
|
||||||
Field<Type>& res = tres();
|
Field<Type>& res = tres();
|
||||||
|
|
||||||
addBoundarySource(res);
|
addBoundarySource(res);
|
||||||
|
@ -205,7 +207,7 @@ Foam::tmp<Foam::Field<Type> > Foam::fvMatrix<Type>::residual() const
|
||||||
{
|
{
|
||||||
scalarField psiCmpt = psi_.internalField().component(cmpt);
|
scalarField psiCmpt = psi_.internalField().component(cmpt);
|
||||||
|
|
||||||
scalarField boundaryDiagCmpt(psi_.size(), 0.0);
|
scalarField boundaryDiagCmpt(psi_.size(), 0);
|
||||||
addBoundaryDiag(boundaryDiagCmpt, cmpt);
|
addBoundaryDiag(boundaryDiagCmpt, cmpt);
|
||||||
|
|
||||||
FieldField<Field, scalar> bouCoeffsCmpt
|
FieldField<Field, scalar> bouCoeffsCmpt
|
||||||
|
|
Reference in a new issue