-
Notifications
You must be signed in to change notification settings - Fork 0
/
ControlFlowCamberFormula.jl
53 lines (46 loc) · 1.32 KB
/
ControlFlowCamberFormula.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#=
ControlFlowCamberFormula.jl
Jacob Child
Flow Lab Onboarding
Feb 3, 2022
Background: A Camber line is "a measure of the curvature of an airfoil"
It is halfway between the upper and lower curves of the airfoil
Equation
if X<=p
zbar = c*(2*p*x-x^2)/(p^2)
else if x > p
zbar = c*(1-2*p+2*p*x-x^2)/((1-p)^2)
else
println("error")
Pseudocode - ask for the c and p inputs , run an if statement and have A
for loop run through x values, 0:.1:1;
=#
println("Hello! We are going to calculate the the camber of an airfoil \n")
println("\n input c \n")
input1 = readline()
c = parse(Float64, input1)
println("\n input p \n")
input2 = readline()
p = parse(Float64, input2)
#println(p) #to check if it parsed correctly
x = [0:.1:1.1;] #makes an array stopping at 1 and step size .1
global zbar = x[1:11]
global k = 1
while x[k] <= 1
if x[k] <= p
global zbar[k] = c*(2*p*x[k]-x[k]^2)/(p^2)
global k = k + 1 #iterate
elseif x[k] > p
global zbar[k] = c*(1-2*p+2*p*x[k]-x[k]^2)/((1-p)^2)
global k = k + 1 #iterate
else
println("error")
break
end
end
println("\n")
println(zbar)
pop!(x) #removes the last value of the x array to allow DataFrames to work
using DataFrames #only works in Julia REPL?
DataFrame()
DataFrame("X" => x, "zbar" => zbar)