POLITECHNIKA WARSZAWSKA WYDZIAŁ MECHANICZNY ENERGETYKI I LOTNICTWA ZAKŁAD MECHANIKI PRACA DYPLOMOWA INŻYNIERSKA MAREK CEL OPROGRAMOWANIE DO WYZNACZANIA PODSTAWOWYCH CHARAKTERYSTYK AERODYNAMICZNYCH PŁATA NOŚNEGO SOFTWARE FOR ESTIMATING BASIC AERODYNAMIC CHARACTERISTICS OF AN AIRCRAFT WING 191184 Lotnictwo i Kosmonautyka Promotor: dr inż Zbigniew Paturski Warszawa, marzec 2009
102
Embed
Oprogramowanie do Wyznaczania Podstawowych Charakterystyk ...marekcel.pl/Marek_Cel_-_Praca_Dyplomowa_Inz.pdf · Teoria profilu cienkiego ... 5.2.1. Wprowadzanie danych geometrycznych
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
POLITECHNIKA WARSZAWSKA
WYDZIAŁMECHANICZNY ENERGETYKI I LOTNICTWA
ZAKŁAD MECHANIKI
PRACA DYPLOMOWAINŻYNIERSKA
MAREK CEL
OPROGRAMOWANIE DO WYZNACZANIA PODSTAWOWYCHCHARAKTERYSTYK AERODYNAMICZNYCH PŁATA NOŚNEGO
SOFTWARE FOR ESTIMATING BASIC AERODYNAMICCHARACTERISTICS OF AN AIRCRAFT WING
191184
Lotnictwo i Kosmonautyka
Promotor: dr inż Zbigniew Paturski
Warszawa, marzec 2009
Oświadczenie autora (autorów) pracy
Świadom odpowiedzialności prawnej oświadczam, że przedstawiona praca dyplomowa:
- została napisana przeze mnie samodzielnie i nie zawiera treści uzyskanych w sposób niezgodny z obowiązującymi przepisami,
- nie była wcześniej przedmiotem procedur związanych z uzyskaniem tytułu zawodowego lub stopnia naukowego w wyższej uczelni.
Oświadczam ponadto, że niniejsza wersja pracy jest identyczna z załączoną wersją elektroniczną.
............................................. .............................................. data podpis autora (autorów) pracy
SŁOWA KLUCZOWE: aerodynamika samolotu, numeryczna implementacja teorii linii nośnej Prandtla
W celu dalszej weryfikacji porównane zostały wyniki współczynnika siły nośnej
płata otrzymane za pomocą stworzonego oprogramowania z wynikami otrzymanymi
za pomocą symulacji numerycznej z wykorzystaniem programu FLUENT. Obliczenia
przeprowadzona dla płata o obrysie trapezowym, którego dane geometryczne przedstawia
Tabela 6.2, dla trzech różnych kątów natarcia i prędkości przepływu 60 m/s.
Uzyskane wyniki oraz wartości procentowe błędu względnego przedstawione
zostały w Tabeli 6.6.
Opracowany Program FLUENT Błąd Względny
α [deg] CZ [-] CZ [-] δ [%]
1,00 0,22 0,20213493 8,12
3,00 0,40 0,37158938 7,10
5,00 0,58 0,53382475 7,96
Tabela 6.6
Jak widać na przedstawionej tabeli są pewne rozbieżności wyników pomiędzy
uzyskanymi za pomocą opracowanego w ramach tej pracy kodu, a za pomocą symulacji
numerycznej. Jednak część z tych rozbieżności wynikać może z dokładności odczytu
charakterystyk (pochodna aerodynamiczna i kąt zerowej siły nośnej) profilu NACA 642-
212 z wykresu [27].
Wiedząc, że współczynnik siły nośnej płata obliczany jest za pomocą całkowania
rozkładu współczynnika siły nośnej wzdłuż cięciwy, założyć można, że także rozkład
współczynnika siły nośnej obliczany z wykorzystaniem stworzonego oprogramowania
nie jest obarczony dużym błędem.
Na Rysunkach 6.2 i 6.3 zamieszczono w celach informacyjnych wizualizację
rozkładu współczynnika ciśnienia odpowiednio na górnej i dolnej powierzchni płata przy
kącie natarcia 5 stopni i prędkości przepływu 60 m/s, uzyskane z wykorzystaniem
symulacji numerycznej w programie FLUENT.
- 43 -
6. Analiza uzyskanych wyników
Rysunek 6.2
Rysunek 6.3
- 44 -
7. Wnioski, możliwe zastosowania oraz możliwości rozwoju
7. Wnioski, możliwe zastosowania oraz możliwości rozwoju
Opracowany program znajduje zastosowanie przede wszystkim do wyznaczania
współczynnika siły nośnej płata nośnego, jego rozkładu wzdłuż rozpiętości
oraz współczynnika oporu indukowanego płata na podstawie zadanego obrysu i jego
rozkładu wzdłuż rozpiętości.
Program wykorzystać można podczas optymalizacji obrysu płata nośnego lub jego
końcówki pod względem minimalizacji oporu indukowanego. Innym zastosowaniem może
być pomoc w wyznaczaniu rozkładu momentu zginającego skrzydła na podstawie rozkładu
współczynnika siły nośnej wzdłuż rozpiętości.
Uwolnienie kodu źródłowego i udostępnienie go na zasadach wolnej licencji,
na przykład GNU Public General License niesie za sobą duże możliwości rozwoju
i popularyzacji stworzonego oprogramowania. Wiele istotnych projektów open-source
miało swój początek właśnie w uczelniach wyższych. Doskonałym tego przykładem jest
Licencja X11 wywodząca się z Massachusetts Institute of Technology. Ponieważ na rynku
brak jest podobnego wolnego oprogramowania może ono zyskać popularność w pewnych
kręgach związanych na przykład z modelarstwem i lotnictwem amatorskim.
Samo oprogramowanie jest we wczesnym stadium i wymaga szczegółowego
testowania i wniesienia poprawek zarówno w sferze interfejsu użytkownika
jak i algorytmu obliczeniowego.
Wykorzystana metoda Glauerta nie jest precyzyjna i może dawać niepoprawne
wyniki, dlatego należy rozważyć inny sposób rozwiązywania równania 3.3.16 na przykład
- 45 -
7. Wnioski, możliwe zastosowania oraz możliwości rozwoju
z wykorzystaniem numerycznych procedur rozwiązywania równań różniczkowo-
całkowych.
Kolejną funkcją oprogramowania wymagającą usprawnienia są formularze służące
zapisowi i odczytowi wyników do i z plików. Należałoby rozszerzyć je o pewne
funkcjonalności potwierdzenia nadpisania pliku wynikowego, pewne błędy występują
także podczas porzucania zmian względem wczytanego pliku.
- 46 -
Załączniki
Załączniki
A – Listingi ważniejszych kodów źródłowych
1 #ifndef LINEAR_SOLVER_H2 #define LINEAR_SOLVER_H34 /**5 * System of linear equations solver6 * Thanks to Franciszek Dul, Ph.D. - Warsaw University of Technology7 */89 inline void SWAP( double &a , double &b ) ;1011 int GEN_SOLV( double* x, double* A, int n, int m=1, double a_tol=1.e-12 ) ;1213 #endif
Listing A-1 – linear_solver.h
1 #include "../include/linear_solver.h"2 #include <cmath>3 #include <iostream>45 /**6 * System of linear equations solver7 * Thanks to Franciszek Dul, Ph.D. - Warsaw University of Technology
- 47 -
Załączniki
8 */910 inline void SWAP( double &a , double &b ){ double tmp = a; a = b; b = tmp; }111213 int GEN_SOLV( double* x , double* A , int n , int m , double a_tol ) {14 // n - dimension , m - number of RHS (if m = 1 Ax=b is solved) 15 // A(i,j) = A[n*j+i], i=1...n, j=1...n, 16 // x(i,j) = x[n*k+i], i=1...n, k=1...m, input: RHS; output x 1718 int i, j, jn, k, kn, ir, jx;19 double a_max , hr , d;2021 for( j = 0 , jn = 0; j < n; ++j , jn += n ) {22 a_max = fabs( A[j+jn] );23 ir = j;24 for( i = j+1; i < n; ++i ) {25 if ( ( d = fabs( A[i+jn] ) ) > a_max ) {26 a_max = d;27 ir = i;28 }29 }30 if ( a_max < a_tol ) {31 std::cerr << "ERR: GEN_SOLV , ierr = " << j << std::endl;32 return j;33 }34 if ( ir > j ) {35 for( k = 0 , kn = 0; k < n; ++k , kn += n )36 SWAP( A[j+kn] , A[ir+kn] );37 for( jx = 0 ; jx < m; ++jx )38 SWAP( x[n*jx+j] , x[n*jx+ir] );39 }40 hr = 1.0 / A[j+jn];41 for( jx = 0 ; jx < m; ++jx )42 x[n*jx+j] *= hr;43 for( i = j+1; i < n; ++i )44 A[j+i*n] *= hr;45 for( i = j+1; i < n; ++i ) {
10 /****************************************************************************11 ** PRIVATE MEMBER FUNCTIONS12 ****************************************************************************/1314 /**15 * void Wing::calculateCharacteristics()16 * calculates aerodynamic charasteristics of the wing17 */18 void Wing::calculateCharacteristics() {19 int a, i, n ;20 double sum_nAn2, sum_nAnsin, tmp_gamma ;21 22 // creating arrays for every Angle of Attack23 gamma = new double* [aoa_iterations] ;24 lift_coefficient_distribution = new double* [aoa_iterations] ;25 induced_velocity_distribution = new double* [aoa_iterations] ;26 induced_drag_coefficient_distribution = new double* [aoa_iterations] ;27 28 lift_coefficient = new double [aoa_iterations] ;29 induced_drag_coefficient = new double [aoa_iterations] ;30 31 // creating wing span distributions arrays second dimension32 for ( a = 0; a < aoa_iterations; a++ ) {33 // creating arrays for every Cross Section34 gamma[a] = new double [sections_fullspan ] ;35 lift_coefficient_distribution[a] = new double [ sections_fullspan ] ;36 induced_velocity_distribution[a] = new double [ sections_fullspan ] ;37 induced_drag_coefficient_distribution[a] = new double
[ sections_fullspan ] ;38 }39 40 // calculating characteristics for every angle of attack41 for ( a = 0; a < aoa_iterations; a++ ) {42 43 // start value of temporary coefficients44 lift_coefficient[a] = 0.0 ;45 46 for ( i = 0; i < sections_fullspan; i++ ) {47
- 53 -
Załączniki
48 // start values49 tmp_gamma = 0.0 ;50 sum_nAn2 = 0.0 ;51 sum_nAnsin = 0.0 ;52 53 // for every Fourier series term54 for ( n = 0; n < fourier_accuracy; n++ ) {55 // calculating gamma (circulation) for single Cross Section and
220 }221222 equations_span[i] = wingspan[cur_section] ;223224 cur_section = cur_section - step ;225 }226 227}228229/**230* void Wing::interpolateCrossSections()231* creates arrays of Cross Sections data using linear interpolations of all
data:232* Leading Edge X Coordinate233* Trailing Edge X Coordinate234* Airfoil Lift Curve Slope235* and Airfoil Angle of 0 Lift236*/237void Wing::interpolateSections() {238 int i ;239 240 // creating arrays of interpolating data241 wingspan = new double[sections_iterations] ;242 chord_length = new double[sections_iterations] ;243 lift_curve_slope = new double[sections_iterations] ;244 angle_of_0_lift_deg = new double[sections_iterations] ;245 angle_of_0_lift_rad = new double[sections_iterations] ;246 247 // calculating winspan_step248 double wingspan_step = ( wing_span / 2 ) / ( sections_iterations - 1 ) ;249 250 // setting start current section251 int current_section = 0 ;252 253 // setting start leading edge x coordinate, trailing edge x coordinate
Wing::angle_of_0_lift_deg445* and Wing::angle_of_0_lift_rad for full ( NOT semi ) wingspana and creates
fi (Wing::fi) array446*/447void Wing::rewriteSectionsForFullSpan() {448 double* f_wingspan ;449 double* f_chord_length ;450 double* f_lift_curve_slope ;451 double* f_angle_of_0_lift_deg ;452 double* f_angle_of_0_lift_rad ;453 int f_iterations = 2 * sections_iterations - 1 ;454 int i ;455 456 // creating full span arrays457 f_wingspan = new double[f_iterations] ;458 f_chord_length = new double[f_iterations] ;459 f_lift_curve_slope = new double[f_iterations] ;460 f_angle_of_0_lift_deg = new double[f_iterations] ;461 f_angle_of_0_lift_rad = new double[f_iterations] ;462 fi = new double[f_iterations] ;463 mi = new double[f_iterations] ;464 465 // left wing tip to wing root (excluded)
487 }488 489 // setting number of sections in full span Wing::sections_fullspan490 sections_fullspan = f_iterations ;491 492 // deleting semi span arrays493 delete [] wingspan ;494 delete [] chord_length ;495 delete [] lift_curve_slope ;496 delete [] angle_of_0_lift_deg ;497 delete [] angle_of_0_lift_rad ;498 499 // pointing sections arrays to full span arrays
- 66 -
Załączniki
500 wingspan = f_wingspan ;501 chord_length = f_chord_length ;502 lift_curve_slope = f_lift_curve_slope ;503 angle_of_0_lift_deg = f_angle_of_0_lift_deg ;504 angle_of_0_lift_rad = f_angle_of_0_lift_rad ;505 506}507508/**509* bool Wing::solveEquations()510* solves system of linear equation due to assign values to equations
variables511* which are coefficients of Fourier series terms and calculate aerodynamic
characteristics512* returns TRUE on success513* returns FALSE on failure514*/515bool Wing::solveEquations() {516 bool success = true ;517 int a, i, n = 0 ;518 double* lhs ;519 double* rhs ;520 521 // creating Wing::fourier_terms array's first dimension522 fourier_terms = new double* [aoa_iterations] ;523 // and second dimension524 for ( a = 0; a < aoa_iterations; a++ ) {525 fourier_terms[a] = new double [fourier_accuracy] ;526 }527 528 // creating temporary arrays529 lhs = new double [ fourier_accuracy * fourier_accuracy + fourier_accuracy
] ;530 rhs = new double [ fourier_accuracy ] ;531 532 // iterating over Angle of Attack533 for ( a = 0; a < aoa_iterations; a++ ) {534 // copying equations Right-Hand-Side to temporary array535 for ( i = 0; i < fourier_accuracy; i++ ) {
- 67 -
Załączniki
536 rhs[i] = equations_rhs[a][i] ;537 // copying equations Left-Hand-Side to temporary array538 for ( n = 0; n < fourier_accuracy; n++ ) {539 lhs[fourier_accuracy*n+i] = equations_lhs[i][n] ;540 }541 }542 // solving system of linear equations for single Angle of Attack543 if ( GEN_SOLV( rhs, lhs, fourier_accuracy ) != -1 ) {544 success = false ;545 }546 // copying equation's result547 for ( i = 0; i < fourier_accuracy; i++ ) {548 fourier_terms[a][i] = rhs[i] ;549 } 550551 }552 553 delete [] lhs ;554 delete [] rhs ;555 lhs = 0 ;556 rhs = 0 ;557 558 return success ;559}560561/**562* void Wing::sortFullSpanSections() 563*wingspan, Wing::chord_length, Wing::lift_curve_sl_of_0_liftand
Wing::angle_of_0_lift_deg564 * and Wing::angle_of_0_lift_rad using bubble sort algorithm565*/566void Wing::sortFullSpanSections() {567 bool sorted ;568 int i, j ;569 double temp ;570 571 for ( i = 1; i < sections_fullspan; i++ ) {572 sorted = true ;573
612}613614/**615* void Wing::sortSectionsData() 616* sorts unsorted Wing::sections_data[ ] array using bubble sort algorithm617*/618void Wing::sortSectionsData() {619 bool sorted ;620 int i, j, k ;621 double temp ;622 623 for ( i = 1; i < sections; i++ ) {624 sorted = true ;625626 for ( j = 0; j < sections - i; j++ ) {627 if ( sections_data[0][j] > sections_data[0][j+1] ) {628 for (k=0;k<5;k++) {629 temp = sections_data[k][j] ;630 sections_data[k][j] = sections_data[k][j+1] ;631 sections_data[k][j+1] = temp ;632 }633 sorted = false ;634 }635 }636 if ( sorted ) {637 break ;638 }639 }640}641642/**643* bool Wing::writeAoAToFile()644* writes full span sections arrays to file645*/646bool Wing::writeAoAToFile() {647 int a ;648 FILE* file ;649
- 70 -
Załączniki
650 if ((file=fopen("../tmp/tmp.aoa", "w"))!=NULL) {651 for ( a = 0; a < aoa_iterations; a++ ) {652 fprintf( file, "%f\t%f\n", angle_of_attack_deg[a],
angle_of_attack_rad[a] ) ;653 }654 fclose( file) ;655 return true ;656 } else {657 return false ;658 }659}660661/**662* bool Wing::writeEquationsToFile()663* writes Wing::equations_lhs and Wing::equations_rhs to file664*/665bool Wing::writeEquationsToFile() {666 int a, i, n ;667 bool ret = true ;668 FILE* file ;669 670 if ((file=fopen("../tmp/tmp.lhs", "w"))!=NULL) {671 for ( i = 0; i < fourier_accuracy; i++ ) {672 fprintf( file, "%f\t\t", equations_span[i] ) ;673 for ( n = 0; n < fourier_accuracy; n++ ) {674 fprintf( file, "%f\t", equations_lhs[i][n] ) ;675 }676 fprintf( file, "\n" ) ;677 }678 fclose( file ) ;679 } else {680 fclose( file ) ;681 ret = false ;682 }683 684 if ((file=fopen("../tmp/tmp.rhs", "w"))!=NULL && ret) {685 for ( i = 0; i < fourier_accuracy; i++ ) {686 fprintf( file, "%f\t\t", equations_span[i] ) ;687 for ( a = 0; a < aoa_iterations; a++ ) {
- 71 -
Załączniki
688 fprintf( file, "%f\t", equations_rhs[a][i] ) ;689 }690 fprintf( file, "\n" ) ;691 }692 fclose( file ) ;693 } else {694 fclose( file ) ;695 ret = false ;696 }697 698 return ret ;699}700701/**702* bool Wing::writeFourierToFile()703* writes Wing::fourier_terms to file704*/705bool Wing::writeFourierToFile() {706 int a, n ;707 FILE* file ;708 709 if ((file=fopen("../tmp/tmp.terms", "w"))!=NULL) {710 for ( n = 0; n < fourier_accuracy; n++ ) {711 for ( a = 0; a < aoa_iterations; a++ ) {712 fprintf( file, "%f\t", fourier_terms[a][n] ) ;713 }714 fprintf( file, "\n" ) ;715 }716 fclose( file) ;717 return true ;718 } else {719 return false ;720 }721}722723/**724* bool Wing::writeFullspanToFile()725* writes full span sections arrays to file
- 72 -
Załączniki
726*/727bool Wing::writeFullspanToFile() {728 int i ;729 FILE* file ;730 731 if ((file=fopen("../tmp/tmp.fullspan", "w"))!=NULL) {732 for ( i = 0; i < sections_fullspan; i++ ) {733 fprintf( file, "%f\t%f\t%f\t%f\t%f\t%f\t%f\n", wingspan[i],
800 if ((file=fopen("../tmp/tmp.winginput", "w"))!=NULL) {801 for ( i = 0; i < sections; i++ ) {802 fprintf( file, "%f\t%f\t%f\t%f\t%f\n", sections_data[0][i],
875}876877/**878* Wing::~Wing()879* destructor880* releases results881*/882Wing::~Wing() {883 releaseResults() ;884}885886/**887* bool Wing::addSectionData( double, double, double, double, double ) 888* adds new wing cross section data set to Wing::sections_data[ ] array889* returns TRUE on success890* returns FALSE on failure (given Wing Span Y Coordinate is NOT unique OR
given891* Leading Edge X Coordinate is greater than given Trailing Edge X Coordinate
OR given892* Wing Span Y Coordinate is less than 0.0)893*/894bool Wing::addSectionData( double span_y, double le_x, double te_x, double
slope, double angle ) {895 896 double* new_sections_data[5] ;897 double data_set[5] = { span_y, le_x, te_x, slope, angle } ;898 int i, j ;899 900 // first cross section must be wing root (Y Coordinate = 0)901 if ( sections == 0 && span_y != 0.0)902 return false ;903 904 // check if given Wing Span Y Coordinate is less than 0.0905 if ( span_y < 0.0 )906 // if so return FALSE on failure907 return false ;908 909 // check if given Trailing Edge X Coordinate is greater than given
Leading Edge X Coordinate910 if ( te_x <= le_x )
- 77 -
Załączniki
911 // if NOT return FALSE on failure912 return false ;913 914 // check if new Wing Span Y Coordinate already exists in
Wing::sections_data[ ] array915 if ( checkIfSectionExists( span_y ) )916 // if exists return FALSE on failure917 return false ; 918 919 // For every value in set (Wing Span Y Coordinate, Leading Edge X
Coordinate, etc.)920 for ( i = 0; i < 5; i++ ) {921 // create new array of length greater by one than current922 new_sections_data[i] = new double[sections + 1] ;923924 // For every current existing sections925 for ( j = 0; j < sections; j++ ) {926 // copy value into new array927 new_sections_data[i][j] = sections_data[i][j] ;928 }929930 // copy new value into last element of the new array931 new_sections_data[i][sections] = data_set[i] ;932933 // delete current array934 delete [] sections_data[i] ;935 // point at new array936 sections_data[i] = new_sections_data[i] ;937 }938 939 // Increment Wing::sections by one940 sections++ ;941 942 // sort new Wing::sections_data[ ] array943 sortSectionsData() ;944 945 // recalculate Wing Geometric Data946 calculateGeometry() ;947
- 78 -
Załączniki
948 // write Wing::sections_data array to file949 writeWingInputToFile() ;950 951 // setting Wing::results_uptodate as FALSE952 results_uptodate = false ;953 954 // return TRUE on success955 return true ;956 957}958959/****************************************************************************960** Wing::compute() or the Heart of Wing Class961****************************************************************************/962963/**964* bool Wing::compute()965* computes aerodynamic characteristics of the wing966* returns TRUE on success967* returns FALSE on failure968*/969bool Wing::compute() {970 bool ret = true ;971 972 // if too few sections973 if ( sections < 2 )974 return false ;975 976 // if there is no parameters saved977 if ( ! parameters_saved )978 return false ;979 980 // releasing results981 releaseResults() ;982 983 // write parameters to file984 if ( debug_mode ) writeParametersToFile() ;985
- 79 -
Załączniki
986 // iterate Angle of Attack at first987 iterateAoA() ;988 989 // write angle of attack iterations to file990 if ( debug_mode ) writeAoAToFile() ;991 992 // iterate Cross Sections993 interpolateSections() ;994 995 // write interpolated sections arrays to file996 if ( debug_mode ) writeInterpolatedToFile() ;997 998 // rewriting sections arrays for full ( NOT semi ) span999 rewriteSectionsForFullSpan() ;1000 1001 // sorting fulls pan sections1002 sortFullSpanSections() ;1003 1004 // write full span sections arrays to file1005 if ( debug_mode ) writeFullspanToFile() ;1006 1007 // create Equations Left-Hand-Side and Right-Hand-Sides (for every Angle
of Attack)1008 createEquations() ;1009 1010 // write equations LHS and RHSs to file1011 if ( debug_mode ) writeEquationsToFile() ;1012 1013 // solve system of linear equations1014 if ( ! solveEquations() ) ret = false ;1015 1016 // write Fourier terms to file1017 if ( debug_mode && ret ) writeFourierToFile() ;1018 1019 // calculating wing aerodynamic characteristics1020 if ( ret ) calculateCharacteristics() ;1021 1022 if ( ret )1023 results_uptodate = true ;
- 80 -
Załączniki
1024 else1025 results_uptodate = false ;1026 1027 return ret ;1028}10291030/**1031* bool Wing::deleteSectionData( int ) 1032* deletes wing cross section data set from Wing::sections_data[ ]1033* returns TRUE on success1034* returns FALSE on failure (row greater than length of
Wing::sections_data[ ] array)1035*/1036bool Wing::deleteSectionData( int row ) {1037 double* new_sections_data[5] ;1038 int i, j ;1039 1040 // if more than 1 section one cannot delete 1st cross section1041 if ( sections > 1 && row == 0 )1042 return false ;1043 1044 // If row is smaller than length of Wing::sections_data[ ]1045 if ( row < sections ) {1046 // For every value in set (Wing Span Y Coordinate, Leading Edge X
Coordinate, etc.)1047 for ( i = 0; i < 5; i++) {1048 // create new array of length smaller by one than current1049 new_sections_data[i] = new double[sections - 1] ;1050 1051 // For every current existing sections1052 for ( j = 0; j < ( sections - 1 ); j++ ) {1053 switch ( j < row ) {1054 // till deleting row (excluding)1055 case true :1056 new_sections_data[i][j] = sections_data[i][j] ;1057 break ;1058 // from deleting row (including)1059 case false :1060 new_sections_data[i][j] = sections_data[i][j + 1] ;
- 81 -
Załączniki
1061 break ;1062 }1063 }1064 1065 // delete current array1066 delete [] sections_data[i] ;1067 // point at new array1068 sections_data[i] = new_sections_data[i] ;1069 }10701071 // Decrement Wing::sections by one1072 sections-- ;10731074 // recalculate Wing Geometric Data1075 calculateGeometry() ;10761077 // write Wing::sections_data array to file1078 writeWingInputToFile() ;10791080 // setting Wing::results_uptodate as FALSE1081 results_uptodate = false ;10821083 // return TRUE on success1084 return true ;10851086 // If row is greater than length of Wing::sections_data[ ]1087 } else {1088 // return FALSE on failure1089 return false ;1090 }1091}10921093/**1094* bool Wing::editSectionData( double, double, double, double, double, int ) 1095* edits wing cross section data set in Wing::sections_data[ ]1096* returns TRUE on success1097* returns FALSE on failure (row greater than length of
Wing::sections_data[ ] array OR
- 82 -
Załączniki
1098* new Wing Span Y Coordinate is NOT unique OR given Leading Edge X Coordinate is
1099* greater than given Trailing Edge X Coordinate OR given Wing Span Y Coordinate is
1100* less than 0.0)1101*/1102bool Wing::editSectionData( double span_y, double le_x, double te_x, double
slope, double angle, int row ) {1103 double data_set[5] = { span_y, le_x, te_x, slope, angle } ;1104 int i ;1105 1106 // wing root section's Y coordinate cannot be modifies1107 if ( row == 0 && span_y != 0.0 )1108 return false ;1109 1110 // check if given Wing Span Y Coordinate is less than 0.01111 if ( span_y < 0.0 )1112 // if so return FALSE on failure1113 return false ;1114 1115 // check if given Trailing Edge X Coordinate is greater than given
Leading Edge X Coordinate1116 if ( te_x <= le_x )1117 // if is NOT return FALSE on failure1118 return false ;1119 1120 // If new value is different than old value of Wing Span Y Coordinate
AND1121 // new Wing Span Y Coordinate already exists in Wing::sections_data[ ]
array1122 if ( ( span_y != sections_data[0][row] ) &&
checkIfSectionExists( span_y ) )1123 // if exists return FALSE on failure1124 return false ;1125 1126 // If row is smaller than length of Wing::wing_cs_data[ ]1127 if ( row < sections ) {1128 // For every value in set (Wing Span Y Coordinate, Leading Edge X
Coordinate, etc.)1129 for ( i = 0; i < 5; i++ ) {1130 // sets new values1131 sections_data[i][row] = data_set[i] ;
- 83 -
Załączniki
1132 }11331134 // sort new Wing::sections_data[ ] array1135 sortSectionsData() ;11361137 // recalculate Wing Geometric Data1138 calculateGeometry() ;11391140 // write Wing::sections_data array to file1141 writeWingInputToFile() ;11421143 // setting Wing::results_uptodate as FALSE1144 results_uptodate = false ;11451146 // return TRUE on success1147 return true ;11481149 // If row is NOT smaller than length of Wing::sections_data[ ]1150 } else {1151 // return FALSE on failure1152 return false ;1153 }1154}11551156/**1157* double Wing::getAoADeg( int aoa )1158* return Wing::angle_of_attack_deg[aoa]1159*/1160double Wing::getAoADeg( int aoa ) {1161 if ( aoa < aoa_iterations )1162 return angle_of_attack_deg[aoa] ;1163 else1164 return 0 ;1165}11661167/**1168* double Wing::getAoA_Finish() 1169* returns Wing::aoa_finish
1208* double Wing::getDragCoef( int aoa )1209* returns Wing::induced_drag_coefficient[aoa]1210*/1211double Wing::getDragCoef( int aoa ) {1212 if ( aoa < aoa_iterations )1213 return induced_drag_coefficient[aoa] ;1214 else1215 return 0 ;1216}12171218/**1219* double Wing::getDragCoefDist( int aoa, int section )1220* returns Wing::induced_drag_coefficient_distribution[aoa][section[1221*/1222double Wing::getDragCoefDist( int aoa, int section ) {1223 if ( aoa < aoa_iterations && section < sections_fullspan )1224 return induced_drag_coefficient_distribution[aoa][section] ;1225 else1226 return 0 ;1227}12281229/**1230* double Wing::getGamma( int aoa, int section )1231* return Wing::gamma[aoa][section]1232*/1233double Wing::getGamma( int aoa, int section ) {1234 if ( aoa < aoa_iterations && section < sections_fullspan )1235 return gamma[aoa][section] ;1236 else1237 return 0 ;1238}12391240/**1241* double Wing::getFluidDensity()1242* return Wing::fluid_density1243*/1244double Wing::getFluidDensity() {1245 return fluid_density ;
- 86 -
Załączniki
1246}12471248/**1249* double Wing::getFluidVelocity()1250* return Wing::fluid_velocity1251*/1252double Wing::getFluidVelocity() {1253 return fluid_velocity ;1254}12551256/**1257* int Wing::getFourierAccuracy()1258* return Wing::fourier_accuracy1259*/1260int Wing::getFourierAccuracy() {1261 return fourier_accuracy ;1262}12631264/**1265* double Wing::getLiftCoef( int aoa )1266* returns Wing::lift_coefficient1267*/1268double Wing::getLiftCoef( int aoa ) {1269 if ( aoa < aoa_iterations )1270 return lift_coefficient[aoa] ;1271 else1272 return 0 ;1273}12741275/**1276* double Wing::getLiftCoefDist( int aoa, int section )1277* returns Wing::lift_coefficient_distribution[aoa][section]1278*/1279double Wing::getLiftCoefDist( int aoa, int section ) {1280 if ( aoa < aoa_iterations && section < sections_fullspan )1281 return lift_coefficient_distribution[aoa][section] ;1282 else1283 return 0 ;
- 87 -
Załączniki
1284}12851286/**1287* int Wing::getSections() 1288* returns Wing::sections1289*/1290int Wing::getSections() {1291 return sections ;1292}12931294/**1295* int Wing::getSectionsFullspan()1296* returns Wing::sections_fullspan1297*/1298int Wing::getSectionsFullspan() {1299 return sections_fullspan ;1300}13011302/**1303* int Wing::getSectionsIterations()1304* returns Wing::sections_iterations1305*/1306int Wing::getSectionsIterations() {1307 return sections_iterations ;1308}13091310/**1311* double Wing::getSectionAngle( int )1312* returns Wing::sections_data[4][i]1313*/1314double Wing::getSectionAngle( int i ) {1315 if ( i < sections )1316 return sections_data[4][i] ;1317 else1318 return 0 ;1319}13201321/**
- 88 -
Załączniki
1322* double Wing::getSectionsLEX( int )1323* returns Wing::sections_data[1][i]1324*/1325double Wing::getSectionLEX( int i ) {1326 if ( i < sections )1327 return sections_data[1][i] ;1328 else1329 return 0 ;1330}13311332/**1333* double Wing::getSectionSlope( int )1334* returns Wing::sections_data[3][i]1335*/1336double Wing::getSectionSlope( int i ) {1337 if ( i < sections )1338 return sections_data[3][i] ;1339 else1340 return 0 ;1341}13421343/**1344* double Wing::getSectionsTEX( int )1345* returns Wing::sections_data[2][i]1346*/1347double Wing::getSectionTEX( int i ) {1348 if ( i < sections )1349 return sections_data[2][i] ;1350 else1351 return 0 ;1352}13531354/**1355* double Wing::getSectionY( int )1356* returns Wing::sections_data[0][i]1357*/1358double Wing::getSectionY( int i ) {1359 if ( i < sections )
14531454 parameters_saved = true ;14551456 sections_fullspan = 2 * sections_iterations - 1 ;14571458 // checkiing if results exists1459 int are_results ;1460 fscanf( fl, "%d", &are_results ) ;14611462 // if so reading results1463 if ( are_results > 0 ) {1464 results_uptodate = true ;1465 // creating angle of attach arrays1466 angle_of_attack_deg = new double [aoa_iterations] ;1467 angle_of_attack_rad = new double [aoa_iterations] ;1468 // reading angle of attack iterations1469 for ( a = 0; a < aoa_iterations; a++ ) {1470 fscanf( fl, "%lf %lf", &angle_of_attack_deg[a], &angle_of_attack_rad[a] )
;
- 92 -
Załączniki
1471 }1472 // creating full span arrays1473 wingspan = new double [sections_fullspan] ;1474 chord_length = new double [sections_fullspan] ;1475 lift_curve_slope = new double [sections_fullspan] ;1476 angle_of_0_lift_deg = new double [sections_fullspan] ;1477 angle_of_0_lift_rad = new double [sections_fullspan] ;1478 fi = new double [sections_fullspan] ;1479 mi = new double [sections_fullspan] ;1480 // reading full span section data to file1481 for ( i = 0; i < sections_fullspan; i++ ) {1482 fscanf( fl, "%lf %lf %lf %lf %lf %lf %lf", &wingspan[i],
1483 }1484 // creating equations' span array1485 equations_span = new double [fourier_accuracy] ;1486 // reading equations' span1487 for ( i = 0; i < fourier_accuracy; i++ ) {1488 fscanf( fl, "%lf", &equations_span[i] ) ;1489 }1490 // creating Left-Hand-Sides of equations arrays1491 equations_lhs = new double* [fourier_accuracy] ;1492 for ( i = 0; i < fourier_accuracy; i++ ) {1493 equations_lhs[i] = new double [fourier_accuracy] ;1494 }1495 // reading Left-Hand-Sides of equations1496 for ( i = 0; i < fourier_accuracy; i++ ) {1497 for ( n = 0; n < fourier_accuracy; n++ ) {1498 fscanf( fl, "%lf", &equations_lhs[i][n] ) ;1499 }1500 }1501 // creating Right-Hand-Sides of equations arrays and Fouerier series
terms array1502 equations_rhs = new double* [aoa_iterations] ;1503 fourier_terms = new double* [aoa_iterations] ;1504 for ( a = 0; a < aoa_iterations; a++ ) {1505 equations_rhs[a] = new double [fourier_accuracy] ;1506 fourier_terms[a] = new double [fourier_accuracy] ;
- 93 -
Załączniki
1507 }1508 // reading Right-Hand-Sides of equations1509 for ( i = 0; i < fourier_accuracy; i++ ) {1510 for ( a = 0; a < aoa_iterations; a++ ) {1511 fscanf( fl, "%lf", &equations_rhs[a][i] ) ;1512 }1513 }1514 // reading Fourier series terms1515 for ( n = 0; n < fourier_accuracy; n++ ) {1516 for ( a = 0; a < aoa_iterations; a++ ) {1517 fscanf( fl, "%lf", &fourier_terms[a][n] ) ;1518 }1519 }1520 // creating spanwise distribution characteristics' arrays1521 gamma = new double* [aoa_iterations] ;1522 lift_coefficient_distribution = new double* [aoa_iterations] ;1523 induced_velocity_distribution = new double* [aoa_iterations] ;1524 induced_drag_coefficient_distribution = new double* [aoa_iterations] ;1525 for ( a = 0; a < aoa_iterations; a++ ) {1526 gamma[a] = new double [sections_fullspan] ;1527 lift_coefficient_distribution[a] = new double [sections_fullspan] ;1528 induced_velocity_distribution[a] = new double [sections_fullspan] ;1529 induced_drag_coefficient_distribution[a] = new double [sections_fullspan]
;1530 }1531 // reading Wing::gamma (circulation)1532 for ( i = 0; i < sections_fullspan; i++ ) {1533 for ( a = 0; a < aoa_iterations; a++ ) {1534 fscanf( fl, "%lf", &gamma[a][i] ) ;1535 }1536 }1537 // reading Wing::lift_coefficient_distribution1538 for ( i = 0; i < sections_fullspan; i++ ) {1539 for ( a = 0; a < aoa_iterations; a++ ) {1540 fscanf( fl, "%lf", &lift_coefficient_distribution[a][i] ) ;1541 }1542 }1543 // reading Wing::induced_velocity_distribution1544 for ( i = 0; i < sections_fullspan; i++ ) {
- 94 -
Załączniki
1545 for ( a = 0; a < aoa_iterations; a++ ) {1546 fscanf( fl, "%lf", &induced_velocity_distribution[a][i] ) ;1547 }1548 }1549 // reading Wing::induced_drag_coefficient_distribution1550 for ( i = 0; i < sections_fullspan; i++ ) {1551 for ( a = 0; a < aoa_iterations; a++ ) {1552 fscanf( fl, "%lf", &induced_drag_coefficient_distribution[a][i] ) ;1553 }1554 }1555 }1556 // creating arrays of angle of attack dependent characteristics1557 lift_coefficient = new double [aoa_iterations] ;1558 induced_drag_coefficient = new double [aoa_iterations] ;1559 // reading Wing::lift_coefficient1560 for ( a = 0; a < aoa_iterations; a++ ) {1561 fscanf( fl, "%lf", &lift_coefficient[a] ) ;1562 }1563 // reading Wing::induced_drag_coefficient1564 for ( a = 0; a < aoa_iterations; a++ ) {1565 fscanf( fl, "%lf", &induced_drag_coefficient[a] ) ;1566 }1567 fclose( fl ) ;1568 strcpy( file_name, file ) ;1569 return true ;1570 } else1571 return false ;1572}15731574/** bool Wing::setParametres( double, double, int, double, double, int,
int )1575* sets parameters and deletes Wing::equation_lhs array 1576* returns TRUE on success1577* returns FALSE on failure1578*/1579bool Wing::setParameters( double a_start, double a_finish, int a_iterations,
double f_velocity, double f_density, int s_iterations, int f_accuracy ) {1580 bool input_valid = true ;1581
- 95 -
Załączniki
1582 // AoA Iteration Start Value cannot be greater than AoA Iteration Finish Value
1583 if ( a_start == a_finish ) {1584 // if AoA Iteration Start Value eq. to AoA Iteration Finish Value1585 // AoA Number of Iterations should be 11586 if ( ! a_iterations == 1 ) input_valid = false ;1587 } else if ( a_start < a_finish ) {1588 // if AoA Iteration Start Value less than AoA Iteration Finish Value1589 // AoA Number of Iterations should be greater than 11590 if ( ! a_iterations > 1 ) input_valid = false ;1591 } else1592 input_valid = false ;1593 1594 // Fluid Velocity should be greater than 0.01595 if ( ! f_velocity > 0.0 ) input_valid = false ;1596 1597 // Fluid Density should be greater than 0.01598 if ( ! f_density > 0.0 ) input_valid = false ;1599 1600 // Number of Cross Sections should be greater or equal to Wing::sections1601 if ( ! s_iterations >= sections ) input_valid = false ;1602 1603 // Fourier Series Accuracy should be smaller than Number of Cross
Section less by 11604 if ( ! s_iterations > f_accuracy ) input_valid = false ;1605 1606 // If all parameters are valid delete Wing::equations_lhs and save
Dostępny w Internecie: http://marketshare.hitslink.com/operating-system-market-share.aspx?qprid=8[24] Nokia to acquire Trolltech to accelerate software strategy [online]. Keilalahdentie: Nokia ShowPressRelease
[dostęp: 2009-02-20]. Dostępny w Internecie: http://www.nokia.com/A4136001?newsid=1185531[25] Grębosz, J.: Symfonia C++. T.2. Kraków: Oficyna Kallimach, 1999, s.263-264[26] Eckel, B.: Thinking in C++. Gliwice: Helion: 2002, s.184-186[27] Abbott, H.: Theory of Wing Sections, Dover: Courier Dover Publications, 1959, p.570