Skip to content

Commit

Permalink
Merged in prabhuramachandran/pysph/fix_parallel_adaptive_timestep (pu…
Browse files Browse the repository at this point in the history
…ll request #146)


BUG: Fix parallel adaptive timesteps.
  • Loading branch information
kunal-puri committed Mar 5, 2015
2 parents 9c12664 + 6907c0c commit 9db3f32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pysph/solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,15 @@ def _compute_timestep(self):

# set the globally stable time step across all processors
if self.in_parallel:
if dt is None:
# For some reason this processor does not have an adaptive
# timestep constraint so we set it to a large number so the
# timestep is determined by the other processors.
dt = 1e20
dt = self.pm.update_time_steps(dt)
else:
if dt is None:
dt = undamped_dt
else:
dt = undamped_dt

Expand Down
5 changes: 4 additions & 1 deletion pysph/sph/integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def compute_h_minimum(self):
self.h_minimum = hmin

def compute_time_step(self, dt, cfl):
"""If there are any adaptive timestep constraints, the appropriate
timestep is returned, else None is returned.
"""
a_eval = self.c_integrator.acceleration_eval

# different time step controls
Expand Down Expand Up @@ -102,7 +105,7 @@ def compute_time_step(self, dt, cfl):
# return the computed time steps. If dt factors aren't
# defined, the default dt is returned
if dt_min <= 0.0:
return dt
return None
else:
return cfl*dt_min

Expand Down

0 comments on commit 9db3f32

Please sign in to comment.