Skip to content

Commit

Permalink
return device scalar from estimate_rk4_timestep
Browse files Browse the repository at this point in the history
  • Loading branch information
majosm committed Oct 25, 2021
1 parent b106569 commit ed86d15
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion examples/advection/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ def rhs(t, u):
# {{{ time stepping

# FIXME: dt estimate is not necessarily valid for surfaces
dt = 0.45 * adv_operator.estimate_rk4_timestep(actx, dcoll, fields=u0)
dt = actx.to_numpy(
0.45 * adv_operator.estimate_rk4_timestep(actx, dcoll, fields=u0))
nsteps = int(final_time // dt) + 1

logger.info("dt: %.5e", dt)
Expand Down
2 changes: 1 addition & 1 deletion examples/advection/var-velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def zero_inflow_bc(dtag, t=0):
def rhs(t, u):
return adv_operator.operator(t, u)

dt = adv_operator.estimate_rk4_timestep(actx, dcoll, fields=u)
dt = actx.to_numpy(adv_operator.estimate_rk4_timestep(actx, dcoll, fields=u))

logger.info("Timestep size: %g", dt)

Expand Down
2 changes: 1 addition & 1 deletion examples/advection/weak.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def u_analytic(x, t=0):
def rhs(t, u):
return adv_operator.operator(t, u)

dt = adv_operator.estimate_rk4_timestep(actx, dcoll, fields=u)
dt = actx.to_numpy(adv_operator.estimate_rk4_timestep(actx, dcoll, fields=u))

logger.info("Timestep size: %g", dt)

Expand Down
2 changes: 1 addition & 1 deletion grudge/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ def estimate_rk4_timestep(self, actx, dcoll, **kwargs):
characteristic_lengthscales(actx, dcoll) / wavespeeds
)

return actx.to_numpy(op.nodal_min(dcoll, "vol", local_timesteps))
return op.nodal_min(dcoll, "vol", local_timesteps)
2 changes: 1 addition & 1 deletion test/test_grudge.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ def analytic_sol(x, t=0):
def rhs(t, w):
return maxwell_operator.operator(t, w)

dt = maxwell_operator.estimate_rk4_timestep(actx, dcoll)
dt = actx.to_numpy(maxwell_operator.estimate_rk4_timestep(actx, dcoll))
final_t = dt * 5
nsteps = int(final_t/dt)

Expand Down
3 changes: 2 additions & 1 deletion test/test_mpi_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ def source_f(actx, dcoll, t=0):
[dcoll.zeros(actx) for i in range(dcoll.dim)]
)

dt = 2/3 * wave_op.estimate_rk4_timestep(actx, dcoll, fields=fields)
dt = actx.to_numpy(
2/3 * wave_op.estimate_rk4_timestep(actx, dcoll, fields=fields))

wave_op.check_bc_coverage(local_mesh)

Expand Down

0 comments on commit ed86d15

Please sign in to comment.