Skip to content

Commit

Permalink
Prevent usage of adaptive steppers with stochastic PDEs
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zwicker committed Dec 2, 2024
1 parent 0f9a6d5 commit 4d3b949
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pde/solvers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,10 @@ def make_stepper(
# create stepper with fixed steps
return super().make_stepper(state, dt)

if getattr(self.pde, "is_sde", False):
# adaptive steppers cannot deal with stochastic PDEs
raise RuntimeError("Cannot use adaptive stepper with stochastic equation")

# Support `None` as a default value, so the controller can signal that
# the solver should use a default time step.
if dt is None:
Expand Down
3 changes: 0 additions & 3 deletions pde/solvers/explicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,6 @@ def _make_adaptive_stepper(
An example for the state from which the grid and other information can
be extracted
"""
if self.pde.is_sde:
raise RuntimeError("Cannot use adaptive stepper with stochastic equation")

self.info["scheme"] = self.scheme
if self.scheme == "euler":
return self._make_adaptive_euler_stepper(state)
Expand Down

0 comments on commit 4d3b949

Please sign in to comment.