Skip to content

Commit

Permalink
delete 2d function in thin_structure_math.h and cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
xipenglyu committed Jul 17, 2023
1 parent 598cd1d commit 631f9de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@ namespace SPH
//=====================================================================================================//
namespace thin_structure_dynamics
{
//=================================================================================================//
Vec2d getVectorAfterThinStructureRotation(const Vec2d &initial_vector, const Vec2d &rotation_angles)
{
/**The rotation matrix. */
Real sin_angle = sin(rotation_angles[0]);
Real cos_angle = cos(rotation_angles[0]);

Mat2d rotation_matrix{
{cos_angle, sin_angle}, // First row
{-sin_angle, cos_angle}, // Second row
};

return rotation_matrix * initial_vector;
}
//=================================================================================================//
Vec3d getVectorAfterThinStructureRotation(const Vec3d &initial_vector, const Vec3d &rotation_angles)
{
Expand All @@ -42,11 +29,7 @@ Vec3d getVectorAfterThinStructureRotation(const Vec3d &initial_vector, const Vec

return rotation_matrix * initial_vector;
}
//=================================================================================================//
Vec2d getVectorChangeRateAfterThinStructureRotation(const Vec2d &initial_vector, const Vec2d &rotation_angles, const Vec2d &angular_vel)
{
return Vec2d(cos(rotation_angles[0]) * angular_vel[0], -sin(rotation_angles[0]) * angular_vel[0]);
}

//=================================================================================================//
Vec3d getVectorChangeRateAfterThinStructureRotation(const Vec3d &initial_vector, const Vec3d &rotation_angles, const Vec3d &angular_vel)
{
Expand All @@ -63,16 +46,6 @@ Vec3d getVectorChangeRateAfterThinStructureRotation(const Vec3d &initial_vector,
return Vec3d(dpseudo_n_dt_0, dpseudo_n_dt_1, dpseudo_n_dt_2);
}
//=================================================================================================//
Vec2d getRotationFromPseudoNormalForFiniteDeformation(const Vec2d &dpseudo_n_d2t, const Vec2d &rotation, const Vec2d &angular_vel, Real dt)
{
Real cos_rotation_0 = cos(rotation[0]);
Real sin_rotation_0 = sin(rotation[0]);

Real angle_vel_dt_0 = cos_rotation_0 * (dpseudo_n_d2t[0] + sin_rotation_0 * angular_vel[0] * angular_vel[0]) - sin_rotation_0 * (dpseudo_n_d2t[1] + cos_rotation_0 * angular_vel[0] * angular_vel[0]);

return Vec2d(angle_vel_dt_0, 0.0);
}
//=================================================================================================//
Vec3d getRotationFromPseudoNormalForFiniteDeformation(const Vec3d &dpseudo_n_d2t, const Vec3d &rotation, const Vec3d &angular_vel, Real dt)
{
Real sin_rotation_0 = sin(rotation[0]);
Expand All @@ -92,20 +65,13 @@ Vec3d getRotationFromPseudoNormalForFiniteDeformation(const Vec3d &dpseudo_n_d2t
return Vec3d(angle_vel_dt_0, angle_vel_dt_1, 0.0);
}
//=================================================================================================//
Vec2d getRotationFromPseudoNormalForSmallDeformation(const Vec2d &dpseudo_n_d2t, const Vec2d &rotation, const Vec2d &angular_vel, Real dt)
{
return Vec2d(dpseudo_n_d2t[0], 0);
}

//=================================================================================================//
Vec3d getRotationFromPseudoNormalForSmallDeformation(const Vec3d &dpseudo_n_d2t, const Vec3d &rotation, const Vec3d &angular_vel, Real dt)
{
return Vec3d(-dpseudo_n_d2t[1], dpseudo_n_d2t[0], 0.0);
}
//=================================================================================================//
Vec2d getNormalFromDeformationGradientTensor(const Mat2d &F)
{
return Vec2d(-F.col(0)[1], F.col(0)[0]).normalized();
}

//=================================================================================================//
Vec3d getNormalFromDeformationGradientTensor(const Mat3d &F)
{
Expand Down Expand Up @@ -189,29 +155,15 @@ Vec3d getRotationJump(const Vec3d &pseudo_n_jump, const Mat3d &transformation_ma
local_rotation_jump[1] = local_pseuodo_n_jump[1];
return transformation_matrix.transpose() * local_rotation_jump;
}
//=================================================================================================//
Mat2d getCorrectedAlmansiStrain(const Mat2d &current_local_almansi_strain, const Real &nu_)
{
Mat2d corrected_almansi_strain = current_local_almansi_strain;
corrected_almansi_strain(1, 1) = -nu_ * current_local_almansi_strain(0, 0) / (1.0 - nu_);
return corrected_almansi_strain;
}

//=================================================================================================//
Mat3d getCorrectedAlmansiStrain(const Mat3d &current_local_almansi_strain, const Real &nu_)
{
Mat3d corrected_almansi_strain = current_local_almansi_strain;
corrected_almansi_strain(2, 2) = -nu_ * (current_local_almansi_strain(0, 0) + current_local_almansi_strain(1, 1)) / (1.0 - nu_);
return corrected_almansi_strain;
}
//=================================================================================================//
Mat2d getCorrectionMatrix(const Mat2d &local_deformation_part_one)
{
Real one_over_local_deformation = 1.0 / local_deformation_part_one(0, 0);
return Mat2d{
{one_over_local_deformation, 0},
{0, 0},
};
}

//=================================================================================================//
Mat3d getCorrectionMatrix(const Mat3d &local_deformation_part_one)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,18 @@ namespace thin_structure_dynamics
* when the axis about which they occur points toward the observer,
* and the coordinate system is right-handed.
*/
Vec2d getVectorAfterThinStructureRotation(const Vec2d &initial_vector, const Vec2d &rotation_angles);
Vec3d getVectorAfterThinStructureRotation(const Vec3d &initial_vector, const Vec3d &rotation_angles);

/** Vector change rate after rotation. */
Vec2d getVectorChangeRateAfterThinStructureRotation(const Vec2d &initial_vector, const Vec2d &rotation_angles, const Vec2d &angular_vel);
Vec3d getVectorChangeRateAfterThinStructureRotation(const Vec3d &initial_vector, const Vec3d &rotation_angles, const Vec3d &angular_vel);

/** get the rotation from pseudo-normal for finite deformation. */
Vec2d getRotationFromPseudoNormalForFiniteDeformation(const Vec2d &dpseudo_n_d2t, const Vec2d &rotation, const Vec2d &angular_vel, Real dt);
Vec3d getRotationFromPseudoNormalForFiniteDeformation(const Vec3d &dpseudo_n_d2t, const Vec3d &rotation, const Vec3d &angular_vel, Real dt);

/** get the rotation from pseudo-normal for small deformation. */
Vec2d getRotationFromPseudoNormalForSmallDeformation(const Vec2d &dpseudo_n_d2t, const Vec2d &rotation, const Vec2d &angular_vel, Real dt);
Vec3d getRotationFromPseudoNormalForSmallDeformation(const Vec3d &dpseudo_n_d2t, const Vec3d &rotation, const Vec3d &angular_vel, Real dt);

/** get the current normal direction from deformation gradient tensor. */
Vec2d getNormalFromDeformationGradientTensor(const Mat2d &F);
Vec3d getNormalFromDeformationGradientTensor(const Mat3d &F);

/** get variable jump form gradient tensor. */
Expand All @@ -77,15 +72,12 @@ Vecd getWENORightState(const Vecd &e_ij, const Real &r_ij, const Vecd &particle_
const Matd &gradient_particle_i_value, const Vecd &particle_j_value, const Matd &gradient_particle_j_value);

/** get the artificial rotation from the pseudo-normal jump. */
Vec2d getRotationJump(const Vec2d &pseudo_n_jump, const Mat2d &transformation_matrix);
Vec3d getRotationJump(const Vec3d &pseudo_n_jump, const Mat3d &transformation_matrix);

/** get the corrected Eulerian Almansi strain tensor according to plane stress problem. */
Mat2d getCorrectedAlmansiStrain(const Mat2d &current_local_almansi_strain, const Real &nu_);
Mat3d getCorrectedAlmansiStrain(const Mat3d &current_local_almansi_strain, const Real &nu_);

/** get the correction matrix. */
Mat2d getCorrectionMatrix(const Mat2d &local_deformation_part_one);
Mat3d getCorrectionMatrix(const Mat3d &local_deformation_part_one);
} // namespace thin_structure_dynamics
} // namespace SPH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Real PH = 10.0; /** Width of the square plate. */
Real PT = 1.0; /** Thickness of the square plate. */
Real PW = 1.0; /** Thickness of the square plate. */
Vec3d n_0 = Vec3d(0.0, 0.0, 1.0); /** Pseudo-normal. */
Vec3d b_n_0 = Vec3d(0.0, 1.0, 0.0); /** Pseudo-normal. */
Vec3d b_n_0 = Vec3d(0.0, 1.0, 0.0); /** Pseudo-binormal. */
int particle_number = 40; /** Particle number in the direction of the length */
Real resolution_ref = PL / (Real)particle_number; /** Initial reference particle spacing. */
int BWD = 1; /** Width of the boundary layer measured by number of particles. */
Expand Down

0 comments on commit 631f9de

Please sign in to comment.