diff --git a/src/finiteVolume/finiteVolume/divSchemes/gaussDivScheme/gaussDivScheme.C b/src/finiteVolume/finiteVolume/divSchemes/gaussDivScheme/gaussDivScheme.C index 9721a04eca..308f0daff7 100644 --- a/src/finiteVolume/finiteVolume/divSchemes/gaussDivScheme/gaussDivScheme.C +++ b/src/finiteVolume/finiteVolume/divSchemes/gaussDivScheme/gaussDivScheme.C @@ -58,7 +58,7 @@ gaussDivScheme::fvcDiv ( fvc::surfaceIntegrate ( - this->mesh_.Sf() & this->tinterpScheme_().interpolate(vf) + this->tinterpScheme_().dotInterpolate(this->mesh_.Sf(), vf) ) ); diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C index ea58ee0249..305743076c 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C @@ -50,9 +50,9 @@ Foam::fv::correctedSnGrad::fullGradCorrection // construct GeometricField tmp> tssf = - mesh.nonOrthCorrectionVectors() - & linear::type>(mesh).interpolate + linear::type>(mesh).dotInterpolate ( + mesh.nonOrthCorrectionVectors(), gradScheme::New ( mesh, diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C index d871edb6e2..4f6a79c9a2 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C @@ -26,6 +26,7 @@ License #include "surfaceInterpolationScheme.H" #include "volFields.H" #include "surfaceFields.H" +#include "geometricOneField.H" #include "coupledFvPatchField.H" // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // @@ -215,9 +216,19 @@ Foam::surfaceInterpolationScheme::interpolate template -Foam::tmp> -Foam::surfaceInterpolationScheme::interpolate +template +Foam::tmp +< + Foam::GeometricField + < + typename Foam::innerProduct::type, + Foam::fvsPatchField, + Foam::surfaceMesh + > +> +Foam::surfaceInterpolationScheme::dotInterpolate ( + const SFType& Sf, const GeometricField& vf, const tmp& tlambdas ) @@ -233,6 +244,9 @@ Foam::surfaceInterpolationScheme::interpolate << endl; } + typedef typename Foam::innerProduct::type + RetType; + const surfaceScalarField& lambdas = tlambdas(); const Field& vfi = vf.internalField(); @@ -242,9 +256,9 @@ Foam::surfaceInterpolationScheme::interpolate const labelUList& P = mesh.owner(); const labelUList& N = mesh.neighbour(); - tmp> tsf + tmp> tsf ( - new GeometricField + new GeometricField ( IOobject ( @@ -253,16 +267,18 @@ Foam::surfaceInterpolationScheme::interpolate vf.db() ), mesh, - vf.dimensions() + Sf.dimensions()*vf.dimensions() ) ); - GeometricField& sf = tsf.ref(); + GeometricField& sf = tsf.ref(); - Field& sfi = sf.internalField(); + Field& sfi = sf.internalField(); + + const typename SFType::InternalField& Sfi = Sf.internalField(); for (label fi=0; fi::interpolate forAll(lambdas.boundaryField(), pi) { const fvsPatchScalarField& pLambda = lambdas.boundaryField()[pi]; + const typename SFType::PatchFieldType& pSf = Sf.boundaryField()[pi]; + fvsPatchField& psf = sf.boundaryField()[pi]; if (vf.boundaryField()[pi].coupled()) { - tsf.ref().boundaryField()[pi] = - pLambda*vf.boundaryField()[pi].patchInternalField() - + (1.0 - pLambda)*vf.boundaryField()[pi].patchNeighbourField(); + psf = + pSf + & ( + pLambda*vf.boundaryField()[pi].patchInternalField() + + (1.0 - pLambda)*vf.boundaryField()[pi].patchNeighbourField() + ); } else { - sf.boundaryField()[pi] = vf.boundaryField()[pi]; + psf = pSf & vf.boundaryField()[pi]; } } @@ -289,6 +310,93 @@ Foam::surfaceInterpolationScheme::interpolate } +template +Foam::tmp> +Foam::surfaceInterpolationScheme::interpolate +( + const GeometricField& vf, + const tmp& tlambdas +) +{ + return dotInterpolate(geometricOneField(), vf, tlambdas); +} + + +template +Foam::tmp +< + Foam::GeometricField + < + typename Foam::innerProduct::type, + Foam::fvsPatchField, + Foam::surfaceMesh + > +> +Foam::surfaceInterpolationScheme::dotInterpolate +( + const surfaceVectorField& Sf, + const GeometricField& vf +) const +{ + if (surfaceInterpolation::debug) + { + InfoInFunction + << "Interpolating " + << vf.type() << " " + << vf.name() + << " from cells to faces" + << endl; + } + + tmp + < + GeometricField + < + typename Foam::innerProduct::type, + fvsPatchField, + surfaceMesh + > + > tsf = dotInterpolate(Sf, vf, weights(vf)); + + if (corrected()) + { + tsf.ref() += Sf & correction(vf); + } + + return tsf; +} + + +template +Foam::tmp +< + Foam::GeometricField + < + typename Foam::innerProduct::type, + Foam::fvsPatchField, + Foam::surfaceMesh + > +> +Foam::surfaceInterpolationScheme::dotInterpolate +( + const surfaceVectorField& Sf, + const tmp>& tvf +) const +{ + tmp + < + GeometricField + < + typename Foam::innerProduct::type, + fvsPatchField, + surfaceMesh + > + > tSfDotinterpVf = dotInterpolate(Sf, tvf()); + tvf.clear(); + return tSfDotinterpVf; +} + + template Foam::tmp> Foam::surfaceInterpolationScheme::interpolate diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.H b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.H index 7780f9d8bb..da6a64fbff 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.H @@ -156,6 +156,25 @@ public: const tmp& ); + //- Return the face-interpolate of the given cell field + // with the given weighting factors dotted with given field Sf + template + static tmp + < + GeometricField + < + typename innerProduct::type, + fvsPatchField, + surfaceMesh + > + > + dotInterpolate + ( + const SFType& Sf, + const GeometricField& vf, + const tmp& tlambdas + ); + //- Return the face-interpolate of the given cell field // with the given weighting factors static tmp> @@ -165,7 +184,6 @@ public: const tmp& ); - //- Return the interpolation weighting factors for the given field virtual tmp weights ( @@ -186,6 +204,41 @@ public: return tmp>(NULL); } + //- Return the face-interpolate of the given cell field + // with explicit correction dotted with given field Sf + virtual + tmp + < + GeometricField + < + typename innerProduct::type, + fvsPatchField, + surfaceMesh + > + > + dotInterpolate + ( + const surfaceVectorField& Sf, + const GeometricField& vf + ) const; + + //- Return the face-interpolate of the given tmp cell field + // with explicit correction dotted with given field Sf + tmp + < + GeometricField + < + typename innerProduct::type, + fvsPatchField, + surfaceMesh + > + > + dotInterpolate + ( + const surfaceVectorField& Sf, + const tmp>& + ) const; + //- Return the face-interpolate of the given cell field // with explicit correction virtual tmp> @@ -201,6 +254,23 @@ public: }; +template<> +tmp +< + GeometricField + < + typename innerProduct::type, + fvsPatchField, + surfaceMesh + > +> +surfaceInterpolationScheme::dotInterpolate +( + const surfaceVectorField& Sf, + const GeometricField& +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationSchemes.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationSchemes.C index 7332b7cbde..a6da1c8678 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationSchemes.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationSchemes.C @@ -54,9 +54,49 @@ makeBaseSurfaceInterpolationScheme(sphericalTensor) makeBaseSurfaceInterpolationScheme(symmTensor) makeBaseSurfaceInterpolationScheme(tensor) - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<> +Foam::tmp +< + Foam::GeometricField + < + typename Foam::innerProduct::type, + Foam::fvsPatchField, + Foam::surfaceMesh + > +> +Foam::surfaceInterpolationScheme::dotInterpolate +( + const surfaceVectorField& Sf, + const GeometricField& +) const +{ + NotImplemented; + + return + tmp + < + GeometricField + < + typename innerProduct::type, + fvsPatchField, + surfaceMesh + > + > + ( + GeometricField + < + typename innerProduct::type, + fvsPatchField, + surfaceMesh + >::null() + ); +} + + // ************************************************************************* //