CylinderRotEnv2D

class fluidgym.envs.cylinder.CylinderRotEnv2D(reynolds_number: float, resolution: int, dt: float, adaptive_cfl: float, step_length: float, episode_length: int, lift_penalty: float, use_marl: bool, dtype: dtype = torch.float32, cuda_device: device | None = None, load_initial_domain: bool = True, load_domain_statistics: bool = True, randomize_initial_state: bool = True, enable_actions: bool = True, differentiable: bool = False, advection_tol: phipict.solvers.tolerance.SolverTolerance = None, pressure_tol: phipict.solvers.tolerance.SolverTolerance = None, pressure_tol_intermediate: phipict.solvers.tolerance.SolverTolerance = None, pressure_warm_start: bool = False, linear_solve_max_iter: int | None = None, exclude_advection_solve_gradients: bool | None = None, exclude_pressure_solve_gradients: bool | None = None, exclude_pressure_gradient_adjoint: bool | None = None, n_envs: int | None = None)[source]

Bases: CylinderEnvBase

Environment for flow around a cylinder with rotating cylinder actuation.

Parameters:
  • reynolds_number (float) – The Reynolds number of the flow.

  • resolution (int) – The resolution of the simulation grid. Corresponds to the angular resolution around the cylinder.

  • dt (float) – The time step size to use in the simulation.

  • adaptive_cfl (float) – The adaptive CFL number to use in the simulation.

  • step_length (float) – The non-dimensional time length of each environment step.

  • episode_length (int) – The number of steps per episode.

  • lift_penalty (float) – The penalty factor for lift in the reward calculation.

  • use_marl (bool) – Whether to enable multi-agent reinforcement learning mode.

  • dtype (torch.dtype) – The data type to use for the simulation. Defaults to torch.float32.

  • cuda_device (torch.device | None) – The CUDA device to use for the simulation. If None, the default cuda device is used. Defaults to None.

  • load_initial_domain (bool) – Whether to load initial domain states from disk. Defaults to True.

  • load_domain_statistics (bool) – Whether to load domain statistics from disk. Defaults to True.

  • randomize_initial_state (bool) – Whether to randomize the initial state on reset. Defaults to True.

  • enable_actions (bool) – Whether to enable actions. If False, the environment will be run in uncontrolled mode. Defaults to True.

  • differentiable (bool) – Whether to enable differentiable simulation mode. Defaults to False.

  • advection_tol (float | SolverTolerance | Mapping | None) – Tolerance for the momentum and passive-scalar advection solves. None (the default) keeps the tolerance this environment is tuned at.

  • pressure_tol (float | SolverTolerance | Mapping | None) – Tolerance for the pressure solve. None (the default) keeps the tolerance this environment is tuned at.

  • pressure_tol_intermediate (float | SolverTolerance | Mapping | None) – Tolerance for the pressure solves before the final corrector. None (the default) applies pressure_tol everywhere.

  • pressure_warm_start (bool) – Whether to seed each pressure solve with the previous sub-step’s result. Defaults to False.

  • linear_solve_max_iter (int | None) – Iteration limit for the advection and pressure solves. None (the default) leaves the solver’s own limit in place.

  • exclude_advection_solve_gradients (bool | None) – Drop the gradient of the advection solve. Diagnostic only; None (the default) keeps it.

  • exclude_pressure_solve_gradients (bool | None) – Drop the gradient of the pressure solve. Diagnostic only; None (the default) keeps it.

  • exclude_pressure_gradient_adjoint (bool | None) – Drop the pressure path of the PISO velocity-correction backward. Diagnostic only; None (the default) keeps it.

n_envs: int | None

Number of environments simulated together, see

FluidEnv. None (the default) is a single

environment.

References

[1] M. Tokarev, E. Palkin, and R. Mullyadzhanov, “Deep Reinforcement Learning Control of Cylinder Flow Using Rotary Oscillations at Low Reynolds Number,” Energies, vol. 13, no. 22, Art. no. 22, Jan. 2020, doi: 10.3390/en13225920.

property id: str

Unique identifier for the environment.