56 const GeometricField<Type, faPatchField, areaMesh>& vsf,
62 const faMesh&
mesh = vsf.mesh();
64 tmp<GeometricField<GradType, faPatchField, areaMesh>> tlsGrad
66 new GeometricField<GradType, faPatchField, areaMesh>
81 GeometricField<GradType, faPatchField, areaMesh>& lsGrad = tlsGrad.ref();
94 const label ownEdgeI = own[edgei];
95 const label neiEdgeI = nei[edgei];
97 const Type deltaVsf(vsf[neiEdgeI] - vsf[ownEdgeI]);
99 lsGrad[ownEdgeI] += ownLs[edgei]*deltaVsf;
100 lsGrad[neiEdgeI] -= neiLs[edgei]*deltaVsf;
104 forAll(vsf.boundaryField(), patchi)
106 const faPatchField<Type>& bf = vsf.boundaryField()[patchi];
108 tmp<Field<Type>> tvsfp(bf);
112 tvsfp = bf.patchNeighbourField();
114 const auto& vsfp = tvsfp();
118 lsGrad.boundaryField()[patchi].patch().edgeFaces();
122 lsGrad[edgeFaces[pEdgei]] +=
123 ownLsp[pEdgei]*(vsfp[pEdgei] - vsf[edgeFaces[pEdgei]]);
128 lsGrad.correctBoundaryConditions();
static const leastSquaresFaVectors & New(const faMesh &mesh, Args &&... args)
Get existing or create 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)