sinImplicitFunction.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::sinImplicitFunction
29
30Description
31
32 Original code supplied by Henning Scheufler, DLR (2019)
33
34SourceFiles
35 sinImplicitFunction.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef implicitFunction_sinImplicitFunction_H
40#define implicitFunction_sinImplicitFunction_H
41
42#include "implicitFunction.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49namespace implicitFunctions
50{
51
52/*---------------------------------------------------------------------------*\
53 Class sinImplicitFunction Declaration
54\*---------------------------------------------------------------------------*/
57:
58 public implicitFunction
59{
60private:
61
62 // Private Data
63
64 //- Origin point
65 const scalar period_;
66
67 //- Radius
68 const scalar phase_;
69
70 const scalar amplitude_;
71
72 const vector up_;
73
74 const vector direction_;
75
76 const vector origin_;
77
78
79public:
80
81 //- Runtime type information
82 TypeName("sin");
83
84
85 // Constructors
86
87 //- Construct from components
89 (
90 const scalar period,
91 const scalar phase,
92 const scalar amplitude,
93 const vector& direction,
94 const vector& up,
95 const vector& origin
96 );
97
98 //- Construct from dictionary (used by implicitFunctions)
99 explicit sinImplicitFunction(const dictionary& dict);
100
101
102 //- Destructor
103 virtual ~sinImplicitFunction() = default;
104
105
106 // Member Functions
108 virtual scalar value(const vector& p) const
109 {
110 const scalar x = (p - origin_) & direction_;
111 const scalar z = (p - origin_) & -up_;
112
113 return
114 z
115 - amplitude_
116 *Foam::sin(2*constant::mathematical::pi*x/period_ + phase_);
117 }
119 virtual vector grad(const vector& p) const
120 {
122 return Zero;
123 }
125 virtual scalar distanceToSurfaces(const vector& p) const
126 {
128 return 0;
129 }
130};
131
132
133// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134
135} // End namespace implicitFunctions
136} // End namespace Foam
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140#endif
141
142// ************************************************************************* //
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.
Original code supplied by Henning Scheufler, DLR (2019)
sinImplicitFunction(const scalar period, const scalar phase, const scalar amplitude, const vector &direction, const vector &up, const vector &origin)
Construct from components.
virtual scalar distanceToSurfaces(const vector &p) const
virtual vector grad(const vector &p) const
virtual ~sinImplicitFunction()=default
Destructor.
TypeName("sin")
Runtime type information.
sinImplicitFunction(const dictionary &dict)
Construct from dictionary (used by implicitFunctions)
virtual scalar value(const vector &p) const
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:57
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
constexpr scalar pi(M_PI)
Namespace for OpenFOAM.
dimensionedScalar sin(const dimensionedScalar &ds)
uint8_t direction
Definition: direction.H:56
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73