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();
230 template<
class GradType>
237 DebugPout<<
"fusedGaussGrad<Type>::correctBoundaryConditions on " 247 const auto& pSf =
mesh.Sf().boundaryField()[patchi];
249 const auto&
snGrad = tsnGrad();
250 auto& pgrad = gGradbf[patchi];
255 const Type uncorrectSnGrad(
n & pgrad[facei]);
256 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.
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
const wordList area
Standard area field types (scalar, vector, tensor, etc)
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.
const Mesh & mesh() const noexcept
Return mesh.
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.
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.
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)