diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index fa3d6d7a315e0fcea6297366534e853e408fa9bc..7fd83f41b1f26612b4fe3e7d8c6ede1eebf4f5e6 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -42,6 +42,7 @@ Foam::fvPatchField<Type>::fvPatchField patch_(p), internalField_(iF), updated_(false), + manipulatedMatrix_(false), patchType_(word::null) {} @@ -58,6 +59,7 @@ Foam::fvPatchField<Type>::fvPatchField patch_(p), internalField_(iF), updated_(false), + manipulatedMatrix_(false), patchType_(word::null) {} @@ -75,6 +77,7 @@ Foam::fvPatchField<Type>::fvPatchField patch_(p), internalField_(iF), updated_(false), + manipulatedMatrix_(false), patchType_(ptf.patchType_) {} @@ -92,6 +95,7 @@ Foam::fvPatchField<Type>::fvPatchField patch_(p), internalField_(iF), updated_(false), + manipulatedMatrix_(false), patchType_(dict.lookupOrDefault<word>("patchType", word::null)) { if (dict.found("value")) @@ -133,6 +137,7 @@ Foam::fvPatchField<Type>::fvPatchField patch_(ptf.patch_), internalField_(ptf.internalField_), updated_(false), + manipulatedMatrix_(false), patchType_(ptf.patchType_) {} @@ -148,6 +153,7 @@ Foam::fvPatchField<Type>::fvPatchField patch_(ptf.patch_), internalField_(iF), updated_(false), + manipulatedMatrix_(false), patchType_(ptf.patchType_) {} @@ -267,6 +273,28 @@ void Foam::fvPatchField<Type>::rmap } +template<class Type> +void Foam::fvPatchField<Type>::updateCoeffs() +{ + updated_ = true; +} + + +template<class Type> +void Foam::fvPatchField<Type>::updateCoeffs(const scalarField& weights) +{ + if (!updated_) + { + updateCoeffs(); + + Field<Type>& fld = *this; + fld *= weights; + + updated_ = true; + } +} + + template<class Type> void Foam::fvPatchField<Type>::evaluate(const Pstream::commsTypes) { @@ -276,13 +304,25 @@ void Foam::fvPatchField<Type>::evaluate(const Pstream::commsTypes) } updated_ = false; + manipulatedMatrix_ = false; } template<class Type> void Foam::fvPatchField<Type>::manipulateMatrix(fvMatrix<Type>& matrix) { - // do nothing + manipulatedMatrix_ = true; +} + + +template<class Type> +void Foam::fvPatchField<Type>::manipulateMatrix +( + fvMatrix<Type>& matrix, + const scalarField& weights +) +{ + manipulatedMatrix_ = true; } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 6047f1e4af794e10a5abbcc8e89176c337a90cf6..d3b2ed4e70f8ef1ec856f17055ca2a385e97c8ef 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -93,6 +93,10 @@ class fvPatchField // the construction of the matrix bool updated_; + //- Update index used so that manipulateMatrix is called only once + // during the construction of the matrix + bool manipulatedMatrix_; + //- Optional patch type, used to allow specified boundary conditions // to be applied to constraint patches by providing the constraint // patch type as 'patchType' @@ -327,6 +331,12 @@ public: return updated_; } + //- Return true if the matrix has already been manipulated + bool manipulatedMatrix() const + { + return manipulatedMatrix_; + } + // Mapping functions @@ -365,10 +375,12 @@ public: //- Update the coefficients associated with the patch field // Sets Updated to true - virtual void updateCoeffs() - { - updated_ = true; - } + virtual void updateCoeffs(); + + //- Update the coefficients associated with the patch field + // and apply weight field + // Sets Updated to true + virtual void updateCoeffs(const scalarField& weights); //- Return internal field next to patch as patch field virtual tmp<Field<Type> > patchInternalField() const; @@ -479,6 +491,13 @@ public: //- Manipulate matrix virtual void manipulateMatrix(fvMatrix<Type>& matrix); + //- Manipulate matrix with given weights + virtual void manipulateMatrix + ( + fvMatrix<Type>& matrix, + const scalarField& weights + ); + // I-O