Skip to main content

NACA 0012 Airfoil Environment

This module provides NACA 0012 airfoil flow CFD environments for reinforcement learning, including configurations for steady flow and gust response control.

NACA0012Base Objects

class NACA0012Base(MaiaFlowEnv)

Base class for NACA 0012 airfoil environments with Hugging Face integration.

Provides common functionality for NACA airfoil configurations.

__init__

def __init__(env_config: Dict)

Initialize the NACA 0012 base environment.

Arguments:

  • env_config - Environment configuration dictionary.

NACA0012 Objects

class NACA0012(NACA0012Base)

NACA 0012 airfoil environment optimizing lift-to-drag ratio.

This environment controls flow around a NACA 0012 airfoil using synthetic jets. The reward maximizes L/D ratio.

Attributes:

  • numJetsInSimulation - Number of jet actuators in the CFD simulation.

__init__

def __init__(env_config: Dict)

Initialize the NACA 0012 environment.

Arguments:

  • env_config - Environment configuration dictionary.

convert_action

def convert_action(action: np.ndarray) -> np.ndarray

Convert RL action to CFD actuation format.

Arguments:

  • action - Action array from the RL agent.

Returns:

Action sequence for the CFD solver.

get_reward

def get_reward() -> Tuple[float, Dict]

Compute the reward based on lift-to-drag ratio.

Maximizes L/D ratio. Penalizes heavily for negative lift or near-zero drag.

Returns:

Tuple containing:

  • reward: L/D ratio (or -100 for invalid conditions)
  • obj_dict: Dictionary with force information

NACA0012Gust Objects

class NACA0012Gust(NACA0012Base)

NACA 0012 airfoil environment for gust response control.

This environment controls flow around a NACA 0012 airfoil during gust encounters. The reward minimizes deviation from unperturbed baseline forces.

Attributes:

  • unperturbed_avg_drag - Baseline drag coefficient without gust.
  • unperturbed_avg_lift - Baseline lift coefficient without gust.
  • numJetsInSimulation - Number of jet actuators in the CFD simulation.

__init__

def __init__(env_config: Dict)

Initialize the NACA 0012 gust environment.

Arguments:

  • env_config - Environment configuration dictionary.

convert_action

def convert_action(action: np.ndarray) -> np.ndarray

Convert RL action to CFD actuation format.

Arguments:

  • action - Action array from the RL agent.

Returns:

Action sequence for the CFD solver.

get_reward

def get_reward() -> Tuple[float, Dict]

Compute the reward based on deviation from baseline forces.

Minimizes deviation of lift and drag from unperturbed values.

Returns:

Tuple containing:

  • reward: Negative weighted deviation from baseline
  • obj_dict: Dictionary with force information