TCF3DBottomEnv

class fluidgym.envs.tcf.TCF3DBottomEnv(resolution_y: int, resolution_x_z: int, L: float, D: float, actor_size: int, reynolds_number_wall: float, adaptive_cfl: float, step_length: float, episode_length: int, local_obs_window: int, local_reward_weight: float, use_marl: bool, C_smag: float = 0.0, use_van_driest: bool = False, init_with_noise: bool = True, dtype: dtype = torch.float32, cuda_device: device | None = None, debug: bool = False, load_initial_domain: bool = True, load_domain_statistics: bool = True, randomize_initial_state: bool = True, enable_actions: bool = True, differentiable: bool = False)[source]

Bases: FluidEnv

Environment for turbulent channel flow control.

Parameters:
  • resolution_y (int) – The resolution of the simulation grid in the wall-normal direction.

  • resolution_x_z (int) – The resolution of the simulation grid in the streamwise and spanwise directions.

  • L (float) – The length of the domain in the streamwise direction.

  • D (float) – The length of the domain in the spanwise direction.

  • actor_size (int) – The size of each actor region in grid cells.

  • reynolds_number_wall (float) – The Reynolds number based on the wall shear velocity and half channel height.

  • adaptive_cfl (float) – Target CFL number for adaptive time stepping.

  • step_length (float) – The non-dimensional 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) – The weight of the local reward in the total reward.

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

  • C_smag (float) – The Smagorinsky constant for the LES model. If 0, no LES model is used. Defaults to 0.0.

  • use_van_driest (bool) – Whether to use Van Driest damping for the LES model. Defaults to False.

  • init_with_noise (bool) – Whether to initialize the velocity field with added noise. Defaults to True.

  • 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.

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

  • 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.

References

[1] L. Guastoni, J. Rabault, P. Schlatter, H. Azizpour, and R. Vinuesa, “Deep reinforcement learning for turbulent drag reduction in channel flows,” Eur. Phys. J. E, vol. 46, no. 4, p. 27, Apr. 2023, doi: 10.1140/epje/s10189-023-00285-8.

[2] Z. Zhao et al., “Physics-informed Neural-operator Predictive Control for Drag Reduction in Turbulent Flows,” Oct. 03, 2025, arXiv: arXiv:2510.03360. doi: 10.48550/arXiv.2510.03360.

property id: str

Unique identifier for the environment.

property initial_domain_id: str

Unique identifier for the initial domain.

load_opposition_control_episode(idx: int, mode: EnvMode) DataFrame[source]

Load the opposition control episode data from a CSV file.

Parameters:
  • idx (int) – The index of the episode.

  • mode (EnvMode) – The mode of the environment (e.g., training, evaluation).

Returns:

The DataFrame containing the episode data.

Return type:

pd.DataFrame

property n_agents: int

The number of agents in the environment.

plot(output_path: Path | None = None) None[source]

Plot the environments configuration.

Parameters:

output_path (Path | None) – Path to save the plot. If None, the current directory is used. Defaults to None.

property render_shape: tuple[int, ...]

The shape of the rendered domain.

save_opposition_control_episode(idx: int, mode: EnvMode, df: DataFrame) None[source]

Save the opposition control episode data to a CSV file.

Parameters:
  • idx (int) – The index of the episode.

  • mode (EnvMode) – The mode of the environment (e.g., training, evaluation).

  • df (pd.DataFrame) – The DataFrame containing the episode data to save.

property scale_actions: bool

Whether actions are scaled by \(u_{\\mathrm{wall}}\).

property tau_ref: float

Reference bottom wall shear stress for normalization.