DeformationΒΆ

Module to deform blade’s parameters, based on a given parameter file.

Deformation._check_control_points Private method to check if control points are computed.
Deformation._check_deformed Private method to check if the deformed parameters are computed.
Deformation._check_param Private static method that checks the passed parameter.
Deformation._check_spline Private method to check if spline interpolation is computed.
Deformation._optimum_control_points Private static method that computes the optimum coordinates of the B-spline control points.
Deformation.compute_all Computes everything:
Deformation.compute_control_points Compute the control points 2D coordinates for one of the parametric curves.
Deformation.compute_deformed_parameters This method uses the spline npoints interpolation of the parametric curve to extract the parameters corresponding to the radial distribution of the original undeformed array.
Deformation.export_param_file Export a new parameter file with the new deformed parameters, while all other values are kept the same as in the original parameter file with the undeformed parameters.
Deformation.generate_spline Generate the B-spline interpolations, using the information: degree, npoints from the parameter file, as well as the computed 2D coordinates of the control points.
Deformation.plot Plot the parametric curve.
Deformation.update_control_points Update the control point Y coordinate with the deformation values specified in the parameter file.
class Deformation(paramfile)[source]

Bases: object

Deform parameter curves {chord, pitch, rake, skew, camber} according to specific information passed through a parameter file.

The module contains several methods that are able to:

1. compute coordinates of the optimal control points, provided their number from the parameter file.

2. update control points Y coordinates, provided the magnitude of the Y deformation from the parameter file.

3. generate B-spline curve using the computed control points (before or after their deformation), provided npoints from the parameter file for spline estimation.

4. plot parametric curves, with several options. Finally export a new parameter file containing the new deformed parameters.

Parameters:

paramfile (str) – parameter file name

Variables:
  • paramfile (str) – parameter file name
  • param (class) –

    class object instantiated by the module params, and contains all the attributes assigned by reading the parameter file. Possible attributes are:

    • param.radii
    • param.parameters
    • param.nbasis
    • param.degree
    • param.deformations

    First attribute is array defines the radial sections, while the remaining attributes are dictionaries with possible keys: chord, pitch, rake, skew, camber.

  • deformed_parameters (dict) – dictionary that contains the deformed parameters at the same radial sections, provided some tolerance due to the spline interpolation. Possible dictionary keys are the parameters chord, pitch, rake, skew, camber. Default value is array of zeros with length equal to the radial sections.
  • control_points (dict) – dictionary that contains the 2D coordinates of the control points associated with the B-spline parametric curve. The dictionary possible keys are the parameters chord, pitch, rake, skew, camber. Default value is None
  • spline (dict) – dictionary that contains the B-spline interpolation for the parametric curves. The dictionary possible keys are the parameters chord, pitch, rake, skew, camber. Each value is a 2D numpy array containing the radii interpolations against the interpolations for one of the parameters mentioned in the dictionary keys. Default value is None.
_check_control_points(param)[source]

Private method to check if control points are computed.

Parameters:param (str) – passed parameter to check. Valid values are: chord, pitch, rake, skew, camber
Raises:ValueError – if the control points have None value, i.e. not computed
_check_deformed(param)[source]

Private method to check if the deformed parameters are computed.

Parameters:param (str) – passed parameter to check. Valid values are: chord, pitch, rake, skew, camber
Raises:ValueError – if the deformed parameters have array of zeros, i.e. not computed
static _check_param(param)[source]

Private static method that checks the passed parameter.

Parameters:param (str) – passed parameter to check. Valid values are: chord, pitch, rake, skew, camber
Raises:ValueError – if the param value is not one of the previous
_check_spline(param)[source]

Private method to check if spline interpolation is computed.

Parameters:param (str) – passed parameter to check. Valid values are: chord, pitch, rake, skew, camber
Raises:ValueError – if the spline of that parameter curve has None value, i.e. not computed
static _optimum_control_points(X, Y, degree, nbasis, rbf_points)[source]

Private static method that computes the optimum coordinates of the B-spline control points.

Parameters:
  • X (array_like) – Array of original points of the parametric curve X-axis, usually array of the radii sections
  • Y (array_like) – radial distribution of parameter chord or pitch or rake or skew or camber, corresponding to the radial sections in X
  • degree (int) – degree of the B-spline construction for the parametric curve
  • nbasis (int) – number of control points associated with the parametric curve
  • rbf_points (int) – if specified greater than zero, then the X and Y arrays are interpolated using the Wendland C2 radial basis function to produce X and Y arrays with length = rbf_points. The larger number of rbf_points implies better estimation of the optimum control coordinates. To turn it off (i.e. compute control points based on original X, Y arrays) then insert 0. (Negative values or None results in same effect as zero)
Returns:

control points 2D coordinates

Return type:

numpy.ndarray

_plot_parametric_curve(param, original=True, ctrl_points=True, spline=True, rbf=False, rbf_points=500, deformed=False, outfile=None)[source]

Private method to plot the parametric curve. Several options can be specified.

Parameters:
  • param (str) – parameter corresponding to the parametric curve needs to be plotted. possible values are chord, pitch, rake, skew, camber
  • original (bool) – if True, then plot the original points of the parameter at the radii sections.
  • ctrl_points (bool) – if True, then plot the control points of that parametric curve.
  • spline (bool) – If True, then plot the B-spline interpolation of the parametric curve.
  • rbf (bool) – if True, then plot the radial basis functions interpolation of the parametric curve.
  • rbf_points (int) – number of points used for the rbf interpolation, if the flag rbf is set True. Beware that this argument does not have the same function of that when computing the control points, although both uses the radial basis function interpolation with the Wendland basis.
  • deformed (bool) – if True, then plot the deformed points of the parameter radial distribution, estimated using the B-spline interpolations within a given tolerance.
  • outfile (str) – if string is passed, then the plot is saved with that name. If the value is None, then the plot is shown on the screen.
compute_all(rbf_points=1000, tol_chord=0.001, tol_pitch=0.001, tol_rake=0.001, tol_skew=0.001, tol_camber=0.001)[source]
Computes everything:
  • control points 2D coordinates
  • deformed control points
  • spline npoints interpolations
  • deformed parameters of the original arrays

The previous procedure is applied for all the parameters: chord, pitch, rake, skew, camber

Parameters:
  • rbf_points (int) – if greater than zero then the Wendland C2 radial basis function is used to interpolate the original arrays for the parametric curve, so that the control points are computed according to the interpolated arrays. Needless to mention that longer arrays would produce better estimation of the control points optimum coordinates. In order to turn off the rbf interpolation then specify either 0 or -1 (Also a None value can be used too). Default value is 1000
  • tol_chord (float) – tolerance used to extract the chord radial distribution for the deformed B-spline interpolation. Default value is 1e-3
  • tol_pitch (float) – tolerance used to extract the pitch radial distribution for the deformed B-spline interpolation. Default value is 1e-3
  • tol_rake (float) – tolerance used to extract the rake radial distribution for the deformed B-spline interpolation. Default value is 1e-3
  • tol_skew (float) – tolerance used to extract the skew radial distribution for the deformed B-spline interpolation. Default value is 1e-3
  • tol_camber (float) – tolerance used to extract the camber radial distribution for the deformed B-spline interpolation. Default value is 1e-3
compute_control_points(param, rbf_points=1000)[source]

Compute the control points 2D coordinates for one of the parametric curves.

Parameters:
  • param (str) – parameter corresponding to the parametric curve. possible values are chord, pitch, rake, skew, camber
  • rbf_points (int) – if greater than zero then the Wendland C2 radial basis function is used to interpolate the original arrays for the parametric curve, so that the control points are computed according to the interpolated arrays. Needless to mention that longer arrays would produce better estimation of the control points optimum coordinates. In order to turn off the rbf interpolation: specify either 0 or -1 (Also a None value can be used too). Default value is 1000
compute_deformed_parameters(param, tol=0.001)[source]

This method uses the spline npoints interpolation of the parametric curve to extract the parameters corresponding to the radial distribution of the original undeformed array. Therefore the resulting deformed parameters should be arrays of same length like that of the original parameters.

Parameters:
  • param (str) – parameter corresponding to the parametric curve. possible values are chord, pitch, rake, skew, camber
  • tol (float) – tolerance required to find the B-spline estimation within the neighborhood of each of the radii sections. It is important to specify the value carefully as it depends on the order of the original array values, as well as the number of points for the spline interpolations. Default value is 1e-3
export_param_file(outfile='parameters_mod.prm')[source]

Export a new parameter file with the new deformed parameters, while all other values are kept the same as in the original parameter file with the undeformed parameters. In the new parameter file (i.e. with deformed parameters) the deformations arrays become array of zeros.

Parameters:outfile (str) – file name to be written out
generate_spline(param)[source]

Generate the B-spline interpolations, using the information: degree, npoints from the parameter file, as well as the computed 2D coordinates of the control points.

Parameters:param (str) – parameter corresponding to the parametric curve. possible values are chord, pitch, rake, skew, camber
plot(param, original=True, ctrl_points=True, spline=True, rbf=False, rbf_points=500, deformed=False, outfile=None)[source]

Plot the parametric curve. Several options can be specified.

Parameters:
  • param (array_like) – array_like of strings corresponding to the parametric curve that needs to be plotted. possible values are chord, pitch, rake, skew, camber
  • original (bool) – if True, then plot the original points of the parameter at the radii sections. Default value is True
  • ctrl_points (bool) – if True, then plot the control points of that parametric curve. Default value is True
  • spline (bool) – If True, then plot the B-spline interpolation of the parametric curve. Default value is True
  • rbf (bool) – if True, then plot the radial basis functions interpolation of the parametric curve. Default value is True
  • rbf_points (int) – number of points used for the rbf interpolation, if the flag rbf is set True. Beware that this argument does not have the same function of that when computing the control points, although both uses the radial basis function interpolation with the Wendland basis. Default value is 500
  • deformed (bool) – if True, then plot the deformed points of the parameter radial distribution, estimated using the B-spline interpolations within a given tolerance. Default value is False
  • outfile (str) – if string is passed, then the plot is saved with that name. If the value is None, then the plot is shown on the screen. Default value is None
update_control_points(param)[source]

Update the control point Y coordinate with the deformation values specified in the parameter file.

Parameters:param (str) – parameter corresponding to the parametric curve. possible values are chord, pitch, rake, skew, camber