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  }
102 
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 // ************************************************************************* //
Foam::implicitFunctions::paraboloidImplicitFunction::paraboloidImplicitFunction
paraboloidImplicitFunction(const vector &coeffs)
Construct from components.
Foam::Vector::x
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:73
mathematicalConstants.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::implicitFunction
Base class for implicit functions.
Definition: implicitFunction.H:56
Foam::implicitFunctions::paraboloidImplicitFunction::TypeName
TypeName("paraboloid")
Runtime type information.
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::implicitFunctions::paraboloidImplicitFunction::grad
virtual vector grad(const vector &p) const
Definition: paraboloidImplicitFunction.H:96
Foam::Vector::z
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:85
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::implicitFunctions::paraboloidImplicitFunction
creates a paraboloid
Definition: paraboloidImplicitFunction.H:56
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
implicitFunction.H
Foam::implicitFunctions::paraboloidImplicitFunction::distanceToSurfaces
virtual scalar distanceToSurfaces(const vector &p) const
Definition: paraboloidImplicitFunction.H:102
Foam::implicitFunctions::paraboloidImplicitFunction::value
virtual scalar value(const vector &p) const
Definition: paraboloidImplicitFunction.H:87
Foam::Vector::y
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:79
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::Vector< scalar >
Foam::implicitFunctions::paraboloidImplicitFunction::~paraboloidImplicitFunction
virtual ~paraboloidImplicitFunction()=default
Destructor.