diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 87438ae313..2e4dd38bb1 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -227,6 +227,7 @@ $(schemes)/clippedLinear/clippedLinear.C $(schemes)/harmonic/harmonic.C $(schemes)/fixedBlended/fixedBlended.C $(schemes)/localBlended/localBlended.C +$(schemes)/limiterBlended/limiterBlended.C $(schemes)/localMax/localMax.C $(schemes)/localMin/localMin.C diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/limiterBlended/limiterBlended.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/limiterBlended/limiterBlended.C new file mode 100644 index 0000000000..2693088ef7 --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/limiterBlended/limiterBlended.C @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "limiterBlended.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makeSurfaceInterpolationScheme(limiterBlended) +} + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/limiterBlended/limiterBlended.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/limiterBlended/limiterBlended.H new file mode 100644 index 0000000000..965e65afa9 --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/limiterBlended/limiterBlended.H @@ -0,0 +1,229 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::limiterBlended + +Description + Blends two specified schemes using the limiter function provided by a + limitedSurfaceInterpolationScheme. + + The limited scheme is specified first followed by the scheme to be scaled + by the limiter and then the scheme scaled by 1 - limiter. + +SourceFiles + limiterBlended.C + +\*---------------------------------------------------------------------------*/ + +#ifndef limiterBlended_H +#define limiterBlended_H + +#include "limitedSurfaceInterpolationScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class limiterBlended Declaration +\*---------------------------------------------------------------------------*/ + +template +class limiterBlended +: + public surfaceInterpolationScheme +{ + // Private Member Functions + + //- Limited scheme providing the limiter + tmp > tLimitedScheme_; + + //- Scheme 1 + tmp > tScheme1_; + + //- Scheme 2 + tmp > tScheme2_; + + + //- Disallow default bitwise copy construct + limiterBlended(const limiterBlended&); + + //- Disallow default bitwise assignment + void operator=(const limiterBlended&); + + +public: + + //- Runtime type information + TypeName("limiterBlended"); + + + // Constructors + + //- Construct from mesh and Istream. + // The name of the flux field is read from the Istream and looked-up + // from the mesh objectRegistry + limiterBlended + ( + const fvMesh& mesh, + Istream& is + ) + : + surfaceInterpolationScheme(mesh), + tLimitedScheme_ + ( + limitedSurfaceInterpolationScheme::New(mesh, is) + ), + tScheme1_ + ( + surfaceInterpolationScheme::New(mesh, is) + ), + tScheme2_ + ( + surfaceInterpolationScheme::New(mesh, is) + ) + {} + + //- Construct from mesh, faceFlux and Istream + limiterBlended + ( + const fvMesh& mesh, + const surfaceScalarField& faceFlux, + Istream& is + ) + : + surfaceInterpolationScheme(mesh), + tLimitedScheme_ + ( + limitedSurfaceInterpolationScheme::New(mesh, faceFlux, is) + ), + tScheme1_ + ( + surfaceInterpolationScheme::New(mesh, faceFlux, is) + ), + tScheme2_ + ( + surfaceInterpolationScheme::New(mesh, faceFlux, is) + ) + {} + + + // Member Functions + + //- Return the interpolation weighting factors + tmp weights + ( + const GeometricField& vf + ) const + { + surfaceScalarField blendingFactor = + tLimitedScheme_().limiter(vf); + + return + blendingFactor*tScheme1_().weights(vf) + + (scalar(1) - blendingFactor)*tScheme2_().weights(vf); + } + + //- Return the face-interpolate of the given cell field + // with explicit correction + tmp > + interpolate(const GeometricField& vf) const + { + surfaceScalarField blendingFactor = + tLimitedScheme_().limiter(vf); + + return + blendingFactor*tScheme1_().interpolate(vf) + + (scalar(1) - blendingFactor)*tScheme2_().interpolate(vf); + } + + + //- Return true if this scheme uses an explicit correction + virtual bool corrected() const + { + return tScheme1_().corrected() || tScheme2_().corrected(); + } + + + //- Return the explicit correction to the face-interpolate + // for the given field + virtual tmp > + correction + ( + const GeometricField& vf + ) const + { + surfaceScalarField blendingFactor = + tLimitedScheme_().limiter(vf); + + if (tScheme1_().corrected()) + { + if (tScheme2_().corrected()) + { + return + ( + blendingFactor + * tScheme1_().correction(vf) + + (scalar(1.0) - blendingFactor) + * tScheme2_().correction(vf) + ); + } + else + { + return + ( + blendingFactor + * tScheme1_().correction(vf) + ); + } + } + else if (tScheme2_().corrected()) + { + return + ( + (scalar(1.0) - blendingFactor) + * tScheme2_().correction(vf) + ); + } + else + { + return tmp > + ( + NULL + ); + } + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //