18 Particles::ParticleHandler<dim> &particle_handler,
19 const Tensor<1, 3> &g,
21 std::vector<Tensor<1, 3>> &torque,
22 std::vector<Tensor<1, 3>> &force,
23 const std::vector<double> &MOI)
25 integrate(particle_handler, g, dt, torque, force, MOI);
35 Particles::ParticleHandler<dim> &particle_handler,
36 const Tensor<1, 3> & ,
38 std::vector<Tensor<1, 3>> &torque,
39 std::vector<Tensor<1, 3>> &force,
40 const std::vector<double> & )
42 for (
auto &particle : particle_handler)
44 const types::particle_index particle_id = particle.get_local_index();
46 force[particle_id] = 0.;
47 torque[particle_id] = 0.;
54 Particles::ParticleHandler<dim> &particle_handler,
55 const Tensor<1, 3> &g,
57 std::vector<Tensor<1, 3>> &torque,
58 std::vector<Tensor<1, 3>> &force,
59 const std::vector<double> &MOI,
60 const parallel::distributed::Triangulation<dim> & ,
69 Particles::ParticleHandler<dim> &particle_handler,
70 const Tensor<1, 3> &g,
72 std::vector<Tensor<1, 3>> &torque,
73 std::vector<Tensor<1, 3>> &force,
74 const std::vector<double> &MOI)
76 for (
auto particle = particle_handler.begin();
77 particle != particle_handler.end();
82 types::particle_index particle_id = particle->get_local_index();
84 auto particle_properties = particle->get_properties();
85 Tensor<1, 3> &particle_torque = torque[particle_id];
86 Tensor<1, 3> &particle_force = force[particle_id];
87 Point<3> particle_position;
88 double mass_inverse = 1 / particle_properties[PropertiesIndex::mass];
89 double MOI_inverse = 1 / MOI[particle_id];
92 if constexpr (dim == 3)
93 particle_position = particle->get_location();
95 if constexpr (dim == 2)
98 Tensor<1, 3> acceleration;
99 for (
int d = 0; d < 3; ++d)
101 acceleration[d] = g[d] + (particle_force[d]) * mass_inverse;
104 particle_properties[PropertiesIndex::v_x + d] += dt * acceleration[d];
107 particle_position[d] +=
108 dt * particle_properties[PropertiesIndex::v_x + d];
110 particle_properties[PropertiesIndex::omega_x + d] +=
111 dt * (particle_torque[d] * MOI_inverse);
120 if constexpr (dim == 3)
121 particle->set_location(particle_position);
123 if constexpr (dim == 2)
125 Point<2> position_2d;
126 position_2d[0] = particle_position[0];
127 position_2d[1] = particle_position[1];
128 particle->set_location(position_2d);
137 Particles::ParticleHandler<dim> &particle_handler,
138 const Tensor<1, 3> &g,
140 std::vector<Tensor<1, 3>> &torque,
141 std::vector<Tensor<1, 3>> &force,
142 const std::vector<double> &MOI,
143 const parallel::distributed::Triangulation<dim> & ,
148 bool use_default_function =
149 !action_manager->check_sparse_contacts_enabled() ||
150 action_manager->check_mobility_status_reset();
152 if (use_default_function)
154 integrate(particle_handler, g, dt, torque, force, MOI);
158 throw std::runtime_error(
159 "Adaptive sparse contacts are not supported with explicit Euler integrator, use Velocity Verlet integrator.");
virtual void integrate_start(Particles::ParticleHandler< dim > &particle_handler, const Tensor< 1, 3 > &body_force, const double time_step, std::vector< Tensor< 1, 3 > > &torque, std::vector< Tensor< 1, 3 > > &force, const std::vector< double > &MOI) override
Integrate the opening step of the scheme. The explicit Euler scheme is self-starting and keeps the ve...
virtual void integrate_end(Particles::ParticleHandler< dim > &particle_handler, const Tensor< 1, 3 > &body_force, const double time_step, std::vector< Tensor< 1, 3 > > &torque, std::vector< Tensor< 1, 3 > > &force, const std::vector< double > &MOI) override
Integrate the closing step of the scheme. The velocities of the explicit Euler scheme are already syn...
virtual void integrate(Particles::ParticleHandler< dim > &particle_handler, const Tensor< 1, 3 > &body_force, const double time_step, std::vector< Tensor< 1, 3 > > &torque, std::vector< Tensor< 1, 3 > > &force, const std::vector< double > &MOI) override
Integrate motion of all particles by using the acceleration with the explicit Euler method.