Structures optimization Documentation#

class tuduam.structures.optimization.ProblemFixedPanel(shear_y: float, shear_x: float, moment_y: float, moment_x: float, applied_loc: float, chord: float, len_sec: float, upper_bnds: list, lower_bnds: list, box_struct: Wingbox, mat_struct: Material, path_coord: str, **kwargs)[source]#

The following problem sets up an exploration of a wingbox for a fixed amount of stringers per cell. Since it is difficult for an optimizer like COBYLA to find a global minimum, a genetic algorithm is set up first to explore the design space. This problem sets up the problem as defined in (PYMOO).

Warning

This optimization problem is not compatible with stringer area because of the constraints requiring stringer geometry.

Parameters:
shear_yfloat

Shear force applied in the y-direction.

shear_xfloat

Shear force applied in the x-direction.

moment_yfloat

Bending moment around the y-axis.

moment_xfloat

Bending moment around the x-axis.

applied_locfloat

Location at which the load is applied.

chordfloat

Chord length of the wingbox section.

len_secfloat

Length of the wingbox section.

box_structWingbox

Wingbox structure, which includes details about geometry, materials, and discretization.

mat_structMaterial

Material properties used in the wingbox.

path_coordstr

Path to the file containing the airfoil coordinates.

upper_bndslist, optional

A list containing the upper bounds of the optimization.

lower_bndslist, optional

A list containing the lower bounds of the optimization.

Attributes:
shear_yfloat

Vertical shear force applied to the section.

shear_xfloat

Horizontal shear force applied to the section.

moment_yfloat

Bending moment around the Y-axis applied to the section.

moment_xfloat

Bending moment around the X-axis applied to the section.

applied_locfloat

The location along the chord where the load is applied.

chordfloat

The length of the wing chord at the section where loads are applied.

len_secfloat

The length of the wing section being analyzed in the spanwise direction, i.e., the distance to the next rib.

box_structWingbox

Data structure describing the structural configuration of the wingbox at the section.

mat_structMaterial

The material properties used in the wing section.

path_coordstr

File path or identifier for coordinates related to the section.

wingbox_objobject

The object used to avoid repetitive computations.

_evaluate(x, out, *args, **kwargs)[source]#

The function is executed at each element in the optimization. The arguments that are passed should be in the following order: t_sk_cell, t_sp, t_st, w_st, h_st. Together, they give a total length of N + 4, where N is the number of cells. This is internally checked, and if it is not the case, a runtime error will be raised.

Parameters:
xlist

The design variable vector which is in the following format [t_sk_cell, t_sp, t_st, w_st, h_st].

shearfloat

The shear force for which we’re optimizing.

momentfloat

The moment for which we’re optimizing.

applied_locfloat

The applied location of the shear force on the wingbox.

str_lstlist

A list with the amount of stringers per cell.

Raises:
RuntimeError

If the flattened design vector does not match the specified wingbox properties.

class tuduam.structures.optimization.ProblemFreePanel(shear_y: float, shear_x: float, moment_y: float, moment_x: float, applied_loc: float, chord: float, len_sec: float, upper_bnds: list, lower_bnds: list, box_struct: Wingbox, mat_struct: Material, path_coord: str, **kwargs_intern)[source]#

The following problem sets up a discrete variable problem which optimizes the amount of stringers per cell. This is done in a separate problem as changing the amount of stringers changes the amount of panels and hence the amount of constraints. Most optimizers do not allow this, hence the following problem uses the output of the WingboxFixedPanel to abide by the constraints.

Parameters:
shear_yfloat

Shear force applied in the y-direction.

shear_xfloat

Shear force applied in the x-direction.

moment_yfloat

Bending moment around the y-axis.

moment_xfloat

Bending moment around the x-axis.

applied_locfloat

Location at which the load is applied.

chordfloat

Chord length of the wingbox section.

len_secfloat

Length of the wingbox section.

upper_bnds: list

A list of N + 4 long containing the upper bounds, where N is the amount of cells. The bounds are presented in the following order t_sk_cell, t_sp, t_st, w_st, h_st.

lower_bnds: list

A list of N + 4 long containing the lower bounds, where N is the amount of cells. The bounds are presented in the following order t_sk_cell, t_sp, t_st, w_st, h_st.

box_structWingbox

Wingbox structure, which includes details about geometry, materials, and discretization.

mat_structMaterial

Material properties used in the wingbox.

path_coordstr

Path to the file containing the airfoil coordinates.

kwargs_interndict

Additional keyword arguments to pass settings and options to the genetic algorithm optimization functions.

Attributes:
box_paramslist

List to store parameters of the wingbox for optimization.

shear_yfloat

Shear force applied in the y-direction.

shear_xfloat

Shear force applied in the x-direction.

moment_yfloat

Bending moment around the y-axis.

moment_xfloat

Bending moment around the x-axis.

applied_locfloat

Location at which the load is applied.

chordfloat

Chord length of the wingbox section.

len_secfloat

Length of the wingbox section.

box_structWingbox

Wingbox structure, which includes details about geometry, materials, and discretization.

mat_structMaterial

Material properties used in the wingbox.

path_coordstr

Path to the file containing the airfoil coordinates.

kwargs_interndict

Additional keyword arguments for the optimization functions. Mostly used to pass any keyword arguments to ProblemFixedPanel

_evaluate(x, out, *args, **kwargs) None[source]#

This function gets evaluated for each ‘element’, where an element in this case is a single sequence of n_var long. For more information, please see the documentation of the pymoo library.

Parameters:
xnp.ndarray

A list of n_var long containing the amount of stringers per cell.

outdict

A dictionary containing the constraints and objective.

class tuduam.structures.optimization.SectionOpt(path_coord: str, chord: float, len_sec: float, wingbox_struct: Wingbox, material_struct: Material)[source]#

The following class allows for the optimization of a single airfoil section. The class assumes that the correct material properties have been embedded in Material, and an initial estimate should be embedded in the Wingbox class.

Parameters:
path_coordstr

The path to the coordinate file of the airfoil that is used.

chordfloat

The chord size.

len_secfloat

The length of the section, that is the length to the next rib.

wingbox_structWingbox

The wingbox structure.

material_structMaterial

The material data structure.

Attributes:
path_coordstr

The path to the coordinate file of the airfoil that is used.

chordfloat

The chord size.

len_secfloat

The length of the section, that is the length to the next rib.

box_structWingbox

The wingbox data structure.

mat_structMaterial

The material data structure.

_wingbox_objIdealWingbox or None

The wingbox object used for computations.

GA_optimize(shear_y: float, shear_x: float, moment_y: float, moment_x: float, applied_loc: float, upper_bnds: list, lower_bnds: list, n_gen: int = 50, pop: int = 100, verbose: bool = True, seed: int = 1, multiprocess: bool = False, cores: int = 4, save_hist: bool = True)[source]#

The following function executes the Genetic Algorithm (GA) to optimize the wingbox given to the overarching class with the loads fed to the function. For more information on the loads specification please see stress_analysis. Additionally, there are some keywords which are explained below.

Parameters:
shearfloat

The internal shear force acting at the section.

momentfloat

The internal moment acting at the section.

applied_locfloat

The position of the internal shear force given as a ratio to the chord.

upper_bnds: list

A list of N + 4 long containing the upper bounds, where N is the amount of cells. The bounds are presented in the following order t_sk_cell, t_sp, t_st, w_st, h_st.

lower_bnds: list

A list of N + 4 long containing the lower bounds, where N is the amount of cells. The bounds are presented in the following order t_sk_cell, t_sp, t_st, w_st, h_st.

n_genint, optional

The number of generations allowed before termination, defaults to 50.

popint, optional

The generation size, defaults to 50.

verbosebool, optional

If true, will print the results of all generations, defaults to True.

seedint, optional

The seed for the random generations of the samples, defaults to 1.

coresint, optional

The number of cores used for the parallelization of the evaluations, defaults to multiprocessing.cpu_count().

save_histbool, optional

Saves the history in the result object if true, defaults to True.

Returns:
pymoo.core.result.Result

Returns the result class from pymoo, which will also contain the history if specified true. Please see the example for use cases (example).

full_section_opt(shear_y: float, shear_x: float, moment_x: float, moment_y: float, applied_loc: float, n_gen_full: int = 50, pop_full: int = 100, verbose_full: bool = True, cores: int = 4, seed: int = 1, multiprocess_full: bool = True, save_hist_full: bool = True, **kwargs)[source]#

The following function handles the full optimization of the wingbox. Compared to the GA_optimize(), this function also varies the amount of stringers per cell to find the optimum design. In order to do this, it utilizes all previously defined optimizations in combination with a discrete Genetic Algorithm variable optimization.

Parameters:
shearfloat

The shear force for which we’re optimizing.

momentfloat

The moment for which we’re optimizing.

applied_locfloat

The applied location of the shear force on the wingbox.

n_gen_fullint, optional

The number of generations for the full optimization, defaults to 50.

verbose_fullbool, optional

If true, will print the results of all generations for the full optimization, defaults to True.

seedint, optional

The seed for the random generations of the samples, defaults to 1.

save_hist_fullbool, optional

Saves the history in the result object if true, defaults to True.

optimize_cobyla(shear_y: float, shear_x: float, moment_y: float, moment_x: float, applied_loc: float, str_lst: list, bnd_mult: int = 1000.0, x0: list | None = None) OptimizeResult[source]#

Optimizes the design using the COBYLA optimizer with the constraints defined in IsotropicWingboxConstraints. The optimization parameters are the skin thickness in each cell, the spar thickness, and the area of the stringers. Hence the resulting design vector is x = []. The amount of stringers is not an optimization parameter here as this would result in a varying amount of constraints which is not supported by COBYLA. Hence, the result of this will be fed to a different optimizer.

Parameters:
shearfloat

The shear force for which we’re optimizing.

momentfloat

The moment for which we’re optimizing.

applied_locfloat

The applied location of the shear force on the wingbox.

str_listlist

List of the amount of stringers per cell.

bnd_multint, optional

A multiplier to increase the enforcement of the bounds on the variables, defaults to 1000.

x0list, optional

A more explicit way to define the initial estimate instead of taking it from the wingbox structure, defaults to None.

Returns:
scipy.optimize.OptimizeResult

The result of the optimization process.