Skip to content

Commit

Permalink
Fix FlowEnv reset time arg (#190)
Browse files Browse the repository at this point in the history
* Fix FlowEnv reset

* Fix formatting
  • Loading branch information
jcallaham authored Sep 12, 2024
1 parent afe8428 commit 9afa857
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hydrogym/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def step(self, iter: int, control: Iterable[float] = None, **kwargs):
"""
raise NotImplementedError

def reset(self, t=0.0):
def reset(self):
"""Reset variables for the timestepper"""
pass

Expand Down Expand Up @@ -389,7 +389,7 @@ def check_complete(self):
def reset(self, t=0.0) -> Union[ArrayLike, Tuple[ArrayLike, dict]]:
self.iter = 0
self.flow.reset(q0=self.q0, t=t)
self.solver.reset(t=t)
self.solver.reset()

return self.flow.get_observations()

Expand Down
5 changes: 5 additions & 0 deletions test/test_cyl.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def test_env():
"mesh": "medium",
},
"solver": hgym.SemiImplicitBDF,
"solver_config": {
"dt": 1e-2,
},
}
env = hgym.FlowEnv(env_config)

Expand All @@ -97,6 +100,8 @@ def test_env():
y, reward, done, info = env.step(u)
u = feedback_ctrl(y)

env.reset()


def test_linearize():
flow = hgym.Cylinder(mesh="medium")
Expand Down

0 comments on commit 9afa857

Please sign in to comment.