preprocess_windio_for_BE.WindIOPreprocessor Class Reference

Kynema API: preprocess_windio_for_BE.WindIOPreprocessor Class Reference
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
preprocess_windio_for_BE.WindIOPreprocessor Class Reference

Public Member Functions

 __init__ (self, str windIO_file)
 
Dict[str, Any] process_all_data (self, np.ndarray aero_nodes)
 
None save_processed_data (self, Dict[str, Any] processed_data, str output_file)
 

Public Attributes

 windIO_file
 
 windIO_data
 
 blade_data
 
 span_positions
 
 airfoil_labels
 
 airfoil_data
 
 polar_data
 
 outer_shape_data
 

Protected Member Functions

 _initialize_data (self)
 
None _load_windIO_file (self)
 
None _extract_blade_data (self)
 
None _extract_airfoil_data (self)
 
None _extract_polar_data (self)
 
Tuple[Dict[str, Any], Dict[str, Any]] _interpolate_airfoil_cross_sections (self, np.ndarray aero_nodes)
 
Dict[str, np.ndarray] _normalize_airfoil_coordinates (self, str airfoil_name, int num_points=300)
 
Dict[str, Dict[str, Any]] _setup_property_interpolators (self)
 
Dict[str, Dict[str, Any]] _normalize_all_airfoil_polars (self, Dict[str, np.ndarray] target_conditions)
 
Dict[str, Any] _normalize_single_airfoil_polars (self, Dict[str, Any] polar_set, Dict[str, np.ndarray] target_conditions)
 
Dict[str, Any] _interpolate_polars_at_aero_node (self, str node_name, float node_position, List[str] source_airfoils, Dict[str, Dict[str, Any]] normalized_polars)
 
 _interpolate_polars_via_pchip (self, normalized_polars, weight)
 
Dict[str, Tuple[float, float]] _calculate_aerodynamic_center_coords (self, Dict[str, Any] interpolated_cross_sections)
 

Detailed Description

Preprocessor for windIO airfoil and polar data interpolation.

Constructor & Destructor Documentation

◆ __init__()

preprocess_windio_for_BE.WindIOPreprocessor.__init__ (   self,
str  windIO_file 
)
Initializes the preprocessor with a windIO file and loads all data attributes.

Args:
    windIO_file: Path to the input windIO YAML file

Member Function Documentation

◆ _calculate_aerodynamic_center_coords()

Dict[str, Tuple[float, float]] preprocess_windio_for_BE.WindIOPreprocessor._calculate_aerodynamic_center_coords (   self,
Dict[str, Any]  interpolated_cross_sections 
)
protected
Calculate local x-y coordinates of aerodynamic centers for each aerodynamic node.

This function performs the following steps:
- Scales airfoil coordinates by chord length
- Positions aerodynamic center along x-axis (chord line) based on aerodynamic_center value
- Applies section offsets (section_offset_x, section_offset_y)
- Applies twist rotation around leading edge

Args:
    interpolated_cross_sections: Dictionary containing interpolated cross-section data

Returns:
    Dictionary with node_name -> (x_ac, y_ac) coordinates of aerodynamic centers

◆ _extract_airfoil_data()

None preprocess_windio_for_BE.WindIOPreprocessor._extract_airfoil_data (   self)
protected
Extracts airfoil data from windIO structure.

◆ _extract_blade_data()

None preprocess_windio_for_BE.WindIOPreprocessor._extract_blade_data (   self)
protected
Extracts blade and outer_shape_data from windIO structure.

◆ _extract_polar_data()

None preprocess_windio_for_BE.WindIOPreprocessor._extract_polar_data (   self)
protected
Extracts polar data from airfoil data.

◆ _initialize_data()

preprocess_windio_for_BE.WindIOPreprocessor._initialize_data (   self)
protected
Initializes all data attributes.

Calls the following methods in order:
- _load_windIO_file -> loads and parses the windIO YAML file
- _extract_blade_data -> extracts blade and outer_shape_data from windIO structure
- _extract_airfoil_data -> extracts airfoil data from windIO structure
- _extract_polar_data -> extracts polar data from airfoil data

◆ _interpolate_airfoil_cross_sections()

Tuple[Dict[str, Any], Dict[str, Any]] preprocess_windio_for_BE.WindIOPreprocessor._interpolate_airfoil_cross_sections (   self,
np.ndarray  aero_nodes 
)
protected
Interpolates airfoil cross-sections at aerodynamic nodes along the blade span.

This function:
- Uses spanwise positions from windIO outer_shape data to locate provided airfoils
- Normalizes all windIO-provided airfoils to a common grid
- Interpolates new airfoil cross-section between normalized airfoils using the piecewise
  cubic hermite polynomial (PCHIP) interpolation
- Interpolates chord, twist, section_offset_y, section_offset_x, relative thickness (rthick),
  and aerodynamic center using PCHIP

Args:
    aero_nodes: Array of aerodynamic node positions [0-1] along blade span, r/R

Returns:
    Tuple with two dictionaries:
    - normalized_airfoils: Dictionary with normalized airfoil cross-sections
    - interpolated_cross_sections: Dictionary with interpolated airfoil cross-sections at each node, including:
        - airfoil_coordinates: normalized x,y coordinates
        - interpolation_method: 'direct_copy' or 'pchip'
        - source_airfoils: list of provided airfoils used
        - interpolation_weight: weight for interpolation between two airfoils
        - chord: interpolated chord
        - twist: interpolated twist
        - section_offset_y: interpolated section offset y
        - section_offset_x: interpolated section offset x
        - relative_thickness: interpolated thickness ratio
        - aerodynamic_center: interpolated aerodynamic center

◆ _interpolate_polars_at_aero_node()

Dict[str, Any] preprocess_windio_for_BE.WindIOPreprocessor._interpolate_polars_at_aero_node (   self,
str  node_name,
float  node_position,
List[str]  source_airfoils,
Dict[str, Dict[str, Any]]   normalized_polars 
)
protected
Interpolates polar data at a specific aerodynamic node using pre-normalized data.

Args:
    node_name: Name of the aerodynamic node
    node_position: Position along blade span, r/R [0-1]
    source_airfoils: List of source airfoil names for interpolation
    normalized_polars: Pre-normalized polar data for all windIO-provided airfoils

Returns:
    Dictionary containing interpolated polar data for this node

◆ _interpolate_polars_via_pchip()

preprocess_windio_for_BE.WindIOPreprocessor._interpolate_polars_via_pchip (   self,
  normalized_polars,
  weight 
)
protected
Interpolates polar data at a specific spanwise position using PCHIP interpolation
across all available airfoils.

Args:
    normalized_polars: Dictionary of normalized polar data for all airfoils
    weight: Spanwise position for interpolation [0-1]

Returns:
    Interpolated polar data

◆ _load_windIO_file()

None preprocess_windio_for_BE.WindIOPreprocessor._load_windIO_file (   self)
protected
Loads and parses the windIO YAML file.

◆ _normalize_airfoil_coordinates()

Dict[str, np.ndarray] preprocess_windio_for_BE.WindIOPreprocessor._normalize_airfoil_coordinates (   self,
str  airfoil_name,
int   num_points = 300 
)
protected
Normalizes/regularizes airfoil coordinates to a common grid based on normalized surface curve fraction.
Uses PCHIP interpolation with open trailing edge.

This normalization/regularization is necessary for blade element analysis because:
- Different airfoils may have different numbers of coordinate points
- Original coordinates may have non-uniform spacing along the surface
- Blade span interpolation i.e. interpolation between two airfoils requires the
  airfoils to be in comparable formats

The process splits the airfoil into upper/lower surfaces, parameterizes each by arc
length, then interpolates to a uniform grid (uniform spacing, 300 points by default)
for consistent analysis.

Args:
    airfoil_name: Name of the airfoil
    num_points: Number of points for normalized grid

Returns:
    Dictionary with normalized x, y coordinates

◆ _normalize_all_airfoil_polars()

Dict[str, Dict[str, Any]] preprocess_windio_for_BE.WindIOPreprocessor._normalize_all_airfoil_polars (   self,
Dict[str, np.ndarray]  target_conditions 
)
protected
Normalizes/regularizes polar data for all available airfoils to a common angle-of-attack grid.

This function processes all airfoils that have polar data available in the windIO file.
For each airfoil, it interpolates the polar coefficients (cl, cd, cm) to a common
angle-of-attack grid using linear interpolation.

Args:
    target_conditions: Target conditions i.e. angle-of-attack range for interpolation.
    The target conditions typically include a standardized angle-of-attack range
    (e.g., -π to +π radians at 1° resolution) that will be used consistently across
    all airfoils for blade element analysis.

Returns:
    Dictionary with airfoil names as keys and their normalized polar data as values

◆ _normalize_single_airfoil_polars()

Dict[str, Any] preprocess_windio_for_BE.WindIOPreprocessor._normalize_single_airfoil_polars (   self,
Dict[str, Any]  polar_set,
Dict[str, np.ndarray]   target_conditions 
)
protected
Processes a single airfoil polar set by extracting coefficients and interpolating to target angle-of-attack
(AoA) conditions using linear interpolation to ensure bounded behavior.

Args:
    polar_set: Single airfoil polar dataset containing 'alpha', 'cl', 'cd', 'cm'
    target_conditions: Target conditions for interpolation

Returns:
    Interpolated polar data as dictionary

◆ _setup_property_interpolators()

Dict[str, Dict[str, Any]] preprocess_windio_for_BE.WindIOPreprocessor._setup_property_interpolators (   self)
protected
Sets up interpolators for blade properties including outer_shape properties
namely chord, twist, section_offset_y, section_offset_x, and rthick, and
airfoil-specific properties namely aerodynamic center.

Returns:
    Dictionary of interpolators for each property

◆ process_all_data()

Dict[str, Any] preprocess_windio_for_BE.WindIOPreprocessor.process_all_data (   self,
np.ndarray  aero_nodes 
)
Processes all airfoil cross-sections and polars by
- normalizing/regularizing the cross-sections and then interpolating the normalized
  cross-sections at each aerodynamic node
- normalizing/regularizing the provided polars in windIO file to a common angle-of-attack
  grid
- interpolating the normalized polars at each aerodynamic node

Args:
    aero_nodes: Aerodynamic node positions

Returns:
    Complete processed dataset

◆ save_processed_data()

None preprocess_windio_for_BE.WindIOPreprocessor.save_processed_data (   self,
Dict[str, Any]  processed_data,
str   output_file 
)
Saves processed data as a new windIO v2.0 file with additional airfoil information
for Blade Element Analysis at aerodynamic nodes.

This method creates a new windIO file that includes:
- All original windIO data
- Processed airfoil cross-sections at aerodynamic nodes
- Processed polar data at aerodynamic nodes

Args:
    processed_data: Processed airfoil and polar data
    output_file: Output windIO file path

Member Data Documentation

◆ airfoil_data

preprocess_windio_for_BE.WindIOPreprocessor.airfoil_data

◆ airfoil_labels

preprocess_windio_for_BE.WindIOPreprocessor.airfoil_labels

◆ blade_data

preprocess_windio_for_BE.WindIOPreprocessor.blade_data

◆ outer_shape_data

preprocess_windio_for_BE.WindIOPreprocessor.outer_shape_data

◆ polar_data

preprocess_windio_for_BE.WindIOPreprocessor.polar_data

◆ span_positions

preprocess_windio_for_BE.WindIOPreprocessor.span_positions

◆ windIO_data

preprocess_windio_for_BE.WindIOPreprocessor.windIO_data

◆ windIO_file

preprocess_windio_for_BE.WindIOPreprocessor.windIO_file

The documentation for this class was generated from the following file: