From 2c9f92c6b8cc26742a0a1a142883031585a6b93e Mon Sep 17 00:00:00 2001 From: rukawaaaaaaa Date: Thu, 7 Mar 2024 00:34:17 +0800 Subject: [PATCH 1/3] change the small deformation to finite deformation. --- .../slender_structure_dynamics.cpp | 4 +-- .../slender_structure_dynamics.h | 10 +++--- .../solid_dynamics/slender_structure_math.cpp | 35 ++++++++++++++++++- .../solid_dynamics/slender_structure_math.h | 2 ++ 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.cpp b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.cpp index 029d17bf09..2910105d3b 100644 --- a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.cpp +++ b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.cpp @@ -244,10 +244,10 @@ void BarStressRelaxationSecondHalf::initialization(size_t index_i, Real dt) Vecd pseudo_b_n_temp = pseudo_b_n_[index_i]; pseudo_n_[index_i] = transformation_matrix_[index_i].transpose() * - getVectorAfterThinStructureRotation(local_pseudo_n_0, rotation_[index_i]); + getVectorAfterThinStructureRotation(local_pseudo_n_0, rotation_[index_i] + rotation_b_[index_i]); pseudo_b_n_[index_i] = transformation_matrix_[index_i].transpose() * - getVectorAfterThinStructureRotation(local_pseudo_b_n_0, rotation_b_[index_i]); + getVectorAfterThinStructureRotation(local_pseudo_b_n_0, rotation_[index_i] + rotation_b_[index_i]); if (dt < 1e-10) { diff --git a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.h b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.h index 266d5223e3..61b579d0b5 100644 --- a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.h +++ b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.h @@ -231,14 +231,14 @@ class BarStressRelaxationFirstHalf : public BaseBarRelaxation force_[index_i] = force * inv_rho0_ / (thickness_[index_i] * width_[index_i]); dpseudo_n_d2t_[index_i] = pseudo_normal_acceleration * inv_rho0_ * 12.0 / pow(thickness_[index_i], 4); - dpseudo_b_n_d2t_[index_i] = -pseudo_b_normal_acceleration * inv_rho0_ * 12.0 / pow(thickness_[index_i], 4); + dpseudo_b_n_d2t_[index_i] = pseudo_b_normal_acceleration * inv_rho0_ * 12.0 / pow(thickness_[index_i], 4); Vecd local_dpseudo_n_d2t = transformation_matrix_[index_i] * dpseudo_n_d2t_[index_i]; Vecd local_dpseudo_b_n_d2t = transformation_matrix_[index_i] * dpseudo_b_n_d2t_[index_i]; - dangular_b_vel_dt_[index_i] = getRotationFromPseudoNormalForSmallDeformation_b( - Vec3d(local_dpseudo_b_n_d2t), Vec3d(local_dpseudo_n_d2t), Vec3d(rotation_b_[index_i]), Vec3d(angular_b_vel_[index_i]), dt); - dangular_vel_dt_[index_i] = getRotationFromPseudoNormalForSmallDeformation( - Vec3d(local_dpseudo_b_n_d2t), Vec3d(local_dpseudo_n_d2t), Vec3d(rotation_[index_i]), Vec3d(angular_vel_[index_i]), dt); + dangular_b_vel_dt_[index_i] = getRotationFromPseudoNormalForFiniteDeformation_b( + Vec3d(local_dpseudo_b_n_d2t), Vec3d(rotation_b_[index_i]), Vec3d(angular_b_vel_[index_i]), dt); + dangular_vel_dt_[index_i] = getRotationFromPseudoNormalForFiniteDeformation( + Vec3d(local_dpseudo_n_d2t), Vec3d(rotation_[index_i]), Vec3d(angular_vel_[index_i]), dt); }; void update(size_t index_i, Real dt = 0.0); diff --git a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp index d54976c6a0..7852b8e3ae 100644 --- a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp +++ b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp @@ -70,10 +70,43 @@ Vec3d getRotationFromPseudoNormalForFiniteDeformation(const Vec3d &dpseudo_n_d2t Real angle_vel_dt_1 = rotation_1_a * rotation_1_a * (rotation_1_b1 * cos_rotation_1 + rotation_1_b2 * sin_rotation_1) / (rotation_1_b1 * rotation_1_b1 + rotation_1_b2 * rotation_1_b2 + Eps); - return Vec3d(angle_vel_dt_0, angle_vel_dt_1, 0.0); + return Vec3d(0, angle_vel_dt_1, 0.0); } //=================================================================================================// + +Vec3d getRotationFromPseudoNormalForFiniteDeformation_b(const Vec3d &dpseudo_b_n_d2t, const Vec3d &rotation_b, const Vec3d &angular_b_vel, Real dt) +{ + Real sin_rotation_b_0 = sin(rotation_b[0]); + Real cos_rotation_b_0 = cos(rotation_b[0]); + Real sin_rotation_b_2 = sin(rotation_b[2]); + Real cos_rotation_b_2 = cos(rotation_b[2]); + + Real rotation_b_0_a = (dpseudo_b_n_d2t[0] * sin_rotation_b_2 - dpseudo_b_n_d2t[1] * cos_rotation_b_2 - cos_rotation_b_0 * angular_b_vel[2] * angular_b_vel[2] - cos_rotation_b_0 * angular_b_vel[0] * angular_b_vel[0]); + + Real rotation_b_0_b = dpseudo_b_n_d2t[2] + sin_rotation_b_0 * angular_b_vel[0] * angular_b_vel[0]; + + Real angle_b_vel_dt_0 = sin_rotation_b_0 * rotation_b_0_a + cos_rotation_b_0 * rotation_b_0_b; + + Real rotation_b_c = (-dpseudo_b_n_d2t[0] * cos_rotation_b_2 - dpseudo_b_n_d2t[1] * sin_rotation_b_2 + 2 * angular_b_vel[2] * angular_b_vel[0] * sin_rotation_b_0); + + Real rotation_b_c1 = -dpseudo_b_n_d2t[0] * cos_rotation_b_0 + + angular_b_vel[2] * angular_b_vel[2] * cos_rotation_b_0 * cos_rotation_b_0 * sin_rotation_b_2 + + angular_b_vel[0] * angular_b_vel[0] * sin_rotation_b_2 + + dpseudo_b_n_d2t[2] * sin_rotation_b_0 * sin_rotation_b_2 + + 2.0 * angular_b_vel[0] * angular_b_vel[2] * cos_rotation_b_2 * cos_rotation_b_0 * sin_rotation_b_0; + + Real rotation_b_c2 = -dpseudo_b_n_d2t[1] * cos_rotation_b_0 - + angular_b_vel[2] * angular_b_vel[2] * cos_rotation_b_2 * cos_rotation_b_0 * cos_rotation_b_0 - + angular_b_vel[0] * angular_b_vel[0] * cos_rotation_b_2 - + dpseudo_b_n_d2t[2] * sin_rotation_b_0 * cos_rotation_b_2 + + 2.0 * angular_b_vel[0] * angular_b_vel[2] * sin_rotation_b_2 * sin_rotation_b_0 * cos_rotation_b_0; + + Real angle_b_vel_dt_2 = rotation_b_c * rotation_b_c * (rotation_b_c1 * cos_rotation_b_2 + rotation_b_c2 * sin_rotation_b_2) / (rotation_b_c1 * rotation_b_c1 + rotation_b_c2 * rotation_b_c2 + Eps); + return Vec3d(0, 0.0, angle_b_vel_dt_2); + +} +//=================================================================================================// Vec3d getRotationFromPseudoNormalForSmallDeformation( const Vec3d &dpseudo_b_n_d2t, const Vec3d &dpseudo_n_d2t, const Vec3d &rotation, const Vec3d &angular_vel, Real dt) { diff --git a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.h b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.h index 94c2568437..66f8eb0339 100644 --- a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.h +++ b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.h @@ -51,6 +51,8 @@ Vec3d getVectorChangeRateAfterThinStructureRotation(const Vec3d &initial_vector, /** get the rotation from pseudo-normal for finite deformation. */ Vec3d getRotationFromPseudoNormalForFiniteDeformation(const Vec3d &dpseudo_n_d2t, const Vec3d &rotation, const Vec3d &angular_vel, Real dt); +/** get the rotation from pseudo-binormal for finite deformation. */ +Vec3d getRotationFromPseudoNormalForFiniteDeformation_b(const Vec3d &dpseudo_b_n_d2t, const Vec3d &rotation_b, const Vec3d &angular_b_vel, Real dt); /** get the rotation from pseudo-normal for small deformation. */ Vec3d getRotationFromPseudoNormalForSmallDeformation(const Vec3d &dpseudo_b_n_d2t, const Vec3d &dpseudo_n_d2t, const Vec3d &rotation, const Vec3d &angular_vel, Real dt); From 1b0e0a2e1a6eaae5cdef5400b4bd6d2d3c2d8e1d Mon Sep 17 00:00:00 2001 From: rukawaaaaaaa Date: Thu, 7 Mar 2024 09:28:32 +0800 Subject: [PATCH 2/3] commit two unused variable which represent the torsion --- .../solid_dynamics/slender_structure_math.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp index 7852b8e3ae..bfd9cc18e3 100644 --- a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp +++ b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp @@ -55,7 +55,7 @@ Vec3d getRotationFromPseudoNormalForFiniteDeformation(const Vec3d &dpseudo_n_d2t Real rotation_0_a = -(dpseudo_n_d2t[2] * cos_rotation_1 + dpseudo_n_d2t[0] * sin_rotation_1 + angular_vel[1] * angular_vel[1] * cos_rotation_0 + angular_vel[0] * angular_vel[0] * cos_rotation_0); Real rotation_0_b = sin_rotation_0 * angular_vel[0] * angular_vel[0] - dpseudo_n_d2t[1]; - Real angle_vel_dt_0 = sin_rotation_0 * rotation_0_a + cos_rotation_0 * rotation_0_b; + //Real angle_vel_dt_0 = sin_rotation_0 * rotation_0_a + cos_rotation_0 * rotation_0_b; Real rotation_1_a = dpseudo_n_d2t[0] * cos_rotation_1 - dpseudo_n_d2t[2] * sin_rotation_1 + 2.0 * angular_vel[1] * angular_vel[0] * sin_rotation_0; @@ -86,7 +86,7 @@ Vec3d getRotationFromPseudoNormalForFiniteDeformation_b(const Vec3d &dpseudo_b_n Real rotation_b_0_b = dpseudo_b_n_d2t[2] + sin_rotation_b_0 * angular_b_vel[0] * angular_b_vel[0]; - Real angle_b_vel_dt_0 = sin_rotation_b_0 * rotation_b_0_a + cos_rotation_b_0 * rotation_b_0_b; + //Real angle_b_vel_dt_0 = sin_rotation_b_0 * rotation_b_0_a + cos_rotation_b_0 * rotation_b_0_b; Real rotation_b_c = (-dpseudo_b_n_d2t[0] * cos_rotation_b_2 - dpseudo_b_n_d2t[1] * sin_rotation_b_2 + 2 * angular_b_vel[2] * angular_b_vel[0] * sin_rotation_b_0); From f14a1312e76d99ecc34a7d9dc0f2059e2203f28d Mon Sep 17 00:00:00 2001 From: rukawaaaaaaa Date: Thu, 7 Mar 2024 10:57:08 +0800 Subject: [PATCH 3/3] comment out unused variable --- .../solid_dynamics/slender_structure_math.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp index bfd9cc18e3..0677160903 100644 --- a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp +++ b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_math.cpp @@ -52,11 +52,11 @@ Vec3d getRotationFromPseudoNormalForFiniteDeformation(const Vec3d &dpseudo_n_d2t Real sin_rotation_1 = sin(rotation[1]); Real cos_rotation_1 = cos(rotation[1]); - Real rotation_0_a = -(dpseudo_n_d2t[2] * cos_rotation_1 + dpseudo_n_d2t[0] * sin_rotation_1 + + /* Real rotation_0_a = -(dpseudo_n_d2t[2] * cos_rotation_1 + dpseudo_n_d2t[0] * sin_rotation_1 + angular_vel[1] * angular_vel[1] * cos_rotation_0 + angular_vel[0] * angular_vel[0] * cos_rotation_0); Real rotation_0_b = sin_rotation_0 * angular_vel[0] * angular_vel[0] - dpseudo_n_d2t[1]; - //Real angle_vel_dt_0 = sin_rotation_0 * rotation_0_a + cos_rotation_0 * rotation_0_b; - + Real angle_vel_dt_0 = sin_rotation_0 * rotation_0_a + cos_rotation_0 * rotation_0_b; + */ Real rotation_1_a = dpseudo_n_d2t[0] * cos_rotation_1 - dpseudo_n_d2t[2] * sin_rotation_1 + 2.0 * angular_vel[1] * angular_vel[0] * sin_rotation_0; Real rotation_1_b1 = dpseudo_n_d2t[0] * cos_rotation_0 + @@ -81,13 +81,13 @@ Vec3d getRotationFromPseudoNormalForFiniteDeformation_b(const Vec3d &dpseudo_b_n Real cos_rotation_b_0 = cos(rotation_b[0]); Real sin_rotation_b_2 = sin(rotation_b[2]); Real cos_rotation_b_2 = cos(rotation_b[2]); - + /* Real rotation_b_0_a = (dpseudo_b_n_d2t[0] * sin_rotation_b_2 - dpseudo_b_n_d2t[1] * cos_rotation_b_2 - cos_rotation_b_0 * angular_b_vel[2] * angular_b_vel[2] - cos_rotation_b_0 * angular_b_vel[0] * angular_b_vel[0]); Real rotation_b_0_b = dpseudo_b_n_d2t[2] + sin_rotation_b_0 * angular_b_vel[0] * angular_b_vel[0]; - //Real angle_b_vel_dt_0 = sin_rotation_b_0 * rotation_b_0_a + cos_rotation_b_0 * rotation_b_0_b; - + Real angle_b_vel_dt_0 = sin_rotation_b_0 * rotation_b_0_a + cos_rotation_b_0 * rotation_b_0_b; + */ Real rotation_b_c = (-dpseudo_b_n_d2t[0] * cos_rotation_b_2 - dpseudo_b_n_d2t[1] * sin_rotation_b_2 + 2 * angular_b_vel[2] * angular_b_vel[0] * sin_rotation_b_0); Real rotation_b_c1 = -dpseudo_b_n_d2t[0] * cos_rotation_b_0 +