-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7cd1557
commit 1ac124f
Showing
7 changed files
with
476 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
""" | ||
An example to show how to combine NACA5 airfoil_generator and XFOIL | ||
""" | ||
|
||
from airfoil_generators.naca5series import NACA5 | ||
from xfoil.xfoil import oper_visc_cl | ||
import os | ||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
Re = 1000000 | ||
Cl = 0.2 | ||
|
||
drags = np.zeros((5,3)) | ||
|
||
for i in range(1,6): | ||
if i==1: | ||
mld = 210 | ||
elif i==2: | ||
mld = 220 | ||
elif i==3: | ||
mld = 230 | ||
elif i==4: | ||
mld = 240 | ||
else: | ||
mld = 250 | ||
|
||
if mld == 210: | ||
m = .0580 | ||
k1 = 361.40 | ||
p = 0.05 | ||
elif mld ==220: | ||
m = .1260 | ||
k1 = 51.640 | ||
p = 0.10 | ||
elif mld == 230: | ||
m = .2025 | ||
k1 = 15.957 | ||
p = .15 | ||
elif mld == 240: | ||
m = .2900 | ||
k1 = 6.643 | ||
p = 0.20 | ||
elif mld == 250: | ||
m = .3910 | ||
k1 = 3.23 | ||
p = .25 | ||
for t in range(13,16): | ||
airfoil = NACA5(mld,t) | ||
|
||
temp_af_filename = "temp_airfoil_{}{}.dat".format(mld,t) | ||
|
||
with open(temp_af_filename,'w') as af: | ||
af.write(airfoil.get_coords_plain()) | ||
|
||
polar = oper_visc_cl(temp_af_filename, Cl, Re, iterlim=1000) | ||
|
||
try: | ||
drags[i-1][t-13] = polar[0][0][2] | ||
except IndexError: | ||
raise Warning("Shit! XFOIL didn't converge on NACA{}{} at Cl={}.".format(mld,t,Cl)) | ||
|
||
xl, yl, xu, yu, xc, yc = airfoil.get_coords() | ||
def translated_plt(x, y, *args): | ||
plt.plot(x*0.8 + (t-12.9), y*0.8 + (i-0.5) , *args) | ||
translated_plt(xl, yl, 'w') | ||
translated_plt(xu, yu, 'w') | ||
translated_plt(xc, yc, 'w--') | ||
|
||
os.remove(temp_af_filename) | ||
|
||
print drags | ||
plt.pcolor(drags, cmap=plt.cm.RdBu) | ||
|
||
plt.xlabel("Location of max. camber $p$") | ||
plt.ylabel("Max. camber $m$") | ||
|
||
cbar = plt.colorbar() | ||
cbar.ax.set_ylabel("Drag coefficient $C_d$") | ||
|
||
plt.tight_layout() | ||
plt.yticks( (.5,1.5,2.5,3.5,4.5), ("210t", "220t", "230t", "240t", "250t") ) | ||
plt.xticks( (.5,1.5,2.5), ("mld13", "mld14", "mld15") ) | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This file lets Python see this directory as module. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
1.000035 0.001575 | ||
0.999651 0.001651 | ||
0.998499 0.001879 | ||
0.996582 0.002258 | ||
0.993903 0.002786 | ||
0.990464 0.003461 | ||
0.986273 0.004282 | ||
0.981334 0.005243 | ||
0.975656 0.006342 | ||
0.969248 0.007575 | ||
0.962119 0.008936 | ||
0.954279 0.010420 | ||
0.945742 0.012023 | ||
0.936520 0.013738 | ||
0.926628 0.015560 | ||
0.916080 0.017482 | ||
0.904893 0.019497 | ||
0.893083 0.021600 | ||
0.880670 0.023783 | ||
0.867672 0.026039 | ||
0.854108 0.028362 | ||
0.840001 0.030744 | ||
0.825371 0.033179 | ||
0.810242 0.035658 | ||
0.794635 0.038175 | ||
0.778576 0.040722 | ||
0.762089 0.043293 | ||
0.745199 0.045878 | ||
0.727933 0.048472 | ||
0.710316 0.051065 | ||
0.692376 0.053650 | ||
0.674141 0.056219 | ||
0.655638 0.058764 | ||
0.636896 0.061276 | ||
0.617944 0.063747 | ||
0.598810 0.066167 | ||
0.579525 0.068529 | ||
0.560118 0.070822 | ||
0.540618 0.073038 | ||
0.521056 0.075168 | ||
0.501461 0.077201 | ||
0.481864 0.079129 | ||
0.462295 0.080942 | ||
0.442784 0.082631 | ||
0.423360 0.084187 | ||
0.404054 0.085601 | ||
0.384895 0.086864 | ||
0.365912 0.087967 | ||
0.347136 0.088904 | ||
0.328593 0.089667 | ||
0.310314 0.090249 | ||
0.292326 0.090644 | ||
0.274656 0.090847 | ||
0.257333 0.090853 | ||
0.240382 0.090658 | ||
0.223829 0.090260 | ||
0.207700 0.089657 | ||
0.192020 0.088848 | ||
0.176813 0.087833 | ||
0.160997 0.086627 | ||
0.145763 0.084732 | ||
0.131757 0.082670 | ||
0.117771 0.080218 | ||
0.104338 0.077373 | ||
0.091524 0.074141 | ||
0.079387 0.070538 | ||
0.067984 0.066591 | ||
0.057363 0.062337 | ||
0.047568 0.057818 | ||
0.038632 0.053081 | ||
0.030584 0.048178 | ||
0.023443 0.043161 | ||
0.017221 0.038082 | ||
0.011924 0.032988 | ||
0.007550 0.027927 | ||
0.004092 0.022937 | ||
0.001540 0.018053 | ||
-0.000125 0.013302 | ||
-0.000920 0.008702 | ||
-0.000870 0.004267 | ||
0.000000 0.000000 | ||
0.001641 -0.004032 | ||
0.004003 -0.007769 | ||
0.007056 -0.011226 | ||
0.010772 -0.014418 | ||
0.015122 -0.017369 | ||
0.020080 -0.020100 | ||
0.025621 -0.022638 | ||
0.031722 -0.025007 | ||
0.038365 -0.027233 | ||
0.045536 -0.029342 | ||
0.053224 -0.031358 | ||
0.061426 -0.033301 | ||
0.070141 -0.035192 | ||
0.079376 -0.037048 | ||
0.089143 -0.038883 | ||
0.099459 -0.040708 | ||
0.110345 -0.042530 | ||
0.121823 -0.044350 | ||
0.133920 -0.046168 | ||
0.147130 -0.047969 | ||
0.160202 -0.049553 | ||
0.173739 -0.051406 | ||
0.188886 -0.053092 | ||
0.204515 -0.054593 | ||
0.220601 -0.055907 | ||
0.237120 -0.057036 | ||
0.254046 -0.057978 | ||
0.271353 -0.058737 | ||
0.289014 -0.059315 | ||
0.307002 -0.059714 | ||
0.325290 -0.059940 | ||
0.343847 -0.059996 | ||
0.362647 -0.059889 | ||
0.381660 -0.059624 | ||
0.400856 -0.059208 | ||
0.420206 -0.058648 | ||
0.439679 -0.057952 | ||
0.459246 -0.057126 | ||
0.478876 -0.056178 | ||
0.498539 -0.055117 | ||
0.518204 -0.053951 | ||
0.537841 -0.052687 | ||
0.557420 -0.051334 | ||
0.576910 -0.049900 | ||
0.596280 -0.048392 | ||
0.615502 -0.046818 | ||
0.634545 -0.045187 | ||
0.653379 -0.043505 | ||
0.671976 -0.041779 | ||
0.690307 -0.040017 | ||
0.708344 -0.038227 | ||
0.726058 -0.036414 | ||
0.743422 -0.034585 | ||
0.760410 -0.032748 | ||
0.776994 -0.030908 | ||
0.793150 -0.029072 | ||
0.808852 -0.027246 | ||
0.824077 -0.025437 | ||
0.838800 -0.023651 | ||
0.852998 -0.021894 | ||
0.866651 -0.020172 | ||
0.879736 -0.018492 | ||
0.892234 -0.016859 | ||
0.904124 -0.015280 | ||
0.915390 -0.013760 | ||
0.926012 -0.012306 | ||
0.935976 -0.010923 | ||
0.945264 -0.009616 | ||
0.953864 -0.008392 | ||
0.961761 -0.007255 | ||
0.968943 -0.006210 | ||
0.975400 -0.005261 | ||
0.981121 -0.004414 | ||
0.986097 -0.003671 | ||
0.990321 -0.003037 | ||
0.993786 -0.002514 | ||
0.996486 -0.002104 | ||
0.998418 -0.001811 | ||
0.999578 -0.001634 | ||
0.999965 -0.001575 |
Binary file not shown.
Oops, something went wrong.