Newer
Older

Jan Schäfer
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/***************************************************************************
NavierStokesEnergyOperatorRightHandSide.h - description
-------------------
begin : Feb 17, 2017
copyright : (C) 2017 by Tomas Oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/* See Copyright Notice in tnl/Copyright */
#pragma once
#include <TNL/Containers/Vector.h>
#include <TNL/Meshes/Grid.h>
namespace TNL {
template< typename Mesh,
typename Real = typename Mesh::RealType,
typename Index = typename Mesh::IndexType >
class NavierStokesEnergyRightHandSideBase
{
public:
typedef Real RealType;
typedef Index IndexType;
typedef Mesh MeshType;
typedef typename MeshType::DeviceType DeviceType;
typedef typename MeshType::CoordinatesType CoordinatesType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
typedef Pointers::SharedPointer< VelocityFieldType > VelocityFieldPointer;
NavierStokesEnergyRightHandSideBase()
: dynamicalViscosity( 1.0 ){};
static String getType()
{
return String( "LaxFridrichsEnergy< " ) +
MeshType::getType() + ", " +
TNL::getType< Real >() + ", " +
TNL::getType< Index >() + " >";
}
void setVelocity( const VelocityFieldPointer& velocity )
{
this->velocity = velocity;
}
void setDynamicalViscosity( const RealType& dynamicalViscosity )
{
this->dynamicalViscosity = dynamicalViscosity;
}
protected:
VelocityFieldPointer velocity;
RealType dynamicalViscosity;
};
template< typename Mesh,
typename Real = typename Mesh::RealType,
typename Index = typename Mesh::IndexType >
class NavierStokesEnergyRightHandSide
{
};
template< typename MeshReal,
typename Device,
typename MeshIndex,
typename Real,
typename Index >
class NavierStokesEnergyRightHandSide< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
: public NavierStokesEnergyRightHandSideBase< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
{
public:
typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
typedef NavierStokesEnergyRightHandSideBase< MeshType, Real, Index > BaseType;
using typename BaseType::RealType;
using typename BaseType::IndexType;
using typename BaseType::DeviceType;
using typename BaseType::CoordinatesType;
using typename BaseType::MeshFunctionType;
using typename BaseType::MeshFunctionPointer;
using typename BaseType::VelocityFieldType;
using typename BaseType::VelocityFieldPointer;
using BaseType::Dimensions;
template< typename MeshFunction, typename MeshEntity >
__cuda_callable__
Real operator()( const MeshFunction& e,
const MeshEntity& entity,
const RealType& time = 0.0 ) const
{
static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." );
static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" );
const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();
const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >();
const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2 >();
const IndexType& center = entity.getIndex();
const IndexType& east = neighborEntities.template getEntityIndex< 1 >();
const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
const RealType& velocity_x_east = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ east ];
const RealType& velocity_x_west = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ west ];
const RealType& velocity_x_center = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ center ];
return
// 1D uT_11_x
4.0 / 3.0 * ( velocity_x_east * velocity_x_center - velocity_x_center * velocity_x_west
- velocity_x_center * velocity_x_center + velocity_x_west * velocity_x_west
) * hxSquareInverse / 4
* this->dynamicalViscosity;
}
/*template< typename MeshEntity >
__cuda_callable__
Index getLinearSystemRowLength( const MeshType& mesh,
const IndexType& index,
const MeshEntity& entity ) const;
template< typename MeshEntity, typename Vector, typename MatrixRow >
__cuda_callable__
void updateLinearSystem( const RealType& time,
const RealType& tau,
const MeshType& mesh,
const IndexType& index,
const MeshEntity& entity,
const MeshFunctionType& u,
Vector& b,
MatrixRow& matrixRow ) const;*/
};
template< typename MeshReal,
typename Device,
typename MeshIndex,
typename Real,
typename Index >
class NavierStokesEnergyRightHandSide< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
: public NavierStokesEnergyRightHandSideBase< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
{
public:
typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
typedef NavierStokesEnergyRightHandSideBase< MeshType, Real, Index > BaseType;
using typename BaseType::RealType;
using typename BaseType::IndexType;
using typename BaseType::DeviceType;
using typename BaseType::CoordinatesType;
using typename BaseType::MeshFunctionType;
using typename BaseType::MeshFunctionPointer;
using typename BaseType::VelocityFieldType;
using typename BaseType::VelocityFieldPointer;
using BaseType::Dimensions;
template< typename MeshFunction, typename MeshEntity >
__cuda_callable__
Real operator()( const MeshFunction& e,
const MeshEntity& entity,
const RealType& time = 0.0 ) const
{
static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." );
static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" );
const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >();
const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >();
const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >();
const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >();
const IndexType& center = entity.getIndex();
const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >();
const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >();
const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >();
const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >();
const IndexType& southEast = neighborEntities.template getEntityIndex< 1, -1 >();
const IndexType& southWest = neighborEntities.template getEntityIndex< -1, -1 >();
const IndexType& northEast = neighborEntities.template getEntityIndex< 1, 1 >();
const IndexType& northWest = neighborEntities.template getEntityIndex< -1, 1 >();
const RealType& velocity_x_north = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ north ];
const RealType& velocity_x_south = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ south ];
const RealType& velocity_x_east = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ east ];
const RealType& velocity_x_west = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ west ];
const RealType& velocity_x_center = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ center ];
const RealType& velocity_x_southEast = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ southEast ];
const RealType& velocity_x_southWest = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ southWest ];
const RealType& velocity_x_northEast = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ northEast ];
const RealType& velocity_x_northWest = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ northWest ];
const RealType& velocity_y_north = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ north ];
const RealType& velocity_y_south = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ south ];
const RealType& velocity_y_east = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ east ];
const RealType& velocity_y_west = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ west ];
const RealType& velocity_y_center = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ center ];
const RealType& velocity_y_southEast = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ southEast ];
const RealType& velocity_y_southWest = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ southWest ];
const RealType& velocity_y_northEast = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ northEast ];
const RealType& velocity_y_northWest = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ northWest ];
return
// 2D uT_11_x
( 4.0 / 3.0 * ( velocity_x_east * velocity_x_center - velocity_x_center * velocity_x_west
- velocity_x_center * velocity_x_center + velocity_x_west * velocity_x_west
) * hxSquareInverse
- 2.0 / 3.0 * ( velocity_y_northEast * velocity_x_east - velocity_y_southEast * velocity_x_east
- velocity_y_northWest * velocity_x_west + velocity_y_southWest * velocity_x_west
) * hxInverse * hyInverse / 4
) * this->dynamicalViscosity
// vT_12_x
+ ( ( velocity_x_northEast * velocity_y_east - velocity_x_southEast * velocity_y_east
- velocity_x_northWest * velocity_y_west + velocity_x_southWest * velocity_y_west

Jan Schäfer
committed
) * hxInverse * hyInverse / 4
+ ( velocity_y_east * velocity_y_center - velocity_y_center * velocity_y_west
- velocity_y_center * velocity_y_center + velocity_y_west * velocity_y_west

Jan Schäfer
committed
) * hxSquareInverse
) * this->dynamicalViscosity
// uT_21_y
+ ( ( velocity_y_northEast * velocity_x_north - velocity_y_southEast * velocity_x_south
- velocity_y_northWest * velocity_x_north + velocity_y_southWest * velocity_x_south

Jan Schäfer
committed
) * hxInverse * hyInverse / 4
+ ( velocity_x_north * velocity_x_center - velocity_x_center * velocity_x_south
- velocity_x_center * velocity_x_center + velocity_x_south * velocity_x_south

Jan Schäfer
committed
) * hySquareInverse
) * this->dynamicalViscosity
// 2D vT_22_y
+ ( 4.0 / 3.0 * ( velocity_y_north * velocity_y_center - velocity_y_center * velocity_y_south
- velocity_y_center * velocity_y_center + velocity_y_south * velocity_y_south
) * hySquareInverse
- 2.0 / 3.0 * ( velocity_x_northEast * velocity_y_north - velocity_x_southEast * velocity_y_south
- velocity_x_northWest * velocity_y_north + velocity_x_southWest * velocity_y_south

Jan Schäfer
committed
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
) * hxInverse * hyInverse / 4
) * this->dynamicalViscosity;
}
/*template< typename MeshEntity >
__cuda_callable__
Index getLinearSystemRowLength( const MeshType& mesh,
const IndexType& index,
const MeshEntity& entity ) const;
template< typename MeshEntity, typename Vector, typename MatrixRow >
__cuda_callable__
void updateLinearSystem( const RealType& time,
const RealType& tau,
const MeshType& mesh,
const IndexType& index,
const MeshEntity& entity,
const MeshFunctionType& u,
Vector& b,
MatrixRow& matrixRow ) const;*/
};
template< typename MeshReal,
typename Device,
typename MeshIndex,
typename Real,
typename Index >
class NavierStokesEnergyRightHandSide< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
: public NavierStokesEnergyRightHandSideBase< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
{
public:
typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
typedef NavierStokesEnergyRightHandSideBase< MeshType, Real, Index > BaseType;
using typename BaseType::RealType;
using typename BaseType::IndexType;
using typename BaseType::DeviceType;
using typename BaseType::CoordinatesType;
using typename BaseType::MeshFunctionType;
using typename BaseType::MeshFunctionPointer;
using typename BaseType::VelocityFieldType;
using typename BaseType::VelocityFieldPointer;
using BaseType::Dimensions;
template< typename MeshFunction, typename MeshEntity >
__cuda_callable__
Real operator()( const MeshFunction& e,
const MeshEntity& entity,
const RealType& time = 0.0 ) const
{
static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." );
static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" );
const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >();
const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >();
const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >();
const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >();
const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >();
const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >();
const IndexType& center = entity.getIndex();
const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >();
const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >();
const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >();
const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >();
const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >();
const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >();
const IndexType& northWest = neighborEntities.template getEntityIndex< -1, 1, 0 >();
const IndexType& northEast = neighborEntities.template getEntityIndex< 1, 1, 0 >();
const IndexType& southWest = neighborEntities.template getEntityIndex< -1, -1, 0 >();
const IndexType& southEast = neighborEntities.template getEntityIndex< 1, -1, 0 >();
const IndexType& upWest = neighborEntities.template getEntityIndex< -1, 0, 1 >();
const IndexType& upEast = neighborEntities.template getEntityIndex< 1, 0, 1 >();
const IndexType& upSouth = neighborEntities.template getEntityIndex< 0, -1, 1 >();
const IndexType& upNorth = neighborEntities.template getEntityIndex< 0, 1, 1 >();
const IndexType& downWest = neighborEntities.template getEntityIndex< -1, 0, -1 >();
const IndexType& downEast = neighborEntities.template getEntityIndex< 1, 0, -1 >();
const IndexType& downSouth = neighborEntities.template getEntityIndex< 0, -1, -1 >();
const IndexType& downNorth = neighborEntities.template getEntityIndex< 0, 1, -1 >();
const RealType& velocity_x_north = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ north ];
const RealType& velocity_x_south = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ south ];
const RealType& velocity_x_east = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ east ];
const RealType& velocity_x_west = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ west ];
const RealType& velocity_x_up = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ up ];
const RealType& velocity_x_down = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ down ];
const RealType& velocity_x_center = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ center ];
const RealType& velocity_x_northWest = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ northWest ];
const RealType& velocity_x_northEast = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ northEast ];
const RealType& velocity_x_southWest = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ southWest ];
const RealType& velocity_x_southEast = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ southEast ];
const RealType& velocity_x_upWest = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ upWest ];
const RealType& velocity_x_downWest = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ downWest ];
const RealType& velocity_x_upEast = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ upEast ];
const RealType& velocity_x_downEast = this->velocity.template getData< TNL::Devices::Host >()[ 0 ].template getData< DeviceType >()[ downEast ];
const RealType& velocity_y_north = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ north ];
const RealType& velocity_y_south = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ south ];
const RealType& velocity_y_east = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ east ];
const RealType& velocity_y_west = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ west ];
const RealType& velocity_y_up = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ up ];
const RealType& velocity_y_down = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ down ];
const RealType& velocity_y_center = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ center ];
const RealType& velocity_y_northWest = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ northWest ];
const RealType& velocity_y_northEast = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ northEast ];
const RealType& velocity_y_southWest = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ southWest ];
const RealType& velocity_y_southEast = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ southEast ];
const RealType& velocity_y_upNorth = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ upNorth ];
const RealType& velocity_y_upSouth = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ upSouth ];
const RealType& velocity_y_downNorth = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ downNorth ];
const RealType& velocity_y_downSouth = this->velocity.template getData< TNL::Devices::Host >()[ 1 ].template getData< DeviceType >()[ downSouth ];
const RealType& velocity_z_north = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ north ];
const RealType& velocity_z_south = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ south ];
const RealType& velocity_z_east = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ east ];
const RealType& velocity_z_west = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ west ];
const RealType& velocity_z_up = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ up ];
const RealType& velocity_z_down = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ down ];
const RealType& velocity_z_center = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ center ];
const RealType& velocity_z_upWest = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ upWest ];
const RealType& velocity_z_upEast = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ upEast ];
const RealType& velocity_z_upNorth = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ upNorth ];
const RealType& velocity_z_upSouth = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ upSouth ];
const RealType& velocity_z_downWest = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ downWest ];
const RealType& velocity_z_downEast = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ downEast ];
const RealType& velocity_z_downNorth = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ downNorth ];
const RealType& velocity_z_downSouth = this->velocity.template getData< TNL::Devices::Host >()[ 2 ].template getData< DeviceType >()[ downSouth ];
return
// 3D uT_11_x
( 4.0 / 3.0 * ( velocity_x_east * velocity_x_center - velocity_x_center * velocity_x_west
- velocity_x_center * velocity_x_center + velocity_x_west * velocity_x_west
) * hxSquareInverse
- 2.0 / 3.0 * ( velocity_y_northEast * velocity_x_east - velocity_y_southEast * velocity_x_east
- velocity_y_northWest * velocity_x_west + velocity_y_southWest * velocity_x_west
) * hxInverse * hyInverse / 4
- 2.0 / 3.0 * ( velocity_z_upEast * velocity_x_east - velocity_z_downEast * velocity_x_east
- velocity_z_upWest * velocity_x_west + velocity_z_downWest * velocity_x_west
) * hxInverse * hzInverse / 4
) * this->dynamicalViscosity
// vT_12_x
+ ( ( velocity_x_northEast * velocity_y_east - velocity_x_southEast * velocity_y_east
- velocity_x_northWest * velocity_y_west + velocity_x_southWest * velocity_y_west

Jan Schäfer
committed
) * hxInverse * hyInverse / 4
+ ( velocity_y_east * velocity_y_center - velocity_y_center * velocity_y_west
- velocity_y_center * velocity_y_center + velocity_y_west * velocity_y_west

Jan Schäfer
committed
) * hxSquareInverse
) * this->dynamicalViscosity
// wT_13_x
+ ( ( velocity_x_upEast * velocity_z_east - velocity_x_downEast * velocity_z_east
- velocity_x_upWest * velocity_z_west + velocity_x_downWest * velocity_z_west

Jan Schäfer
committed
) * hxInverse * hzInverse / 4
+ ( velocity_z_east * velocity_z_center - velocity_z_center * velocity_z_west
- velocity_z_center * velocity_z_center + velocity_z_west * velocity_z_west

Jan Schäfer
committed
) * hxSquareInverse
) * this->dynamicalViscosity
// uT_21_y
+ ( ( velocity_y_northEast * velocity_x_north - velocity_y_southEast * velocity_x_south
- velocity_y_northWest * velocity_x_north + velocity_y_southWest * velocity_x_south

Jan Schäfer
committed
) * hxInverse * hyInverse / 4
+ ( velocity_x_north * velocity_x_center - velocity_x_center * velocity_x_south
+ velocity_x_center * velocity_x_center + velocity_x_south * velocity_x_south

Jan Schäfer
committed
) * hySquareInverse
) * this->dynamicalViscosity
// 3D vT_22_y
+ ( 4.0 / 3.0 * ( velocity_y_north * velocity_y_center - velocity_y_center * velocity_y_south
- velocity_y_center * velocity_y_center + velocity_y_south * velocity_y_south
) * hySquareInverse
- 2.0 / 3.0 * ( velocity_x_northEast * velocity_y_north - velocity_x_southEast * velocity_y_south
- velocity_x_northWest * velocity_y_north + velocity_x_southWest * velocity_y_south
) * hxInverse * hyInverse / 4
- 2.0 / 3.0 * ( velocity_z_upNorth * velocity_y_north - velocity_z_downNorth * velocity_y_north
- velocity_z_upSouth * velocity_y_south + velocity_z_downSouth * velocity_y_south
) * hyInverse * hzInverse / 4
) * this->dynamicalViscosity
// wT_23_y
+ ( ( velocity_y_upNorth * velocity_z_north - velocity_y_downNorth * velocity_y_north
- velocity_y_upSouth * velocity_z_south + velocity_y_downSouth * velocity_z_south

Jan Schäfer
committed
) * hyInverse * hzInverse / 4
+ ( velocity_z_north * velocity_z_center - velocity_z_center * velocity_z_south
- velocity_z_center * velocity_z_center + velocity_z_south * velocity_z_south

Jan Schäfer
committed
) * hySquareInverse
) * this->dynamicalViscosity
// uT_31_z
+ ( ( velocity_x_up * velocity_x_center - velocity_x_center * velocity_x_center
- velocity_x_center * velocity_x_down + velocity_x_down * velocity_x_down

Jan Schäfer
committed
) * hzSquareInverse
+ ( velocity_z_upEast * velocity_x_up - velocity_z_downEast * velocity_x_down
- velocity_z_upWest * velocity_x_up + velocity_z_downWest * velocity_x_down

Jan Schäfer
committed
) * hxInverse * hzInverse / 4
) * this->dynamicalViscosity
// T_32_z
+ ( ( velocity_z_upNorth * velocity_y_up - velocity_z_downNorth * velocity_y_down
- velocity_z_upSouth * velocity_y_up + velocity_z_downSouth * velocity_y_down

Jan Schäfer
committed
) * hyInverse * hzInverse / 4
+ ( velocity_x_up * velocity_y_center - velocity_x_center * velocity_y_down
- velocity_x_center * velocity_y_center + velocity_x_down * velocity_y_down

Jan Schäfer
committed
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
) * hzSquareInverse
) * this->dynamicalViscosity
// 3D T_33_z
+ ( 4.0 / 3.0 * ( velocity_z_up * velocity_z_center - velocity_z_center * velocity_z_down
- velocity_z_center * velocity_z_center + velocity_z_down * velocity_z_down
) * hzSquareInverse
- 2.0 / 3.0 * ( velocity_y_upNorth * velocity_z_up - velocity_y_downNorth * velocity_z_down
- velocity_y_upSouth * velocity_z_up + velocity_y_downSouth * velocity_z_down
) * hyInverse * hzInverse / 4
- 2.0 / 3.0 * ( velocity_x_upEast * velocity_z_up - velocity_x_downEast * velocity_z_down
- velocity_x_upWest * velocity_z_up + velocity_x_downWest * velocity_z_down
) * hxInverse * hzInverse / 4
) * this->dynamicalViscosity;
}
/*template< typename MeshEntity >
__cuda_callable__
Index getLinearSystemRowLength( const MeshType& mesh,
const IndexType& index,
const MeshEntity& entity ) const;
template< typename MeshEntity, typename Vector, typename MatrixRow >
__cuda_callable__
void updateLinearSystem( const RealType& time,
const RealType& tau,
const MeshType& mesh,
const IndexType& index,
const MeshEntity& entity,
const MeshFunctionType& u,
Vector& b,
MatrixRow& matrixRow ) const;*/
};
} //namespace TNL