Hi Wenxuan,

This is typical when the step size is not sufficient to fully resolve the 
contact process. You can try a series of different time step sizes (1e-4, 
1e-5, 1e-6, 1e-7, to give an example) to see how your selection affects the 
fidelity of the bounce curve and how it converges.

Thank you,
Ruochun

On Thursday, October 24, 2024 at 11:18:29 AM UTC+8 [email protected] wrote:

> Hi, Ruochun
>       
>       I conducted a simple simulation of a single ball falling, but the 
> calculated results were not quite as expected. The speed of particles after 
> collision with the wall is greater than the speed before collision, this 
> phenomenon contradicts the theory of collision energy loss. 
> [image: Screenshot from 2024-10-24 11-16-03.png]
> The code is as follows:
>
> #include <core/ApiVersion.h>
> #include <core/utils/ThreadManager.h>
> #include <DEM/API.h>
> #include <DEM/HostSideHelpers.hpp>
> #include <DEM/utils/Samplers.hpp>
>
> #include <cstdio>
> #include <chrono>
> #include <filesystem>
> #include <random>
>
> using namespace deme;
> using namespace std::filesystem;
>
>
> int main()
> {
> // 1: 设置输出信息级别
> DEMSolver DEMSim;
> DEMSim.UseFrictionalHertzianModel();
> DEMSim.SetVerbosity(STEP_METRIC);
> DEMSim.SetOutputFormat(OUTPUT_FORMAT::CSV);
> DEMSim.SetNoForceRecord();
>
> // 2: 定义颗粒材料物性参数和壁面材料物性参数
> auto mat_type_walls = DEMSim.LoadMaterial({{"E", 1e8}, {"nu", 0.3}, {"CoR", 
> 0.3}, {"mu", 1}});
> auto mat_type_particles = DEMSim.LoadMaterial({{"E", 1e9}, {"nu", 0.3}, {
> "CoR", 0.7}, {"mu", 1}});
>
> // 3: 设置材料之间接触参数
> DEMSim.SetMaterialPropertyPair("CoR", mat_type_walls, mat_type_particles, 
> 0.3);
>
> // 4: 添加颗粒模板
> float density = 2500;
> float radius = 0.025;
> float mass1 = density * 4. / 3. * PI * radius * radius * radius;
> auto sphere_template1 = DEMSim.LoadSphereType(mass1, radius, 
> mat_type_particles);
>
> // 5. 导入几何体
> auto box_outer = DEMSim.AddWavefrontMeshObject("box.obj", mat_type_walls);
> box_outer->Scale(0.001);
>
> // 6. 设置全局参数
> float settle_frame_time = 0.001;
> float settle_batch_time = 1.0;
> unsigned int currframe = 0;
> path out_dir = current_path();
> out_dir += "/00_Factory1_Output";
> create_directory(out_dir);
> DEMSim.InstructBoxDomainDimension({-1.2, 1.2}, {-1.2, 1.2}, {-1.2, 1.2});
> DEMSim.SetGravitationalAcceleration(make_float3(0, 0, -9.81));
>
> // 7. 设置求解时间步长及初始化
> DEMSim.SetInitTimeStep(1e-4);
> DEMSim.SetInitBinSize(2 * radius);
> DEMSim.Initialize();
>
>
> // 8. 生成颗粒
> float3 particle_pos = make_float3(0, 0, 0);
> std::vector<float3> particle_pos_total;
> particle_pos_total.push_back(particle_pos);
> auto particles = DEMSim.AddClumps(sphere_template1, particle_pos_total);
> particles->SetVel(make_float3(0, 0, 0));
> DEMSim.UpdateClumps();
> std::cout << "Current number of clumps: " << DEMSim.GetNumClumps() << std
> ::endl;
>
> // 9. 迭代计算
> for (float t = 0; t < settle_batch_time; t += settle_frame_time) 
> {
> std::cout << "Frame: " << currframe << std::endl;
> char filename[200], meshfilename[200];
> sprintf(meshfilename, "%s/DEMdemo_mesh_%04d.vtk", out_dir.c_str(), 
> currframe);
> sprintf(filename, "%s/DEMdemo_output_%04d.csv", out_dir.c_str(), currframe
> ++);
> DEMSim.WriteSphereFile(std::string(filename));
> DEMSim.WriteMeshFile(std::string(meshfilename));
> DEMSim.DoDynamicsThenSync(settle_frame_time);
> }
>
> // 打印计算结束标志
> std::cout << "Calculation complete!" << std::endl;
> return 0;
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/projectchrono/5a30ccb4-c296-4afe-a62a-bb97b4cf5fe7n%40googlegroups.com.

Reply via email to