302 const Domaine_VDF& domaine_VDF = le_dom_VDF.valeur();
303 int nb_faces=domaine_VDF.
nb_faces();
305 const Domaine& dom = domaine_VDF.
domaine();
307 int nb_som_face=faces_sommets.
dimension(1);
308 int nb_som = domaine_VDF.
nb_som();
309 DoubleTab& variable_imposee_mod =
modele_lu_.variable_imposee_->valeurs();
310 int nb_comp_real = 3;
313 DoubleTab& fluid_points = interp.fluid_points_->valeurs();
314 DoubleTab& solid_points = interp.solid_points_->valeurs();
315 DoubleTab& fluid_elems = interp.fluid_elems_->valeurs();
317 DoubleTab variable_imposee_sommet(nb_som,nb_comp_real);
318 IntTab sommet_interp(nb_som);
319 DoubleTab xf(1, nb_comp_real);
320 DoubleTab vf(1, nb_comp_real);
323 variable_imposee_calculee = 0.0;
324 variable_imposee_sommet = 0.0;
326 for (
int i = 0; i < nb_som; i++)
328 if ((fluid_elems(i) >= 0.0))
330 sommet_interp(0, i) = 1;
333 for(
int j = 0; j < dim_esp; j++)
335 double xj = dom.
coord(i,j);
336 double xjf = fluid_points(i,j);
338 double xjs = solid_points(i,j);
339 d1 += (xj-xjs)*(xj-xjs);
340 d2 += (xjf-xj)*(xjf-xj);
345 if ( (d1 + d2) > eps ) inv_d = 1.0 / (d1 + d2);
347 cells[0] = int(fluid_elems(i));
348 for(
int j = 0; j < nb_comp_real; j++) vf(0, j) = champ_variable_inconnue.
valeur_a_elem_compo(xf, cells[0], j);
349 for (
int j = 0; j < nb_comp_real; j++)
351 double vjs = variable_imposee_mod(i,j);
352 variable_imposee_sommet(i,j) = vjs + (vf(0, j)-vjs)*inv_d*d1;
357 for(
int j = 0; j < nb_comp_real; j++)
359 variable_imposee_sommet(i,j) = variable_imposee_mod(i,j);
363 for (
int f = 0; f < nb_faces; f++)
367 while ((som_f < nb_som_face) and (sommet_interp(faces_sommets(f,som_f))==1))
372 if (compteur == nb_som_face)
375 for (
int som_=0; som_ < nb_som_face; som_++)
377 int i = faces_sommets(f,som_);
378 variable_imposee_calculee(f,0) += variable_imposee_sommet(i,ori)/nb_som_face;
386 const Domaine_VDF& domaine_VDF = le_dom_VDF.valeur();
387 int nb_faces=domaine_VDF.
nb_faces();
389 const Domaine& dom = domaine_VDF.
domaine();
391 int nb_som_face=faces_sommets.
dimension(1);
392 int nb_som = domaine_VDF.
nb_som();
393 DoubleTab& variable_imposee_mod =
modele_lu_.variable_imposee_->valeurs();
396 DoubleTab& solid_points = interp.solid_points_->valeurs();
397 DoubleTab& is_dirichlet = interp.is_dirichlet_->valeurs();
400 int nb_comp = variable_inconnue.
dimension(1);
402 int nb_comp_real = variable_imposee_mod.
dimension(1);
403 DoubleTab variable_imposee_sommet(nb_som,nb_comp_real);
404 IntTab sommet_interp(nb_som);
405 variable_imposee_calculee = 0.0;
406 variable_imposee_sommet = 0.0;
408 for (
int i = 0; i < nb_som; i++)
410 if (is_dirichlet(i) > 0.0)
412 sommet_interp(i) = 1;
414 for(
int j = 0; j < dim_esp; j++)
416 double x = dom.
coord(i,j);
417 double xp = solid_points(i,j);
418 d2 += (x - xp)*(x - xp);
420 Cerr <<
"On passe ICI" << finl;
421 for(
int j = 0; j <nb_comp ; j++) variable_imposee_sommet(i,j) = variable_imposee_mod(i,j);
428 ArrOfDouble mean_grad(nb_comp_real);
430 int taille = voisins.
size();
432 for (
int k = 0; k < taille; k++)
434 int num_som = voisins[k];
436 for (
int j = 0; j < dim_esp; j++)
438 double xf = dom.
coord(num_som,j);
439 double xpf = solid_points(num_som,j);
440 d1 += (xf - xpf)*(xf - xpf);
445 for (
int j = 0; j < nb_comp; j++)
447 double vpf = variable_imposee_mod(num_som,j);
448 double vf = variable_inconnue(num_som,j);
450 mean_grad[j] += (vf - vpf)/d1;
455 for (
int j = 0; j < nb_comp; j++)
457 mean_grad[j] /= nb_contrib;
458 variable_imposee_sommet(i,j) += mean_grad[j]*d2;
465 for(
int j = 0; j < nb_comp; j++)
467 variable_imposee_sommet(i,j) = variable_imposee_mod(i,j);
471 for (
int f = 0; f < nb_faces; f++)
475 while ((som_f < nb_som_face) and (sommet_interp(faces_sommets(f,som_f))==1))
480 if (compteur == nb_som_face)
483 for (
int som_=0; som_ < nb_som_face; som_++)
485 int i = faces_sommets(f,som_);
486 variable_imposee_calculee(f,0) += variable_imposee_sommet(i,ori)/nb_som_face;
507 const Domaine_VDF& domaine_VDF = le_dom_VDF.valeur();
508 int nb_faces=domaine_VDF.
nb_faces();
510 const Domaine& dom = domaine_VDF.
domaine();
512 int nb_som_face=faces_sommets.
dimension(1);
513 int nb_som=domaine_VDF.
nb_som();
514 DoubleTab& vitesse_imposee_mod =
modele_lu_.variable_imposee_->valeurs();
518 DoubleTab& fluid_points = interp.fluid_points_->valeurs();
519 DoubleTab& solid_points = interp.solid_points_->valeurs();
520 DoubleTab& fluid_elems = interp.fluid_elems_->valeurs();
522 double A_pwl = interp.
get_A_pwl(form_WJSP);
524 double y_c_p_pwl = 0;
525 double C_pwl_WJSP = 0;
526 double D_pwl_WJSP = 0;
527 double p_pwl_WJSP = 0;
528 double y_c1_p_pwl_WJSP = 0;
529 double y_c2_p_pwl_WJSP = 0;
542 int impr_yplus = interp.
get_impr() ;
545 DoubleTab xf(1, nb_comp);
546 DoubleTab vf(1, nb_comp);
548 DoubleTab vitesse_imposee_sommet(nb_som,nb_comp);
549 IntTab sommet_interp(1, nb_som);
550 vitesse_imposee_calculee = 0.0;
551 vitesse_imposee_sommet = 0.0;
554 if (
equation().nombre_d_operateurs()<1)
565 double d1_min = 1.0e+10;
567 double d1_mean = 0.0;
568 double yplus_min = 1.0e+10;
569 double yplus_max = 0.0;
570 double yplus_mean = 0.0;
571 double u_tau_min = 1.0e+10;
572 double u_tau_max = 0.0;
573 double u_tau_mean = 0.0;
574 double yplus_ref_min = 1.0e+10;
575 double yplus_ref_max = 0.0;
576 double yplus_ref_mean = 0.0;
577 double u_tau_ref_min = 1.0e+10;
578 double u_tau_ref_max = 0.0;
579 double u_tau_ref_mean = 0.0;
580 double h_yplus_min = 1.0e+10;
581 double h_yplus_max = 0.0;
582 double h_yplus_mean = 0.0;
587 DoubleTab tab_h(1, nb_som);
588 DoubleTab abs_h(1, N+1);
589 DoubleTab compteur_h(1, N);
596 for (
int i = 0; i < nb_som; i++)
598 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = vitesse_imposee_mod(i,j);
600 if ((fluid_elems(i) >= 0.0))
602 sommet_interp(0, i) = 1;
605 DoubleTab normale(1, nb_comp);
606 double norme_de_la_normale= 0.0;
607 for(
int j = 0; j < nb_comp; j++)
609 double xj = dom.
coord(i,j);
611 double xjf = fluid_points(i,j);
614 double xjs = solid_points(i,j);
616 d1 += (xj-xjs)*(xj-xjs);
617 d2 += (xjf-xj)*(xjf-xj);
618 normale(0,j) = xjf - xjs;
619 norme_de_la_normale += normale(0,j)*normale(0,j);
629 if (d1 < eps) itisok = 0;
630 norme_de_la_normale = sqrt(norme_de_la_normale);
631 if ( norme_de_la_normale > eps )
632 for(
int j = 0; j < nb_comp; j++) normale(0,j) /= norme_de_la_normale;
635 for(
int j = 0; j < nb_comp; j++) normale(0,j) = 0.;
646 cells(0) = int(fluid_elems(i));
647 for(
int j = 0; j < nb_comp; j++) vf(0, j) = champ_vitesse_inconnue.
valeur_a_elem_compo(xf, cells[0], j);
649 for(
int j = 0; j < nb_comp; j++) Vn += vf(0, j) * normale(0,j);
650 DoubleTab v_ref_t(1, nb_comp);
652 for(
int j = 0; j < nb_comp; j++) v_ref_t(0, j) =vf(0, j) - Vn*normale(0,j);
654 double norme_v_ref_t = 0.;
655 for(
int j = 0; j < nb_comp; j++) norme_v_ref_t += v_ref_t(0, j)*v_ref_t(0,j) ;
656 norme_v_ref_t = sqrt ( norme_v_ref_t );
657 if (norme_v_ref_t < 1.0e-6) norme_v_ref_t = 1.e-6;
662 double u_tau_ref = pow ( norme_v_ref_t , (1/(1+B_pwl)) ) * pow ( A_pwl, (-1/(1+B_pwl)) ) * pow ( y_ref , (-B_pwl/(1+B_pwl)) ) * pow ( nu,(B_pwl/(1+B_pwl)) ) ;
664 double y_ref_p = y_ref * u_tau_ref / nu;
670 if ( y_ref_p > y_c_p_pwl)
674 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * pow ( d1 / y_ref , B_pwl ) ;
678 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) *(1. - B_pwl*(1-d1/y_ref)) ;
688 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * ( d1 / y_ref ) ;
692 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * (1. - pow(u_tau_ref, 2.)*(y_ref-d1)/(nu *norme_v_ref_t));
695 u_tau_ref = pow ( (nu * norme_v_ref_t / y_ref) , 0.5 ) ;
696 y_ref_p = y_ref * u_tau_ref / nu;
697 if ( y_ref_p > y_c_p_pwl )
705 double norme_v_imp_c = 0;
706 for(
int j=0 ; j < nb_comp; j++) norme_v_imp_c += vitesse_imposee_sommet(i ,j) * vitesse_imposee_sommet(i ,j);
707 norme_v_imp_c = sqrt( norme_v_imp_c );
709 double u_tau = pow ( norme_v_imp_c , (1/(1+B_pwl)) ) * pow ( A_pwl, (-1/(1+B_pwl)) ) * pow ( d1 , (-B_pwl/(1+B_pwl)) ) * pow ( nu,(B_pwl/(1+B_pwl)) ) ;
710 y_plus = u_tau * d1 / nu;
712 if (y_plus >y_c_p_pwl)
720 u_tau = pow ( (nu * norme_v_imp_c/ d1) , 0.5 ) ;
721 y_plus = u_tau * d1 / nu;
722 if ( y_plus > y_c_p_pwl )
725 Cerr<<
"INCOHERENCE: u_tau ="<<u_tau<<
" y+ = "<<y_plus<<
" y+ref = "<<y_ref_p<<finl;
734 if ( (test_ * test_ref < 0) || (itisok == 0) )
736 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = vitesse_imposee_mod(i,j);
748 if (d1 > d1_max) d1_max = d1;
749 if (d1 < d1_min) d1_min = d1;
751 if (y_plus > yplus_max) yplus_max = y_plus;
752 if (y_plus < yplus_min) yplus_min = y_plus;
753 yplus_mean += y_plus;
754 if (u_tau > u_tau_max) u_tau_max = u_tau;
755 if (u_tau < u_tau_min) u_tau_min = u_tau;
757 if (y_ref_p > yplus_ref_max) yplus_ref_max = y_ref_p;
758 if (y_ref_p < yplus_ref_min) yplus_ref_min = y_ref_p;
759 yplus_ref_mean += y_ref_p;
760 if (u_tau_ref > u_tau_ref_max) u_tau_ref_max = u_tau_ref;
761 if (u_tau_ref < u_tau_ref_min) u_tau_ref_min = u_tau_ref;
762 u_tau_ref_mean += u_tau_ref;
764 if (y_plus > h_yplus_max) h_yplus_max = y_plus;
765 if (y_plus < h_yplus_min) h_yplus_min = y_plus;
766 h_yplus_mean += y_plus;
767 tab_h(0,yplus_count) = y_plus;
773 Cerr <<
"On passe bien dans le WJSP" << finl;
775 if ( y_ref_p > y_c2_p_pwl_WJSP)
777 y_plus = u_tau_ref * d1/nu;
778 if (y_plus > y_c2_p_pwl_WJSP)
782 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * pow ( d1 / y_ref , B_pwl ) ;
786 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * (1. - B_pwl*(1-d1/y_ref)) ;
789 else if (y_plus < y_c2_p_pwl_WJSP and y_plus > y_c1_p_pwl_WJSP)
793 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = (C_pwl_WJSP*pow(y_plus,2*p_pwl_WJSP-1) *u_tau_ref + D_pwl_WJSP*pow(y_plus,p_pwl_WJSP-1) *u_tau_ref)* v_ref_t(0,j)/norme_v_ref_t;
797 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = 0 ;
804 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = y_plus * u_tau_ref * v_ref_t(0,j)/norme_v_ref_t;
808 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * (1. - B_pwl*(1-d1/y_ref)) ;
815 u_tau_ref = (nu/y_ref) * pow(-(D_pwl_WJSP/(2*C_pwl_WJSP)) * (1 + pow(1 + 4 * C_pwl_WJSP/pow(D_pwl_WJSP,2) * norme_v_ref_t * y_ref /nu ,1/2)),1/p_pwl_WJSP) ;
816 y_ref_p = y_ref * u_tau_ref / nu;
817 if (y_ref_p < y_c2_p_pwl_WJSP and y_ref_p > y_c1_p_pwl_WJSP)
819 y_plus = u_tau_ref * d1/nu;
820 if (y_plus < y_c2_p_pwl_WJSP and y_plus > y_c1_p_pwl_WJSP)
824 double phi = -pow(1 + 4 * C_pwl_WJSP/pow(D_pwl_WJSP,2) * norme_v_ref_t * y_ref /nu,1/2) - 1;
825 double u_norm = pow(D_pwl_WJSP,2) * nu / (4 * C_pwl_WJSP * y_ref) * (pow ( d1 / y_ref , 2*p_pwl_WJSP - 1 ) * pow(phi,2) + 2 * pow ( d1 / y_ref , p_pwl_WJSP - 1 ) * phi);
826 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = u_norm * v_ref_t(0,j)/norme_v_ref_t;
830 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = 0 ;
837 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = y_plus * u_tau_ref * v_ref_t(0,j)/norme_v_ref_t ;
841 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = 0 ;
850 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * ( d1 / y_ref ) ;
854 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * (1. - pow(u_tau_ref, 2.)*(y_ref-d1)/(nu *norme_v_ref_t));
856 u_tau_ref = pow ( (nu * norme_v_ref_t / y_ref) , 0.5 ) ;
857 y_ref_p = y_ref * u_tau_ref / nu;
858 if ( y_ref_p > y_c1_p_pwl_WJSP)
862 Cerr <<
"Incoherence" << finl;
873 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = vitesse_imposee_mod(i,j);
885 if (d1 > d1_max) d1_max = d1;
886 if (d1 < d1_min) d1_min = d1;
888 if (y_plus > yplus_max) yplus_max = y_plus;
889 if (y_plus < yplus_min) yplus_min = y_plus;
890 yplus_mean += y_plus;
891 if (u_tau_ref > u_tau_max) u_tau_max = u_tau_ref;
892 if (u_tau_ref < u_tau_min) u_tau_min = u_tau_ref;
893 u_tau_mean += u_tau_ref;
894 if (y_ref_p > yplus_ref_max) yplus_ref_max = y_ref_p;
895 if (y_ref_p < yplus_ref_min) yplus_ref_min = y_ref_p;
896 yplus_ref_mean += y_ref_p;
897 if (u_tau_ref > u_tau_ref_max) u_tau_ref_max = u_tau_ref;
898 if (u_tau_ref < u_tau_ref_min) u_tau_ref_min = u_tau_ref;
899 u_tau_ref_mean += u_tau_ref;
901 if (y_plus > h_yplus_max) h_yplus_max = y_plus;
902 if (y_plus < h_yplus_min) h_yplus_min = y_plus;
903 h_yplus_mean += y_plus;
904 tab_h(0,yplus_count) = y_plus;
913 for (
int f = 0; f < nb_faces; f++)
917 while ((som_f < nb_som_face) and (sommet_interp(faces_sommets(f,som_f))==1))
922 if (compteur == nb_som_face)
925 for (
int som_=0; som_ < nb_som_face; som_++)
927 int i = faces_sommets(f,som_);
928 vitesse_imposee_calculee(f,0) += vitesse_imposee_sommet(i,ori)/nb_som_face;
933 if (impr_yplus && (yplus_count >= 1) )
935 d1_mean /= yplus_count;
936 yplus_mean /= yplus_count;
937 yplus_ref_mean /= yplus_count;
938 u_tau_mean /= yplus_count;
939 u_tau_ref_mean /= yplus_count;
940 Cerr<<
"min mean max y = "<<d1_min<<
" "<<d1_mean<<
" "<<d1_max<<finl;
941 Cerr<<
"min mean max y+ = "<<yplus_min<<
" "<<yplus_mean<<
" "<<yplus_max<<finl;
942 Cerr<<
"min mean u_tau = "<<u_tau_min<<
" "<<u_tau_mean<<
" "<<u_tau_max<<finl;
943 Cerr<<
"min mean max y+_ref = "<<yplus_ref_min<<
" "<<yplus_ref_mean<<
" "<<yplus_ref_max<<finl;
944 Cerr<<
"min mean u_tau_ref = "<<u_tau_ref_min<<
" "<<u_tau_ref_mean<<
" "<<u_tau_ref_max<<finl;
946 h_yplus_mean /= yplus_count;
947 double range = ( h_yplus_max - h_yplus_min)/N;
948 for (
int k = 0; k < N+1; k++) abs_h(0,k) = (h_yplus_min + k*range);
949 for (
int i=0; i < yplus_count; i++)
951 for (
int j = 0; j < N; j++)
953 if ( abs_h(0,j) < tab_h(0,i) && tab_h(0,i) <= abs_h(0,j+1) ) compteur_h(0,j) +=1;
956 Cerr<<
"histogramme y+ compteur =";
957 for (
int j = 0; j < N; j++) Cerr<<
" "<<compteur_h(0,j)<<
" ";
959 Cerr<<
"histogramme y+ abscisse =";
960 for (
int j = 0; j < N+1; j++) Cerr<<
" "<<abs_h(0,j)<<
" ";
962 Cerr<<
"histogramme y+ : min = "<<h_yplus_min<<
" - mean = "<<h_yplus_mean<<
" - max = "<<h_yplus_max<<finl;
964 Cerr<<
"Moyenne sur "<<yplus_count<<
" points"<<finl;