diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C index eb59753e3..f7fe1b1fd 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C @@ -146,38 +146,6 @@ gaussGrad::grad } -template -void gaussGrad::correctBoundaryConditions -( - const GeometricField& vsf, - GeometricField - < - typename outerProduct::type, fvPatchField, volMesh - >& gGrad -) -{ - forAll (vsf.boundaryField(), patchi) - { - if (!vsf.boundaryField()[patchi].coupled()) - { - vectorField n = - vsf.mesh().Sf().boundaryField()[patchi] - /vsf.mesh().magSf().boundaryField()[patchi]; - - gGrad.boundaryField()[patchi] += n* - ( - vsf.boundaryField()[patchi].snGrad() - - (n & gGrad.boundaryField()[patchi]) - ); - } - } - - // Note: coupled boundaries provide patchNeighbourField, which is only - // updated on correct boundary conditions. Therefore, evaluateCoupled() - // should be called here -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fv diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H index a12f9455c..6d2674c16 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H @@ -140,15 +140,8 @@ public: const GeometricField& ) const; - - //- Correct the boundary values of the gradient using the patchField - // snGrad functions - static void correctBoundaryConditions - ( - const GeometricField&, - GeometricField - ::type, fvPatchField, volMesh>& - ); + // Correct boundary conditions moved to base class + // HJ, 14/Jun/2013 }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C index 6c92a56e6..5edc178c5 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.C @@ -29,6 +29,7 @@ Description #include "fv.H" #include "HashTable.H" +#include "primitiveFieldsFwd.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -96,6 +97,39 @@ gradScheme::~gradScheme() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void gradScheme::correctBoundaryConditions +( + const GeometricField& vsf, + GeometricField + < + typename outerProduct::type, fvPatchField, volMesh + >& gGrad +) +{ + forAll (vsf.boundaryField(), patchi) + { + if (!vsf.boundaryField()[patchi].coupled()) + { + vectorField n = vsf.mesh().boundary()[patchi].nf(); + + gGrad.boundaryField()[patchi] += n* + ( + vsf.boundaryField()[patchi].snGrad() + - (n & gGrad.boundaryField()[patchi]) + ); + } + } + + // Note: coupled boundaries provide patchNeighbourField, which is only + // updated on correct boundary conditions. Therefore, evaluateCoupled() + // should be called here. HJ, Apr/2013 + gGrad.boundaryField().evaluateCoupled(); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fv diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H index 68d98961c..d4da455c8 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/gradScheme/gradScheme.H @@ -136,6 +136,17 @@ public: ( const GeometricField& ) const = 0; + + + // Moved from gaussGrad into base class. HJ, 14/Jun/2013 + //- Correct the boundary values of the gradient using the patchField + // snGrad functions + static void correctBoundaryConditions + ( + const GeometricField&, + GeometricField + ::type, fvPatchField, volMesh>& + ); };