36 #define declareFvmLaplacianScalarGamma(Type) \ 39 Foam::tmp<Foam::fvMatrix<Foam::Type>> \ 40 Foam::fv::fusedGaussLaplacianScheme<Foam::Type, Foam::scalar>:: \ 43 const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \ 44 const GeometricField<Type, fvPatchField, volMesh>& vf \ 47 DebugPout<< "fusedGaussLaplacianScheme::fvmLaplacian on " << vf.name() \ 48 << " with scalar gamma " << gamma.name() << endl; \ 50 const fvMesh& mesh = this->mesh(); \ 52 GeometricField<scalar, fvsPatchField, surfaceMesh> gammaMagSf \ 57 tmp<fvMatrix<Type>> tfvm = fvmLaplacianUncorrected \ 60 this->tsnGradScheme_().deltaCoeffs(vf), \ 63 fvMatrix<Type>& fvm = tfvm.ref(); \ 65 if (this->tsnGradScheme_().corrected()) \ 67 if (mesh.fluxRequired(vf.name())) \ 69 fvm.faceFluxCorrectionPtr() = std::make_unique \ 71 GeometricField<Type, fvsPatchField, surfaceMesh> \ 74 gammaMagSf*this->tsnGradScheme_().correction(vf) \ 81 *fvm.faceFluxCorrectionPtr() \ 82 )().primitiveField(); \ 90 gammaMagSf*this->tsnGradScheme_().correction(vf) \ 91 )().primitiveField(); \ 100 Foam::tmp<Foam::GeometricField<Foam::Type, Foam::fvPatchField, Foam::volMesh>> \ 101 Foam::fv::fusedGaussLaplacianScheme<Foam::Type, Foam::scalar>:: \ 104 const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \ 105 const GeometricField<Type, fvPatchField, volMesh>& vf \ 108 DebugPout<< "fvcLaplacian on " << vf.name() \ 109 << " with scalar gamma " << gamma.name() << endl; \ 111 const fvMesh& mesh = this->mesh(); \ 113 tmp<GeometricField<Type, fvPatchField, volMesh>> tLaplacian \ 115 fvc::div(gamma*this->tsnGradScheme_().snGrad(vf)*mesh.magSf()) \ 118 tLaplacian.ref().rename \ 120 "laplacian(" + gamma.name() + ',' + vf.name() + ')' \ 134 const GeometricField<scalar, fvPatchField, volMesh>&
gamma,
135 const GeometricField<scalar, fvPatchField, volMesh>& vf
139 typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
140 typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
142 typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
145 <<
"fusedGaussLaplacianScheme<scalar, scalar>::fvcLaplacian" 146 <<
" on " << vf.name() <<
" with gamma " <<
gamma.name() <<
endl;
148 const fvMesh&
mesh = vf.mesh();
150 tmp<FieldType> tresult
156 "laplacian(" + vf.name() +
')',
170 FieldType& result = tresult.ref();
172 const auto tweights(this->tinterpGammaScheme_().weights(
gamma));
173 const auto& weights = tweights();
174 const auto tdeltaCoeffs(this->tsnGradScheme_().deltaCoeffs(vf));
175 const auto& deltaCoeffs = tdeltaCoeffs();
177 if (this->tsnGradScheme_().corrected())
180 tmp<SurfaceFieldType> tfaceGrad
186 "snGradCorr("+vf.name()+
')',
199 tmp<GradFieldType> tgGrad
204 mesh.gradScheme(
"grad(" + vf.name() +
')')
205 )().
grad(vf,
"grad(" + vf.name() +
')')
207 const auto& gGrad = tgGrad();
215 const GradType& ownVal,
216 const GradType& neiVal,
223 result = dotVector&(
lambda*(ownVal - neiVal) + neiVal);
228 mesh.surfaceInterpolation::weights(),
230 mesh.nonOrthCorrectionVectors(),
235 const auto& faceGrad = tfaceGrad();
242 const scalar ownGamma,
243 const scalar neiGamma,
253 const scalar faceGamma(weight*(ownGamma-neiGamma)+neiGamma);
280 const scalar ownGamma,
281 const scalar neiGamma,
288 const auto snGrad(dc*(neiVal-ownVal));
289 const scalar faceGamma(weight*(ownGamma-neiGamma)+neiGamma);
308 result.primitiveFieldRef() /=
mesh.V();
309 result.correctBoundaryConditions();
322 const GeometricField<scalar, fvPatchField, volMesh>&
gamma,
323 const GeometricField<vector, fvPatchField, volMesh>& vf
327 <<
"fusedGaussLaplacianScheme<vector, scalar>::fvcLaplacian" 328 <<
" on " << vf.name() <<
" with gamma " <<
gamma.name() <<
endl;
331 typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
332 typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
334 typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
336 const fvMesh&
mesh = vf.mesh();
338 tmp<FieldType> tresult
344 "laplacian(" + vf.name() +
')',
358 FieldType& result = tresult.ref();
360 const auto tweights(this->tinterpGammaScheme_().weights(
gamma));
361 const auto& weights = tweights();
362 const auto tdeltaCoeffs(this->tsnGradScheme_().deltaCoeffs(vf));
363 const auto& deltaCoeffs = tdeltaCoeffs();
365 if (this->tsnGradScheme_().corrected())
368 tmp<SurfaceFieldType> tfaceGrad
374 "snGradCorr("+vf.name()+
')',
387 tmp<GradFieldType> tgGrad
392 mesh.gradScheme(
"grad(" + vf.name() +
')')
393 )().
grad(vf,
"grad(" + vf.name() +
')')
395 const auto& gGrad = tgGrad();
403 const GradType& ownVal,
404 const GradType& neiVal,
411 result = dotVector&(
lambda*(ownVal - neiVal) + neiVal);
416 mesh.surfaceInterpolation::weights(),
418 mesh.nonOrthCorrectionVectors(),
423 const auto& faceGrad = tfaceGrad();
430 const scalar ownGamma,
431 const scalar neiGamma,
441 const scalar faceGamma(weight*(ownGamma-neiGamma)+neiGamma);
468 const scalar ownGamma,
469 const scalar neiGamma,
476 const auto snGrad(dc*(neiVal-ownVal));
477 const scalar faceGamma(weight*(ownGamma-neiGamma)+neiGamma);
496 result.primitiveFieldRef() /=
mesh.V();
497 result.correctBoundaryConditions();
513 <<
"fusedGaussLaplacianScheme<scalar, scalar>::fvmLaplacian" 514 <<
" on " << vf.
name() <<
" with gamma " <<
gamma.name() <<
endl;
529 <<
"fusedGaussLaplacianScheme<vector, scalar>::fvmLaplacian" 530 <<
" on " << vf.
name() <<
" with gamma " <<
gamma.name() <<
endl;
560 "laplacian(" + vf.
name() +
')',
571 FieldType& result = tresult.ref();
574 <<
"fusedGaussLaplacianScheme<scalar, GType>::fvcLaplacian on " 576 <<
" to generate " << result.name() <<
endl;
579 const auto tdeltaCoeffs(this->tsnGradScheme_().deltaCoeffs(vf));
580 const auto& deltaCoeffs = tdeltaCoeffs();
583 if (this->tsnGradScheme_().corrected())
592 "snGradCorr("+vf.
name()+
')',
610 mesh.gradScheme(
"grad(" + vf.
name() +
')')
611 )().
grad(vf,
"grad(" + vf.
name() +
')')
613 const auto& gGrad = tgGrad();
621 const GradType& ownVal,
622 const GradType& neiVal,
629 result = dotVector&(
lambda*(ownVal - neiVal) + neiVal);
634 mesh.surfaceInterpolation::weights(),
636 mesh.nonOrthCorrectionVectors(),
641 const auto& faceGrad = tfaceGrad();
676 const auto snGrad(dc*(neiVal-ownVal));
690 result.primitiveFieldRef() /=
mesh.V();
691 result.correctBoundaryConditions();
704 const GeometricField<vector, fvPatchField, volMesh>& vf
709 typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
710 typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
712 typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
714 const fvMesh&
mesh = vf.mesh();
716 tmp<FieldType> tresult
722 "laplacian(" + vf.name() +
')',
733 FieldType& result = tresult.ref();
736 <<
"fusedGaussLaplacianScheme<vector, GType>::fvcLaplacian on " 738 <<
" to generate " << result.name() <<
endl;
741 const auto tdeltaCoeffs(this->tsnGradScheme_().deltaCoeffs(vf));
742 const auto& deltaCoeffs = tdeltaCoeffs();
745 if (this->tsnGradScheme_().corrected())
748 tmp<SurfaceFieldType> tfaceGrad
754 "snGradCorr("+vf.name()+
')',
767 tmp<GradFieldType> tgGrad
772 mesh.gradScheme(
"grad(" + vf.name() +
')')
773 )().
grad(vf,
"grad(" + vf.name() +
')')
775 const auto& gGrad = tgGrad();
783 const GradType& ownVal,
784 const GradType& neiVal,
791 result = dotVector&(
lambda*(ownVal - neiVal) + neiVal);
796 mesh.surfaceInterpolation::weights(),
798 mesh.nonOrthCorrectionVectors(),
803 const auto& faceGrad = tfaceGrad();
838 const auto snGrad(dc*(neiVal-ownVal));
852 result.primitiveFieldRef() /=
mesh.V();
853 result.correctBoundaryConditions();
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
makeFvLaplacianScheme(fusedGaussLaplacianScheme)
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.
static tmp< GeometricField< typename innerProduct< vector, Type >::type, fvsPatchField, surfaceMesh > > dotInterpolate(const surfaceVectorField &Sf, const GeometricField< Type, fvPatchField, volMesh > &tvf)
Interpolate field onto faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Generic GeometricField class.
Generic dimensioned Type class.
const wordList area
Standard area field types (scalar, vector, tensor, etc)
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
virtual tmp< fvMatrix< Type > > fvmLaplacian(const GeometricField< GType, fvsPatchField, surfaceMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcLaplacian(const GeometricField< Type, fvPatchField, volMesh > &)
const Mesh & mesh() const noexcept
Return mesh.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const fileName & instance() const noexcept
Read access to instance path component.
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
Mesh data needed to do the Finite Volume discretisation.
#define DebugPout
Report an information message using Foam::Pout.
#define declareFvmLaplacianScalarGamma(Type)
A class for managing temporary objects.
Tensor of scalars, i.e. Tensor<scalar>.
Defines the attributes of an object for which implicit objectRegistry management is supported...
const word extrapolatedCalculatedType
A combined zero-gradient and calculated patch field type.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
const dimensionSet dimArea(sqr(dimLength))
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
const dimensionSet & dimensions() const noexcept
Return dimensions.
static constexpr const zero Zero
Global zero (0)