Airfoil Problem

class blackbox.airfoil_adflow_cst_problem.problem.AirfoilADflowCST(options)[source]

Bases: BaseProblem

__call__(x, return_results=False)[source]

Method to evaluate given sample(s). Input can be a single or multiple samples of size (num_inputs,) or (n_samples,num_inputs)

Parameters:
  • x (np.ndarray) – a numpy array representing samples that will be evaluated

  • return_results (bool) – flag to determine if the results should be returned or not. This should be set to True only when you want this function to return the results. NOTE: This is only useful when you are doing sequential data generation

add_parameter(name, lower_bound, upper_bound)[source]

Method for adding a parameter for the airfoil problem

Parameters:
  • name (str) –

    name of the parameter to be added. It can only be:

    • lower_cst: lower surface cst coefficients

    • upper_cst: upper surface cst coefficients

    • alpha: angle of attack of the flow

    • mach: mach number of the flow

    • reynolds: reynolds number for the flow

  • lower_bound (float or np.ndarray) – lower bound for the parameter. It should be a 1D numpy array if the parameter is lower_cst or upper_cst, otherwise a float

  • upper_bound (float or np.ndarray) – upper bound for the parameter. It should be a 1D numpy array if the parameter is lower_cst or upper_cst, otherwise a float

calculate_area(x)[source]

Method to calculate the area of an airfoil shape based on given parameters

Parameters:

x (np.ndarray) – set of parameters based on which airfoil area will be computed

Returns:

area – area of the airfoil computed based on the given set of parameters

Return type:

float

read_results(dir_name)[source]

Method to read scalars.json and field_outputs.hdf5 files containing results from an airfoil analysis and convert it to a dictionary which can be used later

Parameters:

dir_name (str) – name of directory where the results from the analysis are saved

Returns:

out – a dictionary containing data stored in the folder

Return type:

dict