diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 864dcfdc0..59a7274f8 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -242,7 +242,7 @@ void Foam::fvPatchField::evaluate(const Pstream::commsTypes) template -void Foam::fvPatchField::manipulateMatrix(fvMatrix& matrix) const +void Foam::fvPatchField::manipulateMatrix(fvMatrix& matrix) { // do nothing } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 0592aaee5..daed7adcb 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -463,7 +463,7 @@ public: // Matrix manipulation //- Manipulate matrix - virtual void manipulateMatrix(fvMatrix& matrix) const; + virtual void manipulateMatrix(fvMatrix& matrix); // I-O diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 213c71cb6..a17e1ff44 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -729,8 +729,12 @@ void Foam::fvMatrix::completeAssembly() assemblyCompleted_ = true; - const typename GeometricField:: - GeometricBoundaryField& bFields = psi_.boundaryField(); + // Cast away const to manipulate matrix + GeometricField& ncPsi = + const_cast& >(psi_); + + typename GeometricField:: + GeometricBoundaryField& bFields = ncPsi.boundaryField(); forAll(bFields, patchI) {