paraboloidImplicitFunction.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::paraboloidImplicitFunction
29 
30 Description
31  creates a paraboloid
32 
33  Original code supplied by Henning Scheufler, DLR (2019)
34 
35 SourceFiles
36  paraboloidImplicitFunction.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef implicitFunction_paraboloidImplicitFunction_H
41 #define implicitFunction_paraboloidImplicitFunction_H
42 
43 #include "implicitFunction.H"
44 #include "mathematicalConstants.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace implicitFunctions
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class paraboloidImplicitFunction Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
59  public implicitFunction
60 {
61  // Private Data
62 
63  //- Coefficients of ax^2 + bx*y + cy^2
64  const vector coeffs_;
65 
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("paraboloid");
71 
72 
73  // Constructors
74 
75  //- Construct from components
76  explicit paraboloidImplicitFunction(const vector& coeffs);
77 
78  //- Construct from dictionary
80 
81 
82  //- Destructor
83  virtual ~paraboloidImplicitFunction() = default;
84 
85 
86  // Member Functions
87 
88  virtual scalar value(const vector& p) const
89  {
90  return
91  coeffs_.x()*sqr(p.x())
92  + coeffs_.y()*p.x()*p.y()
93  + coeffs_.z()*sqr(p.y())
94  - p.z();
95  }
96 
97  virtual vector grad(const vector& p) const
98  {
100  return Zero;
101  }
103  virtual scalar distanceToSurfaces(const vector& p) const
104  {
106  return 0;
107  }
108 };
109 
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 } // End namespace implicitFunctions
114 } // End namespace Foam
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #endif
119 
120 // ************************************************************************* //
virtual ~paraboloidImplicitFunction()=default
Destructor.
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
dimensionedSymmTensor sqr(const dimensionedVector &dv)
TypeName("paraboloid")
Runtime type information.
paraboloidImplicitFunction(const vector &coeffs)
Construct from components.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
Base class for implicit functions.
Namespace for OpenFOAM.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127