16#include <Tensors_Computation_VEF.h>
18#include <Domaine_VEF.h>
19#include <Domaine_Cl_VEF.h>
20#include <Champ_P1NC.h>
27 const DoubleTab& velocity,
28 DoubleTab& enstrophy)
const
33 DoubleTrav gradient_elem(nb_elem_tot, dimension, dimension);
39 antisym_loop_edge_faces_enstrophy(dom_VEF, dom_BC_VEF, gradient_elem, enstrophy);
42 antisym_loop_internal_faces_enstrophy(dom_VEF, gradient_elem, enstrophy);
48 const DoubleTab& gradient_elem,
49 DoubleTab& enstrophy)
const
51 for (
int n_edge = 0; n_edge < dom_VEF.
nb_front_Cl(); ++n_edge)
54 const Front_VF& the_edge = ref_cast(Front_VF, current_BC->frontiere_dis());
56 if (sub_type(Periodique, current_BC.valeur()))
57 antisym_loop_edges_periodiqueBC_enstrophy(dom_VEF, the_edge, gradient_elem, enstrophy);
59 antisym_loop_edges_general_enstrophy(dom_VEF, the_edge, gradient_elem, enstrophy);
65 const DoubleTab& tab_gradient_elem,
66 DoubleTab& tab_enstrophy)
const
68 const IntTab& tab_neighbour_face = dom_VEF.
face_voisins();
69 const DoubleVect& tab_volumes = dom_VEF.
volumes();
72 const int nend = nbegin + the_edge.
nb_faces();
75 CDoubleTabView3 gradient_elem = tab_gradient_elem.
view_ro<3>();
76 CDoubleArrView volumes = tab_volumes.view_ro();
77 CIntTabView neighbour_face = tab_neighbour_face.
view_ro();
78 DoubleArrView enstrophy =
static_cast<ArrOfDouble&
>(tab_enstrophy).view_wo();
79 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(nbegin, nend), KOKKOS_LAMBDA(
const int nface)
81 const int f0 = neighbour_face(nface, 0);
82 const int f1 = neighbour_face(nface, 1);
84 const double inv_vol = 1./(volumes(f0) + volumes(f1));
85 const double vol0 = volumes(f0)*inv_vol;
86 const double vol1 = volumes(f1)*inv_vol;
89 const double du_dy = vol0*gradient_elem(f0, 0, 1) + vol1*gradient_elem(f1, 0, 1);
90 const double dv_dx = vol0*gradient_elem(f0, 1, 0) + vol1*gradient_elem(f1, 1, 0);
92 double tmp = 0.5*((du_dy - dv_dx)*(du_dy - dv_dx) +
93 (dv_dx - du_dy)*(dv_dx - du_dy));
97 const double du_dz = vol0*gradient_elem(f0, 0, 2) + vol1*gradient_elem(f1, 0, 2);
98 const double dv_dz = vol0*gradient_elem(f0, 1, 2) + vol1*gradient_elem(f1, 1, 2);
99 const double dw_dx = vol0*gradient_elem(f0, 2, 0) + vol1*gradient_elem(f1, 2, 0);
100 const double dw_dy = vol0*gradient_elem(f0, 2, 1) + vol1*gradient_elem(f1, 2, 1);
102 tmp += 0.5*((du_dz - dw_dx)*(du_dz - dw_dx) +
103 (dv_dz - dw_dy)*(dv_dz - dw_dy) +
104 (dw_dx - du_dz)*(dw_dx - du_dz) +
105 (dw_dy - dv_dz)*(dw_dy - dv_dz));
108 enstrophy(nface) = Kokkos::sqrt(tmp);
110 end_gpu_timer(__KERNEL_NAME__);
116 const DoubleTab& tab_gradient_elem,
117 DoubleTab& tab_enstrophy)
const
119 const IntTab& tab_neighbour_face = dom_VEF.
face_voisins();
122 const int nend = nbegin + the_edge.
nb_faces();
126 CDoubleTabView3 gradient_elem = tab_gradient_elem.
view_ro<3>();
127 CIntTabView neighbour_face = tab_neighbour_face.
view_ro();
128 DoubleArrView enstrophy =
static_cast<ArrOfDouble&
>(tab_enstrophy).view_wo();
130 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(nbegin, nend), KOKKOS_LAMBDA(
const int nface)
132 const int f0 = neighbour_face(nface, 0);
135 const double du_dy = gradient_elem(f0, 0, 1);
136 const double dv_dx = gradient_elem(f0, 1, 0);
138 double tmp = 0.5*((du_dy - dv_dx)*(du_dy - dv_dx) +
139 (dv_dx - du_dy)*(dv_dx - du_dy));
143 const double du_dz = gradient_elem(f0, 0, 2);
144 const double dv_dz = gradient_elem(f0, 1, 2);
145 const double dw_dx = gradient_elem(f0, 2, 0);
146 const double dw_dy = gradient_elem(f0, 2, 1);
148 tmp += 0.5*((du_dz - dw_dx)*(du_dz - dw_dx) +
149 (dv_dz - dw_dy)*(dv_dz - dw_dy) +
150 (dw_dx - du_dz)*(dw_dx - du_dz) +
151 (dw_dy - dv_dz)*(dw_dy - dv_dz));
154 enstrophy(nface) = Kokkos::sqrt(tmp);
156 end_gpu_timer(__KERNEL_NAME__);
161 const DoubleTab& tab_grad_elem,
162 DoubleTab& tab_enstrophy)
const
164 const IntTab& tab_neighbour_face = dom_VEF.
face_voisins();
165 const DoubleVect& tab_volumes = dom_VEF.
volumes();
167 const int nb_faces = dom_VEF.
nb_faces();
171 CDoubleTabView3 grad_elem = tab_grad_elem.
view_ro<3>();
172 CDoubleArrView volumes = tab_volumes.view_ro();
173 CIntTabView neighbour_face = tab_neighbour_face.
view_ro();
174 DoubleArrView enstrophy =
static_cast<ArrOfDouble&
>(tab_enstrophy).view_wo();
176 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(first_internal_face, nb_faces), KOKKOS_LAMBDA(
const int nface)
178 const int f0 = neighbour_face(nface, 0);
179 const int f1 = neighbour_face(nface, 1);
181 const double inv_vol = 1./(volumes(f0) + volumes(f1));
182 const double vol0 = volumes(f0)*inv_vol;
183 const double vol1 = volumes(f1)*inv_vol;
186 const double du_dy = vol0*grad_elem(f0, 0, 1) + vol1*grad_elem(f1, 0, 1);
187 const double dv_dx = vol0*grad_elem(f0, 1, 0) + vol1*grad_elem(f1, 1, 0);
189 double tmp = 0.5*((du_dy - dv_dx)*(du_dy - dv_dx) +
190 (dv_dx - du_dy)*(dv_dx - du_dy));
194 const double du_dz = vol0*grad_elem(f0, 0, 2) + vol1*grad_elem(f1, 0, 2);
195 const double dv_dz = vol0*grad_elem(f0, 1, 2) + vol1*grad_elem(f1, 1, 2);
196 const double dw_dx = vol0*grad_elem(f0, 2, 0) + vol1*grad_elem(f1, 2, 0);
197 const double dw_dy = vol0*grad_elem(f0, 2, 1) + vol1*grad_elem(f1, 2, 1);
199 tmp += 0.5*((du_dz - dw_dx)*(du_dz - dw_dx) +
200 (dv_dz - dw_dy)*(dv_dz - dw_dy) +
201 (dw_dx - du_dz)*(dw_dx - du_dz) +
202 (dw_dy - dv_dz)*(dw_dy - dv_dz));
205 enstrophy(nface) = Kokkos::sqrt(tmp);
207 end_gpu_timer(__KERNEL_NAME__);
213 const DoubleTab& velocity,
214 DoubleTab& strain_invariant)
const
219 DoubleTrav gradient_elem(nb_elem_tot, dimension, dimension);
225 antisym_loop_edge_faces_strain_invariant(dom_VEF, dom_BC_VEF, gradient_elem, strain_invariant);
228 antisym_loop_internal_faces_strain_invariant(dom_VEF, gradient_elem, strain_invariant);
234 const DoubleTab& gradient_elem,
235 DoubleTab& strain_invariant)
const
237 for (
int n_edge = 0; n_edge < dom_VEF.
nb_front_Cl(); ++n_edge)
240 const Front_VF& the_edge = ref_cast(Front_VF, current_BC->frontiere_dis());
242 if (sub_type(Periodique, current_BC.valeur()))
243 antisym_loop_edges_periodiqueBC_strain_invariant(dom_VEF, the_edge, gradient_elem, strain_invariant);
245 antisym_loop_edges_general_strain_invariant(dom_VEF, the_edge, gradient_elem, strain_invariant);
251 const DoubleTab& tab_gradient_elem,
252 DoubleTab& tab_strain_invariant)
const
254 const IntTab& tab_neighbour_face = dom_VEF.
face_voisins();
255 const DoubleVect& tab_volumes = dom_VEF.
volumes();
258 const int nend = nbegin + the_edge.
nb_faces();
261 CDoubleTabView3 gradient_elem = tab_gradient_elem.
view_ro<3>();
262 CDoubleArrView volumes = tab_volumes.view_ro();
263 CIntTabView neighbour_face = tab_neighbour_face.
view_ro();
264 DoubleArrView strain_invariant =
static_cast<ArrOfDouble&
>(tab_strain_invariant).view_wo();
265 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(nbegin, nend), KOKKOS_LAMBDA(
const int nface)
267 const int f0 = neighbour_face(nface, 0);
268 const int f1 = neighbour_face(nface, 1);
270 const double inv_vol = 1./(volumes(f0) + volumes(f1));
271 const double vol0 = volumes(f0)*inv_vol;
272 const double vol1 = volumes(f1)*inv_vol;
275 const double du_dx = vol0*gradient_elem(f0, 0, 0) + vol1*gradient_elem(f1, 0, 0);
276 const double du_dy = vol0*gradient_elem(f0, 0, 1) + vol1*gradient_elem(f1, 0, 1);
277 const double dv_dx = vol0*gradient_elem(f0, 1, 0) + vol1*gradient_elem(f1, 1, 0);
278 const double dv_dy = vol0*gradient_elem(f0, 1, 1) + vol1*gradient_elem(f1, 1, 1);
280 double SijSij = du_dx*du_dx
281 +0.5*(du_dy+dv_dx)*(du_dy+dv_dx)
286 const double du_dz = vol0*gradient_elem(f0, 0, 2) + vol1*gradient_elem(f1, 0, 2);
287 const double dv_dz = vol0*gradient_elem(f0, 1, 2) + vol1*gradient_elem(f1, 1, 2);
288 const double dw_dx = vol0*gradient_elem(f0, 2, 0) + vol1*gradient_elem(f1, 2, 0);
289 const double dw_dy = vol0*gradient_elem(f0, 2, 1) + vol1*gradient_elem(f1, 2, 1);
290 const double dw_dz = vol0*gradient_elem(f0, 2, 2) + vol1*gradient_elem(f1, 2, 2);
292 SijSij += 0.5*(du_dz+dw_dx)*(du_dz+dw_dx)
293 + 0.5*(dv_dz+dw_dy)*(dv_dz+dw_dy)
297 strain_invariant(nface) = Kokkos::sqrt(2*SijSij);
299 end_gpu_timer(__KERNEL_NAME__);
305 const DoubleTab& tab_gradient_elem,
306 DoubleTab& tab_strain_invariant)
const
308 const IntTab& tab_neighbour_face = dom_VEF.
face_voisins();
311 const int nend = nbegin + the_edge.
nb_faces();
314 CDoubleTabView3 gradient_elem = tab_gradient_elem.
view_ro<3>();
315 CIntTabView neighbour_face = tab_neighbour_face.
view_ro();
316 DoubleArrView strain_invariant =
static_cast<ArrOfDouble&
>(tab_strain_invariant).view_wo();
317 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(nbegin, nend), KOKKOS_LAMBDA(
const int nface)
319 const int f0 = neighbour_face(nface, 0);
322 const double du_dx = gradient_elem(f0, 0, 0);
323 const double du_dy = gradient_elem(f0, 0, 1);
324 const double dv_dx = gradient_elem(f0, 1, 0);
325 const double dv_dy = gradient_elem(f0, 1, 1);
327 double SijSij = du_dx*du_dx
328 +0.5*(du_dy+dv_dx)*(du_dy+dv_dx)
333 const double du_dz = gradient_elem(f0, 0, 2);
334 const double dv_dz = gradient_elem(f0, 1, 2);
335 const double dw_dx = gradient_elem(f0, 2, 0);
336 const double dw_dy = gradient_elem(f0, 2, 1);
337 const double dw_dz = gradient_elem(f0, 2, 2);
339 SijSij += 0.5*(du_dz+dw_dx)*(du_dz+dw_dx)
340 + 0.5*(dv_dz+dw_dy)*(dv_dz+dw_dy)
344 strain_invariant(nface) = Kokkos::sqrt(2*SijSij);
346 end_gpu_timer(__KERNEL_NAME__);
351 const DoubleTab& tab_grad_elem,
352 DoubleTab& tab_strain_invariant)
const
354 const IntTab& tab_neighbour_face = dom_VEF.
face_voisins();
355 const DoubleVect& tab_volumes = dom_VEF.
volumes();
357 const int nb_faces = dom_VEF.
nb_faces();
360 CDoubleTabView3 grad_elem = tab_grad_elem.
view_ro<3>();
361 CDoubleArrView volumes = tab_volumes.view_ro();
362 CIntTabView neighbour_face = tab_neighbour_face.
view_ro();
363 DoubleArrView strain_invariant =
static_cast<ArrOfDouble&
>(tab_strain_invariant).view_wo();
364 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(first_internal_face, nb_faces), KOKKOS_LAMBDA(
const int nface)
366 const int f0 = neighbour_face(nface, 0);
367 const int f1 = neighbour_face(nface, 1);
369 const double inv_vol = 1./(volumes(f0) + volumes(f1));
370 const double vol0 = volumes(f0)*inv_vol;
371 const double vol1 = volumes(f1)*inv_vol;
374 const double du_dx = vol0*grad_elem(f0, 0, 0) + vol1*grad_elem(f1, 0, 0);
375 const double du_dy = vol0*grad_elem(f0, 0, 1) + vol1*grad_elem(f1, 0, 1);
376 const double dv_dx = vol0*grad_elem(f0, 1, 0) + vol1*grad_elem(f1, 1, 0);
377 const double dv_dy = vol0*grad_elem(f0, 1, 1) + vol1*grad_elem(f1, 1, 1);
379 double SijSij = du_dx*du_dx
380 +0.5*(du_dy+dv_dx)*(du_dy+dv_dx)
385 const double du_dz = vol0*grad_elem(f0, 0, 2) + vol1*grad_elem(f1, 0, 2);
386 const double dv_dz = vol0*grad_elem(f0, 1, 2) + vol1*grad_elem(f1, 1, 2);
387 const double dw_dx = vol0*grad_elem(f0, 2, 0) + vol1*grad_elem(f1, 2, 0);
388 const double dw_dy = vol0*grad_elem(f0, 2, 1) + vol1*grad_elem(f1, 2, 1);
389 const double dw_dz = vol0*grad_elem(f0, 2, 2) + vol1*grad_elem(f1, 2, 2);
391 SijSij += 0.5*(du_dz+dw_dx)*(du_dz+dw_dx)
392 + 0.5*(dv_dz+dw_dy)*(dv_dz+dw_dy)
396 strain_invariant(nface) = Kokkos::sqrt(2*SijSij);
398 end_gpu_timer(__KERNEL_NAME__);
static DoubleTab & calcul_gradient(const DoubleTab &, DoubleTab &, const Domaine_Cl_VEF &)
const Cond_lim & les_conditions_limites(int) const
Renvoie la i-ieme condition aux limites.
int nb_faces() const
renvoie le nombre global de faces.
double volumes(int i) const
int premiere_face_int() const
une face est interne ssi elle separe deux elements.
int face_voisins(int num_face, int i) const
renvoie l'element voisin de numface dans la direction i.
int num_premiere_face() const
std::enable_if_t< is_default_exec_space< EXEC_SPACE >, ConstView< _TYPE_, _SHAPE_ > > view_ro() const
void compute_enstrophy(const Domaine_VEF &, const Domaine_Cl_VEF &, const DoubleTab &velocity, DoubleTab &enstrophy) const
void antisym_loop_internal_faces_strain_invariant(const Domaine_VEF &dom_VEF, const DoubleTab &gradient_elem, DoubleTab &strain_invariant) const
void antisym_loop_edges_general_enstrophy(const Domaine_VEF &dom_VEF, const Front_VF &the_edge, const DoubleTab &gradient_elem, DoubleTab &enstrophy) const
void antisym_loop_internal_faces_enstrophy(const Domaine_VEF &dom_VEF, const DoubleTab &gradient_elem, DoubleTab &enstrophy) const
void compute_strain_invariant(const Domaine_VEF &, const Domaine_Cl_VEF &, const DoubleTab &velocity, DoubleTab &strain_invariant) const
void antisym_loop_edges_periodiqueBC_strain_invariant(const Domaine_VEF &dom_VEF, const Front_VF &the_edge, const DoubleTab &gradient_elem, DoubleTab &strain_invariant) const
void antisym_loop_edge_faces_enstrophy(const Domaine_VEF &dom_VEF, const Domaine_Cl_VEF &dom_BC_VEF, const DoubleTab &gradient_elem, DoubleTab &enstrophy) const
void antisym_loop_edges_periodiqueBC_enstrophy(const Domaine_VEF &dom_VEF, const Front_VF &the_edge, const DoubleTab &gradient_elem, DoubleTab &enstrophy) const
void antisym_loop_edge_faces_strain_invariant(const Domaine_VEF &dom_VEF, const Domaine_Cl_VEF &dom_BC_VEF, const DoubleTab &gradient_elem, DoubleTab &strain_invariant) const
void antisym_loop_edges_general_strain_invariant(const Domaine_VEF &dom_VEF, const Front_VF &the_edge, const DoubleTab &gradient_elem, DoubleTab &strain_invariant) const