14 #if !defined(CALCULATE_CURVATURE_INCLUDED )
15 #define CALCULATE_CURVATURE_INCLUDED
28 #include <pybind11/pybind11.h>
35 #include "utilities/geometry_utilities.h"
123 double theta_eq = ThisModelPart.
GetProcessInfo()[CONTACT_ANGLE_STATIC];
124 double pi = 3.14159265359;
125 double theta_w = theta_eq*
pi/180.0;
126 double x0,y0,
x1,y1,
x2,y2;
129 for(ModelPart::NodesContainerType::iterator
im = ThisModelPart.
NodesBegin() ;
im != ThisModelPart.
NodesEnd() ; ++
im)
131 if (
im->FastGetSolutionStepValue(IS_INTERFACE) != 0.0 &&
im->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) < 1
e-15)
138 for (
unsigned int i = 0;
i < neighb.
size();
i++)
140 if (neighb[
i].FastGetSolutionStepValue(IS_INTERFACE) != 0.0 || neighb[
i].FastGetSolutionStepValue(TRIPLE_POINT) != 0.0)
142 if (neighb[
i].
X() != x0 || neighb[
i].
Y() != y0)
162 double sign_curv = 1.0;
163 double xc = 0.5*(
x1 +
x2);
164 double yc = 0.5*(y1 + y2);
166 int struct_nodes = 0;
168 for (
unsigned int i = 0;
i < neighb_els.
size();
i++)
171 for (
unsigned int j = 0;
j < 3;
j++)
173 if (neighb_els[
i].GetGeometry()[
j].FastGetSolutionStepValue(IS_INTERFACE) != 0.0 || neighb_els[
i].GetGeometry()[
j].FastGetSolutionStepValue(TRIPLE_POINT) != 0.0)
175 if (neighb_els[
i].GetGeometry()[
j].FastGetSolutionStepValue(IS_STRUCTURE) != 0.0)
179 neighb_els[
i].GetValue(IS_WATER_ELEMENT) = 1.0;
181 double x0_loc = neighb_els[
i].GetGeometry()[0].X();
182 double y0_loc = neighb_els[
i].GetGeometry()[0].Y();
183 double x1_loc = neighb_els[
i].GetGeometry()[1].X();
184 double y1_loc = neighb_els[
i].GetGeometry()[1].Y();
185 double x2_loc = neighb_els[
i].GetGeometry()[2].X();
186 double y2_loc = neighb_els[
i].GetGeometry()[2].Y();
188 double x10 = x1_loc - x0_loc;
189 double y10 = y1_loc - y0_loc;
191 double x20 = x2_loc - x0_loc;
192 double y20 = y2_loc - y0_loc;
194 double detJ = x10 * y20-y10 * x20;
195 double totArea=0.5*detJ;
202 double eps_sign = -0.00000001;
203 if (
N[0] >= eps_sign &&
N[1] >= eps_sign &&
N[2] >= eps_sign)
205 if (neighb_els[
i].
GetValue(IS_WATER_ELEMENT) == 1.0)
217 im->FastGetSolutionStepValue(MEAN_CURVATURE_2D) = sign_curv*curv;
224 if (
im->FastGetSolutionStepValue(TRIPLE_POINT) != 0.0)
228 double sin_t = sin(theta_w+0.5*
pi);
229 double cos_t = cos(theta_w+0.5*
pi);
233 double dist_struct = 0.0;
235 for (
unsigned int i = 0;
i < neighb.
size();
i++)
237 if (neighb[
i].FastGetSolutionStepValue(IS_INTERFACE) != 0.0)
241 n1[0] = neighb[
i].FastGetSolutionStepValue(NORMAL_X);
242 n1[1] = neighb[
i].FastGetSolutionStepValue(NORMAL_Y);
252 if (neighb[
i].FastGetSolutionStepValue(IS_STRUCTURE) != 0.0)
257 dist_struct =
Norm2D(struct_dist);
258 if (dist_struct < 1.0e-5)
259 neighb[
i].Set(TO_ERASE,
true);
264 double ds =
Norm2D(ds_vec);
267 dT[0] =
n1[0] - n0[0];
268 dT[1] =
n1[1] - n0[1];
269 double dT_norm =
Norm2D(dT);
270 double curv_tp = dT_norm/ds;
272 im->FastGetSolutionStepValue(MEAN_CURVATURE_2D) = curv_tp;
275 if(
im->FastGetSolutionStepValue(IS_STRUCTURE) != 0.0 &&
im->FastGetSolutionStepValue(TRIPLE_POINT)*1.0E8 == 0.0)
277 im->FastGetSolutionStepValue(MEAN_CURVATURE_2D) = 0.0;
287 double pi = 3.14159265;
289 for(ModelPart::NodesContainerType::iterator
im = ThisModelPart.
NodesBegin() ;
292 if (
im->FastGetSolutionStepValue(FLAG_VARIABLE) > 0.999)
316 double norm_ij = 0.0;
317 double norm_ik = 0.0;
318 double norm_jk = 0.0;
321 double area_ijk = 0.0;
322 double alfa_ij = 0.0;
323 double beta_ij = 0.0;
324 double theta_kij = 0.0;
325 double theta_sum = 0.0;
328 double A_mixed = 0.0;
330 double Delta_xi = 0.0;
335 for (
unsigned int i = 0;
i < neighb_faces.
size();
i++)
337 int num_flag_var = 0;
338 num_flag_var += neighb_faces[
i].GetGeometry()[0].FastGetSolutionStepValue(FLAG_VARIABLE);
339 num_flag_var += neighb_faces[
i].GetGeometry()[1].FastGetSolutionStepValue(FLAG_VARIABLE);
340 num_flag_var += neighb_faces[
i].GetGeometry()[2].FastGetSolutionStepValue(FLAG_VARIABLE);
341 if (num_flag_var > 2.999)
344 for (
unsigned int j = 0;
j < neighb_faces[
i].GetGeometry().size() ;
j++)
346 if (neighb_faces[
i].GetGeometry()[
j].
X() != xi ||
347 neighb_faces[
i].GetGeometry()[
j].
Y() != yi || neighb_faces[
i].GetGeometry()[
j].
Z() != zi)
352 xj = neighb_faces[
i].GetGeometry()[
j].X();
353 yj = neighb_faces[
i].GetGeometry()[
j].Y();
354 zj = neighb_faces[
i].GetGeometry()[
j].Z();
358 xk = neighb_faces[
i].GetGeometry()[
j].X();
359 yk = neighb_faces[
i].GetGeometry()[
j].Y();
360 zk = neighb_faces[
i].GetGeometry()[
j].Z();
376 beta_ij =
pi - alfa_ij - theta_kij;
378 area_ijk = 0.5*
Norm3D(cross_prod_ijk);
379 if (alfa_ij > hpi || beta_ij > hpi || theta_kij > hpi)
383 A_mixed += 0.5*area_ijk*1000.0;
385 A_mixed += 0.25*area_ijk*1000.0;
389 A_mixed += 0.125*
cotan(alfa_ij)*norm_ik*norm_ik*1000.0;
390 A_mixed += 0.125*
cotan(beta_ij)*norm_ij*norm_ij*1000.0;
393 K_xi[0] += (
cotan(alfa_ij)*rki[0] +
cotan(beta_ij)*rji[0])*1000.0;
394 K_xi[1] += (
cotan(alfa_ij)*rki[1] +
cotan(beta_ij)*rji[1])*1000.0;
395 K_xi[2] += (
cotan(alfa_ij)*rki[2] +
cotan(beta_ij)*rji[2])*1000.0;
397 theta_sum += theta_kij;
398 Sp += (0.5*area_ijk - 0.125*tan(hpi - theta_kij)*norm_jk*norm_jk);
401 double A_mixed_norm = sqrt(A_mixed*A_mixed);
402 if(A_mixed_norm < 1
e-10)
411 K_xi[0] = (0.5/A_mixed)*K_xi[0];
412 K_xi[1] = (0.5/A_mixed)*K_xi[1];
413 K_xi[2] = (0.5/A_mixed)*K_xi[2];
418 K_xi_norm[0] = K_xi[0];
419 K_xi_norm[1] = K_xi[1];
420 K_xi_norm[2] = K_xi[2];
422 im->FastGetSolutionStepValue(NORMAL_GEOMETRIC_X) = K_xi_norm[0];
423 im->FastGetSolutionStepValue(NORMAL_GEOMETRIC_Y) = K_xi_norm[1];
424 im->FastGetSolutionStepValue(NORMAL_GEOMETRIC_Z) = K_xi_norm[2];
427 im->FastGetSolutionStepValue(MEAN_CURVATURE_3D) =
Norm3D(K_xi);
428 im->FastGetSolutionStepValue(GAUSSIAN_CURVATURE) = (2*
pi - theta_sum)/Sp;
431 Delta_xi = ((
im->FastGetSolutionStepValue(MEAN_CURVATURE_3D))*(
im->FastGetSolutionStepValue(MEAN_CURVATURE_3D)) -
im->FastGetSolutionStepValue(GAUSSIAN_CURVATURE));
434 im->FastGetSolutionStepValue(PRINCIPAL_CURVATURE_1) =
im->FastGetSolutionStepValue(MEAN_CURVATURE_3D) + sqrt(Delta_xi);
435 im->FastGetSolutionStepValue(PRINCIPAL_CURVATURE_2) =
im->FastGetSolutionStepValue(MEAN_CURVATURE_3D) - sqrt(Delta_xi);
439 im->FastGetSolutionStepValue(PRINCIPAL_CURVATURE_1) =
im->FastGetSolutionStepValue(MEAN_CURVATURE_3D);
440 im->FastGetSolutionStepValue(PRINCIPAL_CURVATURE_2) =
im->FastGetSolutionStepValue(MEAN_CURVATURE_3D);
448 if (
im->FastGetSolutionStepValue(TRIPLE_POINT) != 0.0)
450 double neigh_fs = 0.0;
451 double mean_curv = 0.0;
453 for (
unsigned int i = 0;
i < neighb.
size();
i++)
455 if (neighb[
i].FastGetSolutionStepValue(IS_FREE_SURFACE) != 0.0)
458 mean_curv += neighb[
i].FastGetSolutionStepValue(MEAN_CURVATURE_3D);
462 im->FastGetSolutionStepValue(MEAN_CURVATURE_3D) = mean_curv/neigh_fs;
465 if ((
im->FastGetSolutionStepValue(IS_STRUCTURE) != 0.0) && (
im->FastGetSolutionStepValue(TRIPLE_POINT) == 0.0))
467 im->FastGetSolutionStepValue(MEAN_CURVATURE_3D) = 0.0;
476 for(ModelPart::NodesContainerType::iterator
im = ThisModelPart.
NodesBegin() ;
479 if (
im->FastGetSolutionStepValue(TRIPLE_POINT) != 0.0)
490 for (
unsigned int i = 0;
i < neighb.
size();
i++)
492 if (neighb[
i].FastGetSolutionStepValue(TRIPLE_POINT) != 0.0)
514 double sign_curv = 1.0;
515 double xc = 0.5*(xj + xk);
516 double yc = 0.5*(yj + yk);
522 ni[0] =
im->FastGetSolutionStepValue(NORMAL_GEOMETRIC_X);
523 ni[1] =
im->FastGetSolutionStepValue(NORMAL_GEOMETRIC_Y);
529 im->FastGetSolutionStepValue(MEAN_CURVATURE_2D) = sign_curv*curv;
541 for(ModelPart::NodesContainerType::iterator
im = ThisModelPart.
NodesBegin() ;
544 if (
im->FastGetSolutionStepValue(IS_FREE_SURFACE) != 0.0)
564 double kappaN_ij = 0.0;
573 double kappa_H =
im->FastGetSolutionStepValue(MEAN_CURVATURE_3D);
574 double kappa_G =
im->FastGetSolutionStepValue(GAUSSIAN_CURVATURE);
580 boost::numeric::ublas::bounded_matrix<double, 2, 2> LHSmat =
ZeroMatrix(2,2);
582 boost::numeric::ublas::bounded_matrix<double, 2, 2>
B =
ZeroMatrix(2,2);
586 double xu = neighb[0].X();
587 double yu = neighb[0].Y();
588 double zu = neighb[0].Z();
597 n_vec[0] =
im->FastGetSolutionStepValue(NORMAL_GEOMETRIC_X);
598 n_vec[1] =
im->FastGetSolutionStepValue(NORMAL_GEOMETRIC_Y);
599 n_vec[2] =
im->FastGetSolutionStepValue(NORMAL_GEOMETRIC_Z);
610 for (
unsigned j = 0;
j < neighb.
size();
j++)
615 for (
unsigned j = 0;
j < neighb.
size();
j++)
635 AddTermsToEq2(kappaN_ij,kappa_H,alfa,beta,num_neighbs,terms_func,terms_func_der);
657 NewtonMethod(terms_func,terms_func_der,
a,kappa_H,kappa_G,kappaN_ij);
659 b = sqrt(
a*(2.0*kappa_H -
a) - kappa_G);
672 double cond_sum = 0.0;
673 double cond_prod =
a*
c -
b*
b;
674 double eps_cond = 1
e-5;
676 cond_sum = 0.5*(
a +
b);
678 cond_sum = 0.5*(
a +
c);
679 if ((cond_sum - kappa_H) > eps_cond || cond_prod != kappa_G)
681 KRATOS_WATCH(
"Not fulfilling this condition!!!!!!!!!!!!!!!!")
688 double D =
a*
c -
b*
b;
690 double lambda_1 = 0.5*T + sqrt(0.25*T*T - D);
691 double lambda_2 = 0.5*T - sqrt(0.25*T*T - D);
701 eigen1[1] = lambda_1 -
a;
703 eigen2[1] = lambda_2 -
a;
715 eigen1_xyz[0] = eigen1[0]*u_vec[0] + eigen1[1]*v_vec[0];
716 eigen1_xyz[1] = eigen1[0]*u_vec[1] + eigen1[1]*v_vec[1];
717 eigen1_xyz[2] = eigen1[0]*u_vec[2] + eigen1[1]*v_vec[2];
718 eigen2_xyz[0] = eigen2[0]*u_vec[0] + eigen2[1]*v_vec[0];
719 eigen2_xyz[1] = eigen2[0]*u_vec[1] + eigen2[1]*v_vec[1];
720 eigen2_xyz[2] = eigen2[0]*u_vec[2] + eigen2[1]*v_vec[2];
723 im->FastGetSolutionStepValue(PRINCIPAL_DIRECTION_1_X) = eigen1_xyz[0];
724 im->FastGetSolutionStepValue(PRINCIPAL_DIRECTION_1_Y) = eigen1_xyz[1];
725 im->FastGetSolutionStepValue(PRINCIPAL_DIRECTION_1_Z) = eigen1_xyz[2];
726 im->FastGetSolutionStepValue(PRINCIPAL_DIRECTION_2_X) = eigen2_xyz[0];
727 im->FastGetSolutionStepValue(PRINCIPAL_DIRECTION_2_Y) = eigen2_xyz[1];
728 im->FastGetSolutionStepValue(PRINCIPAL_DIRECTION_2_Z) = eigen2_xyz[2];
734 double CalculateVol(
const double x0,
const double y0,
const double x1,
const double y1,
const double x2,
const double y2)
736 return 0.5*( (
x1-x0)*(y2-y0)- (y1-y0)*(
x2-x0) );
739 double CalculateCurv(
const double x0,
const double y0,
const double x1,
const double y1,
const double x2,
const double y2)
745 double norm01 =
Norm2D(r01);
746 double norm20 =
Norm2D(r20);
750 double norm_diff =
Norm2D(r_diff);
751 return 2.0*norm_diff/(norm01 + norm20);
754 void IsObtuse(
const double x0,
const double y0,
const double z0,
const double x1,
const double y1,
const double z1,
755 const double x2,
const double y2,
const double z2,
bool& isobt,
bool& isobt_i,
double& alfa)
764 double hpi = 3.14159265*0.5;
778 if (alfa0 > hpi || alfa1 > hpi || alfa2 > hpi)
790 void Vector3D(
const double x0,
const double y0,
const double z0,
800 return sqrt(
a[0]*
a[0] +
a[1]*
a[1]);
805 return sqrt(
a[0]*
a[0] +
a[1]*
a[1] +
a[2]*
a[2]);
810 return (
a[0]*
b[0] +
a[1]*
b[1]);
815 return (
a[0]*
b[0] +
a[1]*
b[1] +
a[2]*
b[2]);
820 c[0] =
a[1]*
b[2] -
a[2]*
b[1];
821 c[1] =
a[2]*
b[0] -
a[0]*
b[2];
822 c[2] =
a[0]*
b[1] -
a[1]*
b[0];
830 if (norm_a*norm_b > -1.0e-20 && norm_a*norm_b < 1.0e-20)
843 if (norm_a*norm_b == 0.0)
853 return cos(alfa)/sin(alfa);
859 double kappaN_ij = 0.0;
862 double norm_rji =
Norm3D(rji);
865 kappaN_ij = 2*kappaN_ij/(norm_rji*norm_rji);
872 u_vec[0] = (u_vec[0] - dotprod*n_vec[0]);
873 u_vec[1] = (u_vec[1] - dotprod*n_vec[1]);
874 u_vec[2] = (u_vec[2] - dotprod*n_vec[2]);
875 double norm_uvec =
Norm3D(u_vec);
876 u_vec[0] /= norm_uvec;
877 u_vec[1] /= norm_uvec;
878 u_vec[2] /= norm_uvec;
883 boost::numeric::ublas::bounded_matrix<double, 2, 2> mat_syst;
884 boost::numeric::ublas::bounded_matrix<double, 2, 2> mat_dx;
885 boost::numeric::ublas::bounded_matrix<double, 2, 2> mat_dy;
887 mat_syst(0,0) = u_vec[0];
888 mat_syst(1,0) = u_vec[1];
889 mat_syst(0,1) = v_vec[0];
890 mat_syst(1,1) = v_vec[1];
891 double det_matsys =
Det2x2(mat_syst);
892 if (det_matsys*det_matsys < 0.00000001)
894 mat_syst(1,0) = u_vec[2];
895 mat_syst(1,1) = v_vec[2];
896 det_matsys =
Det2x2(mat_syst);
898 if (det_matsys*det_matsys < 0.00000001)
900 mat_syst(0,0) = u_vec[1];
901 mat_syst(0,1) = v_vec[1];
909 mat_dx(0,0) = dij[0];
910 mat_dx(1,0) = dij[1];
911 mat_dx(0,1) = v_vec[0];
912 mat_dx(1,1) = v_vec[1];
913 mat_dy(0,0) = u_vec[0];
914 mat_dy(1,0) = u_vec[1];
915 mat_dy(0,1) = dij[0];
916 mat_dy(1,1) = dij[1];
920 mat_dx(0,0) = dij[0];
921 mat_dx(1,0) = dij[2];
922 mat_dx(0,1) = v_vec[0];
923 mat_dx(1,1) = v_vec[2];
924 mat_dy(0,0) = u_vec[0];
925 mat_dy(1,0) = u_vec[2];
926 mat_dy(0,1) = dij[0];
927 mat_dy(1,1) = dij[2];
931 mat_dx(0,0) = dij[1];
932 mat_dx(1,0) = dij[2];
933 mat_dx(0,1) = v_vec[1];
934 mat_dx(1,1) = v_vec[2];
935 mat_dy(0,0) = u_vec[1];
936 mat_dy(1,0) = u_vec[2];
937 mat_dy(0,1) = dij[1];
938 mat_dy(1,1) = dij[2];
941 double det_matdx =
Det2x2(mat_dx);
942 double det_matdy =
Det2x2(mat_dy);
944 alfa = det_matdx/det_matsys;
945 beta = det_matdy/det_matsys;
948 void SolveSys2x2(
double&
a,
double&
b,boost::numeric::ublas::bounded_matrix<double, 2, 2>& LHSmat,
951 boost::numeric::ublas::bounded_matrix<double, 2, 2> mat_syst =
ZeroMatrix(2,2);
952 boost::numeric::ublas::bounded_matrix<double, 2, 2> mat_dx =
ZeroMatrix(2,2);
953 boost::numeric::ublas::bounded_matrix<double, 2, 2> mat_dy =
ZeroMatrix(2,2);
958 double det_matsys =
Det2x2(mat_syst);
959 if (det_matsys > -0.000000001 && det_matsys < 0.000000001)
960 det_matsys = 0.000000001;
962 mat_dx(0,0) = RHSvec[0];
963 mat_dx(1,0) = RHSvec[1];
964 mat_dy(0,1) = RHSvec[0];
965 mat_dy(1,1) = RHSvec[1];
967 double det_matdx =
Det2x2(mat_dx);
968 double det_matdy =
Det2x2(mat_dy);
970 a = det_matdx/det_matsys;
971 b = det_matdy/det_matsys;
974 void SolveSys3x3(
double&
a,
double&
b,
double&
c,boost::numeric::ublas::bounded_matrix<double, 3, 3>& LHSmat,
977 boost::numeric::ublas::bounded_matrix<double, 3, 3> mat_syst =
ZeroMatrix(3,3);
978 boost::numeric::ublas::bounded_matrix<double, 3, 3> mat_dx =
ZeroMatrix(3,3);
979 boost::numeric::ublas::bounded_matrix<double, 3, 3> mat_dy =
ZeroMatrix(3,3);
980 boost::numeric::ublas::bounded_matrix<double, 3, 3> mat_dz =
ZeroMatrix(3,3);
986 double det_matsys =
Det3x3(mat_syst);
988 mat_dx(0,0) = RHSvec[0];
989 mat_dx(1,0) = RHSvec[1];
990 mat_dx(2,0) = RHSvec[2];
991 mat_dy(0,1) = RHSvec[0];
992 mat_dy(1,1) = RHSvec[1];
993 mat_dy(2,1) = RHSvec[2];
994 mat_dz(0,2) = RHSvec[0];
995 mat_dz(1,2) = RHSvec[1];
996 mat_dz(2,2) = RHSvec[2];
998 double det_matdx =
Det3x3(mat_dx);
999 double det_matdy =
Det3x3(mat_dy);
1000 double det_matdz =
Det3x3(mat_dz);
1002 a = det_matdx/det_matsys;
1003 b = det_matdy/det_matsys;
1004 c = det_matdz/det_matsys;
1009 void AddTermsToSys(
double& kappaN_ij,
double& kappa_H,
double& alfa,
double& beta,
int& num_neighbs,
1010 boost::numeric::ublas::bounded_matrix<double, 2, 2>& LHSmat,
array_1d<double,2>& RHSvec,
const int& option)
1012 double weight = 1.0/num_neighbs;
1038 LHSmat(0,0) += weight*(-alfa*alfa - 2.0*alfa*beta)*(-alfa*alfa - 2.0*alfa*beta);
1039 LHSmat(0,1) += weight*beta*beta*(-alfa*alfa - 2.0*alfa*beta);
1040 LHSmat(1,0) += weight*(-alfa*alfa - 2.0*alfa*beta)*beta*beta;
1041 LHSmat(1,1) += weight*beta*beta*beta*beta;
1042 RHSvec[0] += weight*(kappaN_ij - 2.0*kappa_H*alfa*alfa)*(-alfa*alfa - 2.0*alfa*beta);
1043 RHSvec[1] += weight*(kappaN_ij - 2.0*kappa_H*alfa*alfa)*beta*beta;
1048 LHSmat(0,0) += weight*(alfa*alfa - beta*beta)*(alfa*alfa - beta*beta);
1049 LHSmat(0,1) += 2.0*weight*alfa*beta*(alfa*alfa - beta*beta);
1050 LHSmat(1,0) += weight*alfa*beta*(alfa*alfa - beta*beta);
1051 LHSmat(1,1) += 2.0*weight*alfa*alfa*beta*beta;
1052 RHSvec[0] += weight*(kappaN_ij - 2.0*kappa_H*beta*beta)*(alfa*alfa - beta*beta);
1053 RHSvec[1] += weight*(kappaN_ij - 2.0*kappa_H*beta*beta)*alfa*beta;
1066 void AddTermsToEq2(
double& kappaN_ij,
double& kappa_H,
double& alfa,
double& beta,
int& num_neighbs,
1069 double weight = 1.0/num_neighbs;
1070 terms_vec[0] += weight*(alfa*alfa - beta*beta)*(alfa*alfa - beta*beta);
1071 terms_vec[1] += weight*alfa*beta*(alfa*alfa - beta*beta);
1072 terms_vec[2] += 2.0*weight*alfa*beta*(alfa*alfa - beta*beta);
1073 terms_vec[3] += 2.0*weight*alfa*alfa*beta*beta;
1074 terms_vec[4] += weight*(2.0*kappa_H*beta*beta - kappaN_ij)*(alfa*alfa - beta*beta);
1075 terms_vec[5] += weight*weight*(2.0*kappa_H*beta*beta - kappaN_ij)*alfa*beta;
1077 terms_vec_der[0] += weight*(alfa*alfa - beta*beta)*(alfa*alfa - beta*beta);
1078 terms_vec_der[1] += weight*(alfa*alfa - beta*beta)*(alfa*alfa - beta*beta);
1079 terms_vec_der[2] += 2.0*weight*alfa*beta*(alfa*alfa - beta*beta);
1080 terms_vec_der[3] += weight*alfa*beta*(alfa*alfa - beta*beta);
1081 terms_vec_der[4] += 0.5*weight*alfa*beta*(alfa*alfa - beta*beta);
1082 terms_vec_der[5] += 3.0*weight*alfa*beta*(alfa*alfa - beta*beta);
1083 terms_vec_der[6] += 4.0*weight*alfa*alfa*beta*beta;
1084 terms_vec_der[7] += 2.0*weight*alfa*alfa*beta*beta;
1085 terms_vec_der[8] += 0.5*weight*(2.0*kappa_H*beta*beta - kappaN_ij)*(alfa*alfa - beta*beta)*(alfa*alfa - beta*beta);
1086 terms_vec_der[9] += 2.0*weight*(2.0*kappa_H*beta*beta - kappaN_ij)*alfa*beta;
1091 a = (-
B - sqrt(
B*
B - 4.0*
A*
C))/(2.0*
A);
1095 double& kappa_H,
double& kappa_G,
double& kappaN_ij)
1101 double tol = 1.0e-7;
1102 double epsi = 1.0e-10;
1103 unsigned int MaxIter = 20;
1104 bool foundsol =
false;
1105 for(
unsigned int i = 0;
i < MaxIter;
i++)
1111 fx =
func_Newton(x0,terms_vec,kappa_H,kappa_G,kappaN_ij);
1112 dfx =
dxfunc_Newton(x0,terms_vec_der,kappa_H,kappa_G,kappaN_ij);
1113 if (abs(dfx) < epsi)
1118 if(abs(
x1-x0)/abs(x0) <
tol)
1123 if (foundsol ==
false)
1130 f_x = terms_vec[0]*
x*
f_a(
x,kappa_H,kappa_G) + terms_vec[1]*2.0*(kappa_H -
x)*
x*sqrt(
f_a(
x,kappa_H,kappa_G)) +
1131 terms_vec[2]*
f_a(
x,kappa_H,kappa_G)*sqrt(
f_a(
x,kappa_H,kappa_G)) + terms_vec[3]*
f_a(
x,kappa_H,kappa_G) +
1132 terms_vec[4]*sqrt(
f_a(
x,kappa_H,kappa_G)) + terms_vec[5]*2.0*(kappa_H -
a);
1139 df_x = tvder[0]*
f_a(
x,kappa_H,kappa_G) + tvder[1]*
x*
df_a(
x,kappa_H) - tvder[2]*
x*sqrt(
f_a(
x,kappa_H,kappa_G)) +
1140 tvder[3]*2.0*(kappa_H -
x)*sqrt(
f_a(
x,kappa_H,kappa_G)) +
1141 tvder[4]*2.0*(kappa_H -
x)*
x*0.5*
df_a(
x,kappa_H)/sqrt(
f_a(
x,kappa_H,kappa_G)) +
1142 tvder[5]*
df_a(
x,kappa_H)*sqrt(
f_a(
x,kappa_H,kappa_G)) + tvder[6]*
f_a(
x,kappa_H,kappa_G) +
1143 tvder[7]*2.0*(kappa_H -
x)*
df_a(
x,kappa_H) + tvder[8]*sqrt(
f_a(
x,kappa_H,kappa_G))*
df_a(
x,kappa_H) - tvder[9];
1147 double f_a(
double&
x,
double& kappa_H,
double& kappa_G)
1149 return (
x*(2.0*kappa_H -
x) - kappa_G);
1154 return (2.0*(kappa_H -
x));
1157 double Det2x2(boost::numeric::ublas::bounded_matrix<double, 2, 2>&
input)
1162 double Det3x3(boost::numeric::ublas::bounded_matrix<double, 3, 3>&
input)
1189 boost::numeric::ublas::bounded_matrix<double, 3, 3>&
output)
1191 for (
unsigned int i = 0;
i < 3;
i++)
1193 for (
unsigned int j = 0;
j < 3;
j++)
1201 boost::numeric::ublas::bounded_matrix<double, 2, 2>&
output)
1203 for (
unsigned int i = 0;
i < 2;
i++)
1205 for (
unsigned int j = 0;
j < 2;
j++)
1217 for (
unsigned int i = 0;
i < neighb.
size();
i++)
1219 n_vec = neighb[
i].FastGetSolutionStepValue(NORMAL);
1220 if (neighb[
i].FastGetSolutionStepValue(IS_FREE_SURFACE) != 0.0)
1223 if (theta > 2.8 || theta < -2.8)
1265 return "CalculateCurvature";
1271 rOStream <<
"CalculateCurvature";
1389 rOStream << std::endl;
Short class definition.
Definition: calculate_curvature.h:81
void FindUnitTangent3D(array_1d< double, 3 > &u_vec, array_1d< double, 3 > &n_vec)
Definition: calculate_curvature.h:869
void IsObtuse(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, bool &isobt, bool &isobt_i, double &alfa)
Definition: calculate_curvature.h:754
bool GetNeighbours(array_1d< double, 2 > n_node, GlobalPointersVector< Node > &neighb, double &x1, double &y1, double &x2, double &y2, int &i_neck, int &neighnum)
Definition: calculate_curvature.h:1212
double Angle2vecs2D(const array_1d< double, 2 > &a, const array_1d< double, 2 > &b)
Definition: calculate_curvature.h:825
void NormalizeVec2D(array_1d< double, 2 > &input)
Definition: calculate_curvature.h:1167
void SolveSys2x2(double &a, double &b, boost::numeric::ublas::bounded_matrix< double, 2, 2 > &LHSmat, array_1d< double, 2 > &RHSvec)
Definition: calculate_curvature.h:948
void CalculatePrincipalDirections3D(ModelPart &ThisModelPart)
Definition: calculate_curvature.h:537
void FindComponentsUV(double &alfa, double &beta, array_1d< double, 3 > &dij, array_1d< double, 3 > &u_vec, array_1d< double, 3 > &v_vec)
Definition: calculate_curvature.h:881
double DotProduct2D(const array_1d< double, 2 > &a, const array_1d< double, 2 > &b)
Definition: calculate_curvature.h:808
void CalculateCurvature3D(ModelPart &ThisModelPart)
Definition: calculate_curvature.h:283
void SolveEq2ndDeg(double &A, double &B, double &C, double &a)
Definition: calculate_curvature.h:1089
void AddTermsToSys(double &kappaN_ij, double &kappa_H, double &alfa, double &beta, int &num_neighbs, boost::numeric::ublas::bounded_matrix< double, 2, 2 > &LHSmat, array_1d< double, 2 > &RHSvec, const int &option)
Definition: calculate_curvature.h:1009
void NormalizeVec3D(array_1d< double, 3 > &input)
Definition: calculate_curvature.h:1177
double Det3x3(boost::numeric::ublas::bounded_matrix< double, 3, 3 > &input)
Definition: calculate_curvature.h:1162
void AddTermsToEq2(double &kappaN_ij, double &kappa_H, double &alfa, double &beta, int &num_neighbs, array_1d< double, 6 > &terms_vec, array_1d< double, 10 > &terms_vec_der)
Definition: calculate_curvature.h:1066
void SolveSys3x3(double &a, double &b, double &c, boost::numeric::ublas::bounded_matrix< double, 3, 3 > &LHSmat, array_1d< double, 3 > &RHSvec)
Definition: calculate_curvature.h:974
double Det2x2(boost::numeric::ublas::bounded_matrix< double, 2, 2 > &input)
Definition: calculate_curvature.h:1157
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: calculate_curvature.h:1269
double Angle2vecs3D(const array_1d< double, 3 > &a, const array_1d< double, 3 > &b)
Definition: calculate_curvature.h:837
void CopyMatrix2x2(boost::numeric::ublas::bounded_matrix< double, 2, 2 > &input, boost::numeric::ublas::bounded_matrix< double, 2, 2 > &output)
Definition: calculate_curvature.h:1200
CalculateCurvature()
Default constructor.
Definition: calculate_curvature.h:95
virtual std::string Info() const
Turn back information as a string.
Definition: calculate_curvature.h:1263
void NewtonMethod(array_1d< double, 6 > &terms_vec, array_1d< double, 10 > &terms_vec_der, double &a, double &kappa_H, double &kappa_G, double &kappaN_ij)
Definition: calculate_curvature.h:1094
void CrossProduct3D(const array_1d< double, 3 > &a, const array_1d< double, 3 > &b, array_1d< double, 3 > &c)
Definition: calculate_curvature.h:818
double cotan(const double &alfa)
Definition: calculate_curvature.h:851
void CopyMatrix3x3(boost::numeric::ublas::bounded_matrix< double, 3, 3 > &input, boost::numeric::ublas::bounded_matrix< double, 3, 3 > &output)
Definition: calculate_curvature.h:1188
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: calculate_curvature.h:1275
void CalculateCurvature2D(ModelPart &ThisModelPart)
Definition: calculate_curvature.h:119
double f_a(double &x, double &kappa_H, double &kappa_G)
Definition: calculate_curvature.h:1147
double Norm2D(const array_1d< double, 2 > &a)
Definition: calculate_curvature.h:798
double Norm3D(const array_1d< double, 3 > &a)
Definition: calculate_curvature.h:803
double CalculateCurv(const double x0, const double y0, const double x1, const double y1, const double x2, const double y2)
Definition: calculate_curvature.h:739
virtual ~CalculateCurvature()
Destructor.
Definition: calculate_curvature.h:100
double df_a(double &x, double &kappa_H)
Definition: calculate_curvature.h:1152
double dxfunc_Newton(double &x, array_1d< double, 10 > &tvder, double &kappa_H, double &kappa_G, double &kappaN_ij)
Definition: calculate_curvature.h:1136
void Vector2D(const double x0, const double y0, const double x1, const double y1, array_1d< double, 2 > &r01)
Definition: calculate_curvature.h:784
void CalculateCurvatureContactLine(ModelPart &ThisModelPart)
Definition: calculate_curvature.h:472
double NormalCurvature3D(const double xi, const double yi, const double zi, const double xj, const double yj, const double zj, array_1d< double, 3 > &n)
Definition: calculate_curvature.h:856
KRATOS_CLASS_POINTER_DEFINITION(CalculateCurvature)
Pointer definition of PushStructureProcess.
double DotProduct3D(const array_1d< double, 3 > &a, const array_1d< double, 3 > &b)
Definition: calculate_curvature.h:813
double CalculateVol(const double x0, const double y0, const double x1, const double y1, const double x2, const double y2)
Definition: calculate_curvature.h:734
double func_Newton(double &x, array_1d< double, 6 > &terms_vec, double &kappa_H, double &kappa_G, double &kappaN_ij)
Definition: calculate_curvature.h:1127
void Vector3D(const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, array_1d< double, 3 > &r01)
Definition: calculate_curvature.h:790
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
size_type size() const
Definition: global_pointers_vector.h:307
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
im
Definition: GenerateCN.py:100
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
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
output
Definition: generate_frictional_mortar_condition.py:444
input
Definition: generate_frictional_mortar_condition.py:435
x2
Definition: generate_frictional_mortar_condition.py:122
x1
Definition: generate_frictional_mortar_condition.py:121
int C
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:27
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
int tol
Definition: hinsberg_optimization.py:138
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int j
Definition: quadrature.py:648
n1
Definition: read_stl.py:18
float temp
Definition: rotating_cone.py:85
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
A
Definition: sensitivityMatrix.py:70
N
Definition: sensitivityMatrix.py:29
x
Definition: sensitivityMatrix.py:49
B
Definition: sensitivityMatrix.py:76
integer i
Definition: TensorModule.f:17
double precision, public pi
Definition: TensorModule.f:16
e
Definition: run_cpp_mpi_tests.py:31