diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..add2ee1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# pychage folders +*.pyc diff --git a/README.md b/README.md index f661187..e523fb0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,24 @@ -# ornithopter-airfoil-sim -Simulation of an oscillating airfoil +# Ornithopter airfoil simulator + +This program calculates the motion of an airfoil attached to an ornithopter wing. The airfoil undergoes a sinusoidal oscillation and its angle is found through a torque balance. With this angle, the lift and thrust of the airfoil are calculated along with their mean values. It is assumed the airfoil is subject to the inertial reaction of its mass, an aerodynamic force, and a damped angular spring. Each of these forces/torques can be adjusted along with the amplitude and frequency of the oscillation. Therefore, it is possible to try out different constraints and observe how they affect lift and thrust. + +### Requirements +The scripts were written in [Python 3.9.5](https://www.python.org/downloads/) and require the following libraries: +- [numpy](https://numpy.org/install/) +- [scipy](https://scipy.org/install/) +- [matplotlib](https://matplotlib.org/stable/users/installing/index.html) + +### How to use +To execute the program, open the terminal/command prompt and browse to the folder containing main.py and run the command: +``` +>> python3 main.py +``` +If you are using windows, you can simply double click interface.py and to open it with [IDLE](https://docs.python.org/3/library/idle.html). + +To adjust the calculations, open input_parameters.py with a text editor and change the variables. + +### Sample output + +![image](figures/airfoil_motion.gif) + +![image](figures/mean_force.jpg) diff --git a/figures/airfoil_motion.gif b/figures/airfoil_motion.gif new file mode 100644 index 0000000..e4c91cd Binary files /dev/null and b/figures/airfoil_motion.gif differ diff --git a/figures/mean_force.jpg b/figures/mean_force.jpg new file mode 100644 index 0000000..43e8619 Binary files /dev/null and b/figures/mean_force.jpg differ diff --git a/input_parameters.py b/input_parameters.py index 2f1a5a2..0d12ae1 100644 --- a/input_parameters.py +++ b/input_parameters.py @@ -1,27 +1,27 @@ # aerodynamics -COEF_AERO = 1.5 # aerodynamic force scale +COEF_AERO = 1 # aerodynamic force scale VEL_INF = 1 # velocity of incoming flow CHORD = 1 # airfoil chord COEF_AERO *= VEL_INF**2 # mass parameters MASS_POS = -0.5 # position of center of mass -MASS = 0.3 # mass of airfoil +MASS = 0.1 # mass of airfoil INERTIA = MASS*( (CHORD**2)/12 + MASS_POS**2 ) # assume airfoil is thin rod # oscillation AMPLITUDE = 1 # amplitude of oscillation -ANG_FREQ = 0.8 # angular frequency of oscillation +ANG_FREQ = 1 # angular frequency of oscillation # angular spring COEF_SPRING = 0.2 # angular spring/elastic constant COEF_DAMPING = 0.1 # angular damping constant -ANGLE_BIAS = 0.4 # angle offset in rest point of angular spring +ANGLE_BIAS = 0.5 # angle offset in rest point of angular spring # animation TIME_MAX = 40 # maximum time value for simulation FRAME_TIME = 50 # frame delay in milliseconds -SAVE_FIGURES = False # save animation as .gif and plot as .jpg +SAVE_FIGURES = True # save animation as .gif and plot as .jpg # axis bounds XLIM = 1.5 diff --git a/main.py b/main.py index 201b168..d991532 100644 --- a/main.py +++ b/main.py @@ -228,8 +228,8 @@ def solveSystem(): # 3. display if SAVE_FIGURES: - anim.save("airfoil_motion.gif", writer=animation.PillowWriter(fps=10), dpi=100 ) - figure1.savefig('mean_force.jpg') + anim.save("figures/airfoil_motion.gif", writer=animation.PillowWriter(fps=10), dpi=100 ) + figure1.savefig('figures/mean_force.jpg') plt.tight_layout() plt.show()