52 const GeometricField<Type, fvPatchField, volMesh>& vsf,
62 typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
64 const fvMesh&
mesh = vsf.mesh();
68 tmp<GradFieldType> tsecondfGrad
72 "leastSquaresGrad(" + vsf.name() +
")" 74 const GradFieldType& secondfGrad =
77 tmp<GradFieldType> tfGrad
92 GradFieldType& fGrad = tfGrad.ref();
112 Type dDotGradDelta = 0.5*
114 (
C[nei[facei]] -
C[own[facei]])
115 & (secondfGrad[nei[facei]] - secondfGrad[own[facei]])
118 fGrad[own[facei]] -=
lambda[facei]*ownLs[facei]*dDotGradDelta;
119 fGrad[nei[facei]] -= (1.0 -
lambda[facei])*neiLs[facei]*dDotGradDelta;
123 forAll(vsf.boundaryField(), patchi)
125 if (secondfGrad.boundaryField()[patchi].coupled())
128 ownLs.boundaryField()[patchi];
132 const fvPatch&
p = vsf.boundaryField()[patchi].patch();
139 const Field<GradType> neighbourSecondfGrad
141 secondfGrad.boundaryField()[patchi].patchNeighbourField()
144 forAll(faceCells, patchFacei)
146 fGrad[faceCells[patchFacei]] -=
147 0.5*lambdap[patchFacei]*patchOwnLs[patchFacei]
151 neighbourSecondfGrad[patchFacei]
152 - secondfGrad[faceCells[patchFacei]]
159 fGrad.correctBoundaryConditions();
fvsPatchField< vector > fvsPatchVectorField
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
cellMask correctBoundaryConditions()
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Generic GeometricField class.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
Mesh data needed to do the Finite Volume discretisation.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > calcGrad(const GeometricField< Type, fvPatchField, volMesh > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad for optional caching.
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)