-
Notifications
You must be signed in to change notification settings - Fork 32
Add methods to compute camber line, chord line, deform foil wrt max camber #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bladex/profilebase.py
Outdated
return xx_up, xx_down, yy_up, yy_down | ||
|
||
def max_thickness(self, interpolate=False): | ||
def get_chord_line(self, lin_spaced=False, num=500): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This get does not return anything. Rename in compute_chord_line for example.
bladex/profilebase.py
Outdated
self.chord_line = np.array([self.xup_coordinates, | ||
cl_y_coordinates]) | ||
|
||
def get_camber_line(self, interpolate=False, n_interpolated_points=500): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This get does not return anything. Rename in compute_camber_line for example.
bladex/profilebase.py
Outdated
self.get_chord_line(lin_spaced=interpolate, | ||
num=n_interpolated_points) | ||
|
||
camber = self.chord_line[1] + self.camber_line[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you sum?
bladex/profilebase.py
Outdated
trailing edge, hence both the leading and the trailing edges are always | ||
unique. | ||
""" | ||
assert(self.xup_coordinates[0] == self.xdown_coordinates[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid assert
statements, they are removed from code when the compiled code (using optimization flag) is generated. Replace with if..raise
.
bladex/profilebase.py
Outdated
correspond to the same vertical sections, since this would imply | ||
inaccurate measurements for obtaining the camberline. | ||
""" | ||
if (interpolate == True) or \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use backslash for line continuation PEP 3125.
Try to write well-formatted commit and do not exceed to 72 characters per line (here some guidelines). Please consider more meaningful description for the pull-request. |
# required. | ||
cl_x_coordinates, yy_up, yy_down = \ | ||
self.interpolate_coordinates(num=n_interpolated_points)[1:] | ||
cl_x_coordinates, yy_up, yy_down = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need this bracket
bladex/profilebase.py
Outdated
n_points = self.camber_line[0].size | ||
camber = np.zeros(n_points) | ||
for i in range(n_points): | ||
camber[i] = np.linalg.norm(self.chord_line[:,i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this way the camber is always positive, but there are foils with negative camber.
a371ad0
to
1740ad4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not wrap the code by hand, use the code_formatter script: ./code_formatter.sh bladex/profilebase.py
.
Check please the codacy issues introduced.
bladex/profilebase.py
Outdated
self.compute_camber_line(interpolate=interpolate, | ||
n_interpolated_points=n_interpolated_points) | ||
|
||
self.compute_chord_line(lin_spaced=interpolate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uniform the name of the arguments
bladex/profilebase.py
Outdated
self.compute_camber_line(interpolate=interpolate, | ||
n_interpolated_points=n_interpolated_points) | ||
scaling_factor = max_camber_change_percent / 100. + 1. | ||
self.camber_line[1][1:-2] *= scaling_factor # except LE and TE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you are assuming the foil in the reference position you don't need to exclude LE and TE
bladex/profilebase.py
Outdated
self.camber_line = np.array( | ||
[self.xup_coordinates, cl_y_coordinates]) | ||
|
||
def deform_camber_line(self, max_camber_change_percent=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking whether max_camber_change_percent
is None or not, do not assign a default value. Moreover you can rename the argument to percent_change
6566a6a
to
1e182bc
Compare
No description provided.