Permalink
Browse files

ENH: patchCloudSet: new sampledSet

  • Loading branch information...
1 parent eae0ee7 commit c0f48042666f108b33651a05f5c85e229af2b272 mattijs committed Jul 13, 2011
@@ -40,6 +40,8 @@ surfaceFormat vtk;
// cell : use cell-centre value only; constant over cells (default)
// cellPoint : use cell-centre and vertex values
// cellPointFace : use cell-centre, vertex and face values.
+// cellPatchConstrained : use cell-centre except on boundary faces where
+// it uses the boundary value. For use with e.g. patchCloudSet.
// 1] vertex values determined from neighbouring cell-centre values
// 2] face values determined using the current face interpolation scheme
// for the field (linear, gamma, etc.)
@@ -74,6 +76,7 @@ fields
// uniform, face, midPoint, midPointAndFace : start and end coordinate
// uniform: extra number of sampling points
// curve, cloud: list of coordinates
+// patchCloud: list of coordinates and set of patches to look for nearest
sets
(
lineX1
@@ -104,6 +107,18 @@ sets
points ((0.049 0.049 0.00501)(0.051 0.049 0.00501));
}
+ somePatchPoints
+ {
+ // Sample nearest points on selected patches. Use with
+ // interpolations:
+ // - cell (cell value)
+ // - cellPatchConstrained (boundary value)
+ // - cellPoint (interpolated boundary value)
+ type patchCloud;
+ axis xyz;
+ points ((0.049 0.099 0.005)(0.051 0.054 0.005));
+ patches (".*Wall.*");
+ }
);
@@ -207,6 +222,24 @@ surfaces
interpolate true;
}
+ distanceSampling
+ {
+ // Sampling certain distance away (in direction of normals)
+ // from any surface
+ type distanceSurface;
+
+ distance 0.01;
+ // Only to one side
+ signed true;
+
+ //surfaceType triSurfaceMesh;
+ //surfaceName motorbike.stl;
+ surfaceType searchableSphere;
+ centre (0.05 0.05 0.005);
+ radius 0.039;
+
+ interpolate true;
+ }
);
@@ -185,6 +185,7 @@ interpolation = interpolation/interpolation
$(interpolation)/interpolation/interpolations.C
$(interpolation)/interpolationCell/makeInterpolationCell.C
+$(interpolation)/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C
$(interpolation)/interpolationCellPoint/cellPointWeight/cellPointWeight.C
$(interpolation)/interpolationCellPoint/makeInterpolationCellPoint.C
$(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C
@@ -0,0 +1,76 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 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 <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "interpolationCellPatchConstrained.H"
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
+
+template<class Type>
+interpolationCellPatchConstrained<Type>::interpolationCellPatchConstrained
+(
+ const GeometricField<Type, fvPatchField, volMesh>& psi
+)
+:
+ interpolation<Type>(psi)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template<class Type>
+Type interpolationCellPatchConstrained<Type>::interpolate
+(
+ const vector& pt,
+ const label cellI,
+ const label faceI
+) const
+{
+ if (faceI >= 0 && faceI >= this->psi_.mesh().nInternalFaces())
+ {
+ // Use boundary value
+ const polyBoundaryMesh& pbm = this->psi_.mesh().boundaryMesh();
+ label patchI = pbm.whichPatch(faceI);
+ label patchFaceI = pbm[patchI].whichFace(faceI);
+
+ return this->psi_.boundaryField()[patchI][patchFaceI];
+ }
+ else
+ {
+ return this->psi_[cellI];
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
@@ -0,0 +1,97 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 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 <http://www.gnu.org/licenses/>.
+
+Class
+ Foam::interpolationCellPatchConstrained
+
+Description
+ Uses the cell value for any point in the cell apart from a boundary face
+ where it uses the boundary value directly.
+ Note: will not work on an empty patch.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef interpolationCellPatchConstrained_H
+#define interpolationCellPatchConstrained_H
+
+#include "interpolation.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class fvMesh;
+
+/*---------------------------------------------------------------------------*\
+ Class interpolationCellPatchConstrained Declaration
+\*---------------------------------------------------------------------------*/
+
+template<class Type>
+class interpolationCellPatchConstrained
+:
+ public interpolation<Type>
+{
+
+public:
+
+ //- Runtime type information
+ TypeName("cellPatchConstrained");
+
+
+ // Constructors
+
+ //- Construct from components
+ interpolationCellPatchConstrained
+ (
+ const GeometricField<Type, fvPatchField, volMesh>& psi
+ );
+
+
+ // Member Functions
+
+ //- Interpolate field to the given point in the given cell
+ Type interpolate
+ (
+ const vector& position,
+ const label cellI,
+ const label faceI = -1
+ ) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+# include "interpolationCellPatchConstrained.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
@@ -0,0 +1,41 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 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 <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "interpolationCellPatchConstrained.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+makeInterpolation(interpolationCellPatchConstrained);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
View
@@ -7,6 +7,7 @@ probes/csvProbesFunctionObject.C
*/
sampledSet/coordSet/coordSet.C
+sampledSet/patchCloud/patchCloudSet.C
sampledSet/sampledSet/sampledSet.C
sampledSet/cloud/cloudSet.C
sampledSet/face/faceOnlySet.C
Oops, something went wrong.

0 comments on commit c0f4804

Please sign in to comment.