31#include "surfaceInterpolate.H"
48template<
class Type,
class GType>
49template<
class E1,
class E2>
50void fusedGaussLaplacianScheme<Type, GType>::fvmCorrection
53 const dimensionSet& gammaDim,
58 typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfaceType;
60 const auto& vf = fvm.psi();
62 const auto V =
mesh.V().expr();
66 fvm.faceFluxCorrectionPtr() = std::make_unique<surfaceType>
71 mesh.time().timeName(),
79 *
mesh.magSf().dimensions()
80 *corr.data().dimensions()
82 auto& faceFluxCorr = *fvm.faceFluxCorrectionPtr();
84 faceFluxCorr = corr*gammaMagSf;
92 )().primitiveField().expr()
98 surfaceType faceFluxCorr
103 mesh.time().timeName(),
111 *
mesh.magSf().dimensions()
112 *corr.data().dimensions()
114 faceFluxCorr = corr*gammaMagSf;
122 )().primitiveField().expr()
129template<
class Type,
class GType>
139 <<
"fusedGaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected on "
141 <<
" with gammaMagSf " << gammaMagSf.
name()
142 <<
" with deltaCoeffs " << deltaCoeffs.
name()
171 auto& intCoeffs =
fvm.internalCoeffs()[patchi];
172 auto& bouCoeffs =
fvm.boundaryCoeffs()[patchi];
216template<
class Type,
class GType>
217tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
218fusedGaussLaplacianScheme<Type, GType>::gammaSnGradCorr
221 const GeometricField<Type, fvPatchField, volMesh>& vf
226 DebugPout<<
"fusedGaussLaplacianScheme<Type, GType>::gammaSnGradCorr on "
227 << vf.name() <<
" with SfGammCorr " << SfGammaCorr.name() <<
endl;
229 tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tgammaSnGradCorr
231 new GeometricField<Type, fvsPatchField, surfaceMesh>
235 "gammaSnGradCorr("+vf.name()+
')',
242 SfGammaCorr.dimensions()
243 *vf.dimensions()*
mesh.deltaCoeffs().dimensions()
246 auto& gammaSnGradCorr = tgammaSnGradCorr.ref();
247 gammaSnGradCorr.oriented() = SfGammaCorr.oriented();
249 for (
direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
251 gammaSnGradCorr.replace
258 return tgammaSnGradCorr;
371template<
class Type,
class GType>
387 "laplacian(" + vf.
name() +
')',
398 FieldType& result = tresult.
ref();
401 <<
"fusedGaussLaplacianScheme<Type, GType>::fvcLaplacian on "
403 <<
" to generate " << result.name() <<
endl;
409 const auto& deltaCoeffs = tdeltaCoeffs();
507 const auto snGrad = [&]
515 const auto snGrad(dc*(neiVal-ownVal));
516 return mag(Sf)*snGrad;
529 result.primitiveFieldRef() /=
mesh.V();
530 result.correctBoundaryConditions();
536template<
class Type,
class GType>
545 <<
"fusedGaussLaplacianScheme<Type, GType>::fvcLaplacian on "
552template<
class Type,
class GType>
560 DebugPout<<
"fusedGaussLaplacianScheme<Type, GType>::fvmLaplacian on "
576 this->tsnGradScheme_().deltaCoeffs(vf),
582 = gammaSnGradCorr(SfGammaCorr, vf);
584 if (this->tsnGradScheme_().corrected())
586 tfaceFluxCorrection.
ref() +=
587 SfGammaSn*this->tsnGradScheme_().correction(vf);
590 fvm.source() -=
mesh.V()*
fvc::div(tfaceFluxCorrection())().primitiveField();
594 fvm.faceFluxCorrectionPtr(tfaceFluxCorrection.
ptr());
601template<
class Type,
class GType>
609 DebugPout<<
"fusedGaussLaplacianScheme<Type, GType>::fvmLaplacian on "
615template<
class Type,
class GType>
623 DebugPout<<
"fusedGaussLaplacianScheme<Type, GType>::fvcLaplacian on "
640 SfGammaSn*this->tsnGradScheme_().snGrad(vf)
641 + gammaSnGradCorr(SfGammaCorr, vf)
645 tLaplacian.ref().rename
647 "laplacian(" +
gamma.name() +
',' + vf.
name() +
')'
const Mesh & mesh() const noexcept
Return const reference to mesh.
const dimensionSet & dimensions() const noexcept
Return dimensions.
orientedType oriented() const noexcept
Return oriented type.
Generic GeometricField class.
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
const fileName & instance() const noexcept
Read access to instance path component.
Generic dimensioned Type class.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Mesh data needed to do the Finite Volume discretisation.
virtual bool coupled() const
True if the patch field is coupled.
static const word & extrapolatedCalculatedType() noexcept
The type name for extrapolatedCalculated patch fields combines zero-gradient and calculated.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the evaluation of the gradient of this patch...
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the evaluation of the gradient of this patchFi...
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcLaplacian(const GeometricField< Type, fvPatchField, volMesh > &)
virtual tmp< fvMatrix< Type > > fvmLaplacian(const GeometricField< GType, fvsPatchField, surfaceMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
static tmp< fvMatrix< Type > > fvmLaplacianUncorrected(const surfaceScalarField &gammaMagSf, const surfaceScalarField &deltaCoeffs, const GeometricField< Type, fvPatchField, volMesh > &)
tmp< snGradScheme< Type > > tsnGradScheme_
tmp< surfaceInterpolationScheme< GType > > tinterpGammaScheme_
const fvMesh & mesh() const
Return mesh reference.
A class for managing temporary objects.
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Calculate the divergence of the given field.
Calculate the gradient of the given field.
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField.
#define DebugPout
Report an information message using Foam::Pout.
const expr V(m.psi().mesh().V())
Namespace for finite-volume.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
static tmp< GeometricField< typename innerProduct< vector, Type >::type, fvsPatchField, surfaceMesh > > dotInterpolate(const surfaceVectorField &Sf, const GeometricField< Type, fvPatchField, volMesh > &tvf)
Interpolate field onto faces.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
void surfaceSnSum(const surfaceScalarField &deltaCoeffs, const GeometricField< Type, fvPatchField, volMesh > &vf, const CellToFaceOp &cop, GeometricField< ResultType, fvPatchField, volMesh > &result, const bool doCorrectBoundaryConditions)
sum of snGrad
Namespace of functions to calculate implicit derivatives returning a matrix.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
const dimensionSet dimArea(sqr(dimLength))
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0).
static scalar Sn(const scalar a, const scalar x)
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
void multiply(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
errorManipArg< error, int > exit(error &err, const int errNo=1)
fvsPatchField< scalar > fvsPatchScalarField
#define forAll(list, i)
Loop across all elements in list.