From 3b07525b5ad6ec90244fbea480e0338ade5469e5 Mon Sep 17 00:00:00 2001 From: andy <a.heather@opencfd.co.uk> Date: Wed, 4 Mar 2009 09:43:45 +0000 Subject: [PATCH] added interpolationCellPointWallModified --- src/finiteVolume/Make/files | 2 + .../cellPointWeight/cellPointWeight.H | 6 +- .../interpolationCellPoint.H | 8 +- .../cellPointWeightWallModified.C | 72 +++++++++++++ .../cellPointWeightWallModified.H | 79 ++++++++++++++ .../interpolationCellPointWallModified.C | 42 ++++++++ .../interpolationCellPointWallModified.H | 102 ++++++++++++++++++ .../interpolationCellPointWallModifiedI.H | 69 ++++++++++++ .../makeInterpolationCellPointWallModified.C | 36 +++++++ 9 files changed, 411 insertions(+), 5 deletions(-) create mode 100644 src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.C create mode 100644 src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.H create mode 100644 src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.C create mode 100644 src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H create mode 100644 src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModifiedI.H create mode 100644 src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 34a4606e088..847d91abc6f 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -164,6 +164,8 @@ $(interpolation)/interpolationCell/makeInterpolationCell.C $(interpolation)/interpolationCellPoint/cellPointWeight/cellPointWeight.C $(interpolation)/interpolationCellPoint/makeInterpolationCellPoint.C $(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C +$(interpolation)/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.C +$(interpolation)/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C volPointInterpolation = interpolation/volPointInterpolation $(volPointInterpolation)/pointPatchInterpolation/pointPatchInterpolation.C diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.H index 767c9038093..937e277b61a 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.H @@ -51,7 +51,9 @@ class polyMesh; class cellPointWeight { - // Private data +protected: + + // Protected data //- Cell index const label cellIndex_; @@ -63,7 +65,7 @@ class cellPointWeight FixedList<label, 3> faceVertices_; - // Private Member Functions + // Protected Member Functions void findTetrahedron ( diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.H index 9388a85fc88..bbe76871ba7 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.H @@ -42,7 +42,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class interpolationCellPoint Declaration + Class interpolationCellPoint Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -50,7 +50,9 @@ class interpolationCellPoint : public interpolation<Type> { - // Private data +protected: + + // Protected data //- Interpolated volfield const GeometricField<Type, pointPatchField, pointMesh> psip_; @@ -79,7 +81,7 @@ public: //- Interpolate field to the given point in the given cell inline Type interpolate ( - const vector& position, + const vector& position, const label nCell, const label facei = -1 ) const; diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.C new file mode 100644 index 00000000000..f33af9e7e33 --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 "cellPointWeightWallModified.H" +#include "wallPolyPatch.H" +#include "polyMesh.H" +#include "polyBoundaryMesh.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellPointWeightWallModified::cellPointWeightWallModified +( + const polyMesh& mesh, + const vector& position, + const label cellIndex, + const label faceIndex +) +: + cellPointWeight(mesh, position, cellIndex, faceIndex) +{ + if (faceIndex < 0) + { + findTetrahedron(mesh, position, cellIndex); + } + else + { + const polyBoundaryMesh& bm = mesh.boundaryMesh(); + label patchI = bm.whichPatch(faceIndex); + if (patchI != -1) + { + if (isA<wallPolyPatch>(bm[patchI])) + { + // Apply cell centre value wall faces + weights_[0] = 0.0; + weights_[1] = 0.0; + weights_[2] = 0.0; + weights_[3] = 1.0; + } + } + else + { + // Interpolate + findTriangle(mesh, position, faceIndex); + } + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.H new file mode 100644 index 00000000000..e7903a7338b --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.H @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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::cellPointWeightWallModified + +Description + Foam::cellPointWeightWallModified + +SourceFiles + cellPointWeightWallModified.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellPointWeightWallModified_H +#define cellPointWeightWallModified_H + +#include "cellPointWeight.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class polyMesh; + +/*---------------------------------------------------------------------------*\ + Class cellPointWeightWallModified Declaration +\*---------------------------------------------------------------------------*/ + +class cellPointWeightWallModified +: + public cellPointWeight +{ +public: + + // Constructors + + //- Construct from components + cellPointWeightWallModified + ( + const polyMesh& mesh, + const vector& position, + const label nCell, + const label facei = -1 + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.C new file mode 100644 index 00000000000..762aeef1cbc --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 "interpolationCellPointWallModified.H" + +// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // + +template<class Type> +Foam::interpolationCellPointWallModified<Type>:: +interpolationCellPointWallModified +( + const GeometricField<Type, fvPatchField, volMesh>& psi +) +: + interpolationCellPoint<Type>(psi) +{} + + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H new file mode 100644 index 00000000000..a54fc8fb7a0 --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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::interpolationCellPoint + +Description + Same as interpolationCellPoint, but if interpolating a wall face, uses + cell centre value instead + +\*---------------------------------------------------------------------------*/ + +#ifndef interpolationCellPointWallModified_H +#define interpolationCellPointWallModified_H + +#include "interpolationCellPoint.H" +#include "cellPointWeightWallModified.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class interpolationCellPoint Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class interpolationCellPointWallModified +: + public interpolationCellPoint<Type> +{ +public: + + //- Runtime type information + TypeName("cellPointWallModified"); + + + // Constructors + + //- Construct from components + interpolationCellPointWallModified + ( + const GeometricField<Type, fvPatchField, volMesh>& psi + ); + + + // Member Functions + + //- Interpolate field for the given cellPointWeight + inline Type interpolate(const cellPointWeightWallModified& cpw) const; + + //- Interpolate field to the given point in the given cell + inline Type interpolate + ( + const vector& position, + const label nCell, + const label facei = -1 + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "interpolationCellPointWallModifiedI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "interpolationCellPointWallModified.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModifiedI.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModifiedI.H new file mode 100644 index 00000000000..4318ce89941 --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModifiedI.H @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +inline Type Foam::interpolationCellPointWallModified<Type>::interpolate +( + const cellPointWeightWallModified& cpw +) const +{ + const FixedList<scalar, 4>& weights = cpw.weights(); + const FixedList<label, 3>& faceVertices = cpw.faceVertices(); + + Type t = this->psip_[faceVertices[0]]*weights[0]; + t += this->psip_[faceVertices[1]]*weights[1]; + t += this->psip_[faceVertices[2]]*weights[2]; + t += this->psi_[cpw.cell()]*weights[3]; + + return t; +} + + +template<class Type> +inline Type Foam::interpolationCellPointWallModified<Type>::interpolate +( + const vector& position, + const label celli, + const label facei +) const +{ + return + interpolate + ( + cellPointWeightWallModified + ( + this->pMesh_, + position, + celli, + facei + ) + ); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C new file mode 100644 index 00000000000..c2e691f545b --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 "interpolationCellPointWallModified.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makeInterpolation(interpolationCellPointWallModified); +} + +// ************************************************************************* // -- GitLab