@@ -379,9 +379,6 @@ def deform_camber_line(self, percent_change, n_interpolated_points=None):
379379
380380 :param float percent_change: percentage of change of the
381381 maximum camber. Default value is None
382- :param bool interpolate: if True, the interpolated coordinates are
383- used to compute the camber line and foil's thickness, otherwise
384- the original discrete coordinates are used. Default value is False.
385382 :param int n_interpolated_points: number of points to be used for the
386383 equally-spaced sample computations. If None then there is no
387384 interpolation, unless the arrays x_up != x_down elementwise which
@@ -415,6 +412,50 @@ def deform_camber_line(self, percent_change, n_interpolated_points=None):
415412 self .yup_coordinates = self .camber_line [1 ] + half_thickness
416413 self .ydown_coordinates = self .camber_line [1 ] - half_thickness
417414
415+ def set_camber_line_max (self , camber_max ):
416+ """
417+ Deform camber line according to a given maximum value.
418+ The percentage of camber wrt to the x/c coordinate does not change, i.e.,
419+ we rescale the camber value by a scalar
420+ Also reconstructs the deformed airfoil's coordinates.
421+
422+ Thus, the percentage of change is defined as follows:
423+
424+ .. math::
425+ \\ frac{\\ text{new magnitude of max camber - old magnitude of
426+ maximum \
427+ camber}}{\\ text{old magnitude of maximum camber}} * 100
428+
429+ A positive percentage means the new camber is larger than the max
430+ camber value, while a negative percentage indicates the new value
431+ is smaller.
432+
433+ We note that the method works only for airfoils in the reference
434+ position, i.e. chord line lies on the X-axis and the foil is not
435+ rotated, since the measurements are based on the Y-values of the
436+ airfoil coordinates, hence any measurements or scalings will be
437+ inaccurate for the foils not in their reference position.
438+
439+ :param float camber_max: maximum camber to be set.
440+ """
441+ old_camber_max = self .max_camber ()
442+ percent_scaling_factor = 100 * (camber_max - old_camber_max ) / (old_camber_max )
443+ # print(percent_scaling_factor)
444+ self .deform_camber_line (percent_scaling_factor )
445+
446+
447+ def set_thickness_max (self , thickness_max ):
448+ """
449+ Deform y_up and y_down coordinates to have the desired thickness max value.
450+ To do so, we compute the ratio between olt thickness and new one
451+
452+ :param float thickness_max: maximum thickness to be set.
453+ """
454+ old_thickness = self .max_thickness ()
455+ ratio_thickness = thickness_max / old_thickness if old_thickness != 0. else 0.
456+ self .yup_coordinates *= ratio_thickness
457+ self .ydown_coordinates *= ratio_thickness
458+
418459 @property
419460 def yup_curve (self ):
420461 """
0 commit comments