-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #651 from Shuaihao-Zhang/SPH-GNOG
Generalized non-hourglass formulation for ULSPH solid dynamics
- Loading branch information
Showing
53 changed files
with
1,067 additions
and
598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/shared/particle_dynamics/continuum_dynamics/continuum_dynamics_variable.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "continuum_dynamics_variable.h" | ||
|
||
namespace SPH | ||
{ | ||
namespace continuum_dynamics | ||
{ | ||
//=============================================================================================// | ||
VonMisesStress::VonMisesStress(SPHBody &sph_body) | ||
: BaseDerivedVariable<Real>(sph_body, "VonMisesStress"), | ||
p_(particles_->getVariableDataByName<Real>("Pressure")), | ||
shear_stress_(particles_->getVariableDataByName<Matd>("ShearStress")) {} | ||
//=============================================================================================// | ||
void VonMisesStress::update(size_t index_i, Real dt) | ||
{ | ||
Matd stress_tensor = shear_stress_[index_i] - p_[index_i] * Matd::Identity(); | ||
derived_variable_[index_i] = getVonMisesStressFromMatrix(stress_tensor); | ||
} | ||
//=============================================================================================// | ||
VonMisesStrain::VonMisesStrain(SPHBody &sph_body) | ||
: BaseDerivedVariable<Real>(sph_body, "VonMisesStrain"), | ||
strain_tensor_(particles_->getVariableDataByName<Matd>("StrainTensor")) {} | ||
//=============================================================================================// | ||
void VonMisesStrain::update(size_t index_i, Real dt) | ||
{ | ||
derived_variable_[index_i] = getVonMisesStressFromMatrix(strain_tensor_[index_i]); | ||
} | ||
//=============================================================================================// | ||
VerticalStress::VerticalStress(SPHBody &sph_body) | ||
: BaseDerivedVariable<Real>(sph_body, "VerticalStress"), | ||
stress_tensor_3D_(particles_->getVariableDataByName<Mat3d>("StressTensor3D")) {} | ||
//=============================================================================================// | ||
void VerticalStress::update(size_t index_i, Real dt) | ||
{ | ||
derived_variable_[index_i] = stress_tensor_3D_[index_i](1, 1); | ||
} | ||
//=============================================================================================// | ||
AccDeviatoricPlasticStrain::AccDeviatoricPlasticStrain(SPHBody &sph_body) | ||
: BaseDerivedVariable<Real>(sph_body, "AccDeviatoricPlasticStrain"), | ||
plastic_continuum_(DynamicCast<PlasticContinuum>(this, sph_body_.getBaseMaterial())), | ||
stress_tensor_3D_(particles_->getVariableDataByName<Mat3d>("StressTensor3D")), | ||
strain_tensor_3D_(particles_->getVariableDataByName<Mat3d>("StrainTensor3D")), | ||
E_(plastic_continuum_.getYoungsModulus()), nu_(plastic_continuum_.getPoissonRatio()) {} | ||
//=============================================================================================// | ||
void AccDeviatoricPlasticStrain::update(size_t index_i, Real dt) | ||
{ | ||
Mat3d deviatoric_stress = stress_tensor_3D_[index_i] - (1.0 / 3.0) * stress_tensor_3D_[index_i].trace() * Mat3d::Identity(); | ||
Real hydrostatic_pressure = (1.0 / 3.0) * stress_tensor_3D_[index_i].trace(); | ||
Mat3d elastic_strain_tensor_3D = deviatoric_stress / (2.0 * plastic_continuum_.getShearModulus(E_, nu_)) + | ||
hydrostatic_pressure * Mat3d::Identity() / (9.0 * plastic_continuum_.getBulkModulus(E_, nu_)); | ||
Mat3d plastic_strain_tensor_3D = strain_tensor_3D_[index_i] - elastic_strain_tensor_3D; | ||
Mat3d deviatoric_strain_tensor = plastic_strain_tensor_3D - (1.0 / (Real)Dimensions) * plastic_strain_tensor_3D.trace() * Mat3d::Identity(); | ||
Real sum = (deviatoric_strain_tensor.cwiseProduct(deviatoric_strain_tensor)).sum(); | ||
derived_variable_[index_i] = sqrt(sum * 2.0 / 3.0); | ||
} | ||
//=================================================================================================// | ||
} // namespace continuum_dynamics | ||
} // namespace SPH |
99 changes: 99 additions & 0 deletions
99
src/shared/particle_dynamics/continuum_dynamics/continuum_dynamics_variable.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* ------------------------------------------------------------------------- * | ||
* SPHinXsys * | ||
* ------------------------------------------------------------------------- * | ||
* SPHinXsys (pronunciation: s'finksis) is an acronym from Smoothed Particle * | ||
* Hydrodynamics for industrial compleX systems. It provides C++ APIs for * | ||
* physical accurate simulation and aims to model coupled industrial dynamic * | ||
* systems including fluid, solid, multi-body dynamics and beyond with SPH * | ||
* (smoothed particle hydrodynamics), a meshless computational method using * | ||
* particle discretization. * | ||
* * | ||
* SPHinXsys is partially funded by German Research Foundation * | ||
* (Deutsche Forschungsgemeinschaft) DFG HU1527/6-1, HU1527/10-1, * | ||
* HU1527/12-1 and HU1527/12-4. * | ||
* * | ||
* Portions copyright (c) 2017-2023 Technical University of Munich and * | ||
* the authors' affiliations. * | ||
* * | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may * | ||
* not use this file except in compliance with the License. You may obtain a * | ||
* copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * | ||
* * | ||
* ------------------------------------------------------------------------- */ | ||
/** | ||
* @file continuum_dynamics_variable.h | ||
* @brief Here, we define the algorithm classes for computing derived solid dynamics variables. | ||
* @details These variable can be added into variable list for state output. | ||
* @author Shuaihao Zhang and Xiangyu Hu | ||
*/ | ||
|
||
#ifndef CONTINUUM_DYNAMICS_VARIABLE_H | ||
#define CONTINUUM_DYNAMICS_VARIABLE_H | ||
|
||
#include "base_general_dynamics.h" | ||
#include "general_continuum.h" | ||
|
||
namespace SPH | ||
{ | ||
namespace continuum_dynamics | ||
{ | ||
/** | ||
* @class VonMisesStress | ||
* @brief computing von_Mises_stress | ||
*/ | ||
class VonMisesStress : public BaseDerivedVariable<Real> | ||
{ | ||
public: | ||
explicit VonMisesStress(SPHBody &sph_body); | ||
virtual ~VonMisesStress(){}; | ||
void update(size_t index_i, Real dt = 0.0); | ||
|
||
protected: | ||
Real *p_; | ||
Matd *shear_stress_; | ||
}; | ||
/** | ||
* @class VonMisesStrain | ||
* @brief computing von_Mises_strain | ||
*/ | ||
class VonMisesStrain : public BaseDerivedVariable<Real> | ||
{ | ||
public: | ||
explicit VonMisesStrain(SPHBody &sph_body); | ||
virtual ~VonMisesStrain(){}; | ||
void update(size_t index_i, Real dt = 0.0); | ||
|
||
protected: | ||
Matd *strain_tensor_; | ||
}; | ||
/** | ||
* @class VerticalStress | ||
*/ | ||
class VerticalStress : public BaseDerivedVariable<Real> | ||
{ | ||
public: | ||
explicit VerticalStress(SPHBody &sph_body); | ||
virtual ~VerticalStress(){}; | ||
void update(size_t index_i, Real dt = 0.0); | ||
|
||
protected: | ||
Mat3d *stress_tensor_3D_; | ||
}; | ||
/** | ||
* @class AccumulatedDeviatoricPlasticStrain | ||
*/ | ||
class AccDeviatoricPlasticStrain : public BaseDerivedVariable<Real> | ||
{ | ||
public: | ||
explicit AccDeviatoricPlasticStrain(SPHBody &sph_body); | ||
virtual ~AccDeviatoricPlasticStrain(){}; | ||
void update(size_t index_i, Real dt = 0.0); | ||
|
||
protected: | ||
PlasticContinuum &plastic_continuum_; | ||
Mat3d *stress_tensor_3D_, *strain_tensor_3D_; | ||
Real E_, nu_; | ||
}; | ||
} // namespace continuum_dynamics | ||
} // namespace SPH | ||
#endif // CONTINUUM_DYNAMICS_VARIABLE_H |
Oops, something went wrong.