planeImplicitFunction.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2019 OpenCFD Ltd.
9  Copyright (C) 2019-2020 DLR
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::implicitFunctions::planeImplicitFunction
29 
30 Description
31  creates a plane
32 
33  Original code supplied by Henning Scheufler, DLR (2019)
34 
35 SourceFiles
36  planeImplicitFunction.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef implicitFunction_planeImplicitFunction_H
41 #define implicitFunction_planeImplicitFunction_H
42 
43 #include "implicitFunction.H"
44 #include "mathematicalConstants.H"
45 
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 namespace implicitFunctions
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class planeImplicitFunction Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public implicitFunction
61 {
62  // Private Data
63 
64  //- Reference point
65  const vector origin_;
66 
67  //- Unit-normal vector
68  const vector normal_;
69 
70 
71 public:
72 
73  //- Runtime type information
74  TypeName("plane");
75 
76 
77  // Constructors
78 
79  //- Construct from components
80  planeImplicitFunction(const vector& origin, const vector& normal);
81 
82  //- Construct from dictionary (used by implicitFunctions)
83  explicit planeImplicitFunction(const dictionary& dict);
84 
85 
86  //- Destructor
87  virtual ~planeImplicitFunction() = default;
88 
89 
90  // Member Functions
91 
92  virtual scalar value(const vector& p) const
93  {
94  return -normal_ & (origin_ - p);
95  }
96 
97  virtual vector grad(const vector& p) const
98  {
99  // normal_ has the length of one
100  return normal_;
101  }
102 
103  virtual scalar distanceToSurfaces(const vector& p) const
104  {
105  // normal_ has the length of one
106  return mag((p - origin_) & -normal_);
107  }
108 };
109 
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 } // End namespace implicitFunctions
114 } // End namespace Foam
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #endif
119 
120 // ************************************************************************* //
mathematicalConstants.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::implicitFunction
Base class for implicit functions.
Definition: implicitFunction.H:56
Foam::implicitFunctions::planeImplicitFunction::planeImplicitFunction
planeImplicitFunction(const vector &origin, const vector &normal)
Construct from components.
Foam::implicitFunctions::planeImplicitFunction
creates a plane
Definition: planeImplicitFunction.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::implicitFunctions::planeImplicitFunction::grad
virtual vector grad(const vector &p) const
Definition: planeImplicitFunction.H:96
implicitFunction.H
Foam::implicitFunctions::planeImplicitFunction::~planeImplicitFunction
virtual ~planeImplicitFunction()=default
Destructor.
Foam::Vector< scalar >
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::implicitFunctions::planeImplicitFunction::distanceToSurfaces
virtual scalar distanceToSurfaces(const vector &p) const
Definition: planeImplicitFunction.H:102
Foam::implicitFunctions::planeImplicitFunction::value
virtual scalar value(const vector &p) const
Definition: planeImplicitFunction.H:91
Foam::implicitFunctions::planeImplicitFunction::TypeName
TypeName("plane")
Runtime type information.