RBCEnv3D
- class fluidgym.envs.rbc.RBCEnv3D(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 3D 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 π.
use_marl (bool) – Whether to enable multi-agent reinforcement learning mode.
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] J. Vasanth, J. Rabault, F. Alcántara-Ávila, M. Mortensen, and R. Vinuesa, “Multi-agent Reinforcement Learning for the Control of Three-Dimensional Rayleigh-Bénard Convection,” Flow, Turbulence and Combustion, Dec. 2024, doi: 10.1007/s10494-024-00619-2.
- plot_actuation(action: Tensor, action_smooth: Tensor) None[source]
Plot the heater actuation profiles before and after smoothing.
- Parameters:
action (torch.Tensor) – The original heater action profile of shape (n_heaters, n_heaters).
action_smooth (torch.Tensor) – The smoothed heater action profile of shape (n_heaters, n_heaters).
- property render_shape: tuple[int, int, int]
The shape of the rendered domain.