52 #if !defined(KRATOS_ULF_UTILITIES_INCLUDED )
53 #define KRATOS_ULF_UTILITIES_INCLUDED
66 #include <pybind11/pybind11.h>
72 #include "utilities/geometry_utilities.h"
93 if(laplacian_type == 1)
96 for(ModelPart::NodesContainerType::const_iterator in = ThisModelPart.
NodesBegin(); in!=ThisModelPart.
NodesEnd(); in++)
99 if(in->FastGetSolutionStepValue(IS_STRUCTURE) )
100 if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() != 0)
101 in->FastGetSolutionStepValue(IS_FLUID) = 1.0;
103 in->FastGetSolutionStepValue(IS_FLUID) = 0.0;
105 else if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() == 0)
106 in->FastGetSolutionStepValue(IS_BOUNDARY) = 1.0;
114 i->FastGetSolutionStepValue(IS_FREE_SURFACE) = 0;
118 if(
i->FastGetSolutionStepValue(IS_BOUNDARY) != 0
120 i->FastGetSolutionStepValue(IS_STRUCTURE) == 0)
122 i->FastGetSolutionStepValue(IS_FREE_SURFACE) = 1;
123 i->FastGetSolutionStepValue(PRESSURE) = 0.00;
133 for(ModelPart::NodesContainerType::const_iterator in = ThisModelPart.
NodesBegin(); in!=ThisModelPart.
NodesEnd(); in++)
136 if(in->FastGetSolutionStepValue(IS_STRUCTURE) )
137 if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() != 0)
138 in->FastGetSolutionStepValue(IS_FLUID) = 1.0;
140 in->FastGetSolutionStepValue(IS_FLUID) = 0.0;
142 else if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() == 0)
143 in->FastGetSolutionStepValue(IS_BOUNDARY) = 1.0;
145 if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() == 0)
146 in->FastGetSolutionStepValue(PRESSURE) = 0.0;
154 i->FastGetSolutionStepValue(IS_FREE_SURFACE) = 0;
157 if(
i->FastGetSolutionStepValue(IS_BOUNDARY) != 0
159 i->FastGetSolutionStepValue(IS_STRUCTURE) == 0)
161 i->FastGetSolutionStepValue(IS_FREE_SURFACE) = 1;
177 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
183 for(
unsigned int i = 0;
i<geom.
size();
i++)
184 geom[
i].FastGetSolutionStepValue(IS_FLUID) = 1;
197 std::vector<bool> to_be_prescribed(connected_components.size());
199 for(
unsigned int i = 0;
i<connected_components.size();
i++)
201 int boundary_nodes = 0;
202 int prescribed_vel_nodes = 0;
211 if(in->FastGetSolutionStepValue(IS_BOUNDARY) == 1)
217 if(in->FastGetSolutionStepValue(IS_STRUCTURE) == 1)
218 prescribed_vel_nodes += 1;
225 if(boundary_nodes == prescribed_vel_nodes)
227 bool one_is_prescribed =
false;
231 if( one_is_prescribed ==
false &&
232 in->FastGetSolutionStepValue(IS_BOUNDARY) == 1 )
234 std::cout <<
"fixed pressure on node " << in->Id() << std::endl;
235 one_is_prescribed =
true;
251 double deltatime = dt_max;
252 double dvside, lside;
254 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
260 for(
unsigned int i1 = 0; i1 < geom.
size()-1; i1++)
262 for(
unsigned int i2 = i1 + 1; i2 < geom.
size(); i2++)
264 dx[0] = geom[i2].X() - geom[i1].X();
265 dx[1] = geom[i2].Y() - geom[i1].Y();
266 dx[2] = geom[i2].Z() - geom[i1].Z();
270 noalias(dv) = geom[i2].FastGetSolutionStepValue(VELOCITY);
271 noalias(dv) -= geom[i1].FastGetSolutionStepValue(VELOCITY);
278 dt = fabs( lside/dvside );
279 if(
dt < deltatime) deltatime =
dt;
286 if(deltatime < dt_min)
288 std::cout <<
"ATTENTION dt_min is being used" << std::endl;
310 if(corner1[0] > corner2[0])
321 if(corner1[1] > corner2[1])
332 if(corner1[2] > corner2[2])
345 for(ModelPart::NodesContainerType::iterator in = rNodes.begin(); in!=rNodes.end(); in++)
352 if(x<xmin || x>
xmax) erase =
true;
353 else if(y<ymin || y>
ymax) erase =
true;
354 else if(z<zmin || z>
zmax) erase =
true;
359 in->Set(TO_ERASE,
true);
374 return sqrt((Point1[0]-Point2[0])*(Point1[0]-Point2[0]) + (Point1[1]-Point2[1])*(Point1[1]-Point2[1]) +(Point1[2]-Point2[2])*(Point1[2]-Point2[2]));
379 double a=
Length(Point1, Point2);
380 double b=
Length(Point1, Point3);
381 double c=
Length(Point2, Point3);
382 double p=0.5*(
a+
b+
c);
383 return sqrt(
p*(
p-
a)*(
p-
b)*(
p-
c));
390 KRATOS_THROW_ERROR(std::logic_error,
"error: This function is implemented for 3D only",
"");
393 std::vector<array_1d<double,3> > PointsOfFSTriangle;
394 PointsOfFSTriangle.reserve(3);
395 double total_fs_area=0.0;
397 for(ModelPart::ElementsContainerType::iterator in = ThisModelPart.
ElementsBegin();
401 if (in->GetGeometry().size()==4)
403 int n_fs=in->GetGeometry()[0].FastGetSolutionStepValue(IS_FREE_SURFACE);
404 n_fs+=in->GetGeometry()[1].FastGetSolutionStepValue(IS_FREE_SURFACE);
405 n_fs+=in->GetGeometry()[2].FastGetSolutionStepValue(IS_FREE_SURFACE);
406 n_fs+=in->GetGeometry()[3].FastGetSolutionStepValue(IS_FREE_SURFACE);
411 for (
int i=0;
i<4;
i++)
414 if (in->GetGeometry()[
i].FastGetSolutionStepValue(IS_FREE_SURFACE)==1.0)
416 PointsOfFSTriangle[position][0]=in->GetGeometry()[
i].X();
417 PointsOfFSTriangle[position][1]=in->GetGeometry()[
i].Y();
418 PointsOfFSTriangle[position][2]=in->GetGeometry()[
i].Z();
429 return total_fs_area;
438 for(ModelPart::NodesContainerType::iterator in = ThisModelPart.
NodesBegin();
441 in->FastGetSolutionStepValue(NODAL_AREA) = 0.00;
447 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
454 area *= 0.333333333333333333333333333;
457 geom[0].FastGetSolutionStepValue(NODAL_AREA) += area;
458 geom[1].FastGetSolutionStepValue(NODAL_AREA) += area;
459 geom[2].FastGetSolutionStepValue(NODAL_AREA) += area;
465 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
479 geom[0].FastGetSolutionStepValue(NODAL_AREA) += vol;
480 geom[1].FastGetSolutionStepValue(NODAL_AREA) += vol;
481 geom[2].FastGetSolutionStepValue(NODAL_AREA) += vol;
482 geom[3].FastGetSolutionStepValue(NODAL_AREA) += vol;
504 for (ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
511 n_str = geom[0].FastGetSolutionStepValue(IS_BOUNDARY);
512 n_str += geom[1].FastGetSolutionStepValue(IS_BOUNDARY);
513 n_str += geom[2].FastGetSolutionStepValue(IS_BOUNDARY);
519 for (
int i = 0;
i < 3; ++
i)
520 if (geom[
i].FastGetSolutionStepValue(IS_BOUNDARY) == 0.0)
522 sort_coord(0, 0) = geom[
i].X();
523 sort_coord(0, 1) = geom[
i].Y();
527 sort_coord(cnt, 0) = geom[
i].X();
528 sort_coord(cnt, 1) = geom[
i].Y();
535 vec1[0] = sort_coord(0, 0) - sort_coord(1, 0);
536 vec1[1] = sort_coord(0, 1) - sort_coord(1, 1);
538 vec2[0] = sort_coord(2, 0) - sort_coord(1, 0);
539 vec2[1] = sort_coord(2, 1) - sort_coord(1, 1);
542 outer_prod = vec2[1] * vec1[0] - vec1[1] * vec2[0];
544 double length_measure = 0.0;
545 length_measure = vec2[0] * vec2[0] + vec2[1] * vec2[1];
546 length_measure = sqrt(length_measure);
554 for (
int i = 0;
i < 3;
i++)
557 if (geom[
i].FastGetSolutionStepValue(IS_BOUNDARY) == 0.0)
559 geom[
i].Set(TO_ERASE,
true);
570 for (ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
578 if (geom.
size() == 4)
581 n_str += geom[ii].FastGetSolutionStepValue(IS_BOUNDARY);
585 n_wall += geom[ii].FastGetSolutionStepValue(IS_STRUCTURE);
594 for (
int i = 0;
i < 4; ++
i)
599 if (geom[
i].FastGetSolutionStepValue(IS_BOUNDARY) == 0.0)
601 sort_coord(0, 0) = geom[
i].X();
602 sort_coord(0, 1) = geom[
i].Y();
603 sort_coord(0, 2) = geom[
i].Z();
607 sort_coord(cnt, 0) = geom[
i].X();
608 sort_coord(cnt, 1) = geom[
i].Y();
609 sort_coord(cnt, 2) = geom[
i].Z();
619 vec1[0] = sort_coord(0, 0) - sort_coord(1, 0);
620 vec1[1] = sort_coord(0, 1) - sort_coord(1, 1);
621 vec1[2] = sort_coord(0, 2) - sort_coord(1, 2);
623 vec2[0] = sort_coord(2, 0) - sort_coord(1, 0);
624 vec2[1] = sort_coord(2, 1) - sort_coord(1, 1);
625 vec2[2] = sort_coord(2, 2) - sort_coord(1, 2);
627 vec3[0] = sort_coord(3, 0) - sort_coord(1, 0);
628 vec3[1] = sort_coord(3, 1) - sort_coord(1, 1);
629 vec3[2] = sort_coord(3, 2) - sort_coord(1, 2);
632 vec4[0] = sort_coord(1, 0) - sort_coord(3, 0);
633 vec4[1] = sort_coord(1, 1) - sort_coord(3, 1);
634 vec4[2] = sort_coord(1, 2) - sort_coord(3, 2);
638 double vol = (vec2[0] * vec3[1] * vec1[2] - vec2[0] * vec3[2] * vec1[1] +
639 vec2[1] * vec3[2] * vec1[0] - vec2[1] * vec3[0] * vec1[2] +
640 vec2[2] * vec3[0] * vec1[1] - vec2[2] * vec3[1] * vec1[0])*0.1666666666667;
643 outer_prod[0] = vec2[1] * vec3[2] - vec2[2] * vec3[1];
644 outer_prod[1] = vec2[2] * vec3[0] - vec2[0] * vec3[2];
645 outer_prod[2] = vec2[0] * vec3[1] - vec2[1] * vec3[0];
649 if (area_base > 0.0000000000001)
652 KRATOS_WATCH(
"Something strange: area of a wall triangular element --> zero");
654 double length_measure1 =
norm_2(vec2);
655 double length_measure =
norm_2(vec3);
656 double length_measure2 =
norm_2(vec4);
661 if(length_measure1 < length_measure2)
663 if(length_measure1 < length_measure)
664 length_measure = length_measure1;
668 if(length_measure2 < length_measure)
669 length_measure = length_measure2;
672 if (fabs(vol) <
factor * length_measure)
674 for (
int i = 0;
i < 4;
i++)
680 if (geom[
i].FastGetSolutionStepValue(IS_BOUNDARY) == 0.0 || geom[
i].FastGetSolutionStepValue(IS_INTERFACE) == 1.0)
682 geom[
i].Set(TO_ERASE,
true);
683 KRATOS_WATCH(
"NODE TOUCHING THE WALL - WILL BE ERASED!!!!")
705 const double fact2 = admissible_distance_factor*admissible_distance_factor;
710 int size = rNodes.size();
712 #pragma omp parallel for firstprivate(size,NodesBegin),private(in)
713 for (
int k = 0;
k < size;
k++)
717 if (in->FastGetSolutionStepValue(IS_STRUCTURE) == 0)
719 double hnode2 = in->FastGetSolutionStepValue(NODAL_H);
724 i != in->GetValue(NEIGHBOUR_NODES).end();
i++)
726 if (
static_cast<bool> (
i->Is(TO_ERASE)) ==
false)
728 double dx =
i->X() - in->X();
729 double dy =
i->Y() - in->Y();
730 double dz =
i->Z() - in->Z();
732 double dist2 = dx * dx + dy * dy + dz*dz;
734 if (dist2 < fact2 * hnode2)
735 in->Set(TO_ERASE,
true);
751 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
758 n_fs =
int(geom[0].FastGetSolutionStepValue(IS_FREE_SURFACE));
759 n_fs+=
int(geom[1].FastGetSolutionStepValue(IS_FREE_SURFACE));
760 n_fs+=
int(geom[2].FastGetSolutionStepValue(IS_FREE_SURFACE));
767 for (
int i=0;
i<3;
i++)
770 if (geom[
i].FastGetSolutionStepValue(IS_FREE_SURFACE)==0.0 && geom[
i].FastGetSolutionStepValue(IS_FLUID)==1.0 && geom[
i].FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
772 geom[
i].Set(TO_ERASE,
true);
773 KRATOS_WATCH(
"NODE CLOSE TO THE FS - WILL BE ERASED!!!!")
791 for(ModelPart::NodesContainerType::iterator in = ThisModelPart.
NodesBegin();
794 if (in->FastGetSolutionStepValue(DISTANCE)>0.00 && in->FastGetSolutionStepValue(DISTANCE)<crit_distance && in->FastGetSolutionStepValue(IS_STRUCTURE)==0)
796 in->Set(TO_ERASE,
true);
797 KRATOS_WATCH(
"NODE EXCESSIVELY CLOSE TO WALL!!!!! BLADDER FUNCTION!!!!!!!!!!!!!!!!!!!!!!!!!!111")
807 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
814 n_str =
int(geom[0].FastGetSolutionStepValue(IS_STRUCTURE));
815 n_str+=
int(geom[1].FastGetSolutionStepValue(IS_STRUCTURE));
816 n_str+=
int(geom[2].FastGetSolutionStepValue(IS_STRUCTURE));
823 for (
int i=0;
i<3;
i++)
826 if (geom[
i].FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
828 geom[
i].Set(TO_ERASE,
true);
840 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
849 for (
unsigned int iii=0; iii<geom.
size(); iii++)
851 n_lag +=
int(geom[iii].FastGetSolutionStepValue(IS_LAGRANGIAN_INLET));
852 n_str +=
int(geom[iii].FastGetSolutionStepValue(IS_STRUCTURE));
853 n_fl +=
int(geom[iii].FastGetSolutionStepValue(IS_FLUID));
854 n_interf +=
int(geom[iii].FastGetSolutionStepValue(IS_INTERFACE));
860 if (geom.
size()==4 && n_interf==3 && n_lag==0)
865 for (
unsigned int iii=0; iii<geom.
size(); iii++)
868 if (geom[iii].FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
870 geom[iii].Set(TO_ERASE,
true);
871 KRATOS_WATCH(
"NODE CLOSE TO THE WALL - WILL BE ERASED!!!!")
886 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
893 for (
unsigned int iii=0; iii<geom.
size(); iii++)
895 n_lag +=
int(geom[iii].FastGetSolutionStepValue(IS_LAGRANGIAN_INLET));
897 if (geom.
size()==4 && n_lag>0)
899 for (
unsigned int iii=0; iii<geom.
size(); iii++)
901 geom[iii].FastGetSolutionStepValue(NODAL_H)/=
factor;
910 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
917 for (
unsigned int iii=0; iii<geom.
size(); iii++)
919 n_lag +=
int(geom[iii].FastGetSolutionStepValue(IS_LAGRANGIAN_INLET));
921 if (geom.
size()==4 && n_lag>0)
923 for (
unsigned int iii=0; iii<geom.
size(); iii++)
927 geom[iii].FastGetSolutionStepValue(NODAL_H)*=
factor;
942 for(ModelPart::NodesContainerType::iterator in = ThisModelPart.
NodesBegin();
945 if(in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET)==0 && in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET,1)==0 && in->FastGetSolutionStepValue(IS_FREE_SURFACE)==1.0 )
947 if (in->IsFixed(DISPLACEMENT_X)==
true || in->IsFixed(DISPLACEMENT_Y)==
true || in->IsFixed(DISPLACEMENT_Z)==
true)
949 KRATOS_WATCH(
"This node is a BC node. So cant be erased")
953 in->Set(TO_ERASE,
true);
954 KRATOS_WATCH(
"Marking free surface node for erasing (in this problem it is the one that passed through the membrane)!!!")
975 for(ModelPart::NodesContainerType::iterator in = ThisModelPart.
NodesBegin();
978 if((in->GetValue(NEIGHBOUR_ELEMENTS)).size() == 0 && in->FastGetSolutionStepValue(IS_STRUCTURE)==0.0 && in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET)!=1 && in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET,1)!=1.0)
980 in->Set(TO_ERASE,
true);
1017 double x0 = pgeom[0].X();
1018 double x1 = pgeom[1].X();
1019 double x2 = pgeom[2].X();
1021 double y0 = pgeom[0].Y();
1022 double y1 = pgeom[1].Y();
1023 double y2 = pgeom[2].Y();
1031 double detJ =
J(0,0)*
J(1,1)-
J(0,1)*
J(1,0);
1034 Jinv(0,1) = -
J(0,1);
1035 Jinv(1,0) = -
J(1,0);
1045 pgeom[0].GetSolutionStepValue(IS_BOUNDARY) = 1;
1046 pgeom[1].GetSolutionStepValue(IS_BOUNDARY) = 1;
1047 pgeom[2].GetSolutionStepValue(IS_BOUNDARY) = 1;
1054 double x0_2 = x0*x0 + y0*y0;
1055 double x1_2 =
x1*
x1 + y1*y1;
1056 double x2_2 =
x2*
x2 + y2*y2;
1062 rhs[0] = (x1_2 - x0_2);
1063 rhs[1] = (x2_2 - x0_2);
1068 double radius = sqrt(pow(
c[0]-x0,2)+pow(
c[1]-y0,2));
1072 h = pgeom[0].FastGetSolutionStepValue(NODAL_H);
1073 h += pgeom[1].FastGetSolutionStepValue(NODAL_H);
1074 h += pgeom[2].FastGetSolutionStepValue(NODAL_H);
1099 const double x0 = geom[0].X();
1100 const double y0 = geom[0].Y();
1101 const double z0 = geom[0].Z();
1102 const double x1 = geom[1].X();
1103 const double y1 = geom[1].Y();
1104 const double z1 = geom[1].Z();
1105 const double x2 = geom[2].X();
1106 const double y2 = geom[2].Y();
1107 const double z2 = geom[2].Z();
1108 const double x3 = geom[3].X();
1109 const double y3 = geom[3].Y();
1110 const double z3 = geom[3].Z();
1126 Jinv(0,0) =
J(1,1)*
J(2,2) -
J(1,2)*
J(2,1);
1127 Jinv(1,0) = -
J(1,0)*
J(2,2) +
J(1,2)*
J(2,0);
1128 Jinv(2,0) =
J(1,0)*
J(2,1) -
J(1,1)*
J(2,0);
1130 Jinv(0,1) = -
J(0,1)*
J(2,2) +
J(0,2)*
J(2,1);
1131 Jinv(1,1) =
J(0,0)*
J(2,2) -
J(0,2)*
J(2,0);
1132 Jinv(2,1) = -
J(0,0)*
J(2,1) +
J(0,1)*
J(2,0);
1134 Jinv(0,2) =
J(0,1)*
J(1,2) -
J(0,2)*
J(1,1);
1135 Jinv(1,2) = -
J(0,0)*
J(1,2) +
J(0,2)*
J(1,0);
1136 Jinv(2,2) =
J(0,0)*
J(1,1) -
J(0,1)*
J(1,0);
1140 double detJ =
J(0,0)*Jinv(0,0)
1148 double x0_2 = x0*x0 + y0*y0 + z0*z0;
1149 double x1_2 =
x1*
x1 + y1*y1 + z1*z1;
1150 double x2_2 =
x2*
x2 + y2*y2 + z2*z2;
1151 double x3_2 = x3*x3 + y3*y3 + z3*z3;
1158 Rhs[0] = 0.5*(x1_2 - x0_2);
1159 Rhs[1] = 0.5*(x2_2 - x0_2);
1160 Rhs[2] = 0.5*(x3_2 - x0_2);
1171 h = geom[0].FastGetSolutionStepValue(NODAL_H);
1172 h += geom[1].FastGetSolutionStepValue(NODAL_H);
1173 h += geom[2].FastGetSolutionStepValue(NODAL_H);
1174 h += geom[3].FastGetSolutionStepValue(NODAL_H);
1197 for(ModelPart::NodesContainerType::iterator in = ThisModelPart.
NodesBegin();
1198 in!=ThisModelPart.
NodesEnd(); in++)
1200 if((in->GetValue(NEIGHBOUR_ELEMENTS)).size() != 0
1201 && in->FastGetSolutionStepValue(IS_STRUCTURE) != 1 )
1205 noalias(disp) = in->FastGetSolutionStepValue(DISPLACEMENT,1);
1206 noalias(disp) +=
dt * in->FastGetSolutionStepValue(VELOCITY,1);
1229 (
i)->FastGetSolutionStepValue(IS_STRUCTURE) == 0 &&
1230 (
i)->
GetValue(NEIGHBOUR_ELEMENTS).size() == 0 &&
1231 ((
i)->GetDof(DISPLACEMENT_X).IsFixed() ==
false || (
i)->GetDof(DISPLACEMENT_Y).IsFixed() ==
false || (
i)->GetDof(DISPLACEMENT_Z).IsFixed() ==
false)
1237 (
i)->FastGetSolutionStepValue(PRESSURE) = 0;
1243 noalias(acc) = (
i)->FastGetSolutionStepValue(BODY_FORCE);
1252 noalias(disp) =
i->FastGetSolutionStepValue(DISPLACEMENT,1);
1298 KRATOS_THROW_ERROR(std::logic_error,
"Function SaveLagrangianInlet must be re-implemented (see ulf_utilities) according to new format of creating new nodes",
"");
1337 KRATOS_THROW_ERROR(std::logic_error,
"Function InjectNodesAtInlet must be re-implemented (see ulf_utilities) according to new format of creating new nodes",
"");
1428 if (i_node->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET)==1)
1430 i_node->FastGetSolutionStepValue(DISPLACEMENT_X)=i_node->FastGetSolutionStepValue(DISPLACEMENT_X, 1)+vel_x*
dt;
1431 i_node->FastGetSolutionStepValue(VELOCITY_X)=vel_x;
1432 i_node->Fix(DISPLACEMENT_X);
1433 i_node->FastGetSolutionStepValue(DISPLACEMENT_Y)=i_node->FastGetSolutionStepValue(DISPLACEMENT_Y, 1)+vel_y*
dt;
1434 i_node->FastGetSolutionStepValue(VELOCITY_Y)=vel_y;
1435 i_node->Fix(DISPLACEMENT_Y);
1436 i_node->FastGetSolutionStepValue(DISPLACEMENT_Z)=i_node->FastGetSolutionStepValue(DISPLACEMENT_Z, 1)+vel_z*
dt;
1437 i_node->FastGetSolutionStepValue(VELOCITY_Z)=vel_z;
1438 i_node->Fix(DISPLACEMENT_Z);
1453 bool inverted_elements =
false;
1458 unsigned int nstruct=0;
1462 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
1467 for (
unsigned int kkk=0; kkk<(
i->GetGeometry()).size(); kkk++)
1470 nstruct+=
int(
i->GetGeometry()[kkk].FastGetSolutionStepValue(IS_STRUCTURE));
1473 if ( nstruct!= (
i->GetGeometry()).size() )
1479 inverted_elements =
true;
1488 for(ModelPart::ElementsContainerType::iterator
i = ThisModelPart.
ElementsBegin();
1493 for (
unsigned int kkk=0; kkk<(
i->GetGeometry()).size(); kkk++)
1496 nstruct+=
int(
i->GetGeometry()[kkk].FastGetSolutionStepValue(IS_STRUCTURE));
1501 if ( nstruct!= (
i->GetGeometry()).size() )
1505 if(Ael <= 0) inverted_elements =
true;
1513 if( inverted_elements ==
true)
1530 double new_dt = reduction_factor * old_dt;
1533 double new_time =
time - old_dt + new_dt;
1541 for(ModelPart::NodesContainerType::iterator
i = ThisModelPart.
NodesBegin();
1548 double* step_data =
i->SolutionStepData().Data(0);
1549 double* prev_step_data =
i->SolutionStepData().Data(1);
1553 for(
unsigned int j= 0;
j<step_data_size;
j++)
1555 step_data[
j] = prev_step_data[
j];
1571 for(ModelPart::NodesContainerType::iterator
i = ThisModelPart.
NodesBegin();
1574 if((
i)->
GetValue(NEIGHBOUR_NODES).size() != 0)
1577 const double&
A =
i->FastGetSolutionStepValue(NODAL_AREA);
1578 const double&
density =
i->FastGetSolutionStepValue(DENSITY);
1581 const double& A0 =
i->GetValue(NODAL_AREA);
1583 double pressure_increment =
k*
density*(
A - A0)/A0;
1586 i->FastGetSolutionStepValue(PRESSURE) += pressure_increment;
1590 i->FastGetSolutionStepValue(PRESSURE) = 0.0;
1604 for(ModelPart::NodesContainerType::iterator
i = ThisModelPart.
NodesBegin();
1607 i->FastGetSolutionStepValue(NODAL_AREA,1) =
i->FastGetSolutionStepValue(NODAL_AREA);
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
static double CalculateVolume2D(const GeometryType &rGeometry)
This function computes the element's volume (with sign)
Definition: geometry_utilities.h:292
static double CalculateVolume3D(const GeometryType &rGeometry)
This function computes the element's volume (with sign)
Definition: geometry_utilities.h:226
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: global_pointers_vector.h:79
Definition: amatrix_interface.h:41
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
SizeType GetNodalSolutionStepDataSize()
Definition: model_part.h:571
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
This class defines the node.
Definition: node.h:65
Definition: ulf_utilities.h:81
void InjectNodesAtInlet(ModelPart &fluid_model_part, ModelPart &lagrangian_inlet_model_part, float vel_x, float vel_y, float vel_z, float h)
Definition: ulf_utilities.h:1335
void ReduceTimeStep(ModelPart &ThisModelPart, const double reduction_factor)
Definition: ulf_utilities.h:1525
void MarkNodesCloseToFS(ModelPart &ThisModelPart, int domain_size)
Definition: ulf_utilities.h:746
void Predict(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:1191
void MarkNodesCloseToWall(ModelPart &ThisModelPart, int domain_size, double alpha_shape)
Definition: ulf_utilities.h:802
double CalculateFreeSurfaceArea(ModelPart &ThisModelPart, int domain_size)
Definition: ulf_utilities.h:387
void SaveLagrangianInlet(ModelPart &fluid_model_part, ModelPart &lagrangian_inlet_model_part)
Definition: ulf_utilities.h:1296
bool AlphaShape3D(double alpha_param, Geometry< Node > &geom)
Definition: ulf_utilities.h:1089
void IdentifyFluidNodes(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:173
double CalculateTriangleArea3D(array_1d< double, 3 > &Point1, array_1d< double, 3 > &Point2, array_1d< double, 3 > &Point3)
Definition: ulf_utilities.h:376
void SaveNodalArea(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:1600
void ApplyBoundaryConditions(ModelPart &ThisModelPart, int laplacian_type)
Definition: ulf_utilities.h:89
void DeleteFreeSurfaceNodesBladder(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:939
double Length(array_1d< double, 3 > &Point1, array_1d< double, 3 > &Point2)
Definition: ulf_utilities.h:371
void MarkExcessivelyCloseNodes(ModelPart::NodesContainerType &rNodes, const double admissible_distance_factor)
Definition: ulf_utilities.h:700
double EstimateDeltaTime(double dt_min, double dt_max, ModelPart &ThisModelPart)
Definition: ulf_utilities.h:246
void MarkLonelyNodesForErasing(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:962
double CalculateVolume(ModelPart &ThisModelPart, int domain_size)
Definition: ulf_utilities.h:1449
void ApplyMinimalPressureConditions(std::vector< GlobalPointersVector< Node > > &connected_components)
Definition: ulf_utilities.h:192
void RestoreNodalHAtLagInlet(ModelPart &ThisModelPart, double factor)
Definition: ulf_utilities.h:908
void NodalIncrementalPressureCalculation(const double k, ModelPart &ThisModelPart)
Definition: ulf_utilities.h:1565
void MarkNodesTouchingWall(ModelPart &ThisModelPart, int domain_size, double factor)
Definition: ulf_utilities.h:497
void MarkNodesCloseToWallForBladder(ModelPart &ThisModelPart, const double &crit_distance)
Definition: ulf_utilities.h:788
void MarkOuterNodes(const array_1d< double, 3 > &corner1, const array_1d< double, 3 > &corner2, ModelPart::NodesContainerType &rNodes)
Definition: ulf_utilities.h:299
void MoveLonelyNodes(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:1216
bool AlphaShape(double alpha_param, Geometry< Node > &pgeom)
Definition: ulf_utilities.h:1008
void MoveInletNodes(ModelPart &fluid_model_part, float vel_x, float vel_y, float vel_z)
Definition: ulf_utilities.h:1423
Node NodeType
Definition: ulf_utilities.h:83
void CalculateNodalArea(ModelPart &ThisModelPart, int domain_size)
Definition: ulf_utilities.h:432
void SetNodalHAtLagInlet(ModelPart &ThisModelPart, double factor)
Definition: ulf_utilities.h:884
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
dt
Definition: DEM_benchmarks.py:173
z
Definition: GenerateWind.py:163
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
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
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
AMatrix::VectorOuterProductExpression< TExpression1Type, TExpression2Type > outer_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:582
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
float zmax
Definition: cube_mesher.py:747
float xmax
Definition: cube_mesher.py:743
float ymax
Definition: cube_mesher.py:745
float xmin
Definition: cube_mesher.py:742
float zmin
Definition: cube_mesher.py:746
float ymin
Definition: cube_mesher.py:744
fluid_model_part
Definition: edgebased_PureConvection.py:18
int domain_size
Definition: face_heat.py:4
time
Definition: face_heat.py:85
Dt
Definition: face_heat.py:78
float density
Definition: face_heat.py:56
y
Other simbols definition.
Definition: generate_axisymmetric_navier_stokes_element.py:54
h
Definition: generate_droplet_dynamics.py:91
x2
Definition: generate_frictional_mortar_condition.py:122
rhs
Definition: generate_frictional_mortar_condition.py:297
x1
Definition: generate_frictional_mortar_condition.py:121
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
list node_list
Definition: mesh_to_mdpa_converter.py:39
float radius
Definition: mesh_to_mdpa_converter.py:18
vel
Definition: pure_conduction.py:76
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
float xc
Definition: rotating_cone.py:77
alpha_shape
Definition: script.py:120
J
Definition: sensitivityMatrix.py:58
A
Definition: sensitivityMatrix.py:70
p
Definition: sensitivityMatrix.py:52
x
Definition: sensitivityMatrix.py:49
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31
float factor
for node in (self.combined_model_part).Nodes: pold = node.GetSolutionStepValue(PRESSURE,...
Definition: ulf_PGLASS.py:254