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.
cellular_flow_field.h
Go to the documentation of this file.
1 #if !defined(KRATOS_CELLULAR_FLOW_FIELD_H)
2 #define KRATOS_CELLULAR_FLOW_FIELD_H
3 
4 // /* External includes */
5 
6 // System includes
7 
8 // Project includes
9 #include "includes/variables.h"
10 
11 /* System includes */
12 #include <limits>
13 #include <iostream>
14 #include <iomanip>
15 
16 /* External includes */
17 #ifdef _OPENMP
18 #include <omp.h>
19 #endif
20 
21 /* Project includes */
22 #include "includes/define.h"
23 #include "utilities/openmp_utils.h"
24 #include "real_functions.h"
25 #include "velocity_field.h"
26 
27 
28 namespace Kratos
29 {
30 class KRATOS_API(SWIMMING_DEM_APPLICATION) CellularFlowField : public VelocityField
31 {
32 public:
33 
35 
37 
38 CellularFlowField():VelocityField(),mL(1.0), mU(0.0), mK(2.72), mOmega(Globals::Pi)
39 {
40  mOneOverL = 1.0 / mL;
41  mOmegaUOverL = mOmega * mU / mL;
42  unsigned int number_of_threads = ParallelUtilities::GetNumThreads();
43  ResizeVectorsForParallelism(number_of_threads);
44 }
45 
46 CellularFlowField(const double half_wavelength, const double max_flow_speed, const double oscillation_relative_amplitude, const double oscillation_angular_frequency)
47  :VelocityField(), mL(half_wavelength), mU(max_flow_speed), mK(oscillation_relative_amplitude), mOmega(oscillation_angular_frequency)
48 {
49 
50  mOneOverL = 1.0 / mL;
51  mOmegaUOverL = mOmega * mU / mL;
52  unsigned int maximum_number_of_threads = ParallelUtilities::GetNumThreads();
53  ResizeVectorsForParallelism(maximum_number_of_threads);
54 }
55 
56 
58 
59 virtual ~CellularFlowField(){}
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 double U1(const int i_thread = 0) override;
130 double U2(const int i_thread = 0) override;
131 
132 // First-order derivatives
133 
134 double U0DT(const int i_thread = 0) override;
135 double U0D0(const int i_thread = 0) override;
136 double U0D1(const int i_thread = 0) override;
137 double U0D2(const int i_thread = 0) override;
138 
139 double U1DT(const int i_thread = 0) override;
140 double U1D0(const int i_thread = 0) override;
141 double U1D1(const int i_thread = 0) override;
142 double U1D2(const int i_thread = 0) override;
143 
144 double U2DT(const int i_thread = 0) override;
145 double U2D0(const int i_thread = 0) override;
146 double U2D1(const int i_thread = 0) override;
147 double U2D2(const int i_thread = 0) override;
148 
149 // Second-order derivatives
150 
151 double U0DTDT(const int i_thread = 0) override;
152 double U0DTD0(const int i_thread = 0) override;
153 double U0DTD1(const int i_thread = 0) override;
154 double U0DTD2(const int i_thread = 0) override;
155 double U0D0D0(const int i_thread = 0) override;
156 double U0D0D1(const int i_thread = 0) override;
157 double U0D0D2(const int i_thread = 0) override;
158 double U0D1D1(const int i_thread = 0) override;
159 double U0D1D2(const int i_thread = 0) override;
160 double U0D2D2(const int i_thread = 0) override;
161 
162 double U1DTDT(const int i_thread = 0) override;
163 double U1DTD0(const int i_thread = 0) override;
164 double U1DTD1(const int i_thread = 0) override;
165 double U1DTD2(const int i_thread = 0) override;
166 double U1D0D0(const int i_thread = 0) override;
167 double U1D0D1(const int i_thread = 0) override;
168 double U1D0D2(const int i_thread = 0) override;
169 double U1D1D1(const int i_thread = 0) override;
170 double U1D1D2(const int i_thread = 0) override;
171 double U1D2D2(const int i_thread = 0) override;
172 
173 double U2DTDT(const int i_thread = 0) override;
174 double U2DTD0(const int i_thread = 0) override;
175 double U2DTD1(const int i_thread = 0) override;
176 double U2DTD2(const int i_thread = 0) override;
177 double U2D0D0(const int i_thread = 0) override;
178 double U2D0D1(const int i_thread = 0) override;
179 double U2D0D2(const int i_thread = 0) override;
180 double U2D1D1(const int i_thread = 0) override;
181 double U2D1D2(const int i_thread = 0) override;
182 double U2D2D2(const int i_thread = 0) override;
183 
187 
188 
192 
196 
197 
201 
202 
204 
205 private:
206 
210 
214 
215 double mL;
216 double mU;
217 double mK;
218 double mOneOverL;
219 double mOmegaUOverL;
220 double mOmega;
221 std::vector<int> mCoordinatesAreUpToDate;
222 std::vector<double> mSinOmegaT;
223 std::vector<double> mCosOmegaT;
224 std::vector<double> mSinPiX0;
225 std::vector<double> mCosPiX0;
226 std::vector<double> mSinPiX1;
227 std::vector<double> mCosPiX1;
228 
232 
236 
237 
241 
242 
246 
247 
251 
254 
255 
257 
258 }; // Class CellularFlowField
259 
261 
264 
265 
269 
270 } // namespace Kratos.
271 
272 #endif // KRATOS_CELLULAR_FLOW_FIELD_H defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: cellular_flow_field.h:31
virtual std::string Info() const override
Turn back information as a stemplate<class T, std::size_t dim> tring.
Definition: cellular_flow_field.h:87
KRATOS_CLASS_POINTER_DEFINITION(CellularFlowField)
virtual ~CellularFlowField()
Destructor.
Definition: cellular_flow_field.h:59
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: cellular_flow_field.h:94
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: cellular_flow_field.h:100
CellularFlowField()
Default constructor.
Definition: cellular_flow_field.h:38
CellularFlowField(const double half_wavelength, const double max_flow_speed, const double oscillation_relative_amplitude, const double oscillation_angular_frequency)
Definition: cellular_flow_field.h:46
Definition: amatrix_interface.h:41
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
Definition: velocity_field.h:32
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