cylinderImplicitFunction.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::cylinderImplicitFunction
29
30Description
31 creates a infintite long cylinderImplicitFunction
32
33 Original code supplied by Henning Scheufler, DLR (2019)
34
35SourceFiles
36 cylinderImplicitFunction.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef implicitFunction_cylinderImplicitFunction_H
41#define implicitFunction_cylinderImplicitFunction_H
42
43#include "implicitFunction.H"
44#include "point.H"
45#include "tensor.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51namespace implicitFunctions
52{
53
54/*---------------------------------------------------------------------------*\
55 Class cylinderImplicitFunction Declaration
56\*---------------------------------------------------------------------------*/
59:
60 public implicitFunction
61{
62private:
63
64 // Private Data
65
66 //- Origin point
67 const point origin_;
68
69 //- Radius
70 const scalar radius_;
71
72 const scalar scale_;
73
74 const vector direction_;
75
76 const tensor project_;
77
78
79public:
80
81 //- Runtime type information
82 TypeName("cylinder");
83
84
85 // Constructors
86
87 //- Construct from components
89 (
90 const point& origin,
91 const scalar radius,
92 const scalar scale,
93 const vector& direction
94 );
95
96 //- Construct from dictionary
98
99
100 //- Destructor
101 virtual ~cylinderImplicitFunction() = default;
102
103
104 // Member Functions
106 virtual scalar value(const vector& p) const
107 {
108 return (-mag(project_ & (p - origin_)) + radius_)*scale_;
109 }
111 virtual vector grad(const vector& p) const
112 {
113 return -(project_ & (p - origin_))*scale_;
114 }
116 virtual scalar distanceToSurfaces(const vector& p) const
117 {
118 return mag(mag(project_ & (p - origin_)) - radius_)*scale_;
119 }
120};
121
122
123// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124
125} // End namespace implicitFunctions
126} // End namespace Foam
127
128// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129
130#endif
131
132// ************************************************************************* //
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.
creates a infintite long cylinderImplicitFunction
virtual scalar distanceToSurfaces(const vector &p) const
cylinderImplicitFunction(const point &origin, const scalar radius, const scalar scale, const vector &direction)
Construct from components.
virtual ~cylinderImplicitFunction()=default
Destructor.
TypeName("cylinder")
Runtime type information.
cylinderImplicitFunction(const dictionary &dict)
Construct from dictionary.
volScalarField & p
Namespace for OpenFOAM.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
uint8_t direction
Definition: direction.H:56
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73