diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H index e5bbcadc67..1d8b670811 100644 --- a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H @@ -101,7 +101,7 @@ if (mesh.changing()) pcorrEqn.setReferences ( validCells, - scalarList(validCells.size(), 0.0), + scalar(0.0), true ); } diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H index 9c4608e238..cfd0353622 100644 --- a/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H @@ -110,7 +110,7 @@ pcorrEqn.setReferences ( validCells, - scalarList(validCells.size(), 0.0), + scalar(0.0), true ); } diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index bc407a0784..c0c9b63da7 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -522,7 +522,32 @@ void Foam::fvMatrix::setReference template void Foam::fvMatrix::setReferences ( - const labelList& cellLabels, + const labelUList& cellLabels, + const Type& value, + const bool forceReference +) +{ + const bool needRef = (forceReference || psi_.needReference()); + + if (needRef) + { + forAll(cellLabels, celli) + { + const label cellId = cellLabels[celli]; + if (cellId >= 0) + { + source()[cellId] += diag()[cellId]*value; + diag()[cellId] += diag()[cellId]; + } + } + } +} + + +template +void Foam::fvMatrix::setReferences +( + const labelUList& cellLabels, const UList& values, const bool forceReference ) @@ -544,7 +569,6 @@ void Foam::fvMatrix::setReferences } - template void Foam::fvMatrix::relax(const scalar alpha) { diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H index 9bb0d91d2e..4cad056ab2 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H @@ -371,7 +371,15 @@ public: //- Set references level for solution void setReferences ( - const labelList& cells, + const labelUList& cells, + const Type& value, + const bool forceReference = false + ); + + //- Set references level for solution + void setReferences + ( + const labelUList& cells, const UList& values, const bool forceReference = false );