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 -------------------------------------------------------------------------------
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::sinImplicitFunction
29 
30 Description
31 
32  Original code supplied by Henning Scheufler, DLR (2019)
33 
34 SourceFiles
35  sinImplicitFunction.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef implicitFunction_sinImplicitFunction_H
40 #define implicitFunction_sinImplicitFunction_H
41 
42 #include "implicitFunction.H"
43 #include "mathematicalConstants.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 namespace implicitFunctions
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class sinImplicitFunction Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public implicitFunction
59 {
60 private:
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 
79 public:
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
107 
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  }
118 
119  virtual vector grad(const vector& p) const
120  {
122  return Zero;
123  }
124 
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 // ************************************************************************* //
mathematicalConstants.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::implicitFunctions::sinImplicitFunction::TypeName
TypeName("sin")
Runtime type information.
Foam::implicitFunctions::sinImplicitFunction::sinImplicitFunction
sinImplicitFunction(const scalar period, const scalar phase, const scalar amplitude, const vector &direction, const vector &up, const vector &origin)
Construct from components.
Foam::implicitFunction
Base class for implicit functions.
Definition: implicitFunction.H:56
Foam::phase
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:54
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::implicitFunctions::sinImplicitFunction
Original code supplied by Henning Scheufler, DLR (2019)
Definition: sinImplicitFunction.H:55
Foam::sin
dimensionedScalar sin(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:264
Foam::implicitFunctions::sinImplicitFunction::value
virtual scalar value(const vector &p) const
Definition: sinImplicitFunction.H:107
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
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
Foam::implicitFunctions::sinImplicitFunction::distanceToSurfaces
virtual scalar distanceToSurfaces(const vector &p) const
Definition: sinImplicitFunction.H:124
implicitFunction.H
Foam::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::Vector< scalar >
Foam::direction
uint8_t direction
Definition: direction.H:52
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::implicitFunctions::sinImplicitFunction::grad
virtual vector grad(const vector &p) const
Definition: sinImplicitFunction.H:118
Foam::implicitFunctions::sinImplicitFunction::~sinImplicitFunction
virtual ~sinImplicitFunction()=default
Destructor.