344 const Domaine_VEF& domaine_VEF = le_dom_VEF.valeur();
345 int nb_faces=domaine_VEF.
nb_faces();
347 const Domaine& dom = domaine_VEF.
domaine();
349 int nb_som_face=faces_sommets.
dimension(1);
350 int nb_som = domaine_VEF.
nb_som();
351 DoubleTab& variable_imposee_mod =
modele_lu_.variable_imposee_->valeurs();
354 DoubleTab& fluid_points = interp.fluid_points_->valeurs();
355 DoubleTab& solid_points = interp.solid_points_->valeurs();
356 DoubleTab& fluid_elems = interp.fluid_elems_->valeurs();
358 DoubleTab& val_variable_inconnue = champ_variable_inconnue.
valeurs();
359 int nb_comp = val_variable_inconnue.
dimension(1);
360 DoubleTab variable_imposee_sommet(nb_som,nb_comp);
361 IntTab sommet_interp(1, nb_som);
362 DoubleTab xf(1, dim_esp);
363 DoubleTab vf(1, nb_comp);
366 variable_imposee_calculee = 0.0;
367 variable_imposee_sommet = 0.0;
369 for (
int i = 0; i < nb_som; i++)
371 if ((fluid_elems(i) >= 0.0))
373 sommet_interp(0, i) = 1;
376 for(
int j = 0; j < dim_esp; j++)
378 double xj = dom.
coord(i,j);
379 double xjf = fluid_points(i,j);
381 double xjs = solid_points(i,j);
382 d1 += (xj-xjs)*(xj-xjs);
383 d2 += (xjf-xj)*(xjf-xj);
388 if ( (d1 + d2) > eps ) inv_d = 1.0 / (d1 + d2);
390 cells[0] = int(fluid_elems(i));
393 for (
int j = 0; j < nb_comp; j++)
395 double vjs = variable_imposee_mod(i,j);
396 variable_imposee_sommet(i,j) = vjs + (vf(0, j)-vjs)*inv_d*d1;
401 for(
int j = 0; j < nb_comp; j++)
403 variable_imposee_sommet(i,j) = variable_imposee_mod(i,j);
407 for (
int f = 0; f < nb_faces; f++)
411 while ((som_f < nb_som_face) and (sommet_interp(0, faces_sommets(f,som_f))==1))
416 if (compteur == nb_som_face)
418 for (
int som_=0; som_ < nb_som_face; som_++)
420 int i = faces_sommets(f,som_);
421 for(
int j = 0; j < nb_comp; j++)
423 variable_imposee_calculee(f,j) += variable_imposee_sommet(i,j)/nb_som_face;
432 const Domaine_VEF& domaine_VEF = le_dom_VEF.valeur();
433 int nb_faces=domaine_VEF.
nb_faces();
435 const Domaine& dom = domaine_VEF.
domaine();
437 int nb_som_face=faces_sommets.
dimension(1);
438 int nb_som = domaine_VEF.
nb_som();
439 DoubleTab& variable_imposee_mod =
modele_lu_.variable_imposee_->valeurs();
442 DoubleTab& solid_points = interp.solid_points_->valeurs();
443 DoubleTab& is_dirichlet = interp.is_dirichlet_->valeurs();
446 int nb_comp = variable_inconnue.
dimension(1);
448 DoubleTab variable_imposee_sommet(nb_som,nb_comp);
449 IntTab sommet_interp(1, nb_som);
450 variable_imposee_calculee = 0.0;
451 variable_imposee_sommet = 0.0;
453 for (
int i = 0; i < nb_som; i++)
455 if (is_dirichlet(i) > 0.0)
457 sommet_interp(0, i) = 1;
459 for(
int j = 0; j < dim_esp; j++)
461 double x = dom.
coord(i,j);
462 double xp = solid_points(i,j);
463 d2 += (x - xp)*(x - xp);
465 for(
int j = 0; j <nb_comp ; j++) variable_imposee_sommet(i,j) = variable_imposee_mod(i,j);
472 ArrOfDouble mean_grad(nb_comp);
474 int taille = voisins.
size();
476 for (
int k = 0; k < taille; k++)
478 int num_som = voisins[k];
480 for (
int j = 0; j < dim_esp; j++)
482 double xf = dom.
coord(num_som,j);
483 double xpf = solid_points(num_som,j);
484 d1 += (xf - xpf)*(xf - xpf);
489 for (
int j = 0; j < nb_comp; j++)
491 double vpf = variable_imposee_mod(num_som,j);
492 double vf = variable_inconnue(num_som,j);
493 mean_grad[j] += (vf - vpf)/d1;
498 for (
int j = 0; j < nb_comp; j++)
500 mean_grad[j] /= nb_contrib;
501 variable_imposee_sommet(i,j) += mean_grad[j]*d2;
508 for(
int j = 0; j < nb_comp; j++)
510 variable_imposee_sommet(i,j) = variable_imposee_mod(i,j);
514 for (
int f = 0; f < nb_faces; f++)
518 while ((som_f < nb_som_face) and (sommet_interp(0, faces_sommets(f,som_f))==1))
523 if (compteur == nb_som_face)
525 for (
int som_=0; som_ < nb_som_face; som_++)
527 int i = faces_sommets(f,som_);
528 for(
int j = 0; j < nb_comp; j++)
530 variable_imposee_calculee(f,j) += variable_imposee_sommet(i,j)/nb_som_face;
539 Cerr <<
"on passe ici" << finl;
540 const Domaine_VEF& domaine_VEF = le_dom_VEF.valeur();
541 int nb_faces=domaine_VEF.
nb_faces();
543 const Domaine& dom = domaine_VEF.
domaine();
545 int nb_som_face=faces_sommets.
dimension(1);
546 int nb_som = domaine_VEF.
nb_som();
547 DoubleTab& variable_imposee_mod =
modele_lu_.variable_imposee_->valeurs();
550 DoubleTab& solid_points = interp.solid_points_->valeurs();
551 DoubleTab& fluid_elems = interp.fluid_elems_->valeurs();
552 DoubleTab& fluid_points = interp.fluid_points_->valeurs();
555 DoubleTab& variable_inconnue = champ_variable_inconnue.
valeurs();
556 int nb_comp = variable_inconnue.
dimension(1);
557 DoubleTab xf(1, dim_esp);
558 DoubleTab vf(1, nb_comp);
560 DoubleTab variable_imposee_sommet(nb_som,nb_comp);
561 IntTab sommet_interp(1, nb_som);
562 variable_imposee_calculee = 0.0;
563 variable_imposee_sommet = 0.0;
565 Cerr <<
"on passe ici" << finl;
566 for (
int i = 0; i < nb_som; i++)
568 Cerr <<
"on passe la" << finl;
569 if (fluid_elems(i) >= 0.0)
571 sommet_interp(0, i) = 1;
574 for(
int j = 0; j < dim_esp; j++)
576 double xj = dom.
coord(i,j);
577 double xjf = fluid_points(i,j);
579 double xjs = solid_points(i,j);
580 d1 += (xj-xjs)*(xj-xjs);
581 d2 += (xjf-xj)*(xjf-xj);
585 double inv_d = 1.0 / (d1 + d2);
586 cells[0] = int(fluid_elems(i));
588 for (
int j = 0; j < nb_comp; j++)
590 double vjs = variable_imposee_mod(i,j);
591 variable_imposee_sommet(i,j) = vjs + (vf(0, j)-vjs)*inv_d*d1;
594 else if (fluid_elems(i) > -1.5 && fluid_elems(i) < -0.5)
596 sommet_interp(0, i) = 1;
598 for(
int j = 0; j < dim_esp; j++)
600 double x = dom.
coord(i,j);
601 double xp = solid_points(i,j);
602 d2 += (x - xp)*(x - xp);
605 for(
int j = 0; j <nb_comp ; j++) variable_imposee_sommet(i,j) = variable_imposee_mod(i,j);
611 ArrOfDouble mean_grad(nb_comp);
613 int taille = voisins.
size();
615 for (
int k = 0; k < taille; k++)
617 int num_som = voisins[k];
619 for (
int j = 0; j < dim_esp; j++)
621 double xjf = dom.
coord(num_som,j);
622 double xpf = solid_points(num_som,j);
623 d1 += (xjf - xpf)*(xjf - xpf);
628 for (
int j = 0; j < nb_comp; j++)
630 double vpf = variable_imposee_mod(num_som,j);
631 double vjf = variable_inconnue(num_som,j);
632 mean_grad[j] += (vjf - vpf)/d1;
637 for (
int j = 0; j < nb_comp; j++)
639 mean_grad[j] /= nb_contrib;
640 variable_imposee_sommet(i,j) += mean_grad[j]*d2;
647 for(
int j = 0; j < nb_comp; j++)
649 variable_imposee_sommet(i,j) = variable_imposee_mod(i,j);
653 for (
int f = 0; f < nb_faces; f++)
657 while ((som_f < nb_som_face) and (sommet_interp(0, faces_sommets(f,som_f))==1))
662 if (compteur == nb_som_face)
664 for (
int som_=0; som_ < nb_som_face; som_++)
666 int i = faces_sommets(f,som_);
667 for(
int j = 0; j < nb_comp; j++)
669 variable_imposee_calculee(f,j) += variable_imposee_sommet(i,j)/nb_som_face;
685 const Domaine_VEF& domaine_VEF = le_dom_VEF.valeur();
686 int nb_faces=domaine_VEF.
nb_faces();
688 const Domaine& dom = domaine_VEF.
domaine();
690 int nb_som_face=faces_sommets.
dimension(1);
691 int nb_som=domaine_VEF.
nb_som();
692 DoubleTab& vitesse_imposee_mod =
modele_lu_.variable_imposee_->valeurs();
696 DoubleTab& fluid_points = interp.fluid_points_->valeurs();
697 DoubleTab& solid_points = interp.solid_points_->valeurs();
698 DoubleTab& fluid_elems = interp.fluid_elems_->valeurs();
699 double A_pwl = interp.
get_A_pwl(form_WJSP);
701 double y_c_p_pwl = 0;
702 double C_pwl_WJSP = 0;
703 double D_pwl_WJSP = 0;
704 double p_pwl_WJSP = 0;
705 double y_c1_p_pwl_WJSP = 0;
706 double y_c2_p_pwl_WJSP = 0;
719 int impr_yplus = interp.
get_impr() ;
721 DoubleTab& val_vitesse_inconnue = champ_vitesse_inconnue.
valeurs();
722 if (nb_comp != val_vitesse_inconnue.
dimension(1))
724 Cerr<<
"Source_PDF_VEF::calculer_vitesse_imposee_power_law_tbl: variable must be a vector of dimension "<<
Objet_U::dimension<<
" ! "<<finl;
728 DoubleTab xf(1, nb_comp);
729 DoubleTab vf(1, nb_comp);
731 DoubleTab vitesse_imposee_sommet(nb_som,nb_comp);
732 IntTab sommet_interp(1, nb_som);
733 vitesse_imposee_calculee = 0.0;
734 vitesse_imposee_sommet = 0.0;
737 if (
equation().nombre_d_operateurs()<1)
748 double d1_min = 1.0e+10;
750 double d1_mean = 0.0;
751 double yplus_min = 1.0e+10;
752 double yplus_max = 0.0;
753 double yplus_mean = 0.0;
754 double u_tau_min = 1.0e+10;
755 double u_tau_max = 0.0;
756 double u_tau_mean = 0.0;
757 double yplus_ref_min = 1.0e+10;
758 double yplus_ref_max = 0.0;
759 double yplus_ref_mean = 0.0;
760 double u_tau_ref_min = 1.0e+10;
761 double u_tau_ref_max = 0.0;
762 double u_tau_ref_mean = 0.0;
763 double h_yplus_min = 1.0e+10;
764 double h_yplus_max = 0.0;
765 double h_yplus_mean = 0.0;
770 DoubleTab tab_h(1, nb_som);
771 DoubleTab abs_h(1, N+1);
772 DoubleTab compteur_h(1, N);
779 for (
int i = 0; i < nb_som; i++)
781 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = vitesse_imposee_mod(i,j);
783 if ((fluid_elems(i) >= 0.0))
785 sommet_interp(0, i) = 1;
788 DoubleTab normale(1, nb_comp);
789 double norme_de_la_normale= 0.0;
790 for(
int j = 0; j < nb_comp; j++)
792 double xj = dom.
coord(i,j);
793 double xjf = fluid_points(i,j);
795 double xjs = solid_points(i,j);
796 d1 += (xj-xjs)*(xj-xjs);
797 d2 += (xjf-xj)*(xjf-xj);
798 normale(0,j) = xjf - xjs;
799 norme_de_la_normale += normale(0,j)*normale(0,j);
806 if (d1 < eps) itisok = 0;
807 norme_de_la_normale = sqrt(norme_de_la_normale);
808 if ( norme_de_la_normale > eps )
809 for(
int j = 0; j < nb_comp; j++) normale(0,j) /= norme_de_la_normale;
812 for(
int j = 0; j < nb_comp; j++) normale(0,j) = 0.;
823 cells(0) = int(fluid_elems(i));
826 for(
int j = 0; j < nb_comp; j++) Vn += vf(0, j) * normale(0,j);
827 DoubleTab v_ref_t(1, nb_comp);
829 for(
int j = 0; j < nb_comp; j++) v_ref_t(0, j) =vf(0, j) - Vn*normale(0,j);
831 double norme_v_ref_t = 0.;
832 for(
int j = 0; j < nb_comp; j++) norme_v_ref_t += v_ref_t(0, j)*v_ref_t(0,j) ;
833 norme_v_ref_t = sqrt ( norme_v_ref_t );
834 if (norme_v_ref_t < 1.0e-6) norme_v_ref_t = 1.e-6;
839 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)) ) ;
841 double y_ref_p = y_ref * u_tau_ref / nu;
846 if ( y_ref_p > y_c_p_pwl)
850 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * pow ( d1 / y_ref , B_pwl ) ;
854 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)) ;
864 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * ( d1 / y_ref ) ;
868 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));
871 u_tau_ref = pow ( (nu * norme_v_ref_t / y_ref) , 0.5 ) ;
872 y_ref_p = y_ref * u_tau_ref / nu;
873 if ( y_ref_p > y_c_p_pwl )
881 double norme_v_imp_c = 0;
882 for(
int j=0 ; j < nb_comp; j++) norme_v_imp_c += vitesse_imposee_sommet(i ,j) * vitesse_imposee_sommet(i ,j);
883 norme_v_imp_c = sqrt( norme_v_imp_c );
885 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)) ) ;
886 y_plus = u_tau * d1 / nu;
888 if (y_plus >y_c_p_pwl)
896 u_tau = pow ( (nu * norme_v_imp_c/ d1) , 0.5 ) ;
897 y_plus = u_tau * d1 / nu;
898 if ( y_plus > y_c_p_pwl )
901 Cerr<<
"INCOHERENCE: u_tau ="<<u_tau<<
" y+ = "<<y_plus<<
" y+ref = "<<y_ref_p<<finl;
910 if ( (test_ * test_ref < 0) || (itisok == 0) )
912 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = vitesse_imposee_mod(i,j);
924 if (d1 > d1_max) d1_max = d1;
925 if (d1 < d1_min) d1_min = d1;
927 if (y_plus > yplus_max) yplus_max = y_plus;
928 if (y_plus < yplus_min) yplus_min = y_plus;
929 yplus_mean += y_plus;
930 if (u_tau > u_tau_max) u_tau_max = u_tau;
931 if (u_tau < u_tau_min) u_tau_min = u_tau;
933 if (y_ref_p > yplus_ref_max) yplus_ref_max = y_ref_p;
934 if (y_ref_p < yplus_ref_min) yplus_ref_min = y_ref_p;
935 yplus_ref_mean += y_ref_p;
936 if (u_tau_ref > u_tau_ref_max) u_tau_ref_max = u_tau_ref;
937 if (u_tau_ref < u_tau_ref_min) u_tau_ref_min = u_tau_ref;
938 u_tau_ref_mean += u_tau_ref;
940 if (y_plus > h_yplus_max) h_yplus_max = y_plus;
941 if (y_plus < h_yplus_min) h_yplus_min = y_plus;
942 h_yplus_mean += y_plus;
943 tab_h(0,yplus_count) = y_plus;
950 if ( y_ref_p > y_c2_p_pwl_WJSP)
952 y_plus = u_tau_ref * d1/nu;
953 if (y_plus > y_c2_p_pwl_WJSP)
957 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * pow ( d1 / y_ref , B_pwl ) ;
961 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)) ;
964 else if (y_plus < y_c2_p_pwl_WJSP and y_plus > y_c1_p_pwl_WJSP)
968 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;
972 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = 0 ;
979 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;
983 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)) ;
990 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) ;
991 y_ref_p = y_ref * u_tau_ref / nu;
992 if (y_ref_p < y_c2_p_pwl_WJSP and y_ref_p > y_c1_p_pwl_WJSP)
994 y_plus = u_tau_ref * d1/nu;
995 if (y_plus < y_c2_p_pwl_WJSP and y_plus > y_c1_p_pwl_WJSP)
999 double phi = -pow(1 + 4 * C_pwl_WJSP/pow(D_pwl_WJSP,2) * norme_v_ref_t * y_ref /nu,1/2) - 1;
1000 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);
1001 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = u_norm * v_ref_t(0,j)/norme_v_ref_t;
1005 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = 0 ;
1012 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 ;
1016 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = 0 ;
1025 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = v_ref_t(0,j) * ( d1 / y_ref ) ;
1029 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));
1031 u_tau_ref = pow ( (nu * norme_v_ref_t / y_ref) , 0.5 ) ;
1032 y_ref_p = y_ref * u_tau_ref / nu;
1033 if ( y_ref_p > y_c1_p_pwl_WJSP)
1037 Cerr <<
"Incoherence" << finl;
1048 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = vitesse_imposee_mod(i,j);
1060 if (d1 > d1_max) d1_max = d1;
1061 if (d1 < d1_min) d1_min = d1;
1063 if (y_plus > yplus_max) yplus_max = y_plus;
1064 if (y_plus < yplus_min) yplus_min = y_plus;
1065 yplus_mean += y_plus;
1066 if (u_tau_ref > u_tau_max) u_tau_max = u_tau_ref;
1067 if (u_tau_ref < u_tau_min) u_tau_min = u_tau_ref;
1068 u_tau_mean += u_tau_ref;
1069 if (y_ref_p > yplus_ref_max) yplus_ref_max = y_ref_p;
1070 if (y_ref_p < yplus_ref_min) yplus_ref_min = y_ref_p;
1071 yplus_ref_mean += y_ref_p;
1072 if (u_tau_ref > u_tau_ref_max) u_tau_ref_max = u_tau_ref;
1073 if (u_tau_ref < u_tau_ref_min) u_tau_ref_min = u_tau_ref;
1074 u_tau_ref_mean += u_tau_ref;
1076 if (y_plus > h_yplus_max) h_yplus_max = y_plus;
1077 if (y_plus < h_yplus_min) h_yplus_min = y_plus;
1078 h_yplus_mean += y_plus;
1079 tab_h(0,yplus_count) = y_plus;
1088 for (
int f = 0; f < nb_faces; f++)
1092 while ((som_f < nb_som_face) and (sommet_interp(0, faces_sommets(f,som_f))==1))
1097 if (compteur == nb_som_face)
1099 for (
int som_=0; som_ < nb_som_face; som_++)
1101 int i = faces_sommets(f,som_);
1102 for(
int j = 0; j < nb_comp; j++)
1104 vitesse_imposee_calculee(f,j) += vitesse_imposee_sommet(i,j)/nb_som_face;
1110 if (impr_yplus && (yplus_count >= 1) )
1112 d1_mean /= yplus_count;
1113 yplus_mean /= yplus_count;
1114 yplus_ref_mean /= yplus_count;
1115 u_tau_mean /= yplus_count;
1116 u_tau_ref_mean /= yplus_count;
1117 Cerr<<
"min mean max y = "<<d1_min<<
" "<<d1_mean<<
" "<<d1_max<<finl;
1118 Cerr<<
"min mean max y+ = "<<yplus_min<<
" "<<yplus_mean<<
" "<<yplus_max<<finl;
1119 Cerr<<
"min mean u_tau = "<<u_tau_min<<
" "<<u_tau_mean<<
" "<<u_tau_max<<finl;
1120 Cerr<<
"min mean max y+_ref = "<<yplus_ref_min<<
" "<<yplus_ref_mean<<
" "<<yplus_ref_max<<finl;
1121 Cerr<<
"min mean u_tau_ref = "<<u_tau_ref_min<<
" "<<u_tau_ref_mean<<
" "<<u_tau_ref_max<<finl;
1123 h_yplus_mean /= yplus_count;
1124 double range = ( h_yplus_max - h_yplus_min)/N;
1125 for (
int k = 0; k < N+1; k++) abs_h(0,k) = (h_yplus_min + k*range);
1126 for (
int i=0; i < yplus_count; i++)
1128 for (
int j = 0; j < N; j++)
1130 if ( abs_h(0,j) < tab_h(0,i) && tab_h(0,i) <= abs_h(0,j+1) ) compteur_h(0,j) +=1;
1133 Cerr<<
"histogramme y+ compteur =";
1134 for (
int j = 0; j < N; j++) Cerr<<
" "<<compteur_h(0,j)<<
" ";
1136 Cerr<<
"histogramme y+ abscisse =";
1137 for (
int j = 0; j < N+1; j++) Cerr<<
" "<<abs_h(0,j)<<
" ";
1139 Cerr<<
"histogramme y+ : min = "<<h_yplus_min<<
" - mean = "<<h_yplus_mean<<
" - max = "<<h_yplus_max<<finl;
1141 Cerr<<
"Moyenne sur "<<yplus_count<<
" points"<<finl;
1148 const Domaine_VEF& domaine_VEF = le_dom_VEF.valeur();
1149 int nb_faces=domaine_VEF.
nb_faces();
1151 const Domaine& dom = domaine_VEF.
domaine();
1152 const IntTab& faces_sommets=domaine_VEF.
face_sommets();
1153 int nb_som_face=faces_sommets.
dimension(1);
1154 int nb_som = domaine_VEF.
nb_som();
1155 DoubleTab& vitesse_imposee_mod =
modele_lu_.variable_imposee_->valeurs();
1158 DoubleTab& is_dirichlet = interp.is_dirichlet_->valeurs();
1159 DoubleTab& solid_points = interp.solid_points_->valeurs();
1160 DoubleTab& solid_elems = interp.solid_elems_->valeurs();
1164 int impr_yplus = interp.
get_impr() ;
1166 DoubleTab vitesse_imposee_sommet(nb_som,nb_comp);
1167 IntTab sommet_interp(1, nb_som);
1168 vitesse_imposee_calculee = 0.0;
1169 vitesse_imposee_sommet = 0.0;
1171 if (nb_comp != vitesse_inconnue.
dimension(1))
1173 Cerr<<
"Source_PDF_EF::calculer_vitesse_imposee_power_law_tbl_u_star: variable must be a vector of dimension "<<
Objet_U::dimension<<
" ! "<<finl;
1180 if (
equation().nombre_d_operateurs()<1)
1191 double d1_min = 1.0e+10;
1192 double d1_max = 0.0;
1193 double d1_mean = 0.0;
1194 double yplus_min = 1.0e+10;
1195 double yplus_max = 0.0;
1196 double yplus_mean = 0.0;
1197 double u_tau_min = 1.0e+10;
1198 double u_tau_max = 0.0;
1199 double u_tau_mean = 0.0;
1200 double yplus_ref_min = 1.0e+10;
1201 double yplus_ref_max = 0.0;
1202 double yplus_ref_mean = 0.0;
1203 double u_tau_ref_min = 1.0e+10;
1204 double u_tau_ref_max = 0.0;
1205 double u_tau_ref_mean = 0.0;
1206 double h_yplus_min = 1.0e+10;
1207 double h_yplus_max = 0.0;
1208 double h_yplus_mean = 0.0;
1210 int yplus_ref_count=0 ;
1213 DoubleTab tab_h(1, nb_som);
1214 DoubleTab abs_h(1, N+1);
1215 DoubleTab compteur_h(1, N);
1224 for (
int i = 0; i < nb_som; i++)
1227 if (is_dirichlet(i) > 0.0)
1229 sommet_interp(0, i) = 1;
1232 DoubleTab normaleP(1, nb_comp);
1233 double norme_de_la_normaleP= 0.0;
1235 for(
int j = 0; j < nb_comp; j++)
1237 vitesse_imposee_sommet(i,j) = vitesse_imposee_mod(i,j);
1239 double xp = solid_points(i,j);
1240 normaleP(0,j) = x - xp;
1241 norme_de_la_normaleP += normaleP(0,j)*normaleP(0,j);
1243 norme_de_la_normaleP = sqrt(norme_de_la_normaleP);
1244 d1P = norme_de_la_normaleP;
1246 for(
int j = 0; j < nb_comp; j++) normaleP(0,j) /= norme_de_la_normaleP;
1249 cells(0) = int(solid_elems(i));
1264 DoubleTab mean_u_tau_neighbour(1, nb_comp);
1265 mean_u_tau_neighbour = 0.0;
1266 double mean_y_plus_neighbour = 0.;
1267 int taille = voisins.
size();
1269 double pond_tot = 0.;
1270 double ponderation_k;
1271 for (
int k = 0; k < taille; k++)
1274 int num_som = voisins[k];
1277 DoubleTab a(1, nb_comp);
1278 DoubleTab b(1, nb_comp);
1279 double norme_a = 0.0;
1280 double norme_b = 0.0;
1282 for (
int j = 0; j < nb_comp; j++)
1284 double xf = dom.
coord(num_som,j);
1285 double xpf = solid_points(num_som,j);
1286 d1 += (xf - xpf)*(xf - xpf);
1288 b(0,j) = (xf - x)*normaleP(0,j);
1289 norme_a += a(0,j)*a(0,j);
1290 norme_b += b(0,j)*b(0,j);
1293 if ( d1 < eps ) itisok = 0;
1295 if ( (norme_a - norme_b) > eps )
1296 ponderation_k = 1/(sqrt(norme_a - norme_b));
1298 ponderation_k = 1./eps;
1306 for(
int j = 0; j < nb_comp; j++) Vn += vitesse_inconnue(num_som,j) * normaleP(0,j);
1307 DoubleTab vtf_k(1, nb_comp);
1308 for(
int j = 0; j < nb_comp; j++) vtf_k(0, j) = vitesse_inconnue(num_som, j) - Vn * normaleP(0,j);
1309 double norme_vtf_k = 0.;
1310 for(
int j = 0; j < nb_comp; j++) norme_vtf_k += vtf_k(0, j)*vtf_k(0,j);
1311 norme_vtf_k = sqrt(norme_vtf_k);
1312 u_tau_ref = pow ( norme_vtf_k , (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)) ) ;
1313 y_plus_ref = d1 * u_tau_ref / nu;
1314 if (y_plus_ref < y_c_p_pwl )
1316 u_tau_ref = pow ( (nu * norme_vtf_k / d1) , 0.5 ) ;
1317 y_plus_ref = d1 * u_tau_ref / nu;
1318 if ( y_plus_ref > y_c_p_pwl )
1326 if (norme_vtf_k < eps) itisok = 0;
1329 for(
int j = 0; j < nb_comp; j++) mean_u_tau_neighbour(0,j) += (u_tau_ref * vtf_k(0, j) / norme_vtf_k) * ponderation_k;
1330 mean_y_plus_neighbour += y_plus_ref * ponderation_k;
1331 pond_tot += ponderation_k;
1335 if (impr_yplus && itisok)
1337 if (y_plus_ref > yplus_ref_max) yplus_ref_max = y_plus_ref;
1338 if (y_plus_ref < yplus_ref_min) yplus_ref_min = y_plus_ref;
1339 yplus_ref_mean += y_plus_ref;
1340 if (u_tau_ref > u_tau_ref_max) u_tau_ref_max = u_tau_ref;
1341 if (u_tau_ref < u_tau_ref_min) u_tau_ref_min = u_tau_ref;
1342 u_tau_ref_mean += u_tau_ref;
1343 yplus_ref_count += 1;
1351 mean_u_tau_neighbour /= pond_tot;
1352 mean_y_plus_neighbour /= pond_tot;
1354 for(
int j = 0; j < nb_comp; j++) u_tau += mean_u_tau_neighbour(0,j) * mean_u_tau_neighbour(0,j);
1355 u_tau = sqrt(u_tau);
1356 y_plus = u_tau * d1P / nu;
1358 if (u_tau > eps) mean_u_tau_neighbour /= u_tau;
1359 else mean_u_tau_neighbour = 0. ;
1360 if (y_plus > y_c_p_pwl )
1362 if (mean_y_plus_neighbour > y_c_p_pwl )
1364 double vit_coeff = A_pwl * pow (d1P, B_pwl) / pow (nu, B_pwl);
1365 for (
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = pow (u_tau, (1+B_pwl)) * vit_coeff * mean_u_tau_neighbour(0,j);
1371 if (mean_y_plus_neighbour < y_c_p_pwl )
1373 for (
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = (d1P * u_tau * u_tau / nu) * mean_u_tau_neighbour(0,j);
1395 if (impr_yplus && itisok_P)
1397 if (d1P > d1_max) d1_max = d1P;
1398 if (d1P < d1_min) d1_min = d1P;
1400 if (y_plus > yplus_max) yplus_max = y_plus;
1401 if (y_plus < yplus_min) yplus_min = y_plus;
1402 yplus_mean += y_plus;
1403 if (u_tau > u_tau_max) u_tau_max = u_tau;
1404 if (u_tau < u_tau_min) u_tau_min = u_tau;
1405 u_tau_mean += u_tau;
1407 if (y_plus > h_yplus_max) h_yplus_max = y_plus;
1408 if (y_plus < h_yplus_min) h_yplus_min = y_plus;
1409 h_yplus_mean += y_plus;
1410 tab_h(0,yplus_count) = y_plus;
1416 for(
int j = 0; j < nb_comp; j++) vitesse_imposee_sommet(i,j) = vitesse_imposee_mod(i,j);
1420 for (
int f = 0; f < nb_faces; f++)
1424 while ((som_f < nb_som_face) and (sommet_interp(0, faces_sommets(f,som_f))==1))
1429 if (compteur == nb_som_face)
1431 for (
int som_=0; som_ < nb_som_face; som_++)
1433 int i = faces_sommets(f,som_);
1434 for(
int j = 0; j < nb_comp; j++)
1436 vitesse_imposee_sommet(f,j) += vitesse_imposee_sommet(i,j)/nb_som_face;
1442 if (impr_yplus && (yplus_count >= 1) && (yplus_ref_count >= 1) )
1444 d1_mean /= yplus_count;
1445 yplus_mean /= yplus_count;
1446 yplus_ref_mean /= yplus_ref_count;
1447 u_tau_mean /= yplus_count;
1448 u_tau_ref_mean /= yplus_ref_count;
1449 Cerr<<
"min mean max y = "<<d1_min<<
" "<<d1_mean<<
" "<<d1_max<<finl;
1450 Cerr<<
"min mean max y+ = "<<yplus_min<<
" "<<yplus_mean<<
" "<<yplus_max<<finl;
1451 Cerr<<
"min mean u_tau = "<<u_tau_min<<
" "<<u_tau_mean<<
" "<<u_tau_max<<finl;
1452 Cerr<<
"min mean max y+_ref = "<<yplus_ref_min<<
" "<<yplus_ref_mean<<
" "<<yplus_ref_max<<finl;
1453 Cerr<<
"min mean u_tau_ref = "<<u_tau_ref_min<<
" "<<u_tau_ref_mean<<
" "<<u_tau_ref_max<<finl;
1455 h_yplus_mean /= yplus_count;
1456 double range = ( h_yplus_max - h_yplus_min)/N;
1457 for (
int k = 0; k < N+1; k++) abs_h(0,k) = (h_yplus_min + k*range);
1458 for (
int i=0; i < yplus_count; i++)
1460 for (
int j = 0; j < N; j++)
1462 if ( abs_h(0,j) < tab_h(0,i) && tab_h(0,i) <= abs_h(0,j+1) ) compteur_h(0,j) +=1;
1465 Cerr<<
"histogramme y+ compteur =";
1466 for (
int j = 0; j < N; j++) Cerr<<
" "<<compteur_h(0,j)<<
" ";
1468 Cerr<<
"histogramme y+ abscisse =";
1469 for (
int j = 0; j < N+1; j++) Cerr<<
" "<<abs_h(0,j)<<
" ";
1471 Cerr<<
"histogramme y+ : min = "<<h_yplus_min<<
" - mean = "<<h_yplus_mean<<
" - max = "<<h_yplus_max<<finl;
1473 Cerr<<
"Moyenne sur "<<yplus_count<<
" points forces et "<<yplus_ref_count<<
" points references"<<finl;
1489 const Domaine_VEF& domaine_VEF = le_dom_VEF.valeur();
1490 const Domaine& dom = domaine_VEF.
domaine();
1492 const IntTab& faces_sommets=domaine_VEF.
face_sommets();
1493 int nb_faces=domaine_VEF.
nb_faces();
1494 int nb_som_face=faces_sommets.
dimension(1);
1495 int nb_som = domaine_VEF.
nb_som();
1497 DoubleTab& variable_imposee_mod =
modele_lu_.variable_imposee_->valeurs();
1501 DoubleTab& solid_points = interp.solid_points_->valeurs();
1502 DoubleTab& fluid_points = interp.fluid_points_->valeurs();
1503 DoubleTab& fluid_elems = interp.fluid_elems_->valeurs();
1506 DoubleTab& val_variable_inconnue = champ_variable_inconnue.
valeurs();
1509 const DoubleTab& val_ustar = champ_ustar_som.
valeurs();
1511 const DoubleTab& val_yplus = champ_yplus.
valeurs();
1513 int nb_comp = val_variable_inconnue.
dimension(1);
1515 DoubleTab temperature_imposee_sommet(nb_som,nb_comp);
1516 IntTab sommet_interp(nb_som);
1517 DoubleTab x(1, dim_esp);
1518 DoubleTab xf(1, dim_esp);
1519 DoubleTab Tref(1, nb_comp);
1521 double thetap = 0.0;
1522 double thetapref = 0.0;
1529 temperature_imposee_calculee = 0.0;
1530 temperature_imposee_sommet = 0.0;
1536 for (
int i = 0; i < nb_som; i++)
1538 if ((fluid_elems(i) >= 0.0))
1541 sommet_interp(i) = 1;
1542 temperature_imposee_sommet(i,0) = variable_imposee_mod(i,0);
1544 double utau = val_ustar(i);
1545 double yplus = val_yplus(i);
1552 DoubleTab normale(1, nb_comp);
1553 double norme_de_la_normale= 0.0;
1554 for(
int j = 0; j < nb_comp; j++)
1556 double xj = dom.
coord(i,j);
1557 double xjf = fluid_points(i,j);
1559 double xjs = solid_points(i,j);
1560 d1 += (xj-xjs)*(xj-xjs);
1561 d2 += (xjf-xj)*(xjf-xj);
1562 normale(0,j) = xjf - xjs;
1563 norme_de_la_normale += normale(0,j)*normale(0,j);
1567 double y_ref= d1+d2;
1569 if (d1 < eps) itisok = 0;
1572 norme_de_la_normale = sqrt(norme_de_la_normale);
1573 for(
int j = 0; j < nb_comp; j++) normale(0,j) /= norme_de_la_normale;
1576 double nu = d1 * utau / yplus;
1581 cells[0] = int(fluid_elems(i));
1583 double yplusref = y_ref * utau / nu;
1586 thetap = interp.
Kader(yplus,Pr);
1587 thetapref = interp.
Kader(yplusref,Pr);
1591 Cerr <<
"Loi non implementee, choix d'une autre loi obligatoire" << finl;
1594 if ((itisok == 1) and (!boundary_type))
1596 double Tw = variable_imposee_mod(i,0);
1599 temperature_imposee_sommet(i,0) = Tw - abs((thetap / thetapref) * (Tref(0,0) - Tw));
1603 temperature_imposee_sommet(i,0) = Tw + abs((thetap / thetapref) * (Tref(0,0) - Tw));
1606 else if ((itisok == 1) and (boundary_type == 1))
1608 double qw = variable_imposee_mod(i,0);
1609 double T_tau = qw/(rho * Cp * utau);
1610 temperature_imposee_sommet(i,0) = Tref(0,0) + T_tau * (thetapref - thetap);
1614 Cerr <<
"Erreur dans le choix du type de condition aux limites" << finl;
1622 for (
int f = 0; f < nb_faces; f++)
1626 while ((som_f < nb_som_face) and (sommet_interp(faces_sommets(f,som_f))==1))
1631 if (compteur == nb_som_face)
1633 for (
int som_faces =0; som_faces < nb_som_face; som_faces++)
1635 int i = faces_sommets(f,som_faces);
1636 temperature_imposee_calculee(f,0) += temperature_imposee_sommet(i,0)/nb_som_face;