## Flow over bicycle in Python

Objective:

To calculate the drag force for various drag coefficient and velocity values for a certain geometry.

Introduction:

Drag force is the force exerted by the air as the vehicle moves through it. The force exerted is directly proportional to the square of velocity, so as the vehicle accelerates and velocity increases, the froce exerted by the air increases by the formula:

Fa = 1/2 * rho * A * v^2 * Cd

Where

Fa = Drag force

rho = air density

A = Frontal area

Cd = drag coefficient, dependant on the shape of the front of the velocity

v = velocity of the body

Procedure and Code:

To start off, I have assumed the drag coefficient for a bicycle from common cycles to racing cycles. Area, air density, drag coeff., and velocity details are mentioned below. Velocity is ranging from 18 to 43 KMPH, and drag coefficient is varying from 0.25 to 0.8.

# Program to calculate drag force

import matplotlib.pyplot as plt
import numpy as n

# Inputs
# cd = 0.75 # Drag Coeff
A = 0.7 # Frontal Area m^2
rho = 1.225 # Density kg.m-3
v = n.linspace(5, 12, 8) # velocity m.s-1
vcons = 10;
cd = n.linspace(0.25, 0.8, 5)
cdcons = 0.75;

Fa1 = [] # Empty array
Fa2 = []

for vi in v:
Fa1.append((0.5*rho*cdcons*A*vi*vi))

for cdi in cd:
Fa2.append((0.5*rho*cdi*A*vcons*vcons))

print(Fa1)
print(Fa2)

plt.figure(1)
plt.plot(v, Fa1)
plt.xlabel('Velocity (m/s)')
plt.ylabel('Drag Force (N)')

plt.figure(2)
plt.plot(cd, Fa2)
plt.xlabel('Drag Coefficient')
plt.ylabel('Drag Force (N)')

plt.show()

Graphs:

1. Drag force vs Velocity:
2. Drag force vs Drag Coefficient

2 graphs above show variation of drag force with velocity and drag force with drag coefficient respectively.  Since velocity is squared, variation is exponential. However, drag coeff variation is linear due to no exponential powers of the same in the formula.

Errors:

Incorrect For loop syntax: Forgot ":"

### Simulating the motion of a pendulum using 2nd order ODE in Python Arjun Bhat · 2019-12-09 17:11:02

This project explores the simulation of the motion of a pendulum for the equation of damped vibration of a pendulum. Below is the equation (taken from "Challenges" page): The above equation is solved using ODE function, and then odeint is used to get an ar Read more

### Air standard cycle graph plotting in Python Arjun Bhat · 2019-11-20 17:11:18

Project involves plotting an Otto Cycle graph in MATLAB The goal is to plot all strokes for a petrol operating by the otto cycle from intake, compression, power to exhaust, including both adiabatic curves. Description: The Otto Cycle is the idealised cycle that descr Read more

### Forward Kinematics of a 2R Robotic Arm in Python Arjun Bhat · 2019-11-18 16:21:42

Objective: The project involves simulating a 2-joint robotic arm.   Code and Description: import math import matplotlib.pyplot as plt import numpy as nm # Lengths l1 = 1 l2 = 0.5 # Angles ang1 = nm.radians(nm.linspace(0, 90, 19)) ang2 = nm.radians Read more

### Parsing NASA Thermodynamic data for multiple specified Gas Species and Calculating the Thermodynamic Properties Arjun Bhat · 2019-09-11 20:25:18

Aim: To parse the NASA Thermodynamc Properties data file, calculate thermodynamic properties and plot the characteristics. Introduction: NASA's thermodynamic properties file consists of multiple species of gases, their respective operating temperature ranges, and Read more

### Optimization of a function using Genetic Algorithm in MATLAB Arjun Bhat · 2019-09-03 08:51:45

The project aims at optimization of a stalagmite function and finding the global maxima. For this, we will be using the concept of genetic algorithm. Following are the steps used to optimise the function: Code the function given in a separate function code. This is Read more

### Curve Fitting using MATLAB Arjun Bhat · 2019-08-19 20:20:53

Project aims at finding the best fit curve for a given data and finding the error between the original and said curve. The data being used is that of Specific heat (Cp) vs Temeperature. Plot will be made to show variation of Cp with Temp first.  Code: % Data cp Read more

### Simulating the motion of a pendulum using 2nd order ODE in MATLAB Arjun Bhat · 2019-08-13 18:30:48

This project explores the simulation of the motion of a pendulum for the equation of damped vibration of a pendulum. Below is the equation (taken from "Challenges" page): An attempt is made to solve the above equation, and then call it using ode45 to get an array of Read more

### Plotting of an Otto Cycle graph in MATLAB Arjun Bhat · 2019-08-12 19:40:08

Project involves plotting an Otto Cycle graph in MATLAB The goal is to plot all strokes for a petrol operating by the otto cycle from intake, compression, power to exhaust, including both adiabatic curves. Description: The Otto Cycle is the idealised cycle that descr Read more

### 2R Robotic Arm Simulation using MATLAB Arjun Bhat · 2019-07-28 08:19:59

Code and Description: The project involves simulating a 2-joint robotic arm. % Lengths l1 = 1; l2 = 0.5; % Angles ang1 = linspace (0, 90, 20); ang2 = linspace (0, 90, 20); count = 1; % loop for i = 1:length(ang1) ANG1 = ang1(i); for j = 1:length(ang2 Read more

Loading...