Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
RCmags committed Aug 31, 2022
1 parent 07c5f3e commit b271f5b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# pychage folders
*.pyc
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Binary file added figures/airfoil_motion.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/mean_force.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions input_parameters.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit b271f5b

Please sign in to comment.