mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: facGrad: ensure compatibility between caching and corrections (fixes #3039)
This commit is contained in:
@ -103,13 +103,17 @@ grad
|
||||
typedef typename outerProduct<vector,Type>::type GradType;
|
||||
typedef GeometricField<GradType, faPatchField, areaMesh> GradFieldType;
|
||||
|
||||
tmp<GradFieldType> tgGrad = fa::gradScheme<Type>::New
|
||||
tmp<GradFieldType> tgGrad
|
||||
(
|
||||
vf.mesh(),
|
||||
vf.mesh().gradScheme(name)
|
||||
).ref().grad(vf);
|
||||
|
||||
GradFieldType& gGrad = tgGrad.ref();
|
||||
fa::gradScheme<Type>::New
|
||||
(
|
||||
vf.mesh(),
|
||||
vf.mesh().gradScheme(name)
|
||||
)
|
||||
.cref() // const ref to tmp contents
|
||||
.grad(vf).ptr() // steal ptr or deep copy of cached gradient
|
||||
);
|
||||
auto& gGrad = tgGrad.ref();
|
||||
|
||||
const areaVectorField& n = vf.mesh().faceAreaNormals();
|
||||
gGrad -= n*(n & gGrad);
|
||||
|
||||
Reference in New Issue
Block a user