ellipsoidImplicitFunction.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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::implicitFunctions::ellipsoidImplicitFunction
29
30Description
31 creates an ellipsoidImplicitFunction
32
33 Original code supplied by Henning Scheufler, DLR (2019)
34
35SourceFiles
36 ellipsoidImplicitFunction.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef implicitFunction_ellipsoidImplicitFunction_H
41#define implicitFunction_ellipsoidImplicitFunction_H
42
43#include "implicitFunction.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50namespace implicitFunctions
51{
52
53/*---------------------------------------------------------------------------*\
54 Class ellipsoidImplicitFunction Declaration
55\*---------------------------------------------------------------------------*/
58:
59 public implicitFunction
60{
61 // Private Member Data
62
63 //- Axis
64 const vector semiAxis_;
65
66 //- Origin point
67 const vector origin_;
68
69
70public:
71
72 //- Runtime type information
73 TypeName("ellipsoidImplicitFunction");
74
75
76 // Constructors
77
78 //- Construct from components
79 explicit ellipsoidImplicitFunction(const vector& semiAxis);
80
81 //- Construct from dictionary
83
84
85 //- Destructor
86 virtual ~ellipsoidImplicitFunction() = default;
87
88
89 // Member Functions
91 virtual scalar value(const vector& p) const
92 {
93 return
94 -sqrt
95 (
96 sqr((p.x() - origin_.x())/semiAxis_.x())
97 + sqr((p.y() - origin_.y())/semiAxis_.y())
98 + sqr((p.z() - origin_.z())/semiAxis_.z())
99 ) + 1;
100 }
101
103 virtual vector grad(const vector& p) const
104 {
105 // normal_ has the length of one
106 return vector
107 (
108 2*(p.x() - origin_.x())/sqr(semiAxis_.x()),
109 2*(p.y() - origin_.y())/sqr(semiAxis_.y()),
110 2*(p.z() - origin_.z())/sqr(semiAxis_.z())
111 );
112 }
114 virtual scalar distanceToSurfaces(const vector& p) const
115 {
117 return GREAT;
118 }
119};
120
121
122// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123
124} // End namespace implicitFunctions
125} // End namespace Foam
126
127// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128
129#endif
130
131// ************************************************************************* //
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:85
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:79
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:73
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Base class for implicit functions.
ellipsoidImplicitFunction(const dictionary &dict)
Construct from dictionary.
virtual scalar distanceToSurfaces(const vector &p) const
virtual ~ellipsoidImplicitFunction()=default
Destructor.
TypeName("ellipsoidImplicitFunction")
Runtime type information.
ellipsoidImplicitFunction(const vector &semiAxis)
Construct from components.
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Namespace for OpenFOAM.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Vector< scalar > vector
Definition: vector.H:61
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73