13 #if !defined(KRATOS_ENRICHMENTUTILITIES_INCLUDED )
14 #define KRATOS_ENRICHMENTUTILITIES_INCLUDED
44 static int CalculateEnrichedShapeFuncions(
BoundedMatrix<
double,(2+1), 2 >& rPoints,
BoundedMatrix<
double, (2+1), 2 >& DN_DX,
array_1d<
double,(2+1)>& rDistances,
array_1d<
double,(3*(2-1))>& rVolumes,
BoundedMatrix<
double, 3*(2-1), (2+1) >& rGPShapeFunctionValues,
array_1d<
double,(3*(2-1))>& rPartitionsSign, std::vector<Matrix>& rGradientsValue,
BoundedMatrix<
double,3*(2-1), (2)>& NEnriched,
array_1d<
double,(3)>& rGPShapeFunctionValues_in_interfase,
array_1d<
double,(3)>& NEnriched_in_interfase,
double & InterfaseArea)
48 const double one_third=1.0/3.0;
53 double most_common_sign=0;
55 rGPShapeFunctionValues(0,0)=one_third; rGPShapeFunctionValues(0,1)=one_third; rGPShapeFunctionValues(0,2)=one_third;
56 Area = CalculateVolume2D( rPoints );
62 if( (rDistances(0)*rDistances(1))>0.0 && (rDistances(0)*rDistances(2))>0.0 )
65 rGPShapeFunctionValues(0,0)=one_third; rGPShapeFunctionValues(0,1)=one_third; rGPShapeFunctionValues(0,2)=one_third;
68 for (
int j = 0;
j < 3;
j++)
69 rGradientsValue[0](0,
j) = 0.0;
70 if (rDistances(0) < 0.0) rPartitionsSign[0] = -1.0;
71 else rPartitionsSign[0] = 1.0;
93 if ((rDistances(0)*rDistances(1))<0.0)
97 if ((rDistances(1)*rDistances(2))<0.0)
101 if ((rDistances(2)*rDistances(0))<0.0)
108 const double unsigned_distance0=fabs(rDistances(0));
109 const double unsigned_distance1=fabs(rDistances(1));
110 const double unsigned_distance2=fabs(rDistances(2));
112 double longest_distance=fabs(unsigned_distance0);
113 if (unsigned_distance1>longest_distance)
114 longest_distance=unsigned_distance1;
115 if (unsigned_distance2>longest_distance)
116 longest_distance=unsigned_distance2;
118 const double tolerable_distance =longest_distance*0.001;
120 if (unsigned_distance0<tolerable_distance)
121 rDistances[0]=tolerable_distance*(rDistances[0]/fabs(rDistances[0]));
122 if (unsigned_distance1<tolerable_distance)
123 rDistances[1]=tolerable_distance*(rDistances[1]/fabs(rDistances[1]));
124 if (unsigned_distance2<tolerable_distance)
125 rDistances[2]=tolerable_distance*(rDistances[2]/fabs(rDistances[2]));
129 for (
unsigned int i=0;
i<3;
i++)
131 int edge_begin_node=
i;
132 int edge_end_node=
i+1;
133 if (edge_end_node==3) edge_end_node=0;
135 if(cut_edges(
i)==
true)
137 aux_nodes_relative_locations(
i)=fabs(rDistances(edge_end_node)/(rDistances(edge_end_node)-rDistances(edge_begin_node) ) ) ;
138 aux_nodes_father_nodes(
i,0)=edge_begin_node;
139 aux_nodes_father_nodes(
i,1)=edge_end_node;
143 if(fabs(rDistances(edge_end_node))>fabs(rDistances(edge_begin_node)))
145 aux_nodes_relative_locations(
i)=0.0;
146 aux_nodes_father_nodes(
i,0)=edge_end_node;
147 aux_nodes_father_nodes(
i,1)=edge_end_node;
151 aux_nodes_relative_locations(
i)=1.0;
152 aux_nodes_father_nodes(
i,0)=edge_begin_node;
153 aux_nodes_father_nodes(
i,1)=edge_begin_node;
158 for (
unsigned int j=0;
j<2;
j++)
159 aux_points(
i,
j)= rPoints(edge_begin_node,
j) * aux_nodes_relative_locations(
i) + rPoints(edge_end_node,
j) * (1.0- aux_nodes_relative_locations(
i));
164 if (cut_edges(0)==
true)
166 base_point[0] = aux_points(0,0);
167 base_point[1] = aux_points(0,1);
172 base_point[0] = aux_points(1,0);
173 base_point[1] = aux_points(1,1);
176 for (
int i_node = 0; i_node < 3; i_node++)
178 double d = (rPoints(i_node,0) - base_point[0]) * grad_d[0] +
179 (rPoints(i_node,1) - base_point[1]) * grad_d[1] ;
180 abs_distance[i_node] = fabs(
d);
184 for (
int i = 0;
i < 3;
i++)
186 if (rDistances[
i] < 0.0)
188 exact_distance[
i] = -abs_distance[
i];
193 exact_distance[
i] = abs_distance[
i];
206 double max_aux_dist_on_cut = -1;
207 for (
int edge = 0; edge < 3; edge++)
212 if (rDistances[
i] * rDistances[
j] < 0.0)
214 const double tmp = fabs(rDistances[
i]) / (fabs(rDistances[
i]) + fabs(rDistances[
j]));
216 double abs_dist_on_cut = abs_distance[
i] *
tmp + abs_distance[
j] * (1.00 -
tmp);
217 if(abs_dist_on_cut > max_aux_dist_on_cut) max_aux_dist_on_cut = abs_dist_on_cut;
232 unsigned int partition_number=0;
235 bool found_empty_partition=
false;
236 for (
unsigned int i=0;
i<4;
i++)
238 unsigned int j_aux =
i + 2;
239 if (j_aux>2) j_aux -= 3;
244 partition_father_nodes(0,0)=
i;
245 partition_father_nodes(0,1)=
i;
246 partition_father_nodes(1,0)=aux_nodes_father_nodes(
i,0);
247 partition_father_nodes(1,1)=aux_nodes_father_nodes(
i,1);
248 partition_father_nodes(2,0)=aux_nodes_father_nodes(j_aux,0);
249 partition_father_nodes(2,1)=aux_nodes_father_nodes(j_aux,1);
251 coord_subdomain(0,0)=rPoints(
i,0);
252 coord_subdomain(0,1)=rPoints(
i,1);
253 coord_subdomain(1,0)=aux_points(
i,0);
254 coord_subdomain(1,1)=aux_points(
i,1);
255 coord_subdomain(2,0)=aux_points(j_aux,0);
256 coord_subdomain(2,1)=aux_points(j_aux,1);
261 partition_father_nodes=aux_nodes_father_nodes;
262 coord_subdomain=aux_points;
267 CalculateGeometryData(coord_subdomain, DN_DX_subdomain, temp_area);
268 if (temp_area > 1.0e-20)
270 rVolumes(partition_number)=temp_area;
272 double x_GP_partition = one_third * ( coord_subdomain(0,0) + coord_subdomain(1,0) + coord_subdomain(2,0) );
273 double y_GP_partition = one_third * ( coord_subdomain(0,1) + coord_subdomain(1,1) + coord_subdomain(2,1) );
274 double z_GP_partition = 0.0;
276 coord_subdomain = rPoints;
278 CalculatePosition ( coord_subdomain , x_GP_partition ,y_GP_partition ,z_GP_partition ,
N);
280 const double partition_sign = (
N(0)*rDistances(0) +
N(1)*rDistances(1) +
N(2)*rDistances(2))/fabs(
N(0)*rDistances(0) +
N(1)*rDistances(1) +
N(2)*rDistances(2));
283 rGPShapeFunctionValues(partition_number,0)=
N(0);
284 rGPShapeFunctionValues(partition_number,1)=
N(1);
285 rGPShapeFunctionValues(partition_number,2)=
N(2);
289 double abs_dist = 0.0;
290 for (
int j = 0;
j < 3;
j++)
292 dist += rGPShapeFunctionValues(partition_number,
j) * exact_distance[
j];
293 abs_dist += rGPShapeFunctionValues(partition_number,
j) * abs_distance[
j];
296 if (partition_sign < 0.0)
297 rPartitionsSign[partition_number] = -1.0;
299 rPartitionsSign[partition_number] = 1.0;
302 NEnriched(partition_number, 0) = 0.5/max_aux_dist_on_cut * (abs_dist - rPartitionsSign[partition_number] *
dist);
303 for (
int j = 0;
j < 2;
j++)
305 rGradientsValue[partition_number](0,
j) = (0.5/max_aux_dist_on_cut) * (abs_distance_gradient[
j] - rPartitionsSign[partition_number] * exact_distance_gradient[
j]);
309 if (rPartitionsSign[partition_number]*most_common_sign > 0.0)
311 NEnriched(partition_number, 1) = -1.0*rPartitionsSign[partition_number]*NEnriched(partition_number, 0) ;
312 for (
int j = 0;
j < 2;
j++)
314 rGradientsValue[partition_number](1,
j) = -1.0*rPartitionsSign[partition_number]*rGradientsValue[partition_number](0,
j);
321 NEnriched(partition_number, 1) = rPartitionsSign[partition_number]*( 1.0*NEnriched(partition_number, 0) - 0.6666666666666666666666666666 ) ;
322 for (
int j = 0;
j < 2;
j++)
324 rGradientsValue[partition_number](1,
j) = (rPartitionsSign[partition_number]*1.0*rGradientsValue[partition_number](0,
j) - exact_distance_gradient[
j]*1.0/(abs_distance[
i]));
334 found_empty_partition=
true;
337 if (found_empty_partition==
false)
345 InterfaseArea = sqrt(pow(aux_points(0,0)-aux_points(1,0),2)+pow(aux_points(0,1)-aux_points(1,1),2));
346 base_point[0] = (aux_points(0,0)+aux_points(1,0))*0.5;
347 base_point[1] = (aux_points(0,1)+aux_points(1,1))*0.5;
348 CalculatePosition ( rPoints , base_point[0] ,base_point[1] , 0.0 , rGPShapeFunctionValues_in_interfase);
349 double abs_dist_on_interfase = 0.0;
350 for (
int j = 0;
j < 3;
j++)
351 abs_dist_on_interfase += rGPShapeFunctionValues_in_interfase (
j) * abs_distance[
j];
352 NEnriched_in_interfase(0) = 0.5/max_aux_dist_on_cut * abs_dist_on_interfase;
356 InterfaseArea= sqrt(pow(aux_points(0,0)-aux_points(2,0),2)+pow(aux_points(0,1)-aux_points(2,1),2));
357 base_point[0] = (aux_points(0,0)+aux_points(2,0))*0.5;
358 base_point[1] = (aux_points(0,1)+aux_points(2,1))*0.5;
359 CalculatePosition ( rPoints , base_point[0] ,base_point[1] , 0.0 , rGPShapeFunctionValues_in_interfase);
360 double abs_dist_on_interfase = 0.0;
361 for (
int j = 0;
j < 3;
j++)
362 abs_dist_on_interfase += rGPShapeFunctionValues_in_interfase (
j) * abs_distance[
j];
363 NEnriched_in_interfase(0) = 0.5/max_aux_dist_on_cut * abs_dist_on_interfase;
368 InterfaseArea= sqrt(pow(aux_points(2,0)-aux_points(1,0),2)+pow(aux_points(2,1)-aux_points(1,1),2));
369 base_point[0] = (aux_points(2,0)+aux_points(1,0))*0.5;
370 base_point[1] = (aux_points(2,1)+aux_points(1,1))*0.5;
371 CalculatePosition ( rPoints , base_point[0] ,base_point[1] , 0.0 , rGPShapeFunctionValues_in_interfase);
372 double abs_dist_on_interfase = 0.0;
373 for (
int j = 0;
j < 3;
j++)
374 abs_dist_on_interfase += rGPShapeFunctionValues_in_interfase (
j) * abs_distance[
j];
375 NEnriched_in_interfase(0) = 0.5/max_aux_dist_on_cut * abs_dist_on_interfase;
386 static int CalculateEnrichedShapeFuncionsExtendedmodified(
BoundedMatrix<
double,(2+1), 2 >& rPoints,
BoundedMatrix<
double, (2+1), 2 >& DN_DX,
array_1d<
double,(2+1)>& rDistances,
array_1d<
double,(3*(2-1))>& rVolumes,
BoundedMatrix<
double, 3*(2-1), (2+1) >& rGPShapeFunctionValues,
array_1d<
double,(3*(2-1))>& rPartitionsSign, std::vector<Matrix>& rGradientsValue,
BoundedMatrix<
double,3*(2-1), (5)>& NEnriched,
BoundedMatrix<double,10, 2>& rGradientpositive,
BoundedMatrix<double,10, 2>& rGradientnegative ,
BoundedMatrix<int,3,3>& father_nodes)
390 const double one_third=1.0/3.0;
395 double most_common_sign=0;
397 rGPShapeFunctionValues(0,0)=one_third; rGPShapeFunctionValues(0,1)=one_third; rGPShapeFunctionValues(0,2)=one_third;
398 Area = CalculateVolume2D( rPoints );
404 if( (rDistances(0)*rDistances(1))>0.0 && (rDistances(0)*rDistances(2))>0.0 )
407 rGPShapeFunctionValues(0,0)=one_third; rGPShapeFunctionValues(0,1)=one_third; rGPShapeFunctionValues(0,2)=one_third;
408 NEnriched(0,0) = 0.0;
410 for (
int j = 0;
j < 2;
j++)
411 rGradientsValue[0](0,
j) = 0.0;
412 if (rDistances(0) < 0.0) rPartitionsSign[0] = -1.0;
413 else rPartitionsSign[0] = 1.0;
421 const double unsigned_distance0=fabs(rDistances(0));
422 const double unsigned_distance1=fabs(rDistances(1));
423 const double unsigned_distance2=fabs(rDistances(2));
425 double longest_distance=fabs(unsigned_distance0);
426 if (unsigned_distance1>longest_distance)
427 longest_distance=unsigned_distance1;
428 if (unsigned_distance2>longest_distance)
429 longest_distance=unsigned_distance2;
447 if ((rDistances(0)*rDistances(1))<0.0)
451 if ((rDistances(1)*rDistances(2))<0.0)
455 if ((rDistances(2)*rDistances(0))<0.0)
464 int shape_function_id=0;
465 father_nodes(0,0)=-1;
466 father_nodes(0,1)=-1;
467 father_nodes(0,2)=-1;
468 father_nodes(1,0)=-1;
469 father_nodes(1,1)=-1;
470 father_nodes(1,2)=-1;
471 father_nodes(2,0)=-1;
472 father_nodes(2,1)=-1;
473 father_nodes(2,2)=-1;
476 for (
unsigned int i=0;
i<3;
i++)
478 int edge_begin_node=
i;
479 int edge_end_node=
i+1;
480 if (edge_end_node==3) edge_end_node=0;
482 if(cut_edges(
i)==
true)
484 aux_nodes_relative_locations(
i)=fabs(rDistances(edge_end_node)/(rDistances(edge_end_node)-rDistances(edge_begin_node) ) ) ;
487 aux_nodes_father_nodes(
i,0)=edge_begin_node;
488 aux_nodes_father_nodes(
i,1)=edge_end_node;
490 aux_node_enrichment_shape_function_index(
i)=shape_function_id;
491 father_nodes(
i,0)=edge_begin_node;
492 father_nodes(
i,1)=edge_end_node;
493 father_nodes(
i,2)=shape_function_id;
499 if(fabs(rDistances(edge_end_node))<fabs(rDistances(edge_begin_node)))
501 aux_nodes_relative_locations(
i)=0.0;
502 aux_nodes_father_nodes(
i,0)=edge_end_node;
503 aux_nodes_father_nodes(
i,1)=edge_end_node;
507 aux_nodes_relative_locations(
i)=1.0;
508 aux_nodes_father_nodes(
i,0)=edge_begin_node;
509 aux_nodes_father_nodes(
i,1)=edge_begin_node;
512 aux_node_enrichment_shape_function_index(
i)=-1;
516 for (
unsigned int j=0;
j<2;
j++){
517 aux_points(
i,
j)= rPoints(edge_begin_node,
j) * aux_nodes_relative_locations(
i) + rPoints(edge_end_node,
j) * (1.0- aux_nodes_relative_locations(
i));
523 if (cut_edges(0)==
true)
525 base_point[0] = aux_points(0,0);
526 base_point[1] = aux_points(0,1);
530 base_point[0] = aux_points(1,0);
531 base_point[1] = aux_points(1,1);
534 for (
int i_node = 0; i_node < 3; i_node++)
536 double d = (rPoints(i_node,0) - base_point[0]) * grad_d[0] + (rPoints(i_node,1) - base_point[1]) * grad_d[1] ;
537 abs_distance[i_node] = fabs(
d);
541 for (
int i = 0;
i < 3;
i++)
543 if (rDistances[
i] < 0.0)
545 exact_distance[
i] = -abs_distance[
i];
550 exact_distance[
i] = abs_distance[
i];
563 double max_aux_dist_on_cut = -1;
564 for (
int edge = 0; edge < 3; edge++)
569 if (rDistances[
i] * rDistances[
j] < 0.0)
571 const double tmp = fabs(rDistances[
i]) / (fabs(rDistances[
i]) + fabs(rDistances[
j]));
573 double abs_dist_on_cut = abs_distance[
i] *
tmp + abs_distance[
j] * (1.00 -
tmp);
574 if(abs_dist_on_cut > max_aux_dist_on_cut) max_aux_dist_on_cut = abs_dist_on_cut;
588 unsigned int partition_number=0;
591 bool found_empty_partition=
false;
598 for (
int i=0;
i<4;
i++)
602 active_node_in_enrichment_shape_function(0)=-1; active_node_in_enrichment_shape_function(1)=-1;
605 active_node_in_replacement_shape_function(0)=-1; active_node_in_replacement_shape_function(1)=-1; active_node_in_replacement_shape_function(2)=-1;
608 if (j_aux>2) j_aux -= 3;
612 int useful_node_for_N0star=-1;
613 int useful_node_for_N1star=-1;
617 partition_father_nodes(0,0)=
i;
618 partition_father_nodes(0,1)=
i;
619 partition_father_nodes(1,0)=aux_nodes_father_nodes(
i,0);
620 partition_father_nodes(1,1)=aux_nodes_father_nodes(
i,1);
621 partition_father_nodes(2,0)=aux_nodes_father_nodes(j_aux,0);
622 partition_father_nodes(2,1)=aux_nodes_father_nodes(j_aux,1);
624 coord_subdomain(0,0)=rPoints(
i,0);
625 coord_subdomain(0,1)=rPoints(
i,1);
626 coord_subdomain(1,0)=aux_points(
i,0);
627 coord_subdomain(1,1)=aux_points(
i,1);
628 coord_subdomain(2,0)=aux_points(j_aux,0);
629 coord_subdomain(2,1)=aux_points(j_aux,1);
633 if (aux_node_enrichment_shape_function_index(
i)> -1)
634 active_node_in_enrichment_shape_function( aux_node_enrichment_shape_function_index(
i) )=1;
638 if (aux_node_enrichment_shape_function_index(j_aux)> -1)
639 active_node_in_enrichment_shape_function( aux_node_enrichment_shape_function_index(j_aux) )=2;
642 active_node_in_replacement_shape_function(
i)=0;
644 if (aux_nodes_father_nodes(
i,0)==aux_nodes_father_nodes(
i,1))
645 active_node_in_replacement_shape_function(aux_nodes_father_nodes(
i,0))=1;
646 if (aux_nodes_father_nodes(j_aux,0)==aux_nodes_father_nodes(j_aux,1))
647 active_node_in_replacement_shape_function(aux_nodes_father_nodes(j_aux,0))=2;
653 coord_subdomain(0,0)=rPoints(
i,0);
654 coord_subdomain(0,1)=rPoints(
i,1);
655 coord_subdomain(1,0)=aux_points(
i,0);
656 coord_subdomain(1,1)=aux_points(
i,1);
657 coord_subdomain(2,0)=aux_points(j_aux,0);
658 coord_subdomain(2,1)=aux_points(j_aux,1);
661 if(partition_father_nodes(1,0)==
i || partition_father_nodes(1,1)==
i)
663 if(aux_node_enrichment_shape_function_index(
i)==0)
664 useful_node_for_N0star=1;
665 if(aux_node_enrichment_shape_function_index(
i)==1)
666 useful_node_for_N1star=1;
668 if(partition_father_nodes(2,0)==j_aux || partition_father_nodes(2,1)==j_aux)
670 if(aux_node_enrichment_shape_function_index(j_aux)==0)
671 useful_node_for_N0star=2;
672 if(aux_node_enrichment_shape_function_index(j_aux)==1)
673 useful_node_for_N1star=2;
678 partition_father_nodes=aux_nodes_father_nodes;
679 coord_subdomain=aux_points;
682 int non_aux_node_father_node=-1;
684 for (
int j = 0;
j < 3;
j++)
686 if(partition_father_nodes(
j,0)==partition_father_nodes(
j,1))
689 non_aux_node_father_node=partition_father_nodes(
j,0);
692 for (
int j = 0;
j < 3;
j++)
694 if (aux_node_enrichment_shape_function_index(
j)> -1)
696 active_node_in_enrichment_shape_function( aux_node_enrichment_shape_function_index(
j) ) =
j;
698 if(partition_father_nodes(
j,0)==non_aux_node_father_node || partition_father_nodes(
j,1)==non_aux_node_father_node)
700 if (aux_node_enrichment_shape_function_index(
j)==0)
701 useful_node_for_N0star=
j;
702 if (aux_node_enrichment_shape_function_index(
j)==1)
703 useful_node_for_N1star=
j;
707 if (aux_nodes_father_nodes(
j,0)==aux_nodes_father_nodes(
j,1))
708 active_node_in_replacement_shape_function(aux_nodes_father_nodes(
j,0))=
j;
714 CalculateGeometryData(coord_subdomain, DN_DX_subdomain, temp_area);
715 if (temp_area > 1.0e-20)
718 rVolumes(partition_number)=temp_area;
720 double x_GP_partition = one_third * ( coord_subdomain(0,0) + coord_subdomain(1,0) + coord_subdomain(2,0) );
721 double y_GP_partition = one_third * ( coord_subdomain(0,1) + coord_subdomain(1,1) + coord_subdomain(2,1) );
722 double z_GP_partition = 0.0;
724 coord_subdomain = rPoints;
726 CalculatePosition ( coord_subdomain , x_GP_partition ,y_GP_partition ,z_GP_partition ,
N);
728 const double partition_sign = (
N(0)*rDistances(0) +
N(1)*rDistances(1) +
N(2)*rDistances(2))/fabs(
N(0)*rDistances(0) +
N(1)*rDistances(1) +
N(2)*rDistances(2));
731 rGPShapeFunctionValues(partition_number,0)=
N(0);
732 rGPShapeFunctionValues(partition_number,1)=
N(1);
733 rGPShapeFunctionValues(partition_number,2)=
N(2);
737 double abs_dist = 0.0;
738 for (
int j = 0;
j < 3;
j++)
740 dist += rGPShapeFunctionValues(partition_number,
j) * exact_distance[
j];
741 abs_dist += rGPShapeFunctionValues(partition_number,
j) * abs_distance[
j];
744 if (partition_sign < 0.0)
745 rPartitionsSign[partition_number] = -1.0;
747 rPartitionsSign[partition_number] = 1.0;
751 for (
int index_shape_function = 0; index_shape_function < 2; index_shape_function++)
753 if (active_node_in_enrichment_shape_function(index_shape_function) > -1)
755 NEnriched(partition_number, index_shape_function+3 ) = one_third ;
756 for (
int j = 0;
j < 2;
j++)
758 rGradientsValue[partition_number](index_shape_function+3,
j) = DN_DX_subdomain(active_node_in_enrichment_shape_function(index_shape_function),
j);
764 NEnriched(partition_number, index_shape_function+3 ) = 0.0;
765 for (
int j = 0;
j < 2;
j++)
767 rGradientsValue[partition_number](index_shape_function+3,
j) = 0.0;
774 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
777 for (
int j = 0;
j < 3;
j++)
778 if (partition_father_nodes(
j,0)==index_shape_function && partition_father_nodes(
j,1)==index_shape_function)
785 for (
int j = 0;
j < 2;
j++)
786 rGradientsValue[partition_number](index_shape_function,
j) = DN_DX_subdomain(active_node,
j);
787 NEnriched(partition_number, index_shape_function ) = one_third;
788 replacement_shape_function_nodes(index_shape_function) = active_node;
792 for (
int j = 0;
j < 2;
j++)
793 rGradientsValue[partition_number](index_shape_function,
j) = 0.0;
794 replacement_shape_function_nodes(index_shape_function) = -1;
800 unsigned int number_of_real_nodes=0;
801 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
803 if (active_node_in_replacement_shape_function(index_shape_function) > -1)
804 number_of_real_nodes++;
807 if(useful_node_for_N0star > -1)
809 for (
int j = 0;
j < 2;
j++)
815 rGradientpositive(3,
j)=DN_DX_subdomain(useful_node_for_N0star,
j);
817 if (active_node_in_enrichment_shape_function(1) > -1)
818 rGradientpositive(4,
j)=DN_DX_subdomain(active_node_in_enrichment_shape_function(1),
j);
820 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
822 if(replacement_shape_function_nodes(index_shape_function)>-1)
824 rGradientpositive(index_shape_function,
j) = DN_DX_subdomain(replacement_shape_function_nodes(index_shape_function),
j);
830 rGradientnegative(3,
j) =DN_DX_subdomain(useful_node_for_N0star,
j);
831 if (active_node_in_enrichment_shape_function(1) > -1)
832 rGradientnegative(4,
j) =DN_DX_subdomain(active_node_in_enrichment_shape_function(1),
j);
834 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
836 if(replacement_shape_function_nodes(index_shape_function)>-1)
838 rGradientnegative(index_shape_function,
j) = DN_DX_subdomain(replacement_shape_function_nodes(index_shape_function),
j);
844 if(useful_node_for_N1star > -1)
846 for (
int j = 0;
j < 2;
j++)
852 rGradientpositive(9,
j)=DN_DX_subdomain(useful_node_for_N1star,
j);
854 if (active_node_in_enrichment_shape_function(0) > -1)
855 rGradientpositive(8,
j)=DN_DX_subdomain(active_node_in_enrichment_shape_function(0),
j);
857 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
859 if(replacement_shape_function_nodes(index_shape_function)>-1)
861 rGradientpositive(index_shape_function+5,
j) = DN_DX_subdomain(replacement_shape_function_nodes(index_shape_function),
j);
867 rGradientnegative(9,
j)=DN_DX_subdomain(useful_node_for_N1star,
j);
868 if(active_node_in_enrichment_shape_function(0) > -1)
869 rGradientnegative(8,
j)=DN_DX_subdomain(active_node_in_enrichment_shape_function(0),
j);
871 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
873 if(replacement_shape_function_nodes(index_shape_function)>-1)
875 rGradientnegative(index_shape_function+5,
j) = DN_DX_subdomain(replacement_shape_function_nodes(index_shape_function),
j);
886 found_empty_partition=
true;
888 if (found_empty_partition==
false)
899 static int CalculateEnrichedShapeFuncionsExtendedmodified_gausspoints(
Geometry< Node >& trianglegeom,
BoundedMatrix<
double,(2+1), 2 >& rPoints,
BoundedMatrix<
double, (2+1), 2 >& DN_DX,
array_1d<
double,(2+1)>& rDistances,
array_1d<
double,(3*(2-1))>& rVolumes,
BoundedMatrix<
double, 3*(2-1), (2+1) >& rGPShapeFunctionValues,
array_1d<
double,(3*(2-1))>& rPartitionsSign, std::vector<Matrix>& rGradientsValue,
BoundedMatrix<
double,3*(2-1), (5)>& NEnriched,
BoundedMatrix<double,10, 2>& rGradientpositive,
BoundedMatrix<double,10, 2>& rGradientnegative ,
BoundedMatrix<int,3,3>& father_nodes,std::vector<Matrix>& PRUEBA,
array_1d<double,6>& weight)
903 const double one_third=1.0/3.0;
909 double most_common_sign=0;
911 rGPShapeFunctionValues(0,0)=one_third; rGPShapeFunctionValues(0,1)=one_third; rGPShapeFunctionValues(0,2)=one_third;
912 Area = CalculateVolume2D( rPoints );
919 if( (rDistances(0)*rDistances(1))>0.0 && (rDistances(0)*rDistances(2))>0.0 )
922 rGPShapeFunctionValues(0,0)=one_third; rGPShapeFunctionValues(0,1)=one_third; rGPShapeFunctionValues(0,2)=one_third;
923 NEnriched(0,0) = 0.0;
925 for (
int j = 0;
j < 2;
j++)
926 rGradientsValue[0](0,
j) = 0.0;
927 if (rDistances(0) < 0.0) rPartitionsSign[0] = -1.0;
928 else rPartitionsSign[0] = 1.0;
933 const double unsigned_distance0=fabs(rDistances(0));
934 const double unsigned_distance1=fabs(rDistances(1));
935 const double unsigned_distance2=fabs(rDistances(2));
937 double longest_distance=fabs(unsigned_distance0);
938 if (unsigned_distance1>longest_distance)
939 longest_distance=unsigned_distance1;
940 if (unsigned_distance2>longest_distance)
941 longest_distance=unsigned_distance2;
954 if ((rDistances(0)*rDistances(1))<0.0)
958 if ((rDistances(1)*rDistances(2))<0.0)
962 if ((rDistances(2)*rDistances(0))<0.0)
971 int shape_function_id=0;
972 father_nodes(0,0)=-1;
973 father_nodes(0,1)=-1;
974 father_nodes(0,2)=-1;
975 father_nodes(1,0)=-1;
976 father_nodes(1,1)=-1;
977 father_nodes(1,2)=-1;
978 father_nodes(2,0)=-1;
979 father_nodes(2,1)=-1;
980 father_nodes(2,2)=-1;
983 for (
unsigned int i=0;
i<3;
i++)
985 int edge_begin_node=
i;
986 int edge_end_node=
i+1;
987 if (edge_end_node==3) edge_end_node=0;
989 if(cut_edges(
i)==
true)
991 aux_nodes_relative_locations(
i)=fabs(rDistances(edge_end_node)/(rDistances(edge_end_node)-rDistances(edge_begin_node) ) ) ;
993 aux_nodes_father_nodes(
i,0)=edge_begin_node;
994 aux_nodes_father_nodes(
i,1)=edge_end_node;
995 aux_node_enrichment_shape_function_index(
i)=shape_function_id;
996 father_nodes(
i,0)=edge_begin_node;
997 father_nodes(
i,1)=edge_end_node;
998 father_nodes(
i,2)=shape_function_id;
1005 if(fabs(rDistances(edge_end_node))<fabs(rDistances(edge_begin_node)))
1007 aux_nodes_relative_locations(
i)=0.0;
1008 aux_nodes_father_nodes(
i,0)=edge_end_node;
1009 aux_nodes_father_nodes(
i,1)=edge_end_node;
1013 aux_nodes_relative_locations(
i)=1.0;
1014 aux_nodes_father_nodes(
i,0)=edge_begin_node;
1015 aux_nodes_father_nodes(
i,1)=edge_begin_node;
1017 aux_node_enrichment_shape_function_index(
i)=-1;
1021 for (
unsigned int j=0;
j<2;
j++){
1022 aux_points(
i,
j)= rPoints(edge_begin_node,
j) * aux_nodes_relative_locations(
i) + rPoints(edge_end_node,
j) * (1.0- aux_nodes_relative_locations(
i));
1028 if (cut_edges(0)==
true)
1030 base_point[0] = aux_points(0,0);
1031 base_point[1] = aux_points(0,1);
1036 base_point[0] = aux_points(1,0);
1037 base_point[1] = aux_points(1,1);
1040 for (
int i_node = 0; i_node < 3; i_node++)
1042 double d = (rPoints(i_node,0) - base_point[0]) * grad_d[0] + (rPoints(i_node,1) - base_point[1]) * grad_d[1] ;
1043 abs_distance[i_node] = fabs(
d);
1047 for (
int i = 0;
i < 3;
i++)
1049 if (rDistances[
i] < 0.0)
1051 exact_distance[
i] = -abs_distance[
i];
1056 exact_distance[
i] = abs_distance[
i];
1069 double max_aux_dist_on_cut = -1;
1070 for (
int edge = 0; edge < 3; edge++)
1075 if (rDistances[
i] * rDistances[
j] < 0.0)
1077 const double tmp = fabs(rDistances[
i]) / (fabs(rDistances[
i]) + fabs(rDistances[
j]));
1079 double abs_dist_on_cut = abs_distance[
i] *
tmp + abs_distance[
j] * (1.00 -
tmp);
1080 if(abs_dist_on_cut > max_aux_dist_on_cut) max_aux_dist_on_cut = abs_dist_on_cut;
1093 unsigned int partition_number=0;
1096 bool found_empty_partition=
false;
1101 for (
int i=0;
i<4;
i++)
1105 active_node_in_enrichment_shape_function(0)=-1; active_node_in_enrichment_shape_function(1)=-1;
1108 active_node_in_replacement_shape_function(0)=-1; active_node_in_replacement_shape_function(1)=-1; active_node_in_replacement_shape_function(2)=-1;
1111 if (j_aux>2) j_aux -= 3;
1115 int useful_node_for_N0star=-1;
1116 int useful_node_for_N1star=-1;
1120 partition_father_nodes(0,0)=
i;
1121 partition_father_nodes(0,1)=
i;
1122 partition_father_nodes(1,0)=aux_nodes_father_nodes(
i,0);
1123 partition_father_nodes(1,1)=aux_nodes_father_nodes(
i,1);
1124 partition_father_nodes(2,0)=aux_nodes_father_nodes(j_aux,0);
1125 partition_father_nodes(2,1)=aux_nodes_father_nodes(j_aux,1);
1128 coord_subdomain(0,0)=rPoints(
i,0);
1129 coord_subdomain(0,1)=rPoints(
i,1);
1130 coord_subdomain(1,0)=aux_points(
i,0);
1131 coord_subdomain(1,1)=aux_points(
i,1);
1132 coord_subdomain(2,0)=aux_points(j_aux,0);
1133 coord_subdomain(2,1)=aux_points(j_aux,1);
1137 if (aux_node_enrichment_shape_function_index(
i)> -1)
1138 active_node_in_enrichment_shape_function( aux_node_enrichment_shape_function_index(
i) )=1;
1142 if (aux_node_enrichment_shape_function_index(j_aux)> -1)
1143 active_node_in_enrichment_shape_function( aux_node_enrichment_shape_function_index(j_aux) )=2;
1146 active_node_in_replacement_shape_function(
i)=0;
1148 if (aux_nodes_father_nodes(
i,0)==aux_nodes_father_nodes(
i,1))
1149 active_node_in_replacement_shape_function(aux_nodes_father_nodes(
i,0))=1;
1150 if (aux_nodes_father_nodes(j_aux,0)==aux_nodes_father_nodes(j_aux,1))
1151 active_node_in_replacement_shape_function(aux_nodes_father_nodes(j_aux,0))=2;
1157 coord_subdomain(0,0)=rPoints(
i,0);
1158 coord_subdomain(0,1)=rPoints(
i,1);
1159 coord_subdomain(1,0)=aux_points(
i,0);
1160 coord_subdomain(1,1)=aux_points(
i,1);
1161 coord_subdomain(2,0)=aux_points(j_aux,0);
1162 coord_subdomain(2,1)=aux_points(j_aux,1);
1166 if(partition_father_nodes(1,0)==
i || partition_father_nodes(1,1)==
i)
1168 if(aux_node_enrichment_shape_function_index(
i)==0)
1169 useful_node_for_N0star=1;
1170 if(aux_node_enrichment_shape_function_index(
i)==1)
1171 useful_node_for_N1star=1;
1173 if(partition_father_nodes(2,0)==j_aux || partition_father_nodes(2,1)==j_aux)
1175 if(aux_node_enrichment_shape_function_index(j_aux)==0)
1176 useful_node_for_N0star=2;
1177 if(aux_node_enrichment_shape_function_index(j_aux)==1)
1178 useful_node_for_N1star=2;
1184 partition_father_nodes=aux_nodes_father_nodes;
1185 coord_subdomain=aux_points;
1188 int non_aux_node_father_node=-1;
1190 for (
int j = 0;
j < 3;
j++)
1192 if(partition_father_nodes(
j,0)==partition_father_nodes(
j,1))
1195 non_aux_node_father_node=partition_father_nodes(
j,0);
1198 for (
int j = 0;
j < 3;
j++)
1200 if (aux_node_enrichment_shape_function_index(
j)> -1)
1202 active_node_in_enrichment_shape_function( aux_node_enrichment_shape_function_index(
j) ) =
j;
1204 if(partition_father_nodes(
j,0)==non_aux_node_father_node || partition_father_nodes(
j,1)==non_aux_node_father_node)
1206 if (aux_node_enrichment_shape_function_index(
j)==0)
1207 useful_node_for_N0star=
j;
1208 if (aux_node_enrichment_shape_function_index(
j)==1)
1209 useful_node_for_N1star=
j;
1214 if (aux_nodes_father_nodes(
j,0)==aux_nodes_father_nodes(
j,1))
1215 active_node_in_replacement_shape_function(aux_nodes_father_nodes(
j,0))=
j;
1222 CalculateGeometryData(coord_subdomain, DN_DX_subdomain, temp_area);
1223 if (temp_area > 1.0e-20)
1226 rVolumes(partition_number)=temp_area;
1228 double x_GP_partition = one_third * ( coord_subdomain(0,0) + coord_subdomain(1,0) + coord_subdomain(2,0) );
1229 double y_GP_partition = one_third * ( coord_subdomain(0,1) + coord_subdomain(1,1) + coord_subdomain(2,1) );
1230 double z_GP_partition = 0.0;
1231 coord_subdomain_aux = coord_subdomain;
1233 coord_subdomain = rPoints;
1235 CalculatePosition ( coord_subdomain , x_GP_partition ,y_GP_partition ,z_GP_partition ,
N);
1237 const double partition_sign = (
N(0)*rDistances(0) +
N(1)*rDistances(1) +
N(2)*rDistances(2))/fabs(
N(0)*rDistances(0) +
N(1)*rDistances(1) +
N(2)*rDistances(2));
1240 rGPShapeFunctionValues(partition_number,0)=
N(0);
1241 rGPShapeFunctionValues(partition_number,1)=
N(1);
1242 rGPShapeFunctionValues(partition_number,2)=
N(2);
1248 std::vector< Matrix > mInvJ0;
1252 Node::Pointer p_new_node;
1254 for (
unsigned int j=0;
j!=3;
j++)
1256 p_new_node = Node::Pointer(
new Node(id_local, coord_subdomain_aux(
j,0), coord_subdomain_aux(
j,1), coord_subdomain_aux(
j,2)));
1270 mInvJ0.resize(integration_points.size());
1271 mDetJ0.resize(integration_points.size(),
false);
1276 J0 = pGeom->
Jacobian(J0, mThisIntegrationMethod);
1282 double temp_areaaux_2=0.0;
1283 bounded_matrix<double, 4, 8 > N_new=
ZeroMatrix(4,8);
1285 for(
unsigned int PointNumber = 0; PointNumber<integration_points.size(); PointNumber++)
1292 double Weight = integration_points[PointNumber].Weight()* mDetJ0[PointNumber];
1297 for (
unsigned int tt=0; tt<3; tt++)
1299 xp +=
N[tt] * coord_subdomain_aux(tt,0);
1300 yp +=
N[tt] * coord_subdomain_aux(tt,1);
1303 for (
unsigned int h=0;
h<3;
h++)
1306 bounded_matrix<double, 3, 2 > original_coordinates;
1307 for (
unsigned int i = 0;
i < 3;
i++)
1308 for (
unsigned int j = 0;
j < 2;
j++)
1309 original_coordinates(
i,
j) = rPoints(
i,
j);
1312 original_coordinates(
h,0) = xp;
1313 original_coordinates(
h,1) = yp;
1316 CalculateGeometryData(original_coordinates, DN_DX_subdomainaux_1aux, temp_areaaux_2);
1318 PRUEBA[partition_number](PointNumber,
h) = temp_areaaux_2/Area;
1319 weight(partition_number)=Weight;
1325 double abs_dist = 0.0;
1326 for (
int j = 0;
j < 3;
j++)
1328 dist += rGPShapeFunctionValues(partition_number,
j) * exact_distance[
j];
1329 abs_dist += rGPShapeFunctionValues(partition_number,
j) * abs_distance[
j];
1332 if (partition_sign < 0.0)
1333 rPartitionsSign[partition_number] = -1.0;
1335 rPartitionsSign[partition_number] = 1.0;
1339 for (
int index_shape_function = 0; index_shape_function < 2; index_shape_function++)
1341 if (active_node_in_enrichment_shape_function(index_shape_function) > -1)
1343 NEnriched(partition_number, index_shape_function+3 ) = one_third ;
1344 for (
int j = 0;
j < 2;
j++)
1346 rGradientsValue[partition_number](index_shape_function+3,
j) = DN_DX_subdomain(active_node_in_enrichment_shape_function(index_shape_function),
j);
1352 NEnriched(partition_number, index_shape_function+3 ) = 0.0;
1354 for (
int j = 0;
j < 2;
j++)
1356 rGradientsValue[partition_number](index_shape_function+3,
j) = 0.0;
1365 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
1368 for (
int j = 0;
j < 3;
j++)
1369 if (partition_father_nodes(
j,0)==index_shape_function && partition_father_nodes(
j,1)==index_shape_function)
1376 for (
int j = 0;
j < 2;
j++)
1377 rGradientsValue[partition_number](index_shape_function,
j) = DN_DX_subdomain(active_node,
j);
1378 NEnriched(partition_number, index_shape_function ) = one_third;
1379 replacement_shape_function_nodes(index_shape_function) = active_node;
1383 for (
int j = 0;
j < 2;
j++)
1384 rGradientsValue[partition_number](index_shape_function,
j) = 0.0;
1385 replacement_shape_function_nodes(index_shape_function) = -1;
1391 unsigned int number_of_real_nodes=0;
1392 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
1394 if (active_node_in_replacement_shape_function(index_shape_function) > -1)
1395 number_of_real_nodes++;
1398 if(useful_node_for_N0star > -1)
1400 for (
int j = 0;
j < 2;
j++)
1402 if(partition_sign>0)
1406 rGradientpositive(3,
j)=DN_DX_subdomain(useful_node_for_N0star,
j);
1408 if (active_node_in_enrichment_shape_function(1) > -1)
1409 rGradientpositive(4,
j)=DN_DX_subdomain(active_node_in_enrichment_shape_function(1),
j);
1411 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
1413 if(replacement_shape_function_nodes(index_shape_function)>-1)
1415 rGradientpositive(index_shape_function,
j) = DN_DX_subdomain(replacement_shape_function_nodes(index_shape_function),
j);
1421 rGradientnegative(3,
j) =DN_DX_subdomain(useful_node_for_N0star,
j);
1423 if (active_node_in_enrichment_shape_function(1) > -1)
1424 rGradientnegative(4,
j) =DN_DX_subdomain(active_node_in_enrichment_shape_function(1),
j);
1426 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
1428 if(replacement_shape_function_nodes(index_shape_function)>-1)
1430 rGradientnegative(index_shape_function,
j) = DN_DX_subdomain(replacement_shape_function_nodes(index_shape_function),
j);
1436 if(useful_node_for_N1star > -1)
1438 for (
int j = 0;
j < 2;
j++)
1440 if(partition_sign>0)
1444 rGradientpositive(9,
j)=DN_DX_subdomain(useful_node_for_N1star,
j);
1446 if (active_node_in_enrichment_shape_function(0) > -1)
1447 rGradientpositive(8,
j)=DN_DX_subdomain(active_node_in_enrichment_shape_function(0),
j);
1450 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
1452 if(replacement_shape_function_nodes(index_shape_function)>-1)
1454 rGradientpositive(index_shape_function+5,
j) = DN_DX_subdomain(replacement_shape_function_nodes(index_shape_function),
j);
1460 rGradientnegative(9,
j)=DN_DX_subdomain(useful_node_for_N1star,
j);
1461 if(active_node_in_enrichment_shape_function(0) > -1)
1462 rGradientnegative(8,
j)=DN_DX_subdomain(active_node_in_enrichment_shape_function(0),
j);
1465 for (
int index_shape_function = 0; index_shape_function < 3; index_shape_function++)
1467 if(replacement_shape_function_nodes(index_shape_function)>-1)
1469 rGradientnegative(index_shape_function+5,
j) = DN_DX_subdomain(replacement_shape_function_nodes(index_shape_function),
j);
1480 found_empty_partition=
true;
1482 if (found_empty_partition==
false)
1491 static int CalculateEnrichedShapeFuncions_Simplified(
Geometry< Node >& rGeom,
BoundedMatrix<
double,(3+1), 3 >& rPoints,
BoundedMatrix<
double, (3+1), 3 >& DN_DX,
array_1d<
double,(3+1)>& rDistances,
array_1d<
double,(3*(3-1))>& rVolumes,
BoundedMatrix<
double, 3*(3-1), (3+1) >& rShapeFunctionValues,
array_1d<
double,(3*(3-1))>& rPartitionsSign, std::vector<Matrix>& rGradientsValue, std::vector<Matrix>& rGradientsValueaux,
BoundedMatrix<
double,3*(3-1), (2)>& NEnriched,
int& number_interface_elements,
BoundedMatrix<double, 2, 3 >& coord_interface_nodes,
array_1d<double,6>& area_interface,
array_1d<double,6>& area_inter,
array_1d<double,6>& N_Star,
bool& switch_off_e, std::vector<Matrix>& edges_t,std::vector<Matrix>& nodes,std::vector<Matrix>& original_edges, std::vector<Matrix>& rGradientaux1,
int& totalnodes, std::vector<Matrix>& interface_nodes,
BoundedMatrix<
double, 3*(3-1), 8 >& Ngauss_new, std::vector<Matrix>& Tres, std::vector<Matrix>& PRUEBA,
array_1d<double,6>& weight)
1496 const int n_edges = 6;
1497 bool switch_off_ee=
false;
1498 const int edge_i[] = {0, 0, 0, 1, 1, 2};
1499 const int edge_j[] = {1, 2, 3, 2, 3, 3};
1502 std::vector< Matrix > edges_o(8);
1504 for (
unsigned int i = 0;
i < 8;
i++)
1506 edges_o[
i].resize(5, 3,
false);
1509 const double epsilon = 1
e-15;
1510 const double near_factor = 1.00e-12;
1512 bounded_matrix<double, 4, 3 > coord_node=
ZeroMatrix(4,3);
1515 for (
unsigned int i = 0;
i < 8;
i++)
1516 for (
unsigned int j = 0;
j < 5;
j++)
1517 for (
unsigned int k = 0;
k < 3;
k++)
1518 edges_t[
i](
j,
k) =-1.0;
1520 for (
unsigned int i = 0;
i < 8;
i++)
1521 for (
unsigned int j = 0;
j < 5;
j++)
1522 for (
unsigned int k = 0;
k < 3;
k++)
1523 original_edges[
i](
j,
k) =-1.0;
1525 for (
unsigned int i = 0;
i < 6;
i++)
1526 for (
unsigned int j = 0;
j < 8;
j++)
1527 for (
unsigned int k = 0;
k < 3;
k++)
1528 rGradientaux1[
i](
j,
k) =0.0;
1539 bounded_matrix<double, 8, 3 > aux_coordinates;
1540 for (
unsigned int i = 0;
i < 4;
i++)
1541 for (
unsigned int j = 0;
j < 3;
j++)
1542 aux_coordinates(
i,
j) = rPoints(
i,
j);
1543 for (
unsigned int i = 4;
i < 8;
i++)
1544 for (
unsigned int j = 0;
j < 3;
j++)
1545 aux_coordinates(
i,
j) = -10000.0;
1547 int split_edge[] = {0, 1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1};
1548 int new_node_id = 4;
1549 bounded_matrix<double, 4, 4 > length =
ZeroMatrix(4, 4);
1552 int n_negative_distance_nodes = 0;
1553 int n_positive_distance_nodes = 0;
1559 for (
int i = 0;
i < 6;
i++)
1561 rShapeFunctionValues(
i,
j) = 0.25;
1563 for (
int i = 0;
i < 6;
i++)
1564 for (
int j = 0;
j < 8;
j++)
1565 Ngauss_new(
i,
j) = 0.0;
1569 double norm =
norm_2(grad_d);
1575 double sub_volumes_sum = 0.00;
1578 double max_lenght = 0.0;
1579 for (
int edge = 0; edge < n_edges; edge++)
1581 const int i = edge_i[edge];
1582 const int j = edge_j[edge];
1584 double dx = rPoints(
j, 0) - rPoints(
i, 0);
1585 double dy = rPoints(
j, 1) - rPoints(
i, 1);
1586 double dz = rPoints(
j, 2) - rPoints(
i, 2);
1588 double l = sqrt(dx * dx + dy * dy + dz * dz);
1590 edges_dx[edge] = dx;
1591 edges_dy[edge] = dy;
1592 edges_dz[edge] = dz;
1593 edges_length[edge] =
l;
1599 double relatively_close = near_factor*max_lenght;
1602 for (
unsigned int i=0;
i<4;
i++)
1604 if(fabs(rDistances[
i]) < relatively_close)
1606 collapsed_node[
i] =
true;
1607 rDistances[
i] = 0.0;
1611 collapsed_node[
i] =
false;
1613 abs_distance[
i] = fabs(rDistances[
i]);
1617 for (
int edge = 0; edge < n_edges; edge++)
1619 const int i = edge_i[edge];
1620 const int j = edge_j[edge];
1621 if (rDistances[
i] * rDistances[
j] < 0.0)
1623 const double tmp = fabs(rDistances[
i]) / (fabs(rDistances[
i]) + fabs(rDistances[
j]));
1625 if (collapsed_node[
i] ==
false && collapsed_node[
j] ==
false)
1627 split_edge[edge + 4] = new_node_id;
1628 edge_division_i[edge] =
tmp;
1629 edge_division_j[edge] = 1.00 -
tmp;
1632 for (
unsigned int k = 0;
k < 3;
k++)
1633 aux_coordinates(new_node_id,
k) = rPoints(
i,
k) * edge_division_j[edge] + rPoints(
j,
k) * edge_division_i[edge];
1639 totalnodes=new_node_id;
1640 for(
int aux = 0; aux < 4; aux++)
1642 nodes[aux](0,0)=rPoints(aux, 0);
1643 nodes[aux](0,1)=rPoints(aux, 1);
1644 nodes[aux](0,2)=rPoints(aux, 2);
1648 for(
int aux = 4; aux < new_node_id; aux++)
1650 nodes[aux](0,0)=aux_coordinates(aux, 0);
1651 nodes[aux](0,1)=aux_coordinates(aux, 1);
1652 nodes[aux](0,2)=aux_coordinates(aux, 2);
1660 base_point[0] = aux_coordinates(4,0);
1661 base_point[1] = aux_coordinates(4,1);
1662 base_point[2] = aux_coordinates(4,2);
1665 for (
int i_node = 0; i_node <
n_nodes; i_node++)
1667 double d = (rPoints(i_node,0) - base_point[0]) * grad_d[0] +
1668 (rPoints(i_node,1) - base_point[1]) * grad_d[1] +
1669 (rPoints(i_node,2) - base_point[2]) * grad_d[2] ;
1670 abs_distance[i_node] = fabs(
d);
1676 for (
int i_node = 0; i_node <
n_nodes; i_node++)
1678 if (rDistances[i_node] < 0.00)
1681 negative_distance_nodes[n_negative_distance_nodes++] = i_node;
1686 positive_distance_nodes[n_positive_distance_nodes++] = i_node;
1693 if (rDistances[
i] < 0.0)
1694 exact_distance[
i] = -abs_distance[
i];
1696 exact_distance[
i] = abs_distance[
i];
1706 int number_of_splitted_edges = new_node_id - 4;
1708 double volume = edges_dx[0] * edges_dy[1] * edges_dz[2] -
1709 edges_dx[0] * edges_dz[1] * edges_dy[2] +
1710 edges_dy[0] * edges_dz[1] * edges_dx[2] -
1711 edges_dy[0] * edges_dx[1] * edges_dz[2] +
1712 edges_dz[0] * edges_dx[1] * edges_dy[2] -
1713 edges_dz[0] * edges_dy[1] * edges_dx[2];
1715 const double one_sixth = 1.00 / 6.00;
1718 if (number_of_splitted_edges == 0)
1722 sub_volumes_sum =
volume;
1724 double min_distance = 1e9;
1725 for (
int j = 0;
j < 4;
j++)
1726 if(exact_distance[
j] < min_distance) min_distance = exact_distance[
j];
1728 if(min_distance < 0.0)
1729 rPartitionsSign[0] = -1.0;
1731 rPartitionsSign[0] = 1.0;
1735 for (
int j = 0;
j < 4;
j++)
1736 rShapeFunctionValues(0,
j) = 0.25;
1739 NEnriched(
j, 0) = 0.0;
1749 int n_splitted_edges;
1755 KRATOS_ERROR<<
"requiring an internal node for splitting ... can not accept this";
1759 for (
int i = 0;
i < nel;
i++)
1764 double sub_volume = ComputeSubTetraVolumeAndCenter(aux_coordinates, center_position, i0, i1, i2, i3);
1766 rVolumes[
i] = sub_volume;
1768 sub_volumes_sum += sub_volume;
1771 ComputeElementCoordinates(
N, center_position, rPoints,
volume);
1772 for (
int j = 0;
j < 4;
j++)
1773 rShapeFunctionValues(
i,
j) =
N[
j];
1781 double temp_areaaux1=0.0;
1784 CalculateGeometryData(rPoints, DN_DX_subdomainaux1, temp_areaaux1);
1790 double max_aux_dist_on_cut = -1;
1791 for (
int edge = 0; edge < n_edges; edge++)
1793 const int i = edge_i[edge];
1794 const int j = edge_j[edge];
1795 if (rDistances[
i] * rDistances[
j] < 0.0)
1797 const double tmp = fabs(rDistances[
i]) / (fabs(rDistances[
i]) + fabs(rDistances[
j]));
1800 double abs_dist_on_cut = abs_distance[
i] *
tmp + abs_distance[
j] * (1.00 -
tmp);
1802 if(abs_dist_on_cut > max_aux_dist_on_cut) max_aux_dist_on_cut = abs_dist_on_cut;
1806 if(max_aux_dist_on_cut < 1
e-9*max_lenght)
1807 max_aux_dist_on_cut = 1
e-9*max_lenght;
1812 int n_splitted_edges;
1818 KRATOS_ERROR<<
"requiring an internal node for splitting ... can not accept this";
1833 double temp_areaaux=0.0;
1836 for (
unsigned int i = 0;
i < 6;
i++)
1838 PRUEBA[
i].
resize(4, 4,
false);
1842 for (
unsigned int i = 0;
i < 6;
i++)
1848 bounded_matrix<double, 4, 3 > original_coordinates;
1849 for (
unsigned int i = 0;
i < 4;
i++)
1850 for (
unsigned int j = 0;
j < 3;
j++)
1851 original_coordinates(
i,
j) = rPoints(
i,
j);
1854 double temp_areaaux_1=0.0;
1855 CalculateGeometryData(rPoints, DN_DX_subdomainaux_1aux, temp_areaaux_1);
1872 partition_nodes[0]=i0;
1873 partition_nodes[1]=i1;
1874 partition_nodes[2]=i2;
1875 partition_nodes[3]=i3;
1879 for (
unsigned int j=0;
j!=4;
j++)
1881 const int node_id=partition_nodes[
j];
1887 std::vector<array_1d<double,3> > PointsOfFSTriangle;
1888 PointsOfFSTriangle.reserve(3);
1892 for (
unsigned int j=0;
j!=4;
j++)
1894 for (
unsigned int k=0;
k!=3;
k++) {
1895 const int node_id=partition_nodes[
j];
1896 coord_subdomainaux(
j,
k)= aux_coordinates(
node_id ,
k );
1901 for (
unsigned int i = 0;
i < 3;
i++)
1903 center_position[
i] = aux_coordinates(0,
i) + aux_coordinates(1,
i) + aux_coordinates(2,
i) + aux_coordinates(3,
i);
1905 center_position *= 0.25;
1907 CalculateGeometryData(coord_subdomainaux, DN_DX_subdomainaux, temp_areaaux);
1911 std::vector< Matrix > mInvJ0;
1920 Node::Pointer p_new_node;
1922 for (
unsigned int j=0;
j!=4;
j++)
1924 id_local=partition_nodes[
j];
1925 p_new_node = Node::Pointer(
new Node(id_local, coord_subdomainaux(
j,0), coord_subdomainaux(
j,1), coord_subdomainaux(
j,2)));
1938 mInvJ0.resize(integration_points.size());
1939 mDetJ0.resize(integration_points.size(),
false);
1942 J0 = pGeom->
Jacobian(J0, mThisIntegrationMethod);
1949 double temp_areaaux_2=0.0;
1950 bounded_matrix<double, 4, 8 > N_new=
ZeroMatrix(4,8);
1952 for(
unsigned int PointNumber = 0; PointNumber<integration_points.size(); PointNumber++)
1959 double Weight = integration_points[PointNumber].Weight()* mDetJ0[PointNumber];
1965 for (
unsigned int tt=0; tt!=4; tt++)
1967 xp +=
N[tt] * coord_subdomainaux(tt,0);
1968 yp +=
N[tt] * coord_subdomainaux(tt,1);
1969 zp +=
N[tt] * coord_subdomainaux(tt,2);
1972 for (
unsigned int j=0;
j!=4;
j++)
1974 bounded_matrix<double, 8, 3 > aux_coordinates_aux;
1975 aux_coordinates_aux=aux_coordinates;
1977 bounded_matrix<double, 4, 3 > original_coordinates;
1978 for (
unsigned int i = 0;
i < 4;
i++)
1979 for (
unsigned int j = 0;
j < 3;
j++)
1980 original_coordinates(
i,
j) = rPoints(
i,
j);
1983 const int node_idaux=partition_nodes[
j];
1985 aux_coordinates_aux(node_idaux,0)=xp;
1986 aux_coordinates_aux(node_idaux,1)=yp;
1987 aux_coordinates_aux(node_idaux,2)=zp;
1989 original_coordinates(
j,0) = xp;
1990 original_coordinates(
j,1) = yp;
1991 original_coordinates(
j,2) = zp;
1993 for (
unsigned int jj=0; jj!=4; jj++)
1995 for (
unsigned int k=0;
k!=3;
k++)
1997 const int node_id=partition_nodes[jj];
1998 coord_subdomainaux_aux(jj,
k)= aux_coordinates_aux(
node_id ,
k );
2003 CalculateGeometryData(original_coordinates, DN_DX_subdomainaux_1aux, temp_areaaux_2);
2005 PRUEBA[
i](PointNumber,
j) = temp_areaaux_2/temp_areaaux_1;
2017 bounded_matrix<double, 4, 3 > edges=
ZeroMatrix(4,3);
2018 bounded_matrix<double, 4, 3 > edged_enriched=
ZeroMatrix(4,3);
2024 active_node_in_enrichment_shape_function(0)=-1; active_node_in_enrichment_shape_function(1)=-1;
2026 active_node_in_replacement_shape_function(0)=-1; active_node_in_replacement_shape_function(1)=-1;
2029 edges(0,0)=partition_nodes[0];
2030 edges(0,1)=partition_nodes[2];
2031 edges(0,2)=partition_nodes[1];
2033 edges(1,0)=partition_nodes[0];
2034 edges(1,1)=partition_nodes[3];
2035 edges(1,2)=partition_nodes[2];
2037 edges(2,0)=partition_nodes[0];
2038 edges(2,1)=partition_nodes[1];
2039 edges(2,2)=partition_nodes[3];
2041 edges(3,0)=partition_nodes[2];
2042 edges(3,1)=partition_nodes[3];
2043 edges(3,2)=partition_nodes[1];
2046 int shape_function_id=0;
2047 int shape_function_aux_id=0;
2048 for(
int i_aux=0; i_aux<4;i_aux++)
2050 shape_function_id=0;
2051 shape_function_aux_id=0;
2052 active_node_in_enrichment_shape_function(0)=-1; active_node_in_enrichment_shape_function(1)=-1;
2054 active_node_in_replacement_shape_function(0)=-1; active_node_in_replacement_shape_function(1)=-1;
2056 edgeone(0)=-1; edgeone(1)=-1;
2058 edgetwo(0)=-1; edgetwo(1)=-1;
2060 edgetriangle(0)=-1;edgetriangle(1)=-1;edgetriangle(2)=-1;
2062 for (
int j=0;
j<3;
j++)
2064 if(edges(i_aux,
j)<4)
2066 active_node_in_replacement_shape_function(shape_function_id)=edges(i_aux,
j);
2067 shape_function_id++;
2071 active_node_in_enrichment_shape_function(shape_function_aux_id)=edges(i_aux,
j);
2072 shape_function_aux_id++;
2079 unsigned int index=shape_function_aux_id;
2081 for (
unsigned int pos=0; pos<index; pos++)
2083 for (
unsigned int edge_aux=0; edge_aux<6; edge_aux++)
2085 if (split_edge[4+edge_aux]> -1)
2087 if(active_node_in_enrichment_shape_function(pos)==split_edge[4+edge_aux])
2091 edgeone(0)=edge_i[edge_aux];
2092 edgeone(1)=edge_j[edge_aux];
2098 edgetwo(0)=edge_i[edge_aux];
2099 edgetwo(1)=edge_j[edge_aux];
2106 for (
unsigned int pos=0; pos<index; pos++)
2108 for (
unsigned int k=0;
k<2;
k++)
2110 if(edgeone(pos)==edgetwo(
k)) well=
true;
2114 edgetriangle(0)=edgeone(0);
2115 edgetriangle(1)=edgeone(1);
2116 for (
unsigned int pos=0; pos<2; pos++)
2119 if(edgetriangle(pos)==edgetwo(0))
2121 edgetriangle(2)=edgetwo(1);
2123 if(edgetriangle(pos)==edgetwo(1)) {
2124 edgetriangle(2)=edgetwo(0);
2128 if(index==1) well=
true;
2132 for (
unsigned int pos=0; pos<2; pos++)
2135 if(edgetriangle(pos)==active_node_in_replacement_shape_function(0))
2137 edgetriangle(2)= active_node_in_replacement_shape_function(1);
2139 if(edgetriangle(pos)==active_node_in_replacement_shape_function(1))
2141 edgetriangle(2)=active_node_in_replacement_shape_function(0);
2147 for (
unsigned int jj=0; jj<3; jj++){
2148 original_edges[
i](i_aux,jj)=edgetriangle(jj);
2152 for(
int aux=0; aux<2;aux++)
2154 for (
unsigned int edge_aux=0; edge_aux<6; edge_aux++)
2156 if(active_node_in_replacement_shape_function(aux)==edge_i[edge_aux] || active_node_in_replacement_shape_function(aux)==edge_j[edge_aux] )
2158 if (split_edge[4+edge_aux]> -1)
2161 if(active_node_in_enrichment_shape_function(0)==split_edge[4+edge_aux])
2165 for (
int j=0;
j<3;
j++)
2167 edges_t[
i](i_aux,
j)=edges(i_aux,
j);
2171 edges_o[
i](i_aux,0)=edge_i[edge_aux];
2172 edges_o[
i](i_aux,1)=edge_j[edge_aux];
2173 edges_o[
i](i_aux,0)=active_node_in_enrichment_shape_function(1);
2175 else if(active_node_in_enrichment_shape_function(1)==split_edge[4+edge_aux])
2179 for (
int j=0;
j<3;
j++)
2181 edges_t[
i](i_aux,
j)=edges(i_aux,
j);
2184 edges_o[
i](i_aux,0)=edge_i[edge_aux];
2185 edges_o[
i](i_aux,1)=edge_j[edge_aux];
2186 edges_o[
i](i_aux,0)=active_node_in_enrichment_shape_function(0);
2194 for (
unsigned int j=0;
j!=4;
j++)
2196 for (
unsigned int k=0;
k!=3;
k++) {
2197 const int node_id=partition_nodes[
j];
2198 rGradientaux1[
i](
node_id,
k)= DN_DX_subdomainaux(
j,
k);
2205 double abs_dist = 0.0;
2206 for (
int j = 0;
j < 4;
j++)
2208 dist += rShapeFunctionValues(
i,
j) * exact_distance[
j];
2209 abs_dist += rShapeFunctionValues(
i,
j) * abs_distance[
j];
2212 rPartitionsSign[
i] = -1.0;
2214 rPartitionsSign[
i] = 1.0;
2218 if(rPartitionsSign[
i] == 1.0 )
2221 for (
unsigned int j=0;
j!=4;
j++)
2223 const int node_id=partition_nodes[
j];
2225 interface_nodes[local](0,index)=
node_id;
2235 NEnriched(
i, 0) = 0.5 * (abs_dist - rPartitionsSign[
i] *
dist);
2237 NEnriched(
i, 0) /= max_aux_dist_on_cut;
2239 for (
int j = 0;
j < 3;
j++)
2241 rGradientsValue[
i](0,
j) = (0.5/max_aux_dist_on_cut) * (abs_distance_gradient[
j] - rPartitionsSign[
i] * exact_distance_gradient[
j]);
2247 NEnriched(0,0) = 0.0;
2249 switch_off_e=switch_off_ee;
2250 for (
int j = 0;
j < 3;
j++)
2251 rGradientsValue[0](0,
j) = 0.0;
2265 double x0 = rPoints(0, 0);
2266 double y0 = rPoints(0, 1);
2267 double z0 = rPoints(0, 2);
2268 double x1 = rPoints(1, 0);
2269 double y1 = rPoints(1, 1);
2270 double z1 = rPoints(1, 2);
2271 double x2 = rPoints(2, 0);
2272 double y2 = rPoints(2, 1);
2273 double z2 = rPoints(2, 2);
2274 double x3 = rPoints(3, 0);
2275 double y3 = rPoints(3, 1);
2276 double z3 = rPoints(3, 2);
2278 double xc = center_position[0];
2279 double yc = center_position[1];
2280 double zc = center_position[2];
2282 double inv_vol = 1.0 / vol;
2287 N[0] = CalculateVol(
x1, y1, z1, x3, y3, z3,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
2288 N[1] = CalculateVol(x0, y0, z0,
x2, y2, z2, x3, y3, z3,
xc,
yc, zc) * inv_vol;
2289 N[2] = CalculateVol(x3, y3, z3,
x1, y1, z1, x0, y0, z0,
xc,
yc, zc) * inv_vol;
2290 N[3] = CalculateVol(
x1, y1, z1,
x2, y2, z2, x0, y0, z0,
xc,
yc, zc) * inv_vol;
2294 static inline double CalculateVol(
const double x0,
const double y0,
const double z0,
const double x1,
const double y1,
const double z1,
const double x2,
const double y2,
const double z2,
const double x3,
const double y3,
const double z3)
2296 double x10 =
x1 - x0;
2297 double y10 = y1 - y0;
2298 double z10 = z1 - z0;
2300 double x20 =
x2 - x0;
2301 double y20 = y2 - y0;
2302 double z20 = z2 - z0;
2304 double x30 = x3 - x0;
2305 double y30 = y3 - y0;
2306 double z30 = z3 - z0;
2308 double detJ = x10 * y20 * z30 - x10 * y30 * z20 + y10 * z20 * x30 - y10 * x20 * z30 + z10 * x20 * y30 - z10 * y20 * x30;
2309 return detJ * 0.1666666666666666666667;
2313 static inline void CalculateGeometryData(
const bounded_matrix<double, 3, 3 > & coordinates,BoundedMatrix<double,3,2>& DN_DX,array_1d<double,3>&
N,
double& Area)
2315 double x10 = coordinates(1,0) - coordinates(0,0);
2316 double y10 = coordinates(1,1) - coordinates(0,1);
2318 double x20 = coordinates(2,0) - coordinates(0,0);
2319 double y20 = coordinates(2,1) - coordinates (0,1);
2327 double detJ = x10 * y20-y10 * x20;
2329 DN_DX(0,0) = -y20 + y10;
2330 DN_DX(0,1) = x20 - x10;
2337 N[0] = 0.333333333333333;
2338 N[1] = 0.333333333333333;
2339 N[2] = 0.333333333333333;
2345 static inline double CalculateVolume2D(
const bounded_matrix<double, 3, 3 > & coordinates)
2347 double x10 = coordinates(1,0) - coordinates(0,0);
2348 double y10 = coordinates(1,1) - coordinates(0,1);
2350 double x20 = coordinates(2,0) - coordinates(0,0);
2351 double y20 = coordinates(2,1) - coordinates (0,1);
2352 double detJ = x10 * y20-y10 * x20;
2356 static inline bool CalculatePosition(
const bounded_matrix<double, 3, 3 > & coordinates,
const double xc,
const double yc,
const double zc, array_1d<double, 3 > &
N )
2358 double x0 = coordinates(0,0);
2359 double y0 = coordinates(0,1);
2360 double x1 = coordinates(1,0);
2361 double y1 = coordinates(1,1);
2362 double x2 = coordinates(2,0);
2363 double y2 = coordinates(2,1);
2365 double area = CalculateVol(x0, y0,
x1, y1,
x2, y2);
2366 double inv_area = 0.0;
2372 inv_area = 1.0 / area;
2376 N[0] = CalculateVol(
x1, y1,
x2, y2,
xc,
yc) * inv_area;
2377 N[1] = CalculateVol(
x2, y2, x0, y0,
xc,
yc) * inv_area;
2378 N[2] = CalculateVol(x0, y0,
x1, y1,
xc,
yc) * inv_area;
2381 if (
N[0] >= 0.0 &&
N[1] >= 0.0 &&
N[2] >= 0.0 &&
N[0] <= 1.0 &&
N[1] <= 1.0 &&
N[2] <= 1.0)
2387 static inline double CalculateVol(
const double x0,
const double y0,
const double x1,
const double y1,
const double x2,
const double y2)
2389 return 0.5 * ((
x1 - x0)*(y2 - y0)- (y1 - y0)*(
x2 - x0));
2392 static inline void CalculateGeometryData(
const bounded_matrix<double, 3, 3 > & coordinates,BoundedMatrix<double,3,2>& DN_DX,
double& Area)
2394 double x10 = coordinates(1,0) - coordinates(0,0);
2395 double y10 = coordinates(1,1) - coordinates(0,1);
2397 double x20 = coordinates(2,0) - coordinates(0,0);
2398 double y20 = coordinates(2,1) - coordinates (0,1);
2406 double detJ = x10 * y20-y10 * x20;
2408 DN_DX(0,0) = -y20 + y10;
2409 DN_DX(0,1) = x20 - x10;
2421 static inline void CalculateGeometryData( BoundedMatrix<double, 4, 3 > & coordinates, BoundedMatrix<double,4,3>& DN_DX,
double& Volume)
2423 double x10 = coordinates(1,0) - coordinates(0,0);
2424 double y10 = coordinates(1,1) - coordinates(0,1);
2425 double z10 = coordinates(1,2) - coordinates(0,2);
2427 double x20 = coordinates(2,0) - coordinates(0,0);
2428 double y20 = coordinates(2,1) - coordinates (0,1);
2429 double z20 = coordinates(2,2) - coordinates (0,2);
2431 double x30 = coordinates(3,0) - coordinates(0,0);
2432 double y30 = coordinates(3,1) - coordinates (0,1);
2433 double z30 = coordinates(3,2) - coordinates (0,2);
2435 double detJ = x10 * y20 * z30 - x10 * y30 * z20 + y10 * z20 * x30 - y10 * x20 * z30 + z10 * x20 * y30 - z10 * y20 * x30;
2437 DN_DX(0,0) = -y20 * z30 + y30 * z20 + y10 * z30 - z10 * y30 - y10 * z20 + z10 * y20;
2438 DN_DX(0,1) = -z20 * x30 + x20 * z30 - x10 * z30 + z10 * x30 + x10 * z20 - z10 * x20;
2439 DN_DX(0,2) = -x20 * y30 + y20 * x30 + x10 * y30 - y10 * x30 - x10 * y20 + y10 * x20;
2440 DN_DX(1,0) = y20 * z30 - y30 * z20;
2441 DN_DX(1,1) = z20 * x30 - x20 * z30;
2442 DN_DX(1,2) = x20 * y30 - y20 * x30;
2443 DN_DX(2,0) = -y10 * z30 + z10 * y30;
2444 DN_DX(2,1) = x10 * z30 - z10 * x30;
2445 DN_DX(2,2) = -x10 * y30 + y10 * x30;
2446 DN_DX(3,0) = y10 * z20 - z10 * y20;
2447 DN_DX(3,1) = -x10 * z20 + z10 * x20;
2448 DN_DX(3,2) = x10 * y20 - y10 * x20;
2452 Volume = detJ*0.1666666666666666666667;
2455 static double ComputeSubTetraVolumeAndCenter(
const bounded_matrix<double, 3, 8 > & aux_coordinates, array_1d<double, 3 > & center_position,
const int i0,
const int i1,
const int i2,
const int i3)
2457 double x10 = aux_coordinates(i1, 0) - aux_coordinates(i0, 0);
2458 double y10 = aux_coordinates(i1, 1) - aux_coordinates(i0, 1);
2459 double z10 = aux_coordinates(i1, 2) - aux_coordinates(i0, 2);
2461 double x20 = aux_coordinates(i2, 0) - aux_coordinates(i0, 0);
2462 double y20 = aux_coordinates(i2, 1) - aux_coordinates(i0, 1);
2463 double z20 = aux_coordinates(i2, 2) - aux_coordinates(i0, 2);
2465 double x30 = aux_coordinates(i3, 0) - aux_coordinates(i0, 0);
2466 double y30 = aux_coordinates(i3, 1) - aux_coordinates(i0, 1);
2467 double z30 = aux_coordinates(i3, 2) - aux_coordinates(i0, 2);
2469 double detJ = x10 * y20 * z30 - x10 * y30 * z20 + y10 * z20 * x30 - y10 * x20 * z30 + z10 * x20 * y30 - z10 * y20 * x30;
2470 double vol = detJ * 0.1666666666666666666667;
2472 for (
unsigned int i = 0;
i < 3;
i++)
2474 center_position[
i] = aux_coordinates(i0,
i) + aux_coordinates(i1,
i) + aux_coordinates(i2,
i) + aux_coordinates(i3,
i);
2476 center_position *= 0.25;
Definition: enrichmentutilities.h:40
static int CalculateEnrichedShapeFuncionsExtendedmodified_gausspoints(Geometry< Node > &trianglegeom, BoundedMatrix< double,(2+1), 2 > &rPoints, BoundedMatrix< double,(2+1), 2 > &DN_DX, array_1d< double,(2+1)> &rDistances, array_1d< double,(3 *(2-1))> &rVolumes, BoundedMatrix< double, 3 *(2-1),(2+1) > &rGPShapeFunctionValues, array_1d< double,(3 *(2-1))> &rPartitionsSign, std::vector< Matrix > &rGradientsValue, BoundedMatrix< double, 3 *(2-1),(5)> &NEnriched, BoundedMatrix< double, 10, 2 > &rGradientpositive, BoundedMatrix< double, 10, 2 > &rGradientnegative, BoundedMatrix< int, 3, 3 > &father_nodes, std::vector< Matrix > &PRUEBA, array_1d< double, 6 > &weight)
Definition: enrichmentutilities.h:899
static int CalculateEnrichedShapeFuncions(BoundedMatrix< double,(2+1), 2 > &rPoints, BoundedMatrix< double,(2+1), 2 > &DN_DX, array_1d< double,(2+1)> &rDistances, array_1d< double,(3 *(2-1))> &rVolumes, BoundedMatrix< double, 3 *(2-1),(2+1) > &rGPShapeFunctionValues, array_1d< double,(3 *(2-1))> &rPartitionsSign, std::vector< Matrix > &rGradientsValue, BoundedMatrix< double, 3 *(2-1),(2)> &NEnriched, array_1d< double,(3)> &rGPShapeFunctionValues_in_interfase, array_1d< double,(3)> &NEnriched_in_interfase, double &InterfaseArea)
Definition: enrichmentutilities.h:44
static int CalculateEnrichedShapeFuncionsExtendedmodified(BoundedMatrix< double,(2+1), 2 > &rPoints, BoundedMatrix< double,(2+1), 2 > &DN_DX, array_1d< double,(2+1)> &rDistances, array_1d< double,(3 *(2-1))> &rVolumes, BoundedMatrix< double, 3 *(2-1),(2+1) > &rGPShapeFunctionValues, array_1d< double,(3 *(2-1))> &rPartitionsSign, std::vector< Matrix > &rGradientsValue, BoundedMatrix< double, 3 *(2-1),(5)> &NEnriched, BoundedMatrix< double, 10, 2 > &rGradientpositive, BoundedMatrix< double, 10, 2 > &rGradientnegative, BoundedMatrix< int, 3, 3 > &father_nodes)
Definition: enrichmentutilities.h:386
static int CalculateEnrichedShapeFuncions_Simplified(Geometry< Node > &rGeom, BoundedMatrix< double,(3+1), 3 > &rPoints, BoundedMatrix< double,(3+1), 3 > &DN_DX, array_1d< double,(3+1)> &rDistances, array_1d< double,(3 *(3-1))> &rVolumes, BoundedMatrix< double, 3 *(3-1),(3+1) > &rShapeFunctionValues, array_1d< double,(3 *(3-1))> &rPartitionsSign, std::vector< Matrix > &rGradientsValue, std::vector< Matrix > &rGradientsValueaux, BoundedMatrix< double, 3 *(3-1),(2)> &NEnriched, int &number_interface_elements, BoundedMatrix< double, 2, 3 > &coord_interface_nodes, array_1d< double, 6 > &area_interface, array_1d< double, 6 > &area_inter, array_1d< double, 6 > &N_Star, bool &switch_off_e, std::vector< Matrix > &edges_t, std::vector< Matrix > &nodes, std::vector< Matrix > &original_edges, std::vector< Matrix > &rGradientaux1, int &totalnodes, std::vector< Matrix > &interface_nodes, BoundedMatrix< double, 3 *(3-1), 8 > &Ngauss_new, std::vector< Matrix > &Tres, std::vector< Matrix > &PRUEBA, array_1d< double, 6 > &weight)
Definition: enrichmentutilities.h:1491
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
const Matrix & ShapeFunctionsValues() const
Definition: geometry.h:3393
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry.h:2284
virtual Pointer Create(PointsArrayType const &rThisPoints) const
Creates a new geometry pointer.
Definition: geometry.h:813
JacobiansType & Jacobian(JacobiansType &rResult) const
Definition: geometry.h:2901
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
static BoundedMatrix< double, TDim, TDim > InvertMatrix(const BoundedMatrix< double, TDim, TDim > &rInputMatrix, double &rInputMatrixDet, const double Tolerance=ZeroTolerance)
Calculates the inverse of a 2x2, 3x3 and 4x4 matrices (using bounded matrix for performance)
Definition: math_utils.h:197
This class defines the node.
Definition: node.h:65
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
static int Split_Tetrahedra(const int edges[6], int t[56], int *nel, int *splitted_edges, int *nint)
Function to split a tetrahedron For a given edges splitting pattern, this function computes the inter...
Definition: split_tetrahedra.h:177
static void TetrahedraGetNewConnectivityGID(const int tetra_index, const int t[56], const int aux_ids[11], int *id0, int *id1, int *id2, int *id3)
Returns the ids of a subtetra Provided the splitting connectivities array and the array containing th...
Definition: split_tetrahedra.h:150
static void TetrahedraSplitMode(int aux_ids[11], int edge_ids[6])
Returns the edges vector filled with the splitting pattern. Provided the array of nodal ids,...
Definition: split_tetrahedra.h:91
Short class definition.
Definition: array_1d.h:61
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
typename GeometryType::IntegrationPointsArrayType IntegrationPointsArrayType
Definition: add_geometries_to_python.cpp:61
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
GeometryData::IntegrationMethod IntegrationMethod
Type definition for integration methods.
Definition: exact_mortar_segmentation_utility.h:57
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
float dist
Definition: edgebased_PureConvection.py:89
h
Definition: generate_droplet_dynamics.py:91
x2
Definition: generate_frictional_mortar_condition.py:122
x1
Definition: generate_frictional_mortar_condition.py:121
tuple tmp
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:98
int n_nodes
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:15
int t
Definition: ode_solve.py:392
int d
Definition: ode_solve.py:397
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int node_id
Definition: read_stl.py:12
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
N
Definition: sensitivityMatrix.py:29
volume
Definition: sp_statistics.py:15
number_of_partitions
Definition: square_domain.py:61
integer i
Definition: TensorModule.f:17
integer l
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31