From 0d9fdfc5c3824b2f85226b845aa74ccd755717d8 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 26 Oct 2011 14:34:59 +0100 Subject: [PATCH 1/3] multivariateIndependentScheme: new multi-variate discretisation scheme Generic multi-variate discretisation scheme class for which any of the NVD, CNVD or NVDV schemes may be selected for each variable and applied independently. This is equivalent to using separate "div" terms and schemes for each variable/equation. --- .../multivariateIndependentScheme.C | 57 ++++++++ .../multivariateIndependentScheme.H | 126 ++++++++++++++++++ .../multivariateIndependentSchemes.C | 48 +++++++ 3 files changed, 231 insertions(+) create mode 100644 src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentScheme.C create mode 100644 src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentScheme.H create mode 100644 src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentSchemes.C diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentScheme.C new file mode 100644 index 0000000000..9539fee912 --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentScheme.C @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ 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 "multivariateIndependentScheme.H" +#include "limitedSurfaceInterpolationScheme.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "upwind.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +Foam::multivariateIndependentScheme::multivariateIndependentScheme +( + const fvMesh& mesh, + const typename multivariateSurfaceInterpolationScheme:: + fieldTable& fields, + const surfaceScalarField& faceFlux, + Istream& schemeData +) +: + multivariateSurfaceInterpolationScheme + ( + mesh, + fields, + faceFlux, + schemeData + ), + schemes_(schemeData), + faceFlux_(faceFlux) +{} + + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentScheme.H b/src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentScheme.H new file mode 100644 index 0000000000..61a91dcc48 --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentScheme.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ 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::multivariateIndependentScheme + +Description + Generic multi-variate discretisation scheme class for which any of the + NVD, CNVD or NVDV schemes may be selected for each variable and applied + independently. + + This is equivalent to using separate "div" terms and schemes for each + variable/equation. + +SourceFiles + multivariateIndependentScheme.C + +\*---------------------------------------------------------------------------*/ + +#ifndef multivariateIndependentScheme_H +#define multivariateIndependentScheme_H + +#include "multivariateSurfaceInterpolationScheme.H" +#include "limitedSurfaceInterpolationScheme.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class multivariateIndependentScheme Declaration +\*---------------------------------------------------------------------------*/ + +template +class multivariateIndependentScheme +: + public multivariateSurfaceInterpolationScheme +{ + // Private data + + dictionary schemes_; + const surfaceScalarField& faceFlux_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + multivariateIndependentScheme(const multivariateIndependentScheme&); + + //- Disallow default bitwise assignment + void operator=(const multivariateIndependentScheme&); + + +public: + + //- Runtime type information + TypeName("multivariateIndependent"); + + + // Constructors + + //- Construct for field, faceFlux and Istream + multivariateIndependentScheme + ( + const fvMesh& mesh, + const typename multivariateSurfaceInterpolationScheme:: + fieldTable& fields, + const surfaceScalarField& faceFlux, + Istream& schemeData + ); + + + // Member Operators + + tmp > operator() + ( + const GeometricField& field + ) const + { + return surfaceInterpolationScheme::New + ( + faceFlux_.mesh(), + faceFlux_, + schemes_.lookup(field.name()) + ); + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "multivariateIndependentScheme.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentSchemes.C b/src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentSchemes.C new file mode 100644 index 0000000000..1d6f297ada --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/multivariateSchemes/multivariateIndependentScheme/multivariateIndependentSchemes.C @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ 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 "multivariateIndependentScheme.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defineNamedTemplateTypeNameAndDebug(multivariateIndependentScheme, 0); + +multivariateSurfaceInterpolationScheme::addIstreamConstructorToTable + > + addMultivariateIndependentSchemeScalarConstructorToTable_; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // From 721da9c038b191549c3374afc8bcb863ca5f922f Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 26 Oct 2011 14:35:34 +0100 Subject: [PATCH 2/3] face: add special treatment for the sweptVol of a triangular face --- src/OpenFOAM/meshes/meshShapes/face/face.C | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index 995c75cdc0..3211df1514 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -655,6 +655,27 @@ Foam::scalar Foam::face::sweptVol const pointField& newPoints ) const { + if (size() == 3) + { + return + ( + triPointRef + ( + oldPoints[operator[](0)], + oldPoints[operator[](1)], + oldPoints[operator[](2)] + ).sweptVol + ( + triPointRef + ( + newPoints[operator[](0)], + newPoints[operator[](1)], + newPoints[operator[](2)] + ) + ) + ); + } + scalar sv = 0; // Calculate the swept volume by breaking the face into triangles and From 238b776fec2ddf40213fe7d0b47b4aff363f12ca Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 26 Oct 2011 14:36:32 +0100 Subject: [PATCH 3/3] src/finiteVolume/Make/files: added new multivariate scheme --- src/finiteVolume/Make/files | 1 + 1 file changed, 1 insertion(+) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index cc2f3e4225..d30f23b9bd 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -280,6 +280,7 @@ $(limitedSchemes)/limitWith/limitWith.C multivariateSchemes = $(surfaceInterpolation)/multivariateSchemes $(multivariateSchemes)/multivariateSurfaceInterpolationScheme/multivariateSurfaceInterpolationSchemes.C $(multivariateSchemes)/multivariateSelectionScheme/multivariateSelectionSchemes.C +$(multivariateSchemes)/multivariateIndependentScheme/multivariateIndependentSchemes.C $(multivariateSchemes)/upwind/multivariateUpwind.C $(multivariateSchemes)/Gamma/multivariateGamma.C $(multivariateSchemes)/vanLeer/multivariateVanLeer.C