From 78352100f2cf71df2b1b4c044acb8735d9ae006a Mon Sep 17 00:00:00 2001 From: henry Date: Sat, 13 Sep 2008 11:11:19 +0100 Subject: [PATCH] Added limitWith scheme. Currently this evaluated the limiter twice if the scheme is corrected. --- .../limitedSchemes/limitWith/limitWith.C | 37 ++++ .../limitedSchemes/limitWith/limitWith.H | 161 ++++++++++++++++++ 2 files changed, 198 insertions(+) create mode 100644 src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/limitWith/limitWith.C create mode 100644 src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/limitWith/limitWith.H diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/limitWith/limitWith.C b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/limitWith/limitWith.C new file mode 100644 index 0000000000..b7af793b39 --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/limitWith/limitWith.C @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "limitWith.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makeSurfaceInterpolationScheme(limitWith) +} + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/limitWith/limitWith.H b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/limitWith/limitWith.H new file mode 100644 index 0000000000..090f91353d --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/limitWith/limitWith.H @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::limitWith + +Description + limitWith differencing scheme limits the specified scheme with the + specified limiter. + +SourceFiles + limitWith.C + +\*---------------------------------------------------------------------------*/ + +#ifndef limitWith_H +#define limitWith_H + +#include "surfaceInterpolationScheme.H" +#include "limitedSurfaceInterpolationScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class limitWith Declaration +\*---------------------------------------------------------------------------*/ + +template +class limitWith +: + public surfaceInterpolationScheme +{ + // Private Member Functions + + //- Interpolation scheme + tmp > tInterp_; + + //- Limiter + tmp > tLimiter_; + + + //- Disallow default bitwise copy construct + limitWith(const limitWith&); + + //- Disallow default bitwise assignment + void operator=(const limitWith&); + + +public: + + //- Runtime type information + TypeName("limitWith"); + + + // Constructors + + //- Construct from mesh and Istream. + // The name of the flux field is read from the Istream and looked-up + // from the mesh objectRegistry + limitWith + ( + const fvMesh& mesh, + Istream& is + ) + : + surfaceInterpolationScheme(mesh), + tInterp_ + ( + surfaceInterpolationScheme::New(mesh, is) + ), + tLimiter_ + ( + limitedSurfaceInterpolationScheme::New(mesh, is) + ) + {} + + //- Construct from mesh, faceFlux and Istream + limitWith + ( + const fvMesh& mesh, + const surfaceScalarField& faceFlux, + Istream& is + ) + : + surfaceInterpolationScheme(mesh), + tInterp_ + ( + surfaceInterpolationScheme::New(mesh, faceFlux, is) + ), + tLimiter_ + ( + limitedSurfaceInterpolationScheme::New(mesh, faceFlux, is) + ) + {} + + + // Member Functions + + //- Return the interpolation weighting factors + virtual tmp weights + ( + const GeometricField& vf + ) const + { + return tLimiter_().weights + ( + vf, + tInterp_().weights(vf), + tLimiter_().limiter(vf) + ); + } + + //- Return true if this scheme uses an explicit correction + virtual bool corrected() const + { + return tInterp_().corrected(); + } + + //- Return the explicit correction to the face-interpolate + // for the given field + virtual tmp > + correction(const GeometricField& vf) const + { + return tLimiter_().limiter(vf)*tInterp_().correction(vf); + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //