KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
product_of_sines_field.h
Go to the documentation of this file.
1 #if !defined(KRATOS_ETHIR_FLOW_FIELD_H)
2 #define KRATOS_ETHIR_FLOW_FIELD_H
3 
4 // /* External includes */
5 
6 // System includes
7 
8 // Project includes
9 #include "includes/variables.h"
11 
12 /* System includes */
13 #include <limits>
14 #include <iostream>
15 #include <iomanip>
16 
17 /* External includes */
18 #ifdef _OPENMP
19 #include <omp.h>
20 #endif
21 
22 /* Project includes */
23 #include "includes/define.h"
24 #include "utilities/openmp_utils.h"
25 #include "real_functions.h"
26 #include "velocity_field.h"
27 
28 
29 namespace Kratos
30 {
32 {
33 public:
34 
36 
38 
40 {
41  unsigned int number_of_threads = ParallelUtilities::GetNumThreads();
42  ResizeVectorsForParallelism(number_of_threads);
43  mOmega = Globals::Pi;
44 }
45 
46 ProductOfSines(const double period)
47 {
48  unsigned int number_of_threads = ParallelUtilities::GetNumThreads();
49  ResizeVectorsForParallelism(number_of_threads);
50 
51  KRATOS_ERROR_IF(period <= 0.0) << "The period must be non-negative." << std::endl;
52 
53  mOmega = Globals::Pi / period;
54 }
55 
56 
58 
59 virtual ~ProductOfSines(){}
60 
61 
62 //***************************************************************************************************************
63 //***************************************************************************************************************
64 void ResizeVectorsForParallelism(const int n_threads) override;
65 
66 void UpdateCoordinates(const double time, const array_1d<double, 3>& coor, const int i_thread = 0) override;
67 
68 void UpdateCoordinates(const double time, const DenseVector<double>& coor, const int i_thread = 0) override;
69 
70 void LockCoordinates(const int i_thread = 0) override;
71 
72 void UnlockCoordinates(const int i_thread = 0) override;
73 //***************************************************************************************************************
74 //***************************************************************************************************************
75 
79 
80 
84 
86 
87 virtual std::string Info() const override
88 {
89  return "";
90 }
91 
93 
94 virtual void PrintInfo(std::ostream& rOStream) const override
95 {
96 }
97 
99 
100 virtual void PrintData(std::ostream& rOStream) const override
101 {
102 }
103 
104 
108 
110 
111 protected:
114 
115 
119 
120 
124 
125 
126 // Values
127 
128 double U0(const int i_thread = 0) override;
129 
130 // First-order derivatives
131 
132 double U0D0(const int i_thread = 0) override;
133 double U0D1(const int i_thread = 0) override;
134 double U0D2(const int i_thread = 0) override;
135 
136 // Second-order derivatives
137 
138 double U0D0D0(const int i_thread = 0) override;
139 double U0D0D1(const int i_thread = 0) override;
140 double U0D0D2(const int i_thread = 0) override;
141 double U0D1D1(const int i_thread = 0) override;
142 double U0D1D2(const int i_thread = 0) override;
143 double U0D2D2(const int i_thread = 0) override;
144 
148 
149 
153 
157 
158 
162 
163 
165 
166 private:
167 
171 
175 double mOmega;
176 std::vector<int> mCoordinatesAreUpToDate;
177 std::vector<double> mSin0;
178 std::vector<double> mCos0;
179 std::vector<double> mSin1;
180 std::vector<double> mCos1;
181 std::vector<double> mSin2;
182 std::vector<double> mCos2;
183 
187 
191 
192 
196 
197 
201 
202 
206 
208 ProductOfSines & operator=(ProductOfSines const& rOther);
209 
210 
212 
213 }; // Class ProductOfSines
214 
216 
219 
220 
224 
225 } // namespace Kratos.
226 
227 #endif // KRATOS_ETHIR_FLOW_FIELD_H defined
Definition: amatrix_interface.h:41
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
Definition: product_of_sines_field.h:32
double U0D0(const int i_thread=0) override
Definition: product_of_sines_field.cpp:73
double U0D1(const int i_thread=0) override
Definition: product_of_sines_field.cpp:77
void LockCoordinates(const int i_thread=0) override
Definition: product_of_sines_field.cpp:54
double U0D2D2(const int i_thread=0) override
Definition: product_of_sines_field.cpp:107
ProductOfSines()
Default constructor.
Definition: product_of_sines_field.h:39
ProductOfSines(const double period)
Definition: product_of_sines_field.h:46
double U0D1D1(const int i_thread=0) override
Definition: product_of_sines_field.cpp:99
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: product_of_sines_field.h:100
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: product_of_sines_field.h:94
double U0D0D1(const int i_thread=0) override
Definition: product_of_sines_field.cpp:91
virtual ~ProductOfSines()
Destructor.
Definition: product_of_sines_field.h:59
void UnlockCoordinates(const int i_thread=0) override
Definition: product_of_sines_field.cpp:59
void UpdateCoordinates(const double time, const array_1d< double, 3 > &coor, const int i_thread=0) override
Definition: product_of_sines_field.cpp:20
double U0D1D2(const int i_thread=0) override
Definition: product_of_sines_field.cpp:103
virtual std::string Info() const override
Turn back information as a stemplate<class T, std::size_t dim> tring.
Definition: product_of_sines_field.h:87
void ResizeVectorsForParallelism(const int n_threads) override
Definition: product_of_sines_field.cpp:6
double U0(const int i_thread=0) override
Definition: product_of_sines_field.cpp:66
double U0D0D2(const int i_thread=0) override
Definition: product_of_sines_field.cpp:95
double U0D2(const int i_thread=0) override
Definition: product_of_sines_field.cpp:81
double U0D0D0(const int i_thread=0) override
Definition: product_of_sines_field.cpp:87
KRATOS_CLASS_POINTER_DEFINITION(ProductOfSines)
Definition: velocity_field.h:32
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
constexpr double Pi
Definition: global_variables.h:25
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
time
Definition: face_heat.py:85