59 const GeometricField<Type, faPatchField, areaMesh>& vsf
64 const faMesh&
mesh = vsf.mesh();
66 tmp<GeometricField<GradType, faPatchField, areaMesh>> tlsGrad
68 new GeometricField<GradType, faPatchField, areaMesh>
72 "grad(" + vsf.name() +
')',
83 GeometricField<GradType, faPatchField, areaMesh>& lsGrad = tlsGrad.ref();
96 label ownEdgeI = own[edgei];
97 label neiEdgeI = nei[edgei];
99 Type deltaVsf = vsf[neiEdgeI] - vsf[ownEdgeI];
101 lsGrad[ownEdgeI] += ownLs[edgei]*deltaVsf;
102 lsGrad[neiEdgeI] -= neiLs[edgei]*deltaVsf;
106 forAll(vsf.boundaryField(), patchi)
111 lsGrad.boundaryField()[patchi].patch().edgeFaces();
113 if (vsf.boundaryField()[patchi].coupled())
117 vsf.boundaryField()[patchi].patchNeighbourField()
120 forAll(neiVsf, patchEdgeI)
122 lsGrad[edgeFaces[patchEdgeI]] +=
123 patchOwnLs[patchEdgeI]
124 *(neiVsf[patchEdgeI] - vsf[edgeFaces[patchEdgeI]]);
129 const faPatchField<Type>& patchVsf = vsf.boundaryField()[patchi];
131 forAll(patchVsf, patchEdgeI)
133 lsGrad[edgeFaces[patchEdgeI]] +=
134 patchOwnLs[patchEdgeI]
135 *(patchVsf[patchEdgeI] - vsf[edgeFaces[patchEdgeI]]);
141 lsGrad.correctBoundaryConditions();
static const leastSquaresFaVectors & New(const faMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Ignore writing from objectRegistry::writeObject()
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
static const char *const typeName
Typename for Field.
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faPatchField, areaMesh > &) const
Calculate and return the grad of the given field.
GeometricField< vector, faePatchField, edgeMesh > edgeVectorField
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
static void correctBoundaryConditions(const GeometricField< Type, faPatchField, areaMesh > &, GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > &)
Correct the boundary values of the gradient using the patchField.
faePatchField< vector > faePatchVectorField
static constexpr const zero Zero
Global zero (0)