77 DoubleTab& tab_resu, DoubleTab& tab_flux_bords,
82 int nb_faces = domaine_VEF.
nb_faces();
88 CIntTabView elem_faces = domaine_VEF.
elem_faces().view_ro();
89 CIntTabView face_voisins = domaine_VEF.
face_voisins().view_ro();
90 CDoubleTabView face_normale = domaine_VEF.
face_normales().view_ro();
91 CDoubleArrView inverse_volumes = domaine_VEF.
inverse_volumes().view_ro();
92 CDoubleTabView nu = tab_nu.
view_ro();
93 CDoubleTabView inconnue = tab_inconnue.
view_ro();
94 DoubleArrView
flux_bords =
static_cast<ArrOfDouble&
>(tab_flux_bords).view_rw();
95 DoubleArrView resu =
static_cast<ArrOfDouble&
>(tab_resu).view_rw();
97 for (
int n_bord = 0; n_bord < nb_bords; n_bord++)
103 int nb_faces_bord_reel = le_bord.
nb_faces();
104 CIntArrView le_bord_num_face = le_bord.
num_face().view_ro();
108 CIntArrView face_associee = la_cl_perio.
face_associee().view_ro();
109 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__),
110 Kokkos::RangePolicy<>(num1, nb_faces_bord_reel), KOKKOS_LAMBDA(
113 int num_face = le_bord_num_face(ind_face);
114 int fac_asso = face_associee(ind_face);
115 fac_asso = le_bord_num_face(fac_asso);
116 for (
int kk = 0; kk < 2; kk++)
118 int elem = face_voisins(num_face, kk);
119 for (
int i = 0; i < nb_faces_elem; i++)
121 int j = elem_faces(elem, i);
122 if (j > num_face && j != fac_asso)
124 double valA =
viscA(num_face, j, elem, nu(elem, 0), face_voisins, face_normale,
126 double flux = valA * (inconnue(j, 0) - inconnue(num_face, 0));
127 Kokkos::atomic_add(&resu(num_face), +flux);
129 Kokkos::atomic_add(&resu(j), -0.5 * flux);
134 end_gpu_timer(__KERNEL_NAME__);
141 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__),
142 Kokkos::RangePolicy<>(num1, num2), KOKKOS_LAMBDA(
145 int num_face = le_bord_num_face(ind_face);
146 int elem = face_voisins(num_face, 0);
147 for (
int i = 0; i < nb_faces_elem; i++)
149 int j = elem_faces(elem, i);
150 if (j > num_face || num_face >= nb_faces)
152 double valA =
viscA(num_face, j, elem, nu(elem, 0), face_voisins, face_normale,
154 double flux = valA * (inconnue(j, 0) - inconnue(num_face, 0));
155 if (num_face < nb_faces)
157 Kokkos::atomic_add(&resu(num_face), +flux);
158 Kokkos::atomic_add(&
flux_bords(num_face), -flux);
162 Kokkos::atomic_add(&resu(j), -flux);
163 if (j < premiere_face_int)
169 end_gpu_timer(__KERNEL_NAME__);
174 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__),
175 Kokkos::MDRangePolicy<Kokkos::Rank<2>>({premiere_face_int, 0}, {nb_faces, 2}),
176 KOKKOS_LAMBDA(
const int num_face,
const int k)
178 int elem = face_voisins(num_face, k);
179 for (
int i = 0; i < nb_faces_elem; i++)
181 int j = elem_faces(elem, i);
188 int el1 = face_voisins(j, 0);
189 int el2 = face_voisins(j, 1);
190 if ((el1 == -1) || (el2 == -1))
196 double valA =
viscA(num_face, j, elem, nu(elem, 0), face_voisins,
197 face_normale, inverse_volumes);
198 double flux = valA * (inconnue(j, 0) - inconnue(num_face, 0));
199 Kokkos::atomic_add(&resu(num_face), flux);
201 Kokkos::atomic_add(&resu(j), -flux);
206 end_gpu_timer(__KERNEL_NAME__);
210 for (
int n_bord=0; n_bord<nb_bords; n_bord++)
215 int nfin = ndeb + le_bord.
nb_faces();
219 CDoubleArrView surface = domaine_VEF.
face_surfaces().view_ro();
220 CDoubleTabView flux_impose = la_cl_paroi.
flux_impose().view_ro();
221 DoubleArrView
flux_bords =
static_cast<ArrOfDouble&
>(tab_flux_bords).view_rw();
222 DoubleArrView resu =
static_cast<ArrOfDouble&
>(tab_resu).view_rw();
223 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(ndeb, nfin), KOKKOS_LAMBDA(
const int face)
225 double flux = flux_impose(face-ndeb, 0) * surface(face);
229 end_gpu_timer(__KERNEL_NAME__);
234 const double coeff = COEFF_STEFAN_BOLTZMANN;
236 CDoubleArrView surface = domaine_VEF.
face_surfaces().view_ro();
237 CDoubleArrView text =
static_cast<const ArrOfDouble&
>(la_cl_paroi.
tab_T_ext()).view_ro();
238 CDoubleArrView himp =
static_cast<const ArrOfDouble&
>(la_cl_paroi.
tab_h_imp()).view_ro();
240 if (has_emissivity) eps =
static_cast<const ArrOfDouble&
>(la_cl_paroi.
tab_emissivite()).view_ro();
241 CDoubleArrView inconnue =
static_cast<const ArrOfDouble&
>(tab_inconnue).view_ro();
242 DoubleArrView resu =
static_cast<ArrOfDouble&
>(tab_resu).view_rw();
243 DoubleArrView
flux_bords =
static_cast<ArrOfDouble&
>(tab_flux_bords).view_wo();
244 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(ndeb, nfin), KOKKOS_LAMBDA (
const int face)
246 int ind_face = face - ndeb;
247 double flux = himp(ind_face)*(text(ind_face)-inconnue(face))*surface(face);
253 double T = inconnue(face);
254 double t_ext = text(ind_face);
255 flux = coeff * eps(ind_face) * (t_ext * t_ext * t_ext * t_ext - T * T * T * T) * surface(face);
260 end_gpu_timer(__KERNEL_NAME__);
264 ToDo_Kokkos(
"critical");
267 for (
int face=ndeb; face<nfin; face++)
269 double h=la_cl_paroi.
h_imp(face-ndeb);
270 double Text=la_cl_paroi.
T_ext(face-ndeb);
272 double flux=(phiext+h*(Text-tab_inconnue(face)))*surface(face);
273 tab_resu[face] += flux;
274 tab_flux_bords(face) = flux;
278 || sub_type(
Symetrie,la_cl.valeur())
281 DoubleArrView
flux_bords =
static_cast<ArrOfDouble&
>(tab_flux_bords).view_wo();
282 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(ndeb, nfin), KOKKOS_LAMBDA(
const int face)
286 end_gpu_timer(__KERNEL_NAME__);
292 DoubleTab& resu, DoubleTab& tab_flux_bords,
301 if(!
grad_.get_md_vector())
336 int nb_faces = domaine_VEF.
nb_faces();
338 CIntTabView face_voisins_v = domaine_VEF.
face_voisins().view_ro();
339 CDoubleTabView face_normales_v = domaine_VEF.
face_normales().view_ro();
340 CDoubleTabView nu_v = nu.
view_ro();
341 CDoubleTabView3 grad_v =
grad_.view_ro<3>();
342 DoubleTabView resu_v = resu.
view_rw();
343 DoubleTabView tab_flux_bords_v = tab_flux_bords.
view_rw();
345 auto kern_ajouter = KOKKOS_LAMBDA(
int
348 int elem = face_voisins_v(num_face, k);
352 double nu_elem = nu_v(elem, 0);
353 for (
int i = 0; i < nb_comp; i++)
354 for (
int j = 0; j < nb_comp; j++)
356 double grad_ij = grad_v(elem, i, j);
357 double grad_ji = grad_v(elem, j, i);
358 double fn = face_normales_v(num_face, j);
359 double flux = ori * fn * (nu_elem * grad_ij );
360 Kokkos::atomic_sub(&resu_v(num_face, i), flux);
362 if (num_face < nb_faces_bord)
364 double flux_bord = ori * fn * (nu_elem * (grad_ij + grad_ji));
365 Kokkos::atomic_sub(&tab_flux_bords_v(num_face, i), flux_bord);
370 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::MDRangePolicy<Kokkos::Rank<2>>({0,0}, {nb_faces,2}) , kern_ajouter);
371 end_gpu_timer(__KERNEL_NAME__);
375 for (
int n_bord=0; n_bord<nb_bords; n_bord++)
379 if (sub_type(
Symetrie,la_cl.valeur()))
383 int nfin = ndeb + le_bord.
nb_faces();
385 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(ndeb, nfin), KOKKOS_LAMBDA(
const int face)
389 end_gpu_timer(__KERNEL_NAME__);
392 else if (sub_type(
Robin_VEF, la_cl.valeur()))
395 Cerr <<
"Warning not tested on GPU" << finl;
397 ToDo_Kokkos(
"critical");
403 double scale_factor_is_one = 1.;
407 DoubleTab normal_vector;
409 int nfin = ndeb +le_bord.
nb_faces();
410 for (
int face=ndeb; face<nfin; face++)
412 int id_face_bord = face -ndeb;
416 for (
int nc1=0; nc1<nb_comp; nc1++)
418 double flux_robin_uu = 0. ;
419 double flux_robin_rhs = 0.;
423 for (
int nc2 = 0; nc2<nb_comp; nc2++)
425 const double normal2 = normal_vector(nc1)*normal_vector(nc2);
426 flux_robin_uu += (inv_beta*(nc1==nc2) + inv_alpha_minus_inv_beta*normal2)* (face_surface);
428 flux_robin_uu *= inconnue(face,nc1);
435 val = inv_alpha * normal_vector(nc1) * la_cl_robin.
flux_normal_imp(id_face_bord);
438 double tgte = (2*nc1-1)*normal_vector(1-nc1);
444 val = inv_alpha * normal_vector(nc1) * la_cl_robin.
flux_normal_imp(id_face_bord);
449 flux_robin_rhs = val*face_surface;
450 flux_tot = (flux_robin_rhs - flux_robin_uu)* (marq ? porosite_face(face) : 1);
451 resu(face,nc1) += flux_tot;
452 tab_flux_bords(face,nc1) += flux_tot;
462 DoubleTab& resu, DoubleTab& tab_flux_bords,
468 ToDo_Kokkos(
"critical");
469 const IntTab& elemfaces = domaine_VEF.
elem_faces();
470 const IntTab& face_voisins = domaine_VEF.
face_voisins();
472 int nb_faces = domaine_VEF.
nb_faces();
483 for (n_bord=0; n_bord<nb_bords; n_bord++)
490 int nb_faces_bord_reel = le_bord.
nb_faces();
496 for (ind_face=num1; ind_face<nb_faces_bord_reel; ind_face++)
499 fac_asso = le_bord.
num_face(fac_asso);
500 num_face = le_bord.
num_face(ind_face);
501 for (
int kk=0; kk<2; kk++)
503 int elem = face_voisins(num_face, kk);
504 for (i0=0; i0<nb_faces_elem; i0++)
506 if ( ( (j= elemfaces(elem,i0)) > num_face ) && (j != fac_asso ) )
508 for (
int nc=0; nc<nb_comp; nc++)
510 double valA =
viscA(num_face,j,elem,nu(elem,nc));
511 resu(num_face,nc)+=valA*inconnue(j,nc);
512 resu(num_face,nc)-=valA*inconnue(num_face,nc);
516 resu(j,nc)+=0.5*valA*inconnue(num_face,nc);
517 resu(j,nc)-=0.5*valA*inconnue(j,nc);
527 for (ind_face=num1; ind_face<num2; ind_face++)
529 num_face = le_bord.
num_face(ind_face);
530 int elem=face_voisins(num_face,0);
533 for (
int i=0; i<nb_faces_elem; i++)
534 if (( (j= elemfaces(elem,i)) > num_face ) || (ind_face>=nb_faces_bord_reel))
536 for (
int nc=0; nc<nb_comp; nc++)
538 double valA =
viscA(num_face,j,elem,nu(elem,nc));
539 if (ind_face<nb_faces_bord_reel)
541 double flux=valA*(inconnue(j,nc)-inconnue(num_face,nc));
542 resu(num_face,nc)+=flux;
543 tab_flux_bords(num_face,nc)-=flux;
548 resu(j,nc)+=valA*inconnue(num_face,nc);
549 resu(j,nc)-=valA*inconnue(j,nc);
561 for (
int k=0; k<2; k++)
563 int elem = face_voisins(num_face,k);
564 for (i0=0; i0<nb_faces_elem; i0++)
566 if ( (j= elemfaces(elem,i0)) > num_face )
572 el1 = face_voisins(j,0);
573 el2 = face_voisins(j,1);
574 if((el1==-1)||(el2==-1))
579 for (
int nc=0; nc<nb_comp; nc++)
581 double valA =
viscA(num_face,j,elem,nu(elem,nc));
582 resu(num_face,nc)+=valA*inconnue(j,nc);
583 resu(num_face,nc)-=valA*inconnue(num_face,nc);
586 resu(j,nc)+=valA*inconnue(num_face,nc);
587 resu(j,nc)-=valA*inconnue(j,nc);
602 for (n_bord=0; n_bord<nb_bords; n_bord++)
611 int nfin = ndeb + le_bord.
nb_faces();
612 for (
int face=ndeb; face<nfin; face++)
614 for (
int nc=0; nc<nb_comp; nc++)
617 resu(face,nc) += flux0;
618 tab_flux_bords(face,nc) = flux0;
628 int nfin = ndeb + le_bord.
nb_faces();
629 for (
int face=ndeb; face<nfin; face++)
631 for (
int nc=0; nc<nb_comp; nc++)
633 flux0=la_cl_paroi.
h_imp(face-ndeb,nc)*(la_cl_paroi.
T_ext(face-ndeb,nc)-inconnue(face,nc))*domaine_VEF.
surface(face);
634 resu(face,nc) += flux0;
635 tab_flux_bords(face,nc) = flux0;
639 const double text = la_cl_paroi.
T_ext(face - ndeb, nc), T = inconnue(face, nc);
640 flux0 = COEFF_STEFAN_BOLTZMANN * la_cl_paroi.
emissivite(face - ndeb, nc) * (text * text * text * text - T * T * T * T) * domaine_VEF.
face_surfaces(face);
641 resu(face, nc) += flux0;
642 tab_flux_bords(face, nc) += flux0;
652 int nfin = ndeb + le_bord.
nb_faces();
653 for (
int face=ndeb; face<nfin; face++)
655 for (
int nc=0; nc<nb_comp; nc++)
658 flux0 = (phiext + la_cl_paroi.
h_imp(face-ndeb,nc)*(la_cl_paroi.
T_ext(face-ndeb,nc)-inconnue(face,nc)))*domaine_VEF.
surface(face);
659 resu(face,nc) += flux0;
660 tab_flux_bords(face,nc) = flux0;
665 || sub_type(
Symetrie,la_cl.valeur())
670 int nfin = ndeb + le_bord.
nb_faces();
671 for (
int face=ndeb; face<nfin; face++)
672 for (
int nc=0; nc<nb_comp; nc++)
673 tab_flux_bords(face,nc) = 0.;
727 const Domaine_VEF& domaine_VEF = le_dom_vef.valeur();
740 modif_par_porosite_si_flag(
nu_,tab_nu,!marq,
equation().milieu().porosite_elem());
742 int nb_dim = tab_transporte.
nb_dim();
743 int nb_comp = (nb_dim==2 ? tab_transporte.
dimension(1) : 1);
749 IntTrav tab_fac2b_idx(domaine_VEF.
nb_faces());
755 for (
int n_bord = 0; n_bord < nb_bords; n_bord++)
766 int num2b = num1 + nb_faces / 2;
770 ToDo_Kokkos(
"critical");
771 for (
int fac = num1; fac < num2b; fac++)
775 tab_face_associee(fac) = fac_asso;
776 tab_fac2b_idx(fac) = fac;
777 tab_fac2b_idx(fac+nb_faces/2) = fac;
782 CIntTabView elem_faces = domaine_VEF.
elem_faces().view_ro();
783 CIntTabView face_voisins = domaine_VEF.
face_voisins().view_ro();
785 CDoubleArrView inverse_volumes = domaine_VEF.
inverse_volumes().view_ro();
786 CDoubleTabView face_normale = domaine_VEF.
face_normales().view_ro();
787 CDoubleTabView nu = tab_nu.
view_ro();
788 CIntArrView est_face_bord = domaine_VEF.
est_face_bord().view_ro();
789 CIntArrView face_associee =
static_cast<ArrOfInt&
>(tab_face_associee).view_ro();
790 CIntArrView fac2b_idx =
static_cast<ArrOfInt&
>(tab_fac2b_idx).view_ro();
791 Matrice_Morse_View matrice;
792 matrice.set(tab_matrice);
794 auto ajouter_contrib = KOKKOS_LAMBDA(
const int fac)
796 int type_face = est_face_bord(fac);
797 int fac2b = fac2b_idx(fac);
799 if (type_face == 2 && fac == fac2b)
801 int elem1 = face_voisins(fac,0);
802 int elem2 = face_voisins(fac,1);
804 int fac_asso = face_associee(fac);
805 for (
int i = 0; i < nb_faces_elem; i++)
807 int j = elem_faces(elem1,i);
810 double val =
viscA(fac,j,elem1,nu(elem1,0), face_voisins, face_normale, inverse_volumes);
811 double coeff_face1 = val * (marq ? porosite_face(fac) : 1);
812 double coeff_face2 = val * (marq ? porosite_face(j) : 1);
814 for (
int nc = 0; nc < nb_comp; nc++)
816 int n0 = fac*nb_comp + nc;
817 int j0 = j*nb_comp + nc;
819 matrice.atomic_add(n0, n0, +coeff_face1);
820 matrice.atomic_add(n0, j0, -coeff_face2);
821 matrice.atomic_add(j0, n0, -coeff_face1);
822 matrice.atomic_add(j0, j0, +coeff_face2);
827 j = elem_faces(elem2,i);
830 double val =
viscA(fac,j,elem2,nu(elem2,0), face_voisins, face_normale, inverse_volumes);
831 double coeff_face1 = val * (marq ? porosite_face(fac) : 1);
832 double coeff_face2 = val * (marq ? porosite_face(j) : 1);
834 for (
int nc = 0; nc < nb_comp; nc++)
836 int n0 = fac*nb_comp + nc;
837 int j0 = j*nb_comp + nc;
838 int n1 = fac_asso*nb_comp+nc;
840 matrice.atomic_add(n0, n0, +coeff_face1);
841 matrice.atomic_add(n0, j0, -coeff_face2);
842 matrice.atomic_add(j0, n1, -coeff_face1);
843 matrice.atomic_add(j0, j0, +coeff_face2);
849 else if (type_face == 1)
851 int elem1 = face_voisins(fac,0);
852 for (
int i = 0; i < nb_faces_elem; i++)
854 int j = elem_faces(elem1,i);
857 double val =
viscA(fac,j,elem1,nu(elem1,0), face_voisins, face_normale, inverse_volumes);
858 double coeff_face1 = val * (marq ? porosite_face(fac) : 1);
859 double coeff_face2 = val * (marq ? porosite_face(j) : 1);
861 for (
int nc = 0; nc < nb_comp; nc++)
863 int n0 = fac*nb_comp + nc;
864 int j0 = j*nb_comp + nc;
866 matrice.atomic_add(n0, n0, +coeff_face1);
867 matrice.atomic_add(n0, j0, -coeff_face2);
868 matrice.atomic_add(j0, n0, -coeff_face1);
869 matrice.atomic_add(j0, j0, +coeff_face2);
874 else if (type_face == 0)
876 for (
int k=0; k<2; k++)
878 int elem = face_voisins(fac,k);
881 for (
int i = 0; i < nb_faces_elem; i++)
883 int j = elem_faces(elem, i);
886 double val =
viscA(fac, j, elem, nu(elem, 0), face_voisins, face_normale, inverse_volumes);
887 double coeff_face1 = val * (marq ? porosite_face(fac) : 1);
888 double coeff_face2 = val * (marq ? porosite_face(j) : 1);
890 for (
int nc = 0; nc < nb_comp; nc++)
892 int n0 = fac * nb_comp + nc;
893 int j0 = j * nb_comp + nc;
895 matrice.atomic_add(n0, n0, +coeff_face1);
896 matrice.atomic_add(n0, j0, -coeff_face2);
897 matrice.atomic_add(j0, n0, -coeff_face1);
898 matrice.atomic_add(j0, j0, +coeff_face2);
906 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__),domaine_VEF.
nb_faces(), ajouter_contrib);
907 end_gpu_timer(__KERNEL_NAME__);
910 DoubleTrav tab_h_impose(premiere_face_int);
911 DoubleTrav tab_derivee_flux_exterieur_imposee(premiere_face_int);
914 for (
int n_bord = 0; n_bord < nb_bords; n_bord++)
923 int nfin = ndeb + le_bord.
nb_faces();
924 const double coeff = COEFF_STEFAN_BOLTZMANN;
927 CDoubleArrView himp =
static_cast<const ArrOfDouble&
>(la_cl_paroi.
tab_h_imp()).view_ro();
929 if (has_emissivity) eps =
static_cast<const ArrOfDouble&
>(la_cl_paroi.
tab_emissivite()).view_ro();
930 DoubleArrView h_impose =
static_cast<ArrOfDouble&
>(tab_h_impose).view_wo();
931 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(ndeb, nfin), KOKKOS_LAMBDA(
const int face)
933 int ind_face = face - ndeb;
934 h_impose(face) = himp(ind_face);
937 const double T = inconnue(face);
938 h_impose(face) = 4 * coeff * eps(ind_face) * T * T * T;
941 end_gpu_timer(__KERNEL_NAME__);
949 int nfin = ndeb + le_bord.
nb_faces();
950 ToDo_Kokkos(
"critical");
951 for (
int face = ndeb; face < nfin; face++)
953 tab_h_impose(face) = la_cl_paroi.
h_imp(face-ndeb);
957 else if (sub_type(
Robin_VEF, la_cl.valeur()))
959 ToDo_Kokkos(
"critical");
964 double scale_factor_is_one = 1. ;
965 DoubleTab normal_vector ;
967 int nfin = ndeb + le_bord.
nb_faces();
969 for (
int face = ndeb; face < nfin; face++)
974 for (
int nc1 = 0; nc1 < nb_comp; nc1++)
976 const int i = face * nb_comp + nc1;
979 double val = (inv_beta + inv_alpha_minus_inv_beta*normal_vector(nc1)*normal_vector(nc1))*face_surface;
980 double robin_contribution= val * (marq ? tab_porosite_face(face) : 1) ;
981 tab_matrice(i,i) += robin_contribution ;
984 for (
int nc2 = 0; nc2<nc1; nc2++)
986 const int j = face * nb_comp + nc2;
987 const double normal2 = normal_vector(nc1)*normal_vector(nc2);
988 val = inv_alpha_minus_inv_beta*normal2* (face_surface);
989 robin_contribution= val * (marq ? tab_porosite_face(face) : 1) ;
990 tab_matrice(i, j) += robin_contribution;
991 tab_matrice(j ,i) += robin_contribution;
998 CDoubleArrView h_impose =
static_cast<const ArrOfDouble&
>(tab_h_impose).view_ro();
999 CDoubleArrView derivee_flux_exterieur_imposee =
static_cast<const ArrOfDouble&
>(tab_derivee_flux_exterieur_imposee).view_ro();
1000 CDoubleArrView face_surfaces = domaine_VEF.
face_surfaces().view_ro();
1003 auto neumann = KOKKOS_LAMBDA (
const int face)
1005 double h = h_impose(face);
1006 double dphi_dT = derivee_flux_exterieur_imposee(face);
1007 matrice.add(face,face, + (h + dphi_dT) * face_surfaces(face));
1010 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), premiere_face_int, neumann);
1011 end_gpu_timer(__KERNEL_NAME__);
1025 const Domaine_VEF& domaine_VEF = le_dom_vef.valeur();
1026 const IntTab& tab_elem_faces = domaine_VEF.
elem_faces();
1027 const IntTab& tab_face_voisins = domaine_VEF.
face_voisins();
1028 const ArrOfInt& tab_est_face_bord = domaine_VEF.
est_face_bord();
1030 int nb_dim = tab_transporte.
nb_dim();
1031 int nb_comp = (nb_dim == 2 ? tab_transporte.
dimension(1) : 1);
1040 modif_par_porosite_si_flag(
nu_, tab_nu, !marq, porosite_elem);
1041 DoubleVect tab_porosite_eventuelle(
equation().milieu().porosite_face());
1043 tab_porosite_eventuelle = 1;
1055 for (
int n_bord = 0; n_bord < nb_bords; n_bord++)
1066 int num2b = num1 + nb_faces / 2;
1070 ToDo_Kokkos(
"critical");
1071 for (
int fac = num1; fac < num2b; fac++)
1073 int fac_asso = la_cl_perio.
face_associee(fac - num1) + num1;
1075 tab_face_associee(fac) = fac_asso;
1076 tab_fac2b_idx(fac) = fac;
1077 tab_fac2b_idx(fac+nb_faces/2) = fac;
1082 CIntArrView est_face_bord = tab_est_face_bord.view_ro();
1083 CIntTabView face_voisins = tab_face_voisins.
view_ro();
1084 CDoubleTabView face_normales = domaine_VEF.
face_normales().view_ro();
1085 CDoubleArrView inverse_volumes = domaine_VEF.
inverse_volumes().view_ro();
1086 CIntTabView elem_faces = tab_elem_faces.
view_ro();
1088 CDoubleTabView nu = tab_nu.
view_ro();
1089 CDoubleArrView porosite_eventuelle = tab_porosite_eventuelle.view_ro();
1091 CIntArrView fac2b_idx = tab_fac2b_idx.view_ro();
1092 CIntArrView face_associee = tab_face_associee.view_ro();
1094 Matrice_Morse_View matrice;
1095 matrice.set(tab_matrice);
1097 auto kern_elem_faces = KOKKOS_LAMBDA (
const int fac)
1099 int type_face = est_face_bord(fac);
1100 int fac2b = fac2b_idx(fac);
1103 if (type_face == 2 && fac == fac2b)
1105 int fac_asso = face_associee(fac);
1107 int elem1 = face_voisins(fac, 0);
1108 int elem2 = face_voisins(fac, 1);
1110 for (
int i = 0; i < nb_faces_elem; i++)
1112 int j = elem_faces(elem1, i);
1115 for (
int nc = 0; nc < nb_comp; nc++)
1117 double val =
viscA(fac, j, elem1, nu(elem1, nc), face_voisins, face_normales, inverse_volumes);
1119 int n0 = fac * nb_comp + nc;
1120 int j0 = j * nb_comp + nc;
1122 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1123 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1124 matrice.atomic_add(j0, n0, - val * porosite_eventuelle(fac));
1125 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1130 j = elem_faces(elem2, i);
1133 for (
int nc = 0; nc < nb_comp; nc++)
1135 double val =
viscA(fac, j, elem2, nu(elem1, nc), face_voisins, face_normales, inverse_volumes);
1137 int n0 = fac * nb_comp + nc;
1138 int j0 = j * nb_comp + nc;
1139 int n0perio = fac_asso * nb_comp + nc;
1141 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1142 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1143 matrice.atomic_add(j0, n0perio, - val * porosite_eventuelle(fac));
1144 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1151 else if (type_face == 1)
1153 int elem1 = face_voisins(fac, 0);
1155 for (
int i = 0; i < nb_faces_elem; i++)
1157 int j = elem_faces(elem1, i);
1160 for (
int nc = 0; nc < nb_comp; nc++)
1162 double val =
viscA(fac, j, elem1, nu(elem1, nc), face_voisins, face_normales, inverse_volumes);
1164 int n0 = fac * nb_comp + nc;
1165 int j0 = j * nb_comp + nc;
1167 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1168 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1169 matrice.atomic_add(j0, n0, - val * porosite_eventuelle(fac));
1170 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1176 else if (type_face == 0)
1178 int elem1 = face_voisins(fac, 0);
1179 int elem2 = face_voisins(fac, 1);
1181 for (
int i = 0; i < nb_faces_elem; i++)
1183 int j = elem_faces(elem1, i);
1186 for (
int nc = 0; nc < nb_comp; nc++)
1188 double val =
viscA(fac, j, elem1, nu(elem1, nc), face_voisins, face_normales, inverse_volumes);
1190 int n0 = fac * nb_comp + nc;
1191 int j0 = j * nb_comp + nc;
1193 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1194 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1195 matrice.atomic_add(j0, n0, - val * porosite_eventuelle(fac));
1196 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1202 j = elem_faces(elem2, i);
1205 for (
int nc = 0; nc < nb_comp; nc++)
1207 double val =
viscA(fac, j, elem2, nu(elem2, nc), face_voisins, face_normales, inverse_volumes);
1208 int n0 = fac * nb_comp + nc;
1209 int j0 = j * nb_comp + nc;
1211 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1212 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1213 matrice.atomic_add(j0, n0, - val * porosite_eventuelle(fac));
1214 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1222 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), nb_faces_tot, kern_elem_faces);
1223 end_gpu_timer(__KERNEL_NAME__);
1225 for (
int n_bord = 0; n_bord < nb_bords; n_bord++)
1234 int nfin = ndeb + le_bord.
nb_faces();
1235 ToDo_Kokkos(
"critical");
1236 for (
int face = ndeb; face < nfin; face++)
1237 for (
int nc = 0; nc < nb_comp; nc++)
1239 const int i = face * nb_comp + nc;
1240 tab_matrice(i, i) += la_cl_paroi.
h_imp(face - ndeb, nc) * domaine_VEF.
surface(face);