Skip to content

Commit

Permalink
delete the SPH-ENOG method since the present SPH-GNOG is better
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuaihao-Zhang committed Sep 18, 2024
1 parent 29049ca commit c302adc
Show file tree
Hide file tree
Showing 27 changed files with 16 additions and 796 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,80 +29,6 @@ Real AcousticTimeStep::outputResult(Real reduced_value)
{
return acousticCFL_ * smoothing_length_min_ / (reduced_value + TinyReal);
}
//=================================================================================================//
ShearAccelerationRelaxation::ShearAccelerationRelaxation(BaseInnerRelation &inner_relation)
: fluid_dynamics::BaseIntegration<DataDelegateInner>(inner_relation),
continuum_(DynamicCast<GeneralContinuum>(this, particles_->getBaseMaterial())),
G_(continuum_.getShearModulus(continuum_.getYoungsModulus(), continuum_.getPoissonRatio())),
smoothing_length_(sph_body_.sph_adaptation_->ReferenceSmoothingLength()),
acc_shear_(particles_->registerStateVariable<Vecd>("AccelerationByShear"))
{
particles_->addVariableToSort<Vecd>("AccelerationByShear");
}
//=================================================================================================//
void ShearAccelerationRelaxation::interaction(size_t index_i, Real dt)
{
Real rho_i = rho_[index_i];
Vecd acceleration = Vecd::Zero();
Neighborhood &inner_neighborhood = inner_configuration_[index_i];
for (size_t n = 0; n != inner_neighborhood.current_size_; ++n)
{
size_t index_j = inner_neighborhood.j_[n];
Real r_ij = inner_neighborhood.r_ij_[n];
Real dW_ijV_j = inner_neighborhood.dW_ij_[n] * Vol_[index_j];
Vecd &e_ij = inner_neighborhood.e_ij_[n];
Real eta_ij = 2 * (0.7 * (Real)Dimensions + 2.1) * (vel_[index_i] - vel_[index_j]).dot(e_ij) / (r_ij + TinyReal);
acceleration += eta_ij * dW_ijV_j * e_ij;
}
acc_shear_[index_i] += G_ * acceleration * dt / rho_i;
}
//=================================================================================================//
ShearStressRelaxation::ShearStressRelaxation(BaseInnerRelation &inner_relation)
: fluid_dynamics::BaseIntegration<DataDelegateInner>(inner_relation),
continuum_(DynamicCast<GeneralContinuum>(this, particles_->getBaseMaterial())),
shear_stress_(particles_->registerStateVariable<Matd>("ShearStress")),
shear_stress_rate_(particles_->registerStateVariable<Matd>("ShearStressRate")),
velocity_gradient_(particles_->registerStateVariable<Matd>("VelocityGradient")),
strain_tensor_(particles_->registerStateVariable<Matd>("StrainTensor")),
strain_tensor_rate_(particles_->registerStateVariable<Matd>("StrainTensorRate")),
B_(particles_->getVariableDataByName<Matd>("LinearGradientCorrectionMatrix")),
Vol_(particles_->getVariableDataByName<Real>("VolumetricMeasure"))
{
particles_->addVariableToSort<Matd>("ShearStress");
particles_->addVariableToSort<Matd>("ShearStressRate");
particles_->addVariableToSort<Matd>("VelocityGradient");
particles_->addVariableToSort<Matd>("StrainTensor");
particles_->addVariableToSort<Matd>("StrainTensorRate");
}
//====================================================================================//
void ShearStressRelaxation::initialization(size_t index_i, Real dt)
{
strain_tensor_[index_i] += strain_tensor_rate_[index_i] * 0.5 * dt;
shear_stress_[index_i] += shear_stress_rate_[index_i] * 0.5 * dt;
}
//====================================================================================//
void ShearStressRelaxation::interaction(size_t index_i, Real dt)
{
Matd velocity_gradient = Matd::Zero();
Neighborhood &inner_neighborhood = inner_configuration_[index_i];
for (size_t n = 0; n != inner_neighborhood.current_size_; ++n)
{
size_t index_j = inner_neighborhood.j_[n];
Real dW_ijV_j = inner_neighborhood.dW_ij_[n] * Vol_[index_i];
Vecd &e_ij = inner_neighborhood.e_ij_[n];
Vecd v_ij = vel_[index_i] - vel_[index_j];
velocity_gradient -= v_ij * (B_[index_i] * e_ij * dW_ijV_j).transpose();
}
velocity_gradient_[index_i] = velocity_gradient;
strain_tensor_rate_[index_i] = 0.5 * (velocity_gradient + velocity_gradient.transpose());
strain_tensor_[index_i] += strain_tensor_rate_[index_i] * 0.5 * dt;
}
//====================================================================================//
void ShearStressRelaxation::update(size_t index_i, Real dt)
{
shear_stress_rate_[index_i] = continuum_.ConstitutiveRelationShearStress(velocity_gradient_[index_i], shear_stress_[index_i]);
shear_stress_[index_i] += shear_stress_rate_[index_i] * dt * 0.5;
}
//====================================================================================//
StressDiffusion::StressDiffusion(BaseInnerRelation &inner_relation)
: BasePlasticIntegration<DataDelegateInner>(inner_relation),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,6 @@ class BaseIntegration1stHalf : public FluidDynamicsType
using Integration1stHalf = BaseIntegration1stHalf<fluid_dynamics::Integration1stHalfInnerNoRiemann>;
using Integration1stHalfRiemann = BaseIntegration1stHalf<fluid_dynamics::Integration1stHalfInnerRiemann>;

class ShearAccelerationRelaxation : public fluid_dynamics::BaseIntegration<DataDelegateInner>
{
public:
explicit ShearAccelerationRelaxation(BaseInnerRelation &inner_relation);
virtual ~ShearAccelerationRelaxation(){};
void interaction(size_t index_i, Real dt = 0.0);

protected:
GeneralContinuum &continuum_;
Real G_, smoothing_length_;
Vecd *acc_shear_;
};

class ShearStressRelaxation : public fluid_dynamics::BaseIntegration<DataDelegateInner>
{
public:
explicit ShearStressRelaxation(BaseInnerRelation &inner_relation);
virtual ~ShearStressRelaxation(){};
void initialization(size_t index_i, Real dt = 0.0);
void interaction(size_t index_i, Real dt = 0.0);
void update(size_t index_i, Real dt = 0.0);

protected:
GeneralContinuum &continuum_;
Matd *shear_stress_, *shear_stress_rate_, *velocity_gradient_, *strain_tensor_, *strain_tensor_rate_, *B_;
Real *Vol_;
};

template <class DataDelegationType>
class BasePlasticIntegration : public fluid_dynamics::BaseIntegration<DataDelegationType>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* ----------------------------------------------------------------------------*
* SPHinXsys: 2D oscillation beam--updated Lagrangian method *
* SPHinXsys: 2D oscillation beam *
* ----------------------------------------------------------------------------*
* This is the one of the basic test cases for understanding SPH method for *
* solid simulation based on updated Lagrangian method *
* solid simulation based on updated Lagrangian method. *
* A generalized hourglass control method is used here. *
* In this case, the constraint of the beam is implemented with *
* internal constrained subregion. *
* @author Shuaihao Zhang, Dong Wu and Xiangyu Hu *
Expand Down Expand Up @@ -107,7 +108,6 @@ int main(int ac, char *av[])
// Creating body, materials and particles.
//----------------------------------------------------------------------
RealBody beam_body(sph_system, makeShared<Beam>("BeamBody"));
beam_body.sph_adaptation_->resetKernel<KernelCubicBSpline>();
beam_body.defineMaterial<GeneralContinuum>(rho0_s, c0, Youngs_modulus, poisson);
beam_body.generateParticles<BaseParticles, Lattice>();

Expand All @@ -128,17 +128,15 @@ int main(int ac, char *av[])
// this section define all numerical methods will be used in this case
//-----------------------------------------------------------------------------
/** initial condition */
InteractionWithUpdate<LinearGradientCorrectionMatrixInner> correction_matrix(beam_body_inner);
SimpleDynamics<BeamInitialCondition> beam_initial_velocity(beam_body);

InteractionDynamics<continuum_dynamics::ShearAccelerationRelaxation> beam_shear_acceleration(beam_body_inner);
Dynamics1Level<continuum_dynamics::ShearStressRelaxation> beam_shear_stress_relaxation(beam_body_inner);
InteractionWithUpdate<LinearGradientCorrectionMatrixInner> correction_matrix(beam_body_inner);
Dynamics1Level<continuum_dynamics::Integration1stHalf> beam_pressure_relaxation(beam_body_inner);
Dynamics1Level<fluid_dynamics::Integration2ndHalfInnerDissipativeRiemann> beam_density_relaxation(beam_body_inner);
InteractionWithUpdate<continuum_dynamics::ShearStressRelaxationHourglassControl1stHalf> beam_shear_stress(beam_body_inner);
InteractionDynamics<continuum_dynamics::ShearStressRelaxationHourglassControl2ndHalf> beam_shear_acceleration(beam_body_inner);
SimpleDynamics<fluid_dynamics::ContinuumVolumeUpdate> beam_volume_update(beam_body);

ReduceDynamics<fluid_dynamics::AdvectionViscousTimeStep> fluid_advection_time_step(beam_body, U_ref, 0.2);
ReduceDynamics<fluid_dynamics::AcousticTimeStep> fluid_acoustic_time_step(beam_body, 0.4);
ReduceDynamics<fluid_dynamics::AdvectionViscousTimeStep> advection_time_step(beam_body, U_ref, 0.2);
ReduceDynamics<fluid_dynamics::AcousticTimeStep> acoustic_time_step(beam_body, 0.4);
// clamping a solid body part.
BodyRegionByParticle beam_base(beam_body, makeShared<MultiPolygonShape>(createBeamConstrainShape()));
SimpleDynamics<FixBodyPartConstraint> constraint_beam_base(beam_base);
Expand Down Expand Up @@ -182,17 +180,16 @@ int main(int ac, char *av[])
while (integration_time < D_Time)
{
Real relaxation_time = 0.0;
Real advection_dt = fluid_advection_time_step.exec();
Real advection_dt = advection_time_step.exec();
beam_volume_update.exec();

while (relaxation_time < advection_dt)
{
Real acoustic_dt = fluid_acoustic_time_step.exec();
beam_shear_stress_relaxation.exec(acoustic_dt);
Real acoustic_dt = acoustic_time_step.exec();
beam_pressure_relaxation.exec(acoustic_dt);
constraint_beam_base.exec();
beam_density_relaxation.exec(acoustic_dt);
beam_shear_stress.exec(acoustic_dt);
beam_shear_acceleration.exec(acoustic_dt);
beam_density_relaxation.exec(acoustic_dt);
ite++;
relaxation_time += acoustic_dt;
integration_time += acoustic_dt;
Expand Down Expand Up @@ -230,6 +227,5 @@ int main(int ac, char *av[])
{
write_beam_kinetic_energy.testResult();
}

return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<Snapshot number_of_snapshot_for_local_result_="100" />
</Snapshot_Element>
<Result_Element>
<Particle_0 snapshot_0="4.06479841041065" snapshot_1="3.8305884223988658" snapshot_2="3.2886999151932623" snapshot_3="2.493361059193747" snapshot_4="1.6098406338085565" snapshot_5="0.79844058324209577" snapshot_6="0.22957347652212562" snapshot_7="0.0039004596781748112" snapshot_8="0.17423949753675538" snapshot_9="0.69892572776768924" snapshot_10="1.4916034523821886" snapshot_11="2.3717091640174455" snapshot_12="3.1735086086881572" snapshot_13="3.773227477717759" snapshot_14="4.0225801173265134" snapshot_15="3.8824100271832851" snapshot_16="3.3792150739999141" snapshot_17="2.6085429166114729" snapshot_18="1.7367012522200511" snapshot_19="0.90111411605843283" snapshot_20="0.29450782591667729" snapshot_21="0.011850333078466179" snapshot_22="0.11939387895622738" snapshot_23="0.59199556488512772" snapshot_24="1.3435828405391934" snapshot_25="2.2129504136792861" snapshot_26="3.0473965667216905" snapshot_27="3.6762323996906283" snapshot_28="3.999707588913016" snapshot_29="3.9175032245563828" snapshot_30="3.4805836751632291" snapshot_31="2.7660566390525494" snapshot_32="1.9020729657170743" snapshot_33="1.0596715422787422" snapshot_34="0.39876511729155767" snapshot_35="0.04095581527378634" snapshot_36="0.057473825786850709" snapshot_37="0.44904093010731388" snapshot_38="1.1311404606456845" snapshot_39="1.9844399710428542" snapshot_40="2.829482749186095" snapshot_41="3.5339126724992354" snapshot_42="3.9341611054071755" snapshot_43="3.9648817749449559" snapshot_44="3.6195999482503551" snapshot_45="2.9580455581206597" snapshot_46="2.1293289392579973" snapshot_47="1.2626272466747839" snapshot_48="0.54854092142325961" snapshot_49="0.10172799175191929" snapshot_50="0.016182346535847221" snapshot_51="0.31528214589948772" snapshot_52="0.92840726527535333" snapshot_53="1.7468509919213644" snapshot_54="2.6134105640115748" snapshot_55="3.3525996167017511" snapshot_56="3.8492207580470144" snapshot_57="3.9811032213719488" snapshot_58="3.745261695078566" snapshot_59="3.1659994189416474" snapshot_60="2.3726082721269721" snapshot_61="1.5143106950739365" snapshot_62="0.73312013579777779" snapshot_63="0.19682026507625533" snapshot_64="0.00050382291121393906" snapshot_65="0.18774910464415731" snapshot_66="0.71602778998970951" snapshot_67="1.4912770481856907" snapshot_68="2.3529790771330648" snapshot_69="3.1412391762849041" snapshot_70="3.7187033404379624" snapshot_71="3.9728877300395964" snapshot_72="3.8425109942949649" snapshot_73="3.3617292568496553" snapshot_74="2.6360764153926" snapshot_75="1.7791453972569307" snapshot_76="0.9580303957887375" snapshot_77="0.33915444822103324" snapshot_78="0.023634801913339054" snapshot_79="0.078639509463445528" snapshot_80="0.49319911046620479" snapshot_81="1.1783673502565655" snapshot_82="2.0228520110658703" snapshot_83="2.8542512860784188" snapshot_84="3.5310209114729627" snapshot_85="3.9074892499928251" snapshot_86="3.9252014944173177" snapshot_87="3.5723769414833368" snapshot_88="2.9151788916196222" snapshot_89="2.0993437303621332" snapshot_90="1.2523307207089376" snapshot_91="0.54794488545312847" snapshot_92="0.10370310388852257" snapshot_93="0.01350118379148735" snapshot_94="0.29773278933892383" snapshot_95="0.89384211911539391" snapshot_96="1.6976316785858596" snapshot_97="2.5441283232548568" snapshot_98="3.2818965085104201" snapshot_99="3.791734255265121" />
<Particle_0 snapshot_0="4.0647984104106509" snapshot_1="3.8144223592964792" snapshot_2="3.2268871603542912" snapshot_3="2.3724425525929131" snapshot_4="1.4465954852364591" snapshot_5="0.6369647462775283" snapshot_6="0.12237712167076312" snapshot_7="0.019205554519530779" snapshot_8="0.34438339946403751" snapshot_9="1.0233367068625181" snapshot_10="1.9237264008979347" snapshot_11="2.8222415979369813" snapshot_12="3.5782127770067538" snapshot_13="3.9837803753293057" snapshot_14="3.9731605808703963" snapshot_15="3.5543523216987905" snapshot_16="2.7876733883805094" snapshot_17="1.890446694443821" snapshot_18="0.99675295228193073" snapshot_19="0.32758024206466851" snapshot_20="0.014358436071461603" snapshot_21="0.13045572765624308" snapshot_22="0.65152154857124556" snapshot_23="1.4642924772623263" snapshot_24="2.3854152017513934" snapshot_25="3.2284139108604362" snapshot_26="3.8127265531838788" snapshot_27="4.0343458165471677" snapshot_28="3.8059225801574494" snapshot_29="3.2151735596760744" snapshot_30="2.3707391660511945" snapshot_31="1.4476302188695302" snapshot_32="0.64072734032593692" snapshot_33="0.12752098317855196" snapshot_34="0.014483496018494767" snapshot_35="0.33133354404794446" snapshot_36="0.99546506127812806" snapshot_37="1.8833315892658782" snapshot_38="2.7848601108120521" snapshot_39="3.5430482114433497" snapshot_40="3.9635615367505963" snapshot_41="3.9756542742164807" snapshot_42="3.5793025853789451" snapshot_43="2.8347494260688371" snapshot_44="1.9458023887027203" snapshot_45="1.0541690753334019" snapshot_46="0.36781436277176088" snapshot_47="0.023336346817304343" snapshot_48="0.10230730361008245" snapshot_49="0.58725006531811308" snapshot_50="1.3774030648834967" snapshot_51="2.2933660523222819" snapshot_52="3.1420813084384598" snapshot_53="3.7606916286811534" snapshot_54="4.0221089447962619" snapshot_55="3.84338139355068" snapshot_56="3.2957808282416385" snapshot_57="2.4809275980400218" snapshot_58="1.5641037973495577" snapshot_59="0.73326529090297266" snapshot_60="0.1772540949886541" snapshot_61="0.0025047434104203763" snapshot_62="0.25682019840309728" snapshot_63="0.87397658937266254" snapshot_64="1.731916139563292" snapshot_65="2.6379718230164722" snapshot_66="3.4189041379232266" snapshot_67="3.9040087450534471" snapshot_68="4.0005496036341075" snapshot_69="3.6789991992117144" snapshot_70="3.0002945492356581" snapshot_71="2.1317541555173061" snapshot_72="1.2307482396418434" snapshot_73="0.49520383379915489" snapshot_74="0.065374303529805389" snapshot_75="0.041990014965873561" snapshot_76="0.42771465497880584" snapshot_77="1.1361238959932731" snapshot_78="2.0322703311777803" snapshot_79="2.9116882910143826" snapshot_80="3.6141828052068421" snapshot_81="3.9810415354174915" snapshot_82="3.9311492873660705" snapshot_83="3.487331619543832" snapshot_84="2.725952776389911" snapshot_85="1.830991183528107" snapshot_86="0.95942329043932684" snapshot_87="0.31133828315425632" snapshot_88="0.010543244015187109" snapshot_89="0.13121522729744606" snapshot_90="0.64256739371818361" snapshot_91="1.4424147194561876" snapshot_92="2.347161450967993" snapshot_93="3.1802284501762932" snapshot_94="3.7770118171690603" snapshot_95="4.009825099445985" snapshot_96="3.8198794622455496" snapshot_97="3.260264765242094" snapshot_98="2.4475206107071412" snapshot_99="1.5381100009326587" />
</Result_Element>
</result>
Loading

0 comments on commit c302adc

Please sign in to comment.