61 const GeometricField<Type, faPatchField, areaMesh>& vsf,
67 const faMesh&
mesh = vsf.mesh();
69 tmp<GeometricField<GradType, faPatchField, areaMesh>> tlsGrad
71 new GeometricField<GradType, faPatchField, areaMesh>
86 GeometricField<GradType, faPatchField, areaMesh>& lsGrad = tlsGrad.ref();
99 label ownEdgeI = own[edgei];
100 label neiEdgeI = nei[edgei];
102 Type deltaVsf = vsf[neiEdgeI] - vsf[ownEdgeI];
104 lsGrad[ownEdgeI] += ownLs[edgei]*deltaVsf;
105 lsGrad[neiEdgeI] -= neiLs[edgei]*deltaVsf;
109 forAll(vsf.boundaryField(), patchi)
114 lsGrad.boundaryField()[patchi].patch().edgeFaces();
116 if (vsf.boundaryField()[patchi].coupled())
120 vsf.boundaryField()[patchi].patchNeighbourField()
123 forAll(neiVsf, patchEdgeI)
125 lsGrad[edgeFaces[patchEdgeI]] +=
126 patchOwnLs[patchEdgeI]
127 *(neiVsf[patchEdgeI] - vsf[edgeFaces[patchEdgeI]]);
132 const faPatchField<Type>& patchVsf = vsf.boundaryField()[patchi];
134 forAll(patchVsf, patchEdgeI)
136 lsGrad[edgeFaces[patchEdgeI]] +=
137 patchOwnLs[patchEdgeI]
138 *(patchVsf[patchEdgeI] - vsf[edgeFaces[patchEdgeI]]);
144 lsGrad.correctBoundaryConditions();
static const leastSquaresFaVectors & New(const faMesh &mesh, Args &&... args)
Get existing or create a new MeshObject. Registered with typeName.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Ignore writing from objectRegistry::writeObject()
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
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
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > calcGrad(const GeometricField< Type, faPatchField, areaMesh > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad for optional caching.
static constexpr const zero Zero
Global zero (0)