8 #ifndef _GEOMETRYFUNCTIONS_H
9 #define _GEOMETRYFUNCTIONS_H
19 namespace GeometryFunctions {
25 double cang = std::cos(ang);
26 double sang = std::sin(ang);
28 new_vec[0] =
axis[0] * (
axis[0] * old_vec[0] +
axis[1] * old_vec[1] +
axis[2] * old_vec[2]) * (1 - cang) + old_vec[0] * cang + (-
axis[2] * old_vec[1] +
axis[1] * old_vec[2]) * sang;
29 new_vec[1] =
axis[1] * (
axis[0] * old_vec[0] +
axis[1] * old_vec[1] +
axis[2] * old_vec[2]) * (1 - cang) + old_vec[1] * cang + (
axis[2] * old_vec[0] -
axis[0] * old_vec[2]) * sang;
30 new_vec[2] =
axis[2] * (
axis[0] * old_vec[0] +
axis[1] * old_vec[1] +
axis[2] * old_vec[2]) * (1 - cang) + old_vec[2] * cang + (-
axis[1] * old_vec[0] +
axis[0] * old_vec[1]) * sang;
37 if (time < velocity_start_time || time > velocity_stop_time) {
38 center_position[0] = initial_center[0] + previous_displ[0];
39 center_position[1] = initial_center[1] + previous_displ[1];
40 center_position[2] = initial_center[2] + previous_displ[2];
43 if (linear_period > 0.0) {
44 double linear_omega = 2.0 *
Globals::Pi / linear_period;
45 double inv_linear_omega = 1.0 / linear_omega;
46 noalias(center_position) = initial_center + linear_velocity * std::sin(linear_omega * (
time - velocity_start_time)) * inv_linear_omega;
47 noalias(linear_velocity_changed) = linear_velocity * std::cos(linear_omega * (
time - velocity_start_time));
48 noalias(previous_displ) = center_position - initial_center;
50 center_position[0] = initial_center[0] + previous_displ[0] +
dt * linear_velocity[0];
51 center_position[1] = initial_center[1] + previous_displ[1] +
dt * linear_velocity[1];
52 center_position[2] = initial_center[2] + previous_displ[2] +
dt * linear_velocity[2];
53 previous_displ[0] +=
dt * linear_velocity[0];
54 previous_displ[1] +=
dt * linear_velocity[1];
55 previous_displ[2] +=
dt * linear_velocity[2];
56 linear_velocity_changed = linear_velocity;
61 static inline int sign(
const double a)
63 return (0.0 <
a) - (
a < 0.0);
71 static inline double min(
double a,
double b)
79 static inline double max(
double a,
double b)
90 double inv_distance = (distance > 0.0) ? 1.0 / sqrt(distance) : 0.00;
100 double inv_distance = (distance != 0.0) ? 1.0 / distance : 0.00;
110 double inv_distance = (distance != 0.0) ? 1.0 / distance : 0.00;
120 double inv_distance = (distance != 0.0) ? 1.0 / distance : 0.00;
148 static inline void VectorGlobal2Local(
const double LocalCoordSystem[3][3],
const double GlobalVector[3],
double LocalVector[3])
150 for (
int i=0;
i<3;
i++) {
151 LocalVector[
i] = 0.0;
152 for (
int j=0;
j<3;
j++) {
153 LocalVector[
i]+=LocalCoordSystem[
i][
j]*GlobalVector[
j];
160 for (
int i=0;
i<3;
i++) {
161 LocalVector[
i] = 0.0;
162 for (
int j=0;
j<3;
j++) {
163 LocalVector[
i]+=LocalCoordSystem[
i][
j]*GlobalVector[
j];
170 for (
int i=0;
i<3;
i++) {
171 LocalVector[
i] = 0.0;
172 for (
int j=0;
j<3;
j++) {
173 LocalVector[
i]+=LocalCoordSystem[
i][
j]*GlobalVector[
j];
178 static inline void VectorLocal2Global(
const double LocalCoordSystem[3][3],
const double LocalVector[3],
double GlobalVector[3])
180 for (
int i=0;
i<3;
i++) {
181 GlobalVector[
i] = 0.0;
182 for (
int j=0;
j<3;
j++) {
183 GlobalVector[
i]+=LocalCoordSystem[
j][
i]*LocalVector[
j];
190 for (
int i=0;
i<3;
i++) {
191 GlobalVector[
i] = 0.0;
192 for (
int j=0;
j<3;
j++) {
193 GlobalVector[
i]+=LocalCoordSystem[
j][
i]*LocalVector[
j];
200 for (
int i=0;
i<3;
i++) {
201 GlobalVector[
i] = 0.0;
202 for (
int j=0;
j<3;
j++) {
203 GlobalVector[
i]+=LocalCoordSystem[
j][
i]*LocalVector[
j];
210 for (
int i=0;
i<3;
i++) {
211 GlobalVector[
i] = 0.0;
212 for (
int j=0;
j<3;
j++) {
213 GlobalVector[
i]+=LocalCoordSystem[
j][
i]*LocalVector[
j];
218 static inline void ProductMatrices3X3(
const double Matrix1[3][3],
const double Matrix2[3][3],
double Matrix3[3][3])
220 for (
int i = 0;
i < 3;
i++) {
221 for (
int j = 0;
j < 3;
j++) {
223 for (
int k = 0;
k < 3;
k++) {
224 Matrix3[
i][
j] += Matrix1[
i][
k] * Matrix2[
k][
j];
232 for (
int i=0;
i<3;
i++) {
234 for (
int j=0;
j<3;
j++) {
240 static inline void TensorGlobal2Local(
const double LocalCoordSystem[3][3],
const double GlobalTensor[3][3],
double LocalTensor[3][3])
246 double TransposedLocalCoordSystem[3][3];
247 double TemporalResult[3][3];
249 TransposedLocalCoordSystem[0][0] = LocalCoordSystem[0][0]; TransposedLocalCoordSystem[0][1] = LocalCoordSystem[1][0]; TransposedLocalCoordSystem[0][2] = LocalCoordSystem[2][0];
250 TransposedLocalCoordSystem[1][0] = LocalCoordSystem[0][1]; TransposedLocalCoordSystem[1][1] = LocalCoordSystem[1][1]; TransposedLocalCoordSystem[1][2] = LocalCoordSystem[2][1];
251 TransposedLocalCoordSystem[2][0] = LocalCoordSystem[0][2]; TransposedLocalCoordSystem[2][1] = LocalCoordSystem[1][2]; TransposedLocalCoordSystem[2][2] = LocalCoordSystem[2][2];
257 static inline void TensorLocal2Global(
const double LocalCoordSystem[3][3],
const double LocalTensor[3][3],
double GlobalTensor[3][3])
263 double TransposedLocalCoordSystem[3][3];
264 double TemporalResult[3][3];
266 TransposedLocalCoordSystem[0][0] = LocalCoordSystem[0][0]; TransposedLocalCoordSystem[0][1] = LocalCoordSystem[1][0]; TransposedLocalCoordSystem[0][2] = LocalCoordSystem[2][0];
267 TransposedLocalCoordSystem[1][0] = LocalCoordSystem[0][1]; TransposedLocalCoordSystem[1][1] = LocalCoordSystem[1][1]; TransposedLocalCoordSystem[1][2] = LocalCoordSystem[2][1];
268 TransposedLocalCoordSystem[2][0] = LocalCoordSystem[0][2]; TransposedLocalCoordSystem[2][1] = LocalCoordSystem[1][2]; TransposedLocalCoordSystem[2][2] = LocalCoordSystem[2][2];
276 double RT[3][3];
double Temp[3][3];
278 RT[0][0] =
R[0][0]; RT[0][1] =
R[1][0]; RT[0][2] =
R[2][0];
279 RT[1][0] =
R[0][1]; RT[1][1] =
R[1][1]; RT[1][2] =
R[2][1];
280 RT[2][0] =
R[0][2]; RT[2][1] =
R[1][2]; RT[2][2] =
R[2][2];
288 LocalTensor[0][0] = moment_of_inertia; LocalTensor[0][1] = 0.0; LocalTensor[0][2] = 0.0;
289 LocalTensor[1][0] = 0.0; LocalTensor[1][1] = moment_of_inertia; LocalTensor[1][2] = 0.0;
290 LocalTensor[2][0] = 0.0; LocalTensor[2][1] = 0.0; LocalTensor[2][2] = moment_of_inertia;
295 double moment_of_inertia_inv = 1/moment_of_inertia;
296 LocalTensorInv[0][0] = moment_of_inertia_inv; LocalTensorInv[0][1] = 0.0; LocalTensorInv[0][2] = 0.0;
297 LocalTensorInv[1][0] = 0.0; LocalTensorInv[1][1] = moment_of_inertia_inv; LocalTensorInv[1][2] = 0.0;
298 LocalTensorInv[2][0] = 0.0; LocalTensorInv[2][1] = 0.0; LocalTensorInv[2][2] = moment_of_inertia_inv;
303 LocalTensor[0][0] = moments_of_inertia[0]; LocalTensor[0][1] = 0.0; LocalTensor[0][2] = 0.0;
304 LocalTensor[1][0] = 0.0; LocalTensor[1][1] = moments_of_inertia[1]; LocalTensor[1][2] = 0.0;
305 LocalTensor[2][0] = 0.0; LocalTensor[2][1] = 0.0; LocalTensor[2][2] = moments_of_inertia[2];
310 LocalTensorInv[0][0] = 1/moments_of_inertia[0]; LocalTensorInv[0][1] = 0.0; LocalTensorInv[0][2] = 0.0;
311 LocalTensorInv[1][0] = 0.0; LocalTensorInv[1][1] = 1/moments_of_inertia[1]; LocalTensorInv[1][2] = 0.0;
312 LocalTensorInv[2][0] = 0.0; LocalTensorInv[2][1] = 0.0; LocalTensorInv[2][2] = 1/moments_of_inertia[2];
315 static inline double DotProduct(
double Vector1[3],
double Vector2[3])
317 return Vector1[0] * Vector2[0] + Vector1[1] * Vector2[1] + Vector1[2] * Vector2[2];
322 return Vector1[0] * Vector2[0] + Vector1[1] * Vector2[1] + Vector1[2] * Vector2[2];
325 static inline void CrossProduct(
const double u[3],
const double v[3],
double ReturnVector[3])
327 ReturnVector[0] =
u[1]*
v[2] -
u[2]*
v[1];
328 ReturnVector[1] =
v[0]*
u[2] -
u[0]*
v[2];
329 ReturnVector[2] =
u[0]*
v[1] -
u[1]*
v[0];
334 ReturnVector[0] =
u[1]*
v[2] -
u[2]*
v[1];
335 ReturnVector[1] =
v[0]*
u[2] -
u[0]*
v[2];
336 ReturnVector[2] =
u[0]*
v[1] -
u[1]*
v[0];
341 ReturnVector[0] =
u[1]*
v[2] -
u[2]*
v[1];
342 ReturnVector[1] =
v[0]*
u[2] -
u[0]*
v[2];
343 ReturnVector[2] =
u[0]*
v[1] -
u[1]*
v[0];
348 ReturnVector[0] =
u[1]*
v[2] -
u[2]*
v[1];
349 ReturnVector[1] =
v[0]*
u[2] -
u[0]*
v[2];
350 ReturnVector[2] =
u[0]*
v[1] -
u[1]*
v[0];
355 ReturnVector[0] =
u[1]*
v[2] -
u[2]*
v[1];
356 ReturnVector[1] =
v[0]*
u[2] -
u[0]*
v[2];
357 ReturnVector[2] =
u[0]*
v[1] -
u[1]*
v[0];
362 ReturnVector[0] =
u[1]*
v[2] -
u[2]*
v[1];
363 ReturnVector[1] =
v[0]*
u[2] -
u[0]*
v[2];
364 ReturnVector[2] =
u[0]*
v[1] -
u[1]*
v[0];
378 static inline void RotateGridOfNodes(
const double time,
const double angular_velocity_start_time,
const double angular_velocity_stop_time,
379 array_1d<double, 3>& angular_velocity_changed,
const double angular_period,
const double mod_angular_velocity,
385 double sign_angle = 1.0;
388 if (
time < angular_velocity_start_time) angular_velocity_changed =
ZeroVector(3);
390 else if (((
time - angular_velocity_start_time) > 0.0) && ((
time - angular_velocity_stop_time) < 0.0)) {
392 if (angular_period > 0.0) {
393 double angular_omega = 2.0 *
Globals::Pi / angular_period;
394 double inv_angular_omega = 1.0 / angular_omega;
395 noalias(angle) = angular_velocity * std::sin(angular_omega * (
time - angular_velocity_start_time)) * inv_angular_omega;
396 sign_angle = std::sin(angular_omega * (
time - angular_velocity_start_time)) / fabs(sin(angular_omega * (
time - angular_velocity_start_time)));
397 noalias(angular_velocity_changed) = angular_velocity * std::cos(angular_omega * (
time - angular_velocity_start_time));
400 noalias(angle) = angular_velocity * (
time - angular_velocity_start_time);
401 noalias(angular_velocity_changed) = angular_velocity;
406 if (angular_period > 0.0) {
407 double angular_omega = 2.0 *
Globals::Pi / angular_period;
408 double inv_angular_omega = 1.0 / angular_omega;
409 noalias(angle) = angular_velocity * std::sin(angular_omega * (angular_velocity_stop_time - angular_velocity_start_time)) * inv_angular_omega;
411 noalias(angle) = angular_velocity * (angular_velocity_stop_time - angular_velocity_start_time);
429 if (mod_angular_velocity > 0.0) {
433 noalias(rotation_axis) = angular_velocity / mod_angular_velocity;
454 if (mod_angular_velocity > std::numeric_limits<double>::epsilon() ||
MathUtils<double>::Norm3(linear_velocity) > std::numeric_limits<double>::epsilon()) {
456 #pragma omp parallel for
457 for (
int k = 0;
k < (
int)pNodes.size();
k++) {
464 noalias(local_coordinates) =
node->GetInitialPosition().Coordinates() - initial_center;
465 noalias(relative_position) = new_axes1 * local_coordinates[0] + new_axes2 * local_coordinates[1] + new_axes3 * local_coordinates[2];
471 CrossProduct(angular_velocity_changed, relative_position, velocity_due_to_rotation);
472 noalias(
velocity) = linear_velocity_changed + velocity_due_to_rotation;
476 noalias(
node->Coordinates()) = center_position + relative_position;
478 noalias(
node->FastGetSolutionStepValue(DISPLACEMENT)) =
node->Coordinates() -
node->GetInitialPosition().Coordinates();
479 noalias(
node->FastGetSolutionStepValue(DELTA_DISPLACEMENT)) =
node->Coordinates() - old_coordinates;
481 (
node->FastGetSolutionStepValue(DISPLACEMENT)).clear();
492 double inv_distance = (distance != 0.0) ? 1.0 / distance : 0.0;
493 NormalDirection[0] *= inv_distance;
494 NormalDirection[1] *= inv_distance;
495 NormalDirection[2] *= inv_distance;
497 N_fast[0] = NormalDirection[0];
498 N_fast[1] = NormalDirection[1];
499 N_fast[2] = NormalDirection[2];
501 if (fabs(N_fast[0]) >= 0.577)
503 LocalCoordSystem[0][0] = - N_fast[1];
504 LocalCoordSystem[0][1] = N_fast[0];
505 LocalCoordSystem[0][2] = 0.0;
507 else if (fabs(N_fast[1]) >= 0.577)
509 LocalCoordSystem[0][0] = 0.0;
510 LocalCoordSystem[0][1] = - N_fast[2];
511 LocalCoordSystem[0][2] = N_fast[1];
515 LocalCoordSystem[0][0] = N_fast[2];
516 LocalCoordSystem[0][1] = 0.0;
517 LocalCoordSystem[0][2] = - N_fast[0];
522 double inv_distance0 = (distance0 != 0.0) ? 1.0 / distance0 : 0.0;
523 LocalCoordSystem[0][0] = LocalCoordSystem[0][0] * inv_distance0;
524 LocalCoordSystem[0][1] = LocalCoordSystem[0][1] * inv_distance0;
525 LocalCoordSystem[0][2] = LocalCoordSystem[0][2] * inv_distance0;
528 LocalCoordSystem[1][0] = N_fast[1] * LocalCoordSystem[0][2] - N_fast[2] * LocalCoordSystem[0][1];
529 LocalCoordSystem[1][1] = N_fast[2] * LocalCoordSystem[0][0] - N_fast[0] * LocalCoordSystem[0][2];
530 LocalCoordSystem[1][2] = N_fast[0] * LocalCoordSystem[0][1] - N_fast[1] * LocalCoordSystem[0][0];
534 LocalCoordSystem[2][0] = N_fast[0];
535 LocalCoordSystem[2][1] = N_fast[1];
536 LocalCoordSystem[2][2] = N_fast[2];
541 double dx = coord1[0] - coord2[0];
542 double dy = coord1[1] - coord2[1];
543 double dz = coord1[2] - coord2[2];
545 return sqrt(dx * dx + dy * dy + dz * dz);
550 double dx = coord1[0] - coord2[0];
551 double dy = coord1[1] - coord2[1];
552 double dz = coord1[2] - coord2[2];
554 return sqrt(dx * dx + dy * dy + dz * dz);
559 double dx = coord1[0] - coord2[0];
560 double dy = coord1[1] - coord2[1];
561 double dz = coord1[2] - coord2[2];
563 return (dx * dx + dy * dy + dz * dz);
568 double dx = coord1[0] - coord2[0];
569 double dy = coord1[1] - coord2[1];
570 double dz = coord1[2] - coord2[2];
572 return (dx * dx + dy * dy + dz * dz);
576 double Vector1[3] = {0.0};
578 for (
unsigned int i = 0;
i<3;
i++)
580 Vector1[
i] = TestCoord[
i]- CoordInPlane[
i];
588 static inline void CoordProjectionOnPlane(
double CoordOut[3],
double CoordIn[3],
double LocalCoordSystem[3][3],
double IntersectionCoord[3])
590 double out_coord_local[3] = {0.0};
591 double in_coord_local[3] = {0.0};
596 double vector1[3] = {0.0};
597 vector1[0] = out_coord_local[0];
598 vector1[1] = out_coord_local[1];
599 vector1[2] = in_coord_local [2];
607 double out_coord_local[3] = {0.0};
608 double in_coord_local[3] = {0.0};
613 double vector1[3] = {0.0};
614 vector1[0] = out_coord_local[0];
615 vector1[1] = out_coord_local[1];
616 vector1[2] = in_coord_local [2];
623 double LocalCoordSystem[3][3],
double& normal_flag)
628 double Vector1[3] = {0.0};
629 double Vector2[3] = {0.0};
631 double Normal[3] = {0.0};
633 Vector1[0] = FaceCoord2[0] - FaceCoord1[0];
634 Vector1[1] = FaceCoord2[1] - FaceCoord1[1];
635 Vector1[2] = FaceCoord2[2] - FaceCoord1[2];
637 Vector2[0] = FaceCoord3[0] - FaceCoord2[0];
638 Vector2[1] = FaceCoord3[1] - FaceCoord2[1];
639 Vector2[2] = FaceCoord3[2] - FaceCoord2[2];
648 Vector3[0] = ParticleCoord[0] - FaceCoord1[0];
649 Vector3[1] = ParticleCoord[1] - FaceCoord1[1];
650 Vector3[2] = ParticleCoord[2] - FaceCoord1[2];
656 for (
int ia = 0; ia < 3; ia++)
659 LocalCoordSystem[0][ia] = Vector1[ia];
660 LocalCoordSystem[1][ia] = Vector2[ia];
661 LocalCoordSystem[2][ia] = Normal [ia];
666 for (
int ia = 0; ia < 3; ia++)
669 LocalCoordSystem[0][ia] = -Vector1[ia];
670 LocalCoordSystem[1][ia] = -Vector2[ia];
671 LocalCoordSystem[2][ia] = -Normal [ia];
678 double LocalCoordSystem[3][3],
double& normal_flag){
683 double Vector1[3] = {0.0};
684 double Vector2[3] = {0.0};
686 double Normal[3] = {0.0};
688 Vector1[0] = FaceCoord2[0] - FaceCoord1[0];
689 Vector1[1] = FaceCoord2[1] - FaceCoord1[1];
690 Vector1[2] = FaceCoord2[2] - FaceCoord1[2];
692 Vector2[0] = FaceCoord3[0] - FaceCoord2[0];
693 Vector2[1] = FaceCoord3[1] - FaceCoord2[1];
694 Vector2[2] = FaceCoord3[2] - FaceCoord2[2];
703 Vector3[0] = ParticleCoord[0] - FaceCoord1[0];
704 Vector3[1] = ParticleCoord[1] - FaceCoord1[1];
705 Vector3[2] = ParticleCoord[2] - FaceCoord1[2];
710 for (
int ia = 0; ia < 3; ia++)
713 LocalCoordSystem[0][ia] = Vector1[ia];
714 LocalCoordSystem[1][ia] = Vector2[ia];
715 LocalCoordSystem[2][ia] = Normal [ia];
720 for (
int ia = 0; ia < 3; ia++)
723 LocalCoordSystem[0][ia] = -Vector1[ia];
724 LocalCoordSystem[1][ia] = -Vector2[ia];
725 LocalCoordSystem[2][ia] = -Normal [ia];
737 const double O = RotationAngle;
738 double x = TargetPoint[0],
a = CentrePoint[0],
u = LineVector[0];
739 double y = TargetPoint[1],
b = CentrePoint[1],
v = LineVector[1];
740 double z = TargetPoint[2],
c = CentrePoint[2],
w = LineVector[2];
748 const double inv_L = 1.0 /
L;
761 Q.RotateVector3(LocalVector, GlobalVector);
774 LocalTensorC1[0] = LocalTensor[0][0]; LocalTensorC2[0] = LocalTensor[0][1]; LocalTensorC3[0] = LocalTensor[0][2];
775 LocalTensorC1[1] = LocalTensor[1][0]; LocalTensorC2[1] = LocalTensor[1][1]; LocalTensorC3[1] = LocalTensor[1][2];
776 LocalTensorC1[2] = LocalTensor[2][0]; LocalTensorC2[2] = LocalTensor[2][1]; LocalTensorC3[2] = LocalTensor[2][2];
781 Q.RotateVector3(LocalTensorC1, TempTensorC1);
782 Q.RotateVector3(LocalTensorC2, TempTensorC2);
783 Q.RotateVector3(LocalTensorC3, TempTensorC3);
785 TempTensorTraspC1[0] = TempTensorC1[0]; TempTensorTraspC2[0] = TempTensorC1[1]; TempTensorTraspC3[0] = TempTensorC1[2];
786 TempTensorTraspC1[1] = TempTensorC2[0]; TempTensorTraspC2[1] = TempTensorC2[1]; TempTensorTraspC3[1] = TempTensorC2[2];
787 TempTensorTraspC1[2] = TempTensorC3[0]; TempTensorTraspC2[2] = TempTensorC3[1]; TempTensorTraspC3[2] = TempTensorC3[2];
791 Q.RotateVector3(TempTensorTraspC1, GlobalTensorTraspC1);
792 Q.RotateVector3(TempTensorTraspC2, GlobalTensorTraspC2);
793 Q.RotateVector3(TempTensorTraspC3, GlobalTensorTraspC3);
795 GlobalTensor[0][0] = GlobalTensorTraspC1[0]; GlobalTensor[0][1] = GlobalTensorTraspC1[1]; GlobalTensor[0][2] = GlobalTensorTraspC1[2];
796 GlobalTensor[1][0] = GlobalTensorTraspC2[0]; GlobalTensor[1][1] = GlobalTensorTraspC2[1]; GlobalTensor[1][2] = GlobalTensorTraspC2[2];
797 GlobalTensor[2][0] = GlobalTensorTraspC3[0]; GlobalTensor[2][1] = GlobalTensorTraspC3[1]; GlobalTensor[2][2] = GlobalTensorTraspC3[2];
808 const double epsilon = std::numeric_limits<double>::epsilon();
810 if (thetaMag * thetaMag * thetaMag * thetaMag / 24.0 < epsilon) {
811 double aux = (1 - thetaMag * thetaMag / 6);
812 DeltaOrientation =
Quaternion<double>((1 + thetaMag * thetaMag / 2), theta[0]*aux, theta[1]*aux, theta[2]*aux);
816 double aux = std::sin(thetaMag)/thetaMag;
817 DeltaOrientation =
Quaternion<double>(cos(thetaMag), theta[0]*aux, theta[1]*aux, theta[2]*aux);
820 Orientation = DeltaOrientation * Orientation;
832 const double epsilon = std::numeric_limits<double>::epsilon();
834 if (thetaMag * thetaMag * thetaMag * thetaMag / 24.0 < epsilon) {
835 double aux = (1 - thetaMag * thetaMag / 6);
836 DeltaOrientation =
Quaternion<double>((1 + thetaMag * thetaMag * 0.5), theta[0]*aux, theta[1]*aux, theta[2]*aux);
840 double aux = std::sin(thetaMag)/thetaMag;
841 DeltaOrientation =
Quaternion<double>(cos(thetaMag), theta[0]*aux, theta[1]*aux, theta[2]*aux);
844 Orientation = DeltaOrientation * Orientation;
855 const double epsilon = std::numeric_limits<double>::epsilon();
857 if (thetaMag * thetaMag * thetaMag * thetaMag / 24.0 < epsilon) {
858 double aux = (1 - thetaMag * thetaMag / 6);
859 DeltaOrientation =
Quaternion<double>((1 + thetaMag * thetaMag * 0.5), theta[0]*aux, theta[1]*aux, theta[2]*aux);
863 double aux = std::sin(thetaMag)/thetaMag;
864 DeltaOrientation =
Quaternion<double>(cos(thetaMag), theta[0]*aux, theta[1]*aux, theta[2]*aux);
867 NewOrientation = DeltaOrientation * Orientation;
879 const double epsilon = std::numeric_limits<double>::epsilon();
881 if (thetaMag * thetaMag * thetaMag * thetaMag / 24.0 < epsilon) {
882 double aux = (1 - thetaMag * thetaMag / 6);
883 Orientation =
Quaternion<double>((1 + thetaMag * thetaMag / 2), theta[0]*aux, theta[1]*aux, theta[2]*aux);
887 double aux = std::sin(thetaMag)/thetaMag;
888 Orientation =
Quaternion<double>(cos(thetaMag), theta[0]*aux, theta[1]*aux, theta[2]*aux);
900 const double epsilon = std::numeric_limits<double>::epsilon();
902 if (thetaMag * thetaMag * thetaMag * thetaMag / 24.0 < epsilon) {
903 double aux = (1 - thetaMag * thetaMag / 6);
904 DeltaOrientation =
Quaternion<double>((1 + thetaMag * thetaMag / 2), theta[0]*aux, theta[1]*aux, theta[2]*aux);
908 double aux = std::sin(thetaMag)/thetaMag;
909 DeltaOrientation =
Quaternion<double>(cos(thetaMag), theta[0]*aux, theta[1]*aux, theta[2]*aux);
941 double x_axis[3] = {0.0};
942 double y_axis[3] = {0.0};
943 double z_axis[3] = {0.0};
945 x_axis[0] = OLdCoordSystem[0][0];
946 x_axis[1] = OLdCoordSystem[0][1];
947 x_axis[2] = OLdCoordSystem[0][2];
948 y_axis[0] = OLdCoordSystem[1][0];
949 y_axis[1] = OLdCoordSystem[1][1];
950 y_axis[2] = OLdCoordSystem[1][2];
951 z_axis[0] = OLdCoordSystem[2][0];
952 z_axis[1] = OLdCoordSystem[2][1];
953 z_axis[2] = OLdCoordSystem[2][2];
957 double rotation_matrix[3][3];
958 rotation_matrix[2][0] =
Vector[0];
959 rotation_matrix[2][1] =
Vector[1];
960 rotation_matrix[2][2] =
Vector[2];
961 CrossProduct(rotation_matrix[2], y_axis, rotation_matrix[0]);
963 CrossProduct(rotation_matrix[2], rotation_matrix[0], rotation_matrix[1]);
965 NewCoordSystem[0][0] = rotation_matrix[0][0] * x_axis[0] + rotation_matrix[0][1] * y_axis[0] + rotation_matrix[0][2] * z_axis[0];
966 NewCoordSystem[0][1] = rotation_matrix[0][0] * x_axis[1] + rotation_matrix[0][1] * y_axis[1] + rotation_matrix[0][2] * z_axis[1];
967 NewCoordSystem[0][2] = rotation_matrix[0][0] * x_axis[2] + rotation_matrix[0][1] * y_axis[2] + rotation_matrix[0][2] * z_axis[2];
968 NewCoordSystem[1][0] = rotation_matrix[2][0];
969 NewCoordSystem[1][1] = rotation_matrix[2][1];
970 NewCoordSystem[1][2] = rotation_matrix[2][2];
971 NewCoordSystem[2][0] = rotation_matrix[1][0] * x_axis[0] + rotation_matrix[1][1] * y_axis[0] + rotation_matrix[1][2] * z_axis[0];
972 NewCoordSystem[2][1] = rotation_matrix[1][0] * x_axis[1] + rotation_matrix[1][1] * y_axis[1] + rotation_matrix[1][2] * z_axis[1];
973 NewCoordSystem[2][2] = rotation_matrix[1][0] * x_axis[2] + rotation_matrix[1][1] * y_axis[2] + rotation_matrix[1][2] * z_axis[2];
987 b[0] = Coord2[0] - coor[0];
988 b[1] = Coord2[1] - coor[1];
989 b[2] = Coord2[2] - coor[2];
990 p1[0] = JudgeCoord[0] - coor[0];
991 p1[1] = JudgeCoord[1] - coor[1];
992 p1[2] = JudgeCoord[2] - coor[2];
1013 noalias(b_a) = Coord2 - Coord1;
1014 noalias(p1_a) = JudgeCoord - Coord1;
1029 unsigned int facet_size = Area.size();
1030 if (facet_size == 3)
1032 const double total_area = Area[0]+Area[1]+Area[2];
1033 const double inv_total_area = 1.0 / total_area;
1034 for (
unsigned int i = 0;
i< 3;
i++)
1036 Weight[
i] = Area[(
i+1)%facet_size] * inv_total_area;
1039 else if (facet_size == 4)
1041 const double total_discriminant = Area[0]*Area[1]+Area[1]*Area[2]+Area[2]*Area[3]+Area[3]*Area[0];
1042 const double inv_total_discriminant = 1.0 / total_discriminant;
1043 for (
unsigned int i = 0;
i< 4;
i++)
1045 Weight[
i] = (Area[(
i+1)%facet_size]*Area[(
i+2)%facet_size]) * inv_total_discriminant;
1049 KRATOS_WATCH(
"WEIGHTS FOR N-SIZE POLYGONAL FE TO BE IMPLEMENTED")
1059 for (
unsigned int i = 0;
i < 3;
i++){
1061 PC[
i] = Coord[1][
i];
1065 for (
unsigned int i = 0;
i < 3;
i++){
1066 A[
i] =
A[
i] - PC[
i];
1067 B[
i] =
B[
i] - PC[
i];
1068 PC[
i] = Particle_Coord[
i] - PC[
i];
1077 double normal_flag = 1.0;
1089 for (
unsigned int i = 0;
i < 3;
i++){
1090 DistPToB += normal_flag * N_fast[
i] * PC[
i];
1093 if (DistPToB < rad){
1097 for (
unsigned int i = 0;
i < 3;
i++){
1098 IntersectionCoord[
i] = Particle_Coord[
i] - DistPToB * normal_flag * N_fast[
i];
1102 int facet_size = Coord.size();
1104 for (
int i = 0;
i < facet_size;
i++) {
1105 double this_area = 0.0;
1107 if (
InsideOutside(Coord[
i], Coord[(
i+1)%facet_size], IntersectionCoord,
N, this_area) ==
false){
1108 current_edge_index =
i;
1119 double LocalCoordSystem[3][3],
double& DistPToB, std::vector<double>& Weight,
unsigned int& current_edge_index,
bool& inside)
1121 int facet_size = Coord.
size();
1129 for (
unsigned int i = 0;
i<3;
i++)
1131 A[
i] = Coord[2].Coordinates()[
i]-Coord[1].Coordinates()[
i];
1132 B[
i] = Coord[0].Coordinates()[
i]-Coord[1].Coordinates()[
i];
1133 PC[
i] = Particle_Coord[
i]-Coord[1].Coordinates()[
i];
1136 N[0] =
A[1]*
B[2] -
A[2]*
B[1];
1137 N[1] =
A[2]*
B[0] -
A[0]*
B[2];
1138 N[2] =
A[0]*
B[1] -
A[1]*
B[0];
1141 double normal_flag = 1.0;
1145 normal_flag = - 1.0;
1156 for (
unsigned int i = 0;
i<3;
i++)
1158 DistPToB +=
N[
i]*PC[
i];
1164 for (
unsigned int i = 0;
i<3;
i++)
1166 IntersectionCoord[
i] = Particle_Coord[
i] - DistPToB*
N[
i];
1169 std::vector<double> Area;
1170 Area.resize(facet_size);
1172 for (
int i = 0;
i<facet_size;
i++)
1174 double this_area = 0.0;
1176 Coord[(
i+1)%facet_size],
1179 this_area) ==
false)
1181 current_edge_index =
i;
1188 Area[
i] = this_area;
1195 double auxiliar_unit_vector[3];
1199 for (
unsigned int j = 0;
j<3;
j++)
1201 LocalCoordSystem[0][
j] =
A[
j];
1202 LocalCoordSystem[1][
j] = auxiliar_unit_vector[
j];
1203 LocalCoordSystem[2][
j] =
N[
j];
1217 double IntersectionCoordEdge[3];
1218 double normal_unit_vector[3];
1219 double edge_unit_vector[3];
1220 double module_edge_vector = 0.0;
1221 double particle_vector1[3];
1222 double particle_vector2[3];
1224 for (
unsigned int j = 0;
j<3;
j++)
1226 edge_unit_vector[
j] = Coord2[
j] - Coord1[
j];
1227 particle_vector1[
j] = Particle_Coord[
j] - Coord1[
j];
1228 particle_vector2[
j] = Particle_Coord[
j] - Coord2[
j];
1231 normalize( edge_unit_vector, module_edge_vector);
1232 double projection_on_edge =
DotProduct(particle_vector1,edge_unit_vector);
1234 double eta = projection_on_edge/module_edge_vector;
1236 if ((eta>=0.0) && (eta<=1.0))
1238 for (
unsigned int j = 0;
j<3;
j++)
1240 IntersectionCoordEdge[
j] = Coord1[
j] + projection_on_edge*edge_unit_vector[
j];
1241 normal_unit_vector[
j] = Particle_Coord[
j] - IntersectionCoordEdge[
j];
1244 double DistParticleToEdge;
1245 normalize( normal_unit_vector, DistParticleToEdge);
1247 if (DistParticleToEdge < Radius)
1255 double dist_to_vertex_sq = 0.0;
1256 double Rad_sq = Radius*Radius;
1258 for (
unsigned int j = 0;
j<3;
j++)
1260 dist_to_vertex_sq +=particle_vector1[
j]*particle_vector1[
j];
1263 if (dist_to_vertex_sq < Rad_sq)
1271 double dist_to_vertex_sq = 0.0;
1272 double Rad_sq = Radius*Radius;
1273 for (
unsigned int j = 0;
j<3;
j++)
1275 dist_to_vertex_sq +=particle_vector2[
j]*particle_vector2[
j];
1278 if (dist_to_vertex_sq < Rad_sq)
1289 double LocalCoordSystem[3][3],
double& DistParticleToEdge,
double& eta)
1291 double IntersectionCoordEdge[3];
1292 double normal_unit_vector[3];
1293 double edge_unit_vector[3];
1294 double module_edge_vector = 0.0;
1295 double particle_vector[3];
1297 for (
unsigned int j = 0;
j<3;
j++)
1299 edge_unit_vector[
j] = Coord2[
j] - Coord1[
j];
1300 particle_vector[
j] = Particle_Coord[
j] - Coord1[
j];
1303 normalize(edge_unit_vector, module_edge_vector);
1304 double projection_on_edge =
DotProduct(particle_vector,edge_unit_vector);
1306 for (
unsigned int j = 0;
j<3;
j++)
1308 IntersectionCoordEdge[
j] = Coord1[
j] + projection_on_edge*edge_unit_vector[
j];
1309 normal_unit_vector[
j] = Particle_Coord[
j] - IntersectionCoordEdge[
j];
1312 normalize( normal_unit_vector, DistParticleToEdge);
1314 eta = projection_on_edge / module_edge_vector;
1316 if (DistParticleToEdge < Radius)
1318 if ((eta>=0.0) && (eta<=1.0))
1320 double dummy_length = 0.0;
1321 double auxiliar_unit_vector[3];
1322 CrossProduct(normal_unit_vector,edge_unit_vector,auxiliar_unit_vector);
1323 normalize(auxiliar_unit_vector, dummy_length);
1325 for (
unsigned int j = 0;
j<3;
j++)
1327 LocalCoordSystem[0][
j] = edge_unit_vector[
j];
1328 LocalCoordSystem[1][
j] = auxiliar_unit_vector[
j];
1329 LocalCoordSystem[2][
j] = normal_unit_vector[
j];
1342 double dist_sq = 0.0;
1344 for (
unsigned int j = 0;
j < 3;
j++)
1346 normal_v[
j] = Particle_Coord[
j] - Coord[
j];
1347 dist_sq += normal_v[
j] * normal_v[
j];
1349 if (dist_sq <= Radius * Radius)
1351 DistParticleToVertex = sqrt(dist_sq);
1361 double dist_sq = 0.0;
1363 for (
unsigned int j = 0;
j < 3;
j++)
1365 normal_v[
j] = Particle_Coord[
j] - Coord[
j];
1366 dist_sq += normal_v[
j] * normal_v[
j];
1368 if (dist_sq <= Radius * Radius)
return true;
1551 double cosA=cos(EulerAngles[0]);
1552 double sinA=sin(EulerAngles[0]);
1553 double cosB=cos(EulerAngles[1]);
1554 double sinB=sin(EulerAngles[1]);
1555 double cosC=cos(EulerAngles[2]);
1556 double sinC=sin(EulerAngles[2]);
1558 rotation_matrix[0][0] = cosC*cosA - cosB*sinA*sinC;
1559 rotation_matrix[0][1] = -sinC*cosA - cosB*sinA*cosC;
1560 rotation_matrix[0][2] = sinB*sinA;
1561 rotation_matrix[1][0] = cosC*sinA + cosB*cosA*sinC;
1562 rotation_matrix[1][1] = -sinC*sinA + cosB*cosA*cosC;
1563 rotation_matrix[1][2] = -sinB*cosA;
1564 rotation_matrix[2][0] = sinC*sinB;
1565 rotation_matrix[2][1] = cosC*sinB;
1566 rotation_matrix[2][2] = cosB;
1573 if (rotation_matrix[2][2] < 1.0)
1575 if (rotation_matrix[2][2] > -1.0) {
1576 EulerAngles[0] = atan2(rotation_matrix[0][2], -rotation_matrix[1][2]);
1577 EulerAngles[1] = acos(rotation_matrix[2][2]);
1578 EulerAngles[2] = atan2(rotation_matrix[2][0], rotation_matrix[2][1]);
1583 EulerAngles[0] = -atan2(-rotation_matrix[0][1], rotation_matrix[0][0]);
1591 EulerAngles[0] = atan2(-rotation_matrix[0][1], rotation_matrix[0][0]);
1600 const double numerical_limit = std::numeric_limits<double>::epsilon();
1601 const double two_pi = 3.1415926535897932384626433 * 2.0;
1602 if(rotation_matrix(2, 2)<1.0-numerical_limit && rotation_matrix(2, 2)>-1.0+numerical_limit){
1603 const double senb=sqrt(1.0-rotation_matrix(2, 2)*rotation_matrix(2, 2));
1604 EulerAngles[1]=acos(rotation_matrix(2, 2));
1605 EulerAngles[2]=acos(rotation_matrix(1, 2)/senb);
1606 if(rotation_matrix(0, 2)/senb<0.0) EulerAngles[2]=two_pi - EulerAngles[2];
1607 EulerAngles[0]=acos(-rotation_matrix(2, 1)/senb);
1608 if(rotation_matrix(2, 0)/senb<0.0) EulerAngles[0]=two_pi - EulerAngles[0];
1611 EulerAngles[1]=acos(rotation_matrix(2, 2));
1613 EulerAngles[2]=acos(rotation_matrix(0, 0));
1614 if(-rotation_matrix(1, 0)<0.0) EulerAngles[2]=two_pi - EulerAngles[2];
1628 static inline void TriAngleArea(
double Coord1[3],
double Coord2[3],
double Coord3[3],
double& area)
1631 double Vector1[3],Vector2[3],Vector0[3];
1632 for (
k = 0;
k < 3;
k++)
1634 Vector1[
k] = Coord3[
k] - Coord1[
k];
1635 Vector2[
k] = Coord2[
k] - Coord1[
k];
1643 static inline void TriAngleWeight(
double Coord1[3],
double Coord2[3],
double Coord3[3],
double JudgeCoord[3],
double Weight[3])
1652 const double s_inv = 1.0 / s;
1653 Weight[0] = area[1] * s_inv;
1654 Weight[1] = area[2] * s_inv;
1655 Weight[2] = area[0] * s_inv;
1659 static inline void QuadAngleWeight(
double Coord1[3],
double Coord2[3],
double Coord3[3],
double Coord4[3],
double JudgeCoord[3],
double Weight[4])
1661 double area[4], s1, s2, s;
1672 if (fabs(area[0] + area[1] + area[2] + area[3] - s) < 1.0e-15)
1674 double QuadNormArea = 1 / ((area[0] + area[2]) * (area[1] + area[3]));
1676 Weight[0] = (area[1] * area[2]) * QuadNormArea;
1677 Weight[1] = (area[2] * area[3]) * QuadNormArea;
1678 Weight[2] = (area[3] * area[0]) * QuadNormArea;
1679 Weight[3] = (area[0] * area[1]) * QuadNormArea;
1685 double a[3] = {0.0};
1686 double c[3] = {0.0};
1688 double norm_a = 0.0;
1690 for (
unsigned int index = 0;index<3;index++) {
1692 a[index] = P1[index]-
C[index];
1693 c[index] = P2[index]-P1[index];
1701 if (dot_product<0.0) {
1703 for (
unsigned int index = 0;index<3;index++) {
1708 dot_product = -dot_product;
1713 double cos_alpha = dot_product/norm_a;
1714 double alpha = acos(cos_alpha);
1715 double sin_alpha = std::sin(
alpha);
1717 Area = Radius*Radius*
alpha;
1718 double dist = 0.66666666666666*(Radius*sin_alpha/
alpha);
1719 for (
unsigned int index = 0;index<3;index++) {
1728 double normal_outwards[3] = {0.0};
1736 double delta_circle = Radius +
dist;
1738 if ((delta_circle > tol_Radius) && (delta_circle - 2*Radius < -tol_Radius)) {
1741 double b = sqrt(delta_circle*(2*Radius-delta_circle));
1742 AreaSC = 2.0*Radius*Radius*atan(delta_circle/
b)-
b*(Radius-delta_circle);
1746 static inline void AreaAndCentroidCircularSegment(
double Centre[3],
double Radius,
double tol_Radius,
double V0[3],
double V1[3],
double Normal[3],
double& AreaSegC,
double CoMSegC[3],
bool& flag)
1748 double V0V1[3] = {0.0};
1749 double V0CC[3] = {0.0};
1750 double a[3] = {0.0};
1751 double normal_outwards[3] = {0.0};
1752 double Radius_SQ = 0.0;
1753 double distance_V0V1 = 0.0;
1754 double dist_CoM = 0.0;
1758 for (
unsigned int index = 0; index<3; index++) {
1760 V0V1[index] = V1[index] - V0[index];
1761 V0CC[index] = Centre[index] - V0[index];
1769 if ((distV0 > 0.0) && (distV0 < distance_V0V1)) {
1773 double delta_circle = Radius + dist_normal;
1775 if ((delta_circle > tol_Radius) && ( delta_circle - 2.0*Radius < -tol_Radius)) {
1777 Radius_SQ = Radius*Radius;
1778 double semi_dist = sqrt(Radius_SQ - dist_normal*dist_normal);
1781 for (
unsigned int index = 0;index<3;index++) {
1783 a[index] = V0[index] + (distV0 - semi_dist)*V0V1[index] - Centre[index];
1787 double alpha = acos(cos_alpha);
1788 double sin_alpha = std::sin(
alpha);
1790 AreaSegC = Radius_SQ*(
alpha-sin_alpha*cos_alpha);
1792 if (fabs(sin_alpha) < tol_Radius) {dist_CoM=0.0;}
1794 else {dist_CoM = 0.6666666666666 * (Radius*sin_alpha*sin_alpha*sin_alpha/(
alpha-sin_alpha*cos_alpha));}
1796 for (
unsigned int index = 0; index<3; index++) {
1797 CoMSegC[index] = Centre[index] + dist_CoM*normal_outwards[index];
1805 static inline void AreaAndCentroidTriangle(
double Coord1[3],
double Coord2[3],
double Coord3[3],
double& area,
double CoMTri[3]) {
1809 for (
unsigned int index =0; index<3; index++) {
1811 CoMTri[index] = 0.33333333333333 * (Coord1[index]+Coord2[index]+Coord3[index]);
#define DEM_MODULUS_3(a)
Definition: DEM_application_variables.h:29
#define DEM_MULTIPLY_BY_SCALAR_3(a, b)
Definition: DEM_application_variables.h:28
#define DEM_INNER_PRODUCT_3(a, b)
Definition: DEM_application_variables.h:31
#define DEM_SET_TO_CROSS_OF_FIRST_TWO_3(a, b, c)
Definition: DEM_application_variables.h:32
#define DEM_COPY_SECOND_TO_FIRST_3(a, b)
Definition: DEM_application_variables.h:23
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
Various mathematical utilitiy functions.
Definition: math_utils.h:62
static double Norm3(const TVectorType &a)
Calculates the norm of vector "a" which is assumed to be of size 3.
Definition: math_utils.h:691
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
static Quaternion Identity()
Definition: quaternion.h:383
void normalize()
Definition: quaternion.h:179
void ToRotationMatrix(TMatrix3x3 &R) const
Definition: quaternion.h:213
void ToEulerAngles(array_1d< double, 3 > &EA) const
Definition: quaternion.h:236
void RotateVector3(const TVector3_A &a, TVector3_B &b) const
Definition: quaternion.h:325
#define KRATOS_WATCH(variable)
Definition: define.h:806
dt
Definition: DEM_benchmarks.py:173
z
Definition: GenerateWind.py:163
static void WeightsCalculation(std::vector< double > Area, std::vector< double > &Weight)
Definition: GeometryFunctions.h:1027
static void QuaternionVectorGlobal2Local(const Quaternion< double > &Q, const array_1d< double, 3 > &GlobalVector, array_1d< double, 3 > &LocalVector)
Definition: GeometryFunctions.h:764
static bool FastFacetCheck(const std::vector< array_1d< double, 3 > > &Coord, const array_1d< double, 3 > &Particle_Coord, double rad, double &DistPToB, unsigned int ¤t_edge_index)
Definition: GeometryFunctions.h:1053
static bool FastVertexCheck(const array_1d< double, 3 > &Coord, const array_1d< double, 3 > &Particle_Coord, double Radius)
Definition: GeometryFunctions.h:1359
static void RotaMatrixTensorLocal2Global(const double R[3][3], const double LocalTensor[3][3], double GlobalTensor[3][3])
Definition: GeometryFunctions.h:274
static void VectorLocal2Global(const double LocalCoordSystem[3][3], const double LocalVector[3], double GlobalVector[3])
Definition: GeometryFunctions.h:178
static void RotateRightHandedBasisAroundAxis(const array_1d< double, 3 > &e1, const array_1d< double, 3 > &e2, const array_1d< double, 3 > &axis, const double ang, array_1d< double, 3 > &new_axes1, array_1d< double, 3 > &new_axes2, array_1d< double, 3 > &new_axes3)
Definition: GeometryFunctions.h:367
static void GetGiDEulerAngles(const BoundedMatrix< double, 3, 3 > &rotation_matrix, array_1d< double, 3 > &EulerAngles)
Definition: GeometryFunctions.h:1599
static void QuaternionVectorLocal2Global(const Quaternion< double > &Q, const array_1d< double, 3 > &LocalVector, array_1d< double, 3 > &GlobalVector)
Definition: GeometryFunctions.h:759
static bool EdgeCheck(const array_1d< double, 3 > &Coord1, const array_1d< double, 3 > &Coord2, const array_1d< double, 3 > &Particle_Coord, double Radius, double LocalCoordSystem[3][3], double &DistParticleToEdge, double &eta)
Definition: GeometryFunctions.h:1288
static void ConstructInvLocalTensor(const double moment_of_inertia, double LocalTensorInv[3][3])
Definition: GeometryFunctions.h:293
static void normalize(double Vector[3])
Definition: GeometryFunctions.h:87
Geometry< Node > GeometryType
Definition: GeometryFunctions.h:21
static void RotateAVectorAGivenAngleAroundAUnitaryVector(const array_1d< double, 3 > &old_vec, const array_1d< double, 3 > &axis, const double ang, array_1d< double, 3 > &new_vec)
Definition: GeometryFunctions.h:23
static void ComputeContactLocalCoordSystem(array_1d< double, 3 > NormalDirection, const double &distance, double LocalCoordSystem[3][3])
Definition: GeometryFunctions.h:490
static void Compute3DimElementFaceLocalSystem(const array_1d< double, 3 > &FaceCoord1, const array_1d< double, 3 > &FaceCoord2, const array_1d< double, 3 > &FaceCoord3, double ParticleCoord[3], double LocalCoordSystem[3][3], double &normal_flag)
Definition: GeometryFunctions.h:622
static void module(const array_1d< double, 3 > &Vector, double &distance)
Definition: GeometryFunctions.h:127
static void EulerAnglesFromRotationAngle(array_1d< double, 3 > &EulerAngles, const array_1d< double, 3 > &RotatedAngle)
Definition: GeometryFunctions.h:870
static bool FastEdgeVertexCheck(const array_1d< double, 3 > &Coord1, const array_1d< double, 3 > &Coord2, const array_1d< double, 3 > &Particle_Coord, double Radius)
Definition: GeometryFunctions.h:1215
static void GetEulerAngles(const double rotation_matrix[3][3], array_1d< double, 3 > &EulerAngles)
Definition: GeometryFunctions.h:1571
static bool InsideOutside(const array_1d< double, 3 > &Coord1, const array_1d< double, 3 > &Coord2, const array_1d< double, 3 > &JudgeCoord, const array_1d< double, 3 > &normal_element, double &area)
Definition: GeometryFunctions.h:976
static void QuadAngleWeight(double Coord1[3], double Coord2[3], double Coord3[3], double Coord4[3], double JudgeCoord[3], double Weight[4])
Definition: GeometryFunctions.h:1659
static void TensorLocal2Global(const double LocalCoordSystem[3][3], const double LocalTensor[3][3], double GlobalTensor[3][3])
Definition: GeometryFunctions.h:257
static void AreaAndCentroidCircularSegment(double Centre[3], double Radius, double tol_Radius, double V0[3], double V1[3], double Normal[3], double &AreaSegC, double CoMSegC[3], bool &flag)
Definition: GeometryFunctions.h:1746
static void ProductMatrix3X3Vector3X1(const double Matrix[3][3], const array_1d< double, 3 > &Vector1, array_1d< double, 3 > &Vector2)
Definition: GeometryFunctions.h:230
static void TranslateGridOfNodes(const double time, const double velocity_start_time, const double velocity_stop_time, array_1d< double, 3 > ¢er_position, const array_1d< double, 3 > &initial_center, array_1d< double, 3 > &previous_displ, array_1d< double, 3 > &linear_velocity_changed, const double linear_period, const double dt, const array_1d< double, 3 > &linear_velocity)
Definition: GeometryFunctions.h:33
static void AreaAndCentroidTriangle(double Coord1[3], double Coord2[3], double Coord3[3], double &area, double CoMTri[3])
Definition: GeometryFunctions.h:1805
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static void AlternativeAreaCircularSegment(double Radius, double tol_Radius, double V0V1[3], double V0CC[3], double Normal[3], double &AreaSC, bool &flag)
Definition: GeometryFunctions.h:1725
static void CoordProjectionOnPlane(double CoordOut[3], double CoordIn[3], double LocalCoordSystem[3][3], double IntersectionCoord[3])
Definition: GeometryFunctions.h:588
static bool VertexCheck(const array_1d< double, 3 > &Coord, const array_1d< double, 3 > &Particle_Coord, double Radius, double LocalCoordSystem[3][3], double &DistParticleToVertex)
Definition: GeometryFunctions.h:1340
static void OrientationFromRotationAngle(Quaternion< double > &DeltaOrientation, const array_1d< double, 3 > &DeltaRotation)
Definition: GeometryFunctions.h:894
static bool FacetCheck(const GeometryType &Coord, const array_1d< double, 3 > &Particle_Coord, double rad, double LocalCoordSystem[3][3], double &DistPToB, std::vector< double > &Weight, unsigned int ¤t_edge_index, bool &inside)
Definition: GeometryFunctions.h:1118
static void RotatePointAboutArbitraryLine(array_1d< double, 3 > &TargetPoint, const array_1d< double, 3 > &CentrePoint, const array_1d< double, 3 > &LineVector, const double RotationAngle)
Definition: GeometryFunctions.h:735
static void RotateCoordToDirection(const double OLdCoordSystem[3][3], double Vector[3], double NewCoordSystem[3][3])
Definition: GeometryFunctions.h:939
static void GetRotationMatrix(const array_1d< double, 3 > &EulerAngles, double rotation_matrix[3][3])
Definition: GeometryFunctions.h:1549
static double DistanceOfTwoPointSquared(const array_1d< double, 3 > &coord1, const array_1d< double, 3 > &coord2)
Definition: GeometryFunctions.h:557
static void UpdateKinematicVariablesOfAGridOfNodes(double mod_angular_velocity, const array_1d< double, 3 > &linear_velocity, const array_1d< double, 3 > &initial_center, array_1d< double, 3 > &new_axes1, array_1d< double, 3 > &new_axes2, array_1d< double, 3 > &new_axes3, array_1d< double, 3 > &angular_velocity_changed, array_1d< double, 3 > &linear_velocity_changed, array_1d< double, 3 > ¢er_position, const bool fixed_mesh, const double dt, ModelPart::NodesContainerType &pNodes)
Definition: GeometryFunctions.h:448
static void ConstructLocalTensor(const double moment_of_inertia, double LocalTensor[3][3])
Definition: GeometryFunctions.h:286
void QuaternionToGiDEulerAngles(const Quaternion< double > &quaternion, array_1d< double, 3 > &EulerAngles)
Definition: GeometryFunctions.h:1618
static double DistanceOfTwoPoint(const double coord1[3], const double coord2[3])
Definition: GeometryFunctions.h:539
static void QuaternionTensorLocal2Global(const Quaternion< double > &Q, const double LocalTensor[3][3], double GlobalTensor[3][3])
Definition: GeometryFunctions.h:770
static void CrossProduct(const double u[3], const double v[3], double ReturnVector[3])
Definition: GeometryFunctions.h:325
static double DistancePointToPlane(const array_1d< double, 3 > &CoordInPlane, double PlaneUnitNormalVector[3], double TestCoord[3])
Definition: GeometryFunctions.h:574
static int sign(const double a)
Definition: GeometryFunctions.h:61
static void TensorGlobal2Local(const double LocalCoordSystem[3][3], const double GlobalTensor[3][3], double LocalTensor[3][3])
Definition: GeometryFunctions.h:240
static void ProductMatrices3X3(const double Matrix1[3][3], const double Matrix2[3][3], double Matrix3[3][3])
Definition: GeometryFunctions.h:218
static void RotateGridOfNodes(const double time, const double angular_velocity_start_time, const double angular_velocity_stop_time, array_1d< double, 3 > &angular_velocity_changed, const double angular_period, const double mod_angular_velocity, const array_1d< double, 3 > &angular_velocity, array_1d< double, 3 > &new_axes1, array_1d< double, 3 > &new_axes2, array_1d< double, 3 > &new_axes3)
Definition: GeometryFunctions.h:378
static void AreaAndCentroidCircularSector(double C[3], double Radius, double P1[3], double P2[3], double Normal[3], double &Area, double CoMSC[3])
Definition: GeometryFunctions.h:1683
static void TriAngleWeight(double Coord1[3], double Coord2[3], double Coord3[3], double JudgeCoord[3], double Weight[3])
Definition: GeometryFunctions.h:1643
static double DotProduct(double Vector1[3], double Vector2[3])
Definition: GeometryFunctions.h:315
static void CoordProjectionOnPlaneNew(double CoordOut[3], const array_1d< double, 3 > &CoordIn, double LocalCoordSystem[3][3], double IntersectionCoord[3])
Definition: GeometryFunctions.h:605
static void UpdateOrientation(array_1d< double, 3 > &EulerAngles, Quaternion< double > &Orientation, const array_1d< double, 3 > &DeltaRotation)
Definition: GeometryFunctions.h:800
static void TriAngleArea(double Coord1[3], double Coord2[3], double Coord3[3], double &area)
Definition: GeometryFunctions.h:1628
static double min(double a, double b)
Definition: GeometryFunctions.h:71
static void VectorGlobal2Local(const double LocalCoordSystem[3][3], const double GlobalVector[3], double LocalVector[3])
Definition: GeometryFunctions.h:148
constexpr double Pi
Definition: global_variables.h:25
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
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
Temp
Definition: PecletTest.py:105
float velocity
Definition: PecletTest.py:54
axis
Definition: all_t_win_vs_m_fixed_error.py:239
float dist
Definition: edgebased_PureConvection.py:89
time
Definition: face_heat.py:85
y
Other simbols definition.
Definition: generate_axisymmetric_navier_stokes_element.py:54
v
Definition: generate_convection_diffusion_explicit_element.py:114
w
Definition: generate_convection_diffusion_explicit_element.py:108
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
output
Definition: generate_frictional_mortar_condition.py:444
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
u
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:30
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
R
Definition: isotropic_damage_automatic_differentiation.py:172
tuple Q
Definition: isotropic_damage_automatic_differentiation.py:235
def bisection(f, a, b, tol)
Definition: normed_exact_hinsberg_test.py:17
int L
Definition: ode_solve.py:390
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
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
Definition: mesh_converter.cpp:38