48 const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf,
53 typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
55 const fvMesh&
mesh = ssf.mesh();
57 DebugPout<<
"fusedGaussGrad<Type>::gradf on " << ssf.name()
60 tmp<GradFieldType> tgGrad
77 GradFieldType& gGrad = tgGrad.
ref();
83 Field<GradType>& igGrad = gGrad;
84 const Field<Type>& issf = ssf;
88 const GradType Sfssf = Sf[facei]*issf[facei];
90 igGrad[owner[facei]] += Sfssf;
91 igGrad[neighbour[facei]] -= Sfssf;
97 mesh.boundary()[patchi].faceCells();
101 const fvsPatchField<Type>& pssf = ssf.boundaryField()[patchi];
105 igGrad[pFaceCells[facei]] += pSf[facei]*pssf[facei];
111 gGrad.correctBoundaryConditions();
129 const GeometricField<Type, fvPatchField, volMesh>& vf,
134 typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
136 const fvMesh&
mesh = vf.mesh();
138 DebugPout<<
"fusedGaussGrad<Type>::calcGrad on " << vf.name()
141 tmp<GradFieldType> tgGrad
158 GradFieldType& gGrad = tgGrad.ref();
160 if (this->tinterpScheme_().corrected())
162 const auto tfaceCorr(this->tinterpScheme_().
correction(vf));
163 auto& faceCorr = tfaceCorr();
165 DebugPout<<
"fusedGaussGrad<Type>::calcGrad corrected interpScheme " 166 << this->tinterpScheme_().type() <<
endl;
185 this->tinterpScheme_().weights(vf),
195 DebugPout<<
"fusedGaussGrad<Type>::calcGrad uncorrected interpScheme " 196 << this->tinterpScheme_().type() <<
endl;
206 return area*(
lambda*(ownVal - neiVal) + neiVal);
211 tinterpScheme_().weights(vf),
219 gGrad.primitiveFieldRef() /=
mesh.V();
221 gGrad.correctBoundaryConditions();
245 DebugPout<<
"fusedGaussGrad<Type>::calcGrad on " << vf.
name()
246 <<
" into " << gGrad.name() <<
endl;
250 if (this->tinterpScheme_().corrected())
252 const auto tfaceCorr(this->tinterpScheme_().
correction(vf));
253 auto& faceCorr = tfaceCorr();
255 DebugPout<<
"fusedGaussGrad<Type>::calcGrad corrected interpScheme " 256 << this->tinterpScheme_().type() <<
endl;
275 this->tinterpScheme_().weights(vf),
285 DebugPout<<
"fusedGaussGrad<Type>::calcGrad uncorrected interpScheme " 286 << this->tinterpScheme_().type() <<
endl;
296 return area*(
lambda*(ownVal - neiVal) + neiVal);
301 tinterpScheme_().weights(vf),
309 gGrad.primitiveFieldRef() /=
mesh.V();
311 gGrad.correctBoundaryConditions();
318 template<
class GradType>
325 DebugPout<<
"fusedGaussGrad<Type>::correctBoundaryConditions on " 335 const auto& pSf =
mesh.Sf().boundaryField()[patchi];
337 const auto&
snGrad = tsnGrad();
338 auto& pgrad = gGradbf[patchi];
343 const Type uncorrectSnGrad(
n & pgrad[facei]);
344 pgrad[facei] +=
n*(
snGrad[facei] - uncorrectSnGrad);
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const word & name() const noexcept
Return the object name.
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
cellMask correctBoundaryConditions()
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
Generic dimensioned Type class.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
static tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > gradf(const GeometricField< Type, fvsPatchField, surfaceMesh > &, const word &name)
Return the gradient of the given field calculated using Gauss' theorem on the given surface field...
Mesh data needed to do the Finite Volume discretisation.
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
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 Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static void correctBoundaryConditions(const GeometricField< Type, fvPatchField, volMesh > &, GeometricField< GradType, fvPatchField, volMesh > &)
Correct the boundary values of the gradient using the patchField snGrad functions.
const dimensionSet & dimensions() const noexcept
Return dimensions.
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField...
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Mesh data needed to do the Finite Volume discretisation.
const wordList area
Standard area field types (scalar, vector, tensor, etc)
const Mesh & mesh() const noexcept
Return const reference to mesh.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
#define DebugPout
Report an information message using Foam::Pout.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
Field< vector > vectorField
Specialisation of Field<T> for vector.
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
A class for managing temporary objects.
const word extrapolatedCalculatedType
A combined zero-gradient and calculated patch field type.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
static constexpr const zero Zero
Global zero (0)