Moved correct patch grads into base class

This commit is contained in:
Hrvoje Jasak 2013-06-14 22:37:11 +01:00
parent 002040be85
commit fa313560d0
4 changed files with 47 additions and 41 deletions

View file

@ -146,38 +146,6 @@ gaussGrad<Type>::grad
}
template<class Type>
void gaussGrad<Type>::correctBoundaryConditions
(
const GeometricField<Type, fvPatchField, volMesh>& vsf,
GeometricField
<
typename outerProduct<vector, Type>::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

View file

@ -140,15 +140,8 @@ public:
const GeometricField<Type, fvPatchField, volMesh>&
) const;
//- Correct the boundary values of the gradient using the patchField
// snGrad functions
static void correctBoundaryConditions
(
const GeometricField<Type, fvPatchField, volMesh>&,
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>&
);
// Correct boundary conditions moved to base class
// HJ, 14/Jun/2013
};

View file

@ -29,6 +29,7 @@ Description
#include "fv.H"
#include "HashTable.H"
#include "primitiveFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,6 +97,39 @@ gradScheme<Type>::~gradScheme()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void gradScheme<Type>::correctBoundaryConditions
(
const GeometricField<Type, fvPatchField, volMesh>& vsf,
GeometricField
<
typename outerProduct<vector, Type>::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

View file

@ -136,6 +136,17 @@ public:
(
const GeometricField<Type, fvPatchField, volMesh>&
) 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<Type, fvPatchField, volMesh>&,
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>&
);
};