RBCEnv2D
- class fluidgym.envs.rbc.RBCEnv2D(rayleigh_number: float, prandtl_number: float, n_heaters: int, resolution: int, adaptive_cfl: float, dt: float, step_length: float, episode_length: int, local_obs_window: int, local_reward_weight: float | None, uniform_grid: bool, aspect_ratio: 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)[source]
Bases:
RBCEnvBaseEnvironment for 2D Rayleigh-Bénard Convection (RBC).
- Parameters:
rayleigh_number (float) – The Rayleigh number for the simulation.
prandtl_number (float) – The Prandtl number for the simulation.
n_heaters (int) – The number of heaters in the domain.
resolution (int) – The width (resolution) of each heater in grid cells.
adaptive_cfl (float) – Target CFL number for adaptive time stepping.
dt (float) – The time step size for the simulation.
step_length (float) – The physical time length of each environment step.
episode_length (int,) – The number of steps per episode.
local_obs_window (int) – The size of the local observation window for each agent.
local_reward_weight (float | None) – Weighting factor for local rewards in multi-agent settings. Has to be set for multi-agent RL. Defaults to None.
uniform_grid (bool) – Whether to use a uniform grid. If False, a non-uniform grid is used.
aspect_ratio (float) – The aspect ratio (L/H) of the domain in multiples of π.
dtype (torch.dtype) – The data type for the simulation tensors. 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 the initial domain from file. Defaults to True.
load_domain_statistics (bool) – Whether to load precomputed domain statistics. Defaults to True.
randomize_initial_state (bool) – Whether to randomize the initial state of the simulation. Defaults to False.
enable_actions (bool) – Whether to enable action application in the environment. Defaults to True.
differentiable (bool) – Whether to enable differentiable simulation. Defaults to False.
References
[1] C. Vignon, J. Rabault, J. Vasanth, F. Alcántara-Ávila, M. Mortensen, and R. Vinuesa, “Effective control of two-dimensional Rayleigh-Bénard convection: Invariant multi-agent reinforcement learning is all you need,” Physics of Fluids, vol. 35, no. 6, p. 065146, June 2023, doi: 10.1063/5.0153181.
- property render_shape: tuple[int, ...]
The shape of the rendered domain.