Wing Problem

class blackbox.wing_problem.problem.WingADflowVSP(options)[source]

Bases: BaseProblem

__call__(x, return_results=False)[source]

Method to evaluate given x. It can be a single or multiple samples of size (d,) or (N,d) where N is the number of samples and d is the number of parameters added

Parameters:
  • x (np.ndarray) – a numpy array representing values for added parameters

  • 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

property bounds

Method to get upper and lower bound based on added parameters

Returns:

bounds – a tuple containing two 1d numpy arrays - one for lower bound and other for upper bound

Return type:

tuple

read_results(dir_name)[source]

Method to read scalars.json and field_outputs.hdf5 files containing results from a wing 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

class blackbox.wing_problem.wing_vsp.WingVSP(vsp_file)[source]

Bases: object

add_airfoil_cst_parameters(surface, lower, upper, sections)[source]

Method to add entire upper or lower airfoil as a parameter for analysis

Currently, airfoil is parameterized using CST method only

Parameters:
  • surface (str) – a string denoting whether to add upper or lower airfoil surface

  • lower (np.ndarray) – a 1D numpy array containing lower bound for all the CST coefficients

  • upper (np.ndarray) – a 1D numpy array containing upper bound for all the CST coefficients

  • sections (list) – a list containing section indices whose CST coefficients are to be added as a parameter. NOTE: If there is more than one entry in this list, then all those sections will have uniform airfoil shape parametrization

add_shape_parameter(name, lower, upper, sections)[source]

Method for adding a single wing planform parameter for analysis

Example: span, dihedral, sweep, twist, root chord, and tip chord

Parameters:
  • name (str) –

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

    • Span: span of the section

    • Root_Chord: root chord of the section

    • Tip_Chord: tip chord of the section

    • Dihedral: dihedral of the section

    • Sweep: sweep of the section

    • Twist: twist of the section

    NOTE: You can add a single parameter for a set of sections, refer to

    sections argument for more detail

  • lower (float) – lower bound for the parameter

  • upper (float) – upper bound for the parameter

  • sections (list) – a list denoting which section the parameters belongs to. The list must contain integers between 1 and maximum number of sections. If the list contains more than one entires, then only value will control the parameter across given section numbers.

compute_volume(x)[source]

Method to compute volume of the wing for given set of parameters

Parameters:

x (np.ndarray) – 1D numpy array that contains value of the parameters

Returns:

volume – volume of the wing based on given parameters

Return type:

float

get_pygeo_parameter_dict(x)[source]

Method to get pygeo openvsp parameter dictionary for a given set of parameters

This method is useful when you want to create a pygeo openvsp object from scratch and add design variables to it

Parameters:

x (np.ndarray) – 1D numpy array that contains value of the parameters

Returns:

pygeo_params – a key-value pairs that contains pygeo paramters and corresponding parameter values

Return type:

dict[str, float]