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();
741 modif_par_porosite_si_flag(
nu_,tab_nu,!marq,
equation().milieu().porosite_elem());
743 int nb_dim = tab_transporte.
nb_dim();
744 int nb_comp = (nb_dim==2 ? tab_transporte.
dimension(1) : 1);
750 IntTrav tab_fac2b_idx(domaine_VEF.
nb_faces());
756 for (
int n_bord = 0; n_bord < nb_bords; n_bord++)
767 int num2b = num1 + nb_faces / 2;
772 ToDo_Kokkos(
"critical");
773 for (
int fac = num1; fac < num2b; fac++)
777 tab_face_associee(fac) = fac_asso;
778 tab_fac2b_idx(fac) = fac;
779 tab_fac2b_idx(fac+nb_faces/2) = fac;
784 CIntTabView elem_faces = domaine_VEF.
elem_faces().view_ro();
785 CIntTabView face_voisins = domaine_VEF.
face_voisins().view_ro();
787 CDoubleArrView inverse_volumes = domaine_VEF.
inverse_volumes().view_ro();
788 CDoubleTabView face_normale = domaine_VEF.
face_normales().view_ro();
789 CDoubleTabView nu = tab_nu.
view_ro();
790 CIntArrView est_face_bord = domaine_VEF.
est_face_bord().view_ro();
791 CIntArrView face_associee =
static_cast<ArrOfInt&
>(tab_face_associee).view_ro();
792 CIntArrView fac2b_idx =
static_cast<ArrOfInt&
>(tab_fac2b_idx).view_ro();
793 Matrice_Morse_View matrice;
794 matrice.set(tab_matrice);
796 auto ajouter_contrib = KOKKOS_LAMBDA(
const int fac)
798 int type_face = est_face_bord(fac);
799 int fac2b = fac2b_idx(fac);
801 if (type_face == 2 && fac == fac2b)
803 int elem1 = face_voisins(fac,0);
804 int elem2 = face_voisins(fac,1);
806 int fac_asso = face_associee(fac);
807 for (
int i = 0; i < nb_faces_elem; i++)
809 int j = elem_faces(elem1,i);
812 double val =
viscA(fac,j,elem1,nu(elem1,0), face_voisins, face_normale, inverse_volumes);
813 double coeff_face1 = val * (marq ? porosite_face(fac) : 1);
814 double coeff_face2 = val * (marq ? porosite_face(j) : 1);
816 for (
int nc = 0; nc < nb_comp; nc++)
818 int n0 = fac*nb_comp + nc;
819 int j0 = j*nb_comp + nc;
821 matrice.atomic_add(n0, n0, +coeff_face1);
822 matrice.atomic_add(n0, j0, -coeff_face2);
823 matrice.atomic_add(j0, n0, -coeff_face1);
824 matrice.atomic_add(j0, j0, +coeff_face2);
829 j = elem_faces(elem2,i);
832 double val =
viscA(fac,j,elem2,nu(elem2,0), face_voisins, face_normale, inverse_volumes);
833 double coeff_face1 = val * (marq ? porosite_face(fac) : 1);
834 double coeff_face2 = val * (marq ? porosite_face(j) : 1);
836 for (
int nc = 0; nc < nb_comp; nc++)
838 int n0 = fac*nb_comp + nc;
839 int j0 = j*nb_comp + nc;
840 int n1 = fac_asso*nb_comp+nc;
842 matrice.atomic_add(n0, n0, +coeff_face1);
843 matrice.atomic_add(n0, j0, -coeff_face2);
844 matrice.atomic_add(j0, n1, -coeff_face1);
845 matrice.atomic_add(j0, j0, +coeff_face2);
851 else if (type_face == 1)
853 int elem1 = face_voisins(fac,0);
854 for (
int i = 0; i < nb_faces_elem; i++)
856 int j = elem_faces(elem1,i);
859 double val =
viscA(fac,j,elem1,nu(elem1,0), face_voisins, face_normale, inverse_volumes);
860 double coeff_face1 = val * (marq ? porosite_face(fac) : 1);
861 double coeff_face2 = val * (marq ? porosite_face(j) : 1);
863 for (
int nc = 0; nc < nb_comp; nc++)
865 int n0 = fac*nb_comp + nc;
866 int j0 = j*nb_comp + nc;
868 matrice.atomic_add(n0, n0, +coeff_face1);
869 matrice.atomic_add(n0, j0, -coeff_face2);
870 matrice.atomic_add(j0, n0, -coeff_face1);
871 matrice.atomic_add(j0, j0, +coeff_face2);
876 else if (type_face == 0)
878 for (
int k=0; k<2; k++)
880 int elem = face_voisins(fac,k);
883 for (
int i = 0; i < nb_faces_elem; i++)
885 int j = elem_faces(elem, i);
888 double val =
viscA(fac, j, elem, nu(elem, 0), face_voisins, face_normale, inverse_volumes);
889 double coeff_face1 = val * (marq ? porosite_face(fac) : 1);
890 double coeff_face2 = val * (marq ? porosite_face(j) : 1);
892 for (
int nc = 0; nc < nb_comp; nc++)
894 int n0 = fac * nb_comp + nc;
895 int j0 = j * nb_comp + nc;
897 matrice.atomic_add(n0, n0, +coeff_face1);
898 matrice.atomic_add(n0, j0, -coeff_face2);
899 matrice.atomic_add(j0, n0, -coeff_face1);
900 matrice.atomic_add(j0, j0, +coeff_face2);
908 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__),domaine_VEF.
nb_faces(), ajouter_contrib);
909 end_gpu_timer(__KERNEL_NAME__);
912 DoubleTrav tab_h_impose(premiere_face_int);
913 DoubleTrav tab_derivee_flux_exterieur_imposee(premiere_face_int);
917 for (
int n_bord = 0; n_bord < nb_bords; n_bord++)
926 int nfin = ndeb + le_bord.
nb_faces();
927 const double coeff = COEFF_STEFAN_BOLTZMANN;
930 CDoubleArrView himp =
static_cast<const ArrOfDouble&
>(la_cl_paroi.
tab_h_imp()).view_ro();
932 if (has_emissivity) eps =
static_cast<const ArrOfDouble&
>(la_cl_paroi.
tab_emissivite()).view_ro();
933 DoubleArrView h_impose =
static_cast<ArrOfDouble&
>(tab_h_impose).view_wo();
934 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), Kokkos::RangePolicy<>(ndeb, nfin), KOKKOS_LAMBDA(
const int face)
936 int ind_face = face - ndeb;
937 h_impose(face) = himp(ind_face);
940 const double T = inconnue(face);
941 h_impose(face) = 4 * coeff * eps(ind_face) * T * T * T;
944 end_gpu_timer(__KERNEL_NAME__);
952 int nfin = ndeb + le_bord.
nb_faces();
953 ToDo_Kokkos(
"critical");
954 for (
int face = ndeb; face < nfin; face++)
956 tab_h_impose(face) = la_cl_paroi.
h_imp(face-ndeb);
960 else if (sub_type(
Robin_VEF, la_cl.valeur()))
962 ToDo_Kokkos(
"critical");
967 double scale_factor_is_one = 1. ;
968 DoubleTab normal_vector ;
970 int nfin = ndeb + le_bord.
nb_faces();
972 for (
int face = ndeb; face < nfin; face++)
977 for (
int nc1 = 0; nc1 < nb_comp; nc1++)
979 const int i = face * nb_comp + nc1;
982 double val = (inv_beta + inv_alpha_minus_inv_beta*normal_vector(nc1)*normal_vector(nc1))*face_surface;
983 double robin_contribution= val * (marq ? tab_porosite_face(face) : 1) ;
984 tab_matrice(i,i) += robin_contribution ;
987 for (
int nc2 = 0; nc2<nc1; nc2++)
989 const int j = face * nb_comp + nc2;
990 const double normal2 = normal_vector(nc1)*normal_vector(nc2);
991 val = inv_alpha_minus_inv_beta*normal2* (face_surface);
992 robin_contribution= val * (marq ? tab_porosite_face(face) : 1) ;
993 tab_matrice(i, j) += robin_contribution;
994 tab_matrice(j ,i) += robin_contribution;
1001 CDoubleArrView h_impose =
static_cast<const ArrOfDouble&
>(tab_h_impose).view_ro();
1002 CDoubleArrView derivee_flux_exterieur_imposee =
static_cast<const ArrOfDouble&
>(tab_derivee_flux_exterieur_imposee).view_ro();
1003 CDoubleArrView face_surfaces = domaine_VEF.
face_surfaces().view_ro();
1006 auto neumann = KOKKOS_LAMBDA (
const int face)
1008 double h = h_impose(face);
1009 double dphi_dT = derivee_flux_exterieur_imposee(face);
1010 matrice.add(face,face, + (h + dphi_dT) * face_surfaces(face));
1013 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), premiere_face_int, neumann);
1014 end_gpu_timer(__KERNEL_NAME__);
1029 const Domaine_VEF& domaine_VEF = le_dom_vef.valeur();
1030 const IntTab& tab_elem_faces = domaine_VEF.
elem_faces();
1031 const IntTab& tab_face_voisins = domaine_VEF.
face_voisins();
1032 const ArrOfInt& tab_est_face_bord = domaine_VEF.
est_face_bord();
1034 int nb_dim = tab_transporte.
nb_dim();
1035 int nb_comp = (nb_dim == 2 ? tab_transporte.
dimension(1) : 1);
1044 modif_par_porosite_si_flag(
nu_, tab_nu, !marq, porosite_elem);
1045 DoubleVect tab_porosite_eventuelle(
equation().milieu().porosite_face());
1047 tab_porosite_eventuelle = 1;
1059 for (
int n_bord = 0; n_bord < nb_bords; n_bord++)
1070 int num2b = num1 + nb_faces / 2;
1075 ToDo_Kokkos(
"critical");
1076 for (
int fac = num1; fac < num2b; fac++)
1078 int fac_asso = la_cl_perio.
face_associee(fac - num1) + num1;
1080 tab_face_associee(fac) = fac_asso;
1081 tab_fac2b_idx(fac) = fac;
1082 tab_fac2b_idx(fac+nb_faces/2) = fac;
1087 CIntArrView est_face_bord = tab_est_face_bord.view_ro();
1088 CIntTabView face_voisins = tab_face_voisins.
view_ro();
1089 CDoubleTabView face_normales = domaine_VEF.
face_normales().view_ro();
1090 CDoubleArrView inverse_volumes = domaine_VEF.
inverse_volumes().view_ro();
1091 CIntTabView elem_faces = tab_elem_faces.
view_ro();
1093 CDoubleTabView nu = tab_nu.
view_ro();
1094 CDoubleArrView porosite_eventuelle = tab_porosite_eventuelle.view_ro();
1096 CIntArrView fac2b_idx = tab_fac2b_idx.view_ro();
1097 CIntArrView face_associee = tab_face_associee.view_ro();
1099 Matrice_Morse_View matrice;
1100 matrice.set(tab_matrice);
1102 auto kern_elem_faces = KOKKOS_LAMBDA (
const int fac)
1104 int type_face = est_face_bord(fac);
1105 int fac2b = fac2b_idx(fac);
1108 if (type_face == 2 && fac == fac2b)
1110 int fac_asso = face_associee(fac);
1112 int elem1 = face_voisins(fac, 0);
1113 int elem2 = face_voisins(fac, 1);
1115 for (
int i = 0; i < nb_faces_elem; i++)
1117 int j = elem_faces(elem1, i);
1120 for (
int nc = 0; nc < nb_comp; nc++)
1122 double val =
viscA(fac, j, elem1, nu(elem1, nc), face_voisins, face_normales, inverse_volumes);
1124 int n0 = fac * nb_comp + nc;
1125 int j0 = j * nb_comp + nc;
1127 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1128 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1129 matrice.atomic_add(j0, n0, - val * porosite_eventuelle(fac));
1130 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1135 j = elem_faces(elem2, i);
1138 for (
int nc = 0; nc < nb_comp; nc++)
1140 double val =
viscA(fac, j, elem2, nu(elem1, nc), face_voisins, face_normales, inverse_volumes);
1142 int n0 = fac * nb_comp + nc;
1143 int j0 = j * nb_comp + nc;
1144 int n0perio = fac_asso * nb_comp + nc;
1146 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1147 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1148 matrice.atomic_add(j0, n0perio, - val * porosite_eventuelle(fac));
1149 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1156 else if (type_face == 1)
1158 int elem1 = face_voisins(fac, 0);
1160 for (
int i = 0; i < nb_faces_elem; i++)
1162 int j = elem_faces(elem1, i);
1165 for (
int nc = 0; nc < nb_comp; nc++)
1167 double val =
viscA(fac, j, elem1, nu(elem1, nc), face_voisins, face_normales, inverse_volumes);
1169 int n0 = fac * nb_comp + nc;
1170 int j0 = j * nb_comp + nc;
1172 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1173 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1174 matrice.atomic_add(j0, n0, - val * porosite_eventuelle(fac));
1175 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1181 else if (type_face == 0)
1183 int elem1 = face_voisins(fac, 0);
1184 int elem2 = face_voisins(fac, 1);
1186 for (
int i = 0; i < nb_faces_elem; i++)
1188 int j = elem_faces(elem1, i);
1191 for (
int nc = 0; nc < nb_comp; nc++)
1193 double val =
viscA(fac, j, elem1, nu(elem1, nc), face_voisins, face_normales, inverse_volumes);
1195 int n0 = fac * nb_comp + nc;
1196 int j0 = j * nb_comp + nc;
1198 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1199 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1200 matrice.atomic_add(j0, n0, - val * porosite_eventuelle(fac));
1201 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1207 j = elem_faces(elem2, i);
1210 for (
int nc = 0; nc < nb_comp; nc++)
1212 double val =
viscA(fac, j, elem2, nu(elem2, nc), face_voisins, face_normales, inverse_volumes);
1213 int n0 = fac * nb_comp + nc;
1214 int j0 = j * nb_comp + nc;
1216 matrice.atomic_add(n0, n0, + val * porosite_eventuelle(fac));
1217 matrice.atomic_add(n0, j0, - val * porosite_eventuelle(j));
1218 matrice.atomic_add(j0, n0, - val * porosite_eventuelle(fac));
1219 matrice.atomic_add(j0, j0, + val * porosite_eventuelle(j));
1227 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), nb_faces_tot, kern_elem_faces);
1228 end_gpu_timer(__KERNEL_NAME__);
1230 for (
int n_bord = 0; n_bord < nb_bords; n_bord++)
1239 int nfin = ndeb + le_bord.
nb_faces();
1240 ToDo_Kokkos(
"critical");
1241 for (
int face = ndeb; face < nfin; face++)
1242 for (
int nc = 0; nc < nb_comp; nc++)
1244 const int i = face * nb_comp + nc;
1245 tab_matrice(i, i) += la_cl_paroi.
h_imp(face - ndeb, nc) * domaine_VEF.
surface(face);