Commit e388f948 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

simplify

parent 2beb1202
Pipeline #8573 passed with stages
in 3 minutes and 40 seconds
......@@ -168,6 +168,11 @@ class ParticleProblem :
def save_state(self) :
self._saved_velocity = np.copy(self.velocity())
self._saved_position = np.copy(self.position())
self._saved_segments = np.copy(self.segments())
self._saved_disk = np.copy(self.disks())
if self.dim() == 3 :
self._saved_triangles = np.copy(self.triangles())
if self._friction_enabled and self._rotation_enabled :
self._saved_omega = np.copy(self.omega())
......@@ -176,6 +181,10 @@ class ParticleProblem :
self.position()[:] = self._saved_position
if self._friction_enabled and self._rotation_enabled :
self.omega()[:] = self._saved_omega
self.segments()[:] = self._saved_segments
self.disks()[:] = self._saved_disk
if self.dim() == 3 :
self.triangles()[:] = self._saved_triangles
def particle_material(self):
"""Returns the list of particle materials."""
......
......@@ -86,11 +86,6 @@ def predictor_corrector_iterate(fluid, particles, dt, min_nsub=1, contact_tol=1e
# Copy the solid solution of the previous time step before computing the prediction
x0 = np.copy(particles.position())
cp0 = np.copy(particles.contact_forces())
seg0 = np.copy(particles.segments())
disk0 = np.copy(particles.disks())
if particles.dim() == 3 :
tri0 = np.copy(particles.triangles())
# Predictor
#
......@@ -99,10 +94,9 @@ def predictor_corrector_iterate(fluid, particles, dt, min_nsub=1, contact_tol=1e
sf1 = np.copy(fluid.solution())
f0 = np.copy(fluid.compute_node_force(dt))+external_particles_forces
_advance_particles(particles,f0,dt,min_nsub,contact_tol,max_split=max_split)
particles.contact_forces()[:] = cp0
# Keep same contact forces and positions while giving to the fluid the predicted solid velocities to compute the correction
fluid.set_particles(particles.mass(), particles.volume(), x0, particles.velocity(), particles.contact_forces(), reload=True)
fluid.set_particles(particles.mass(), particles.volume(), x0, particles.velocity(), cp0, reload=True)
# Corrector
#
......@@ -119,10 +113,6 @@ def predictor_corrector_iterate(fluid, particles, dt, min_nsub=1, contact_tol=1e
fluid.advance_concentration(dt)
# Reset solid velocities
particles.restore_state()
particles.segments()[:] = seg0
particles.disks()[:] = disk0
if particles.dim() == 3 :
particles.triangles()[:] = tri0
_advance_particles(particles,(alpha*f0+(1-alpha)*f1),dt,min_nsub,contact_tol,after_sub_iter=after_sub_iter,max_split=max_split)
# Give to the fluid the solid information
fluid.set_particles(particles.mass(), particles.volume(), particles.position(), particles.velocity(), particles.contact_forces())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment