
maths
#dimensions 2
parameters 2
   theta 45.0
   dummy -88.8
fitting_parameters 1 theta
end

#trajectory
#closest_approach
#closest_approach_scan
aim

# SI units

2 # dimensions

# gravity
constant 0.0 -9.81

# environment
constant 1.0 # rho(r) FunctionND
constant 0.0 constant 0.0 # u_i(r) FunctionND[D]

# hard deck
plane   0.0 1.0   -1.0

# rocket
constant 0.9 # Cd(u,t)
constant 1.267e-4 # frontal area (mass,time): 0.5" dia
constant 0.0 # volume (mass, time)
table 4 0.0 5.0 0.8 5.0 0.8 0.0 1.0 0.0 # F(t)
# 5.6 g propellant in 0.8 s at 5 N:
# F Dt = D(mv) = v Dm => v = F Dt/Dm = 5 0.8 / 5.6e-3 = 714.286
constant 714.286 # alpha: F = -alpha dm/dt cf F Dt=D(m u_x) => F = u_x dm/dt => alpha = u_x
constant 1.0e8 # max structural pressure (mass,time), ~2 x strength for uniform body
constant 0.0 # ablation rate (fdrag = pdrag * area, gas rho, rocket mass)

# launcher
# rail position@t=0 velocity direction length
rail
   constant 0.0 0.0 # pos
   constant 0.0 0.0 # vel
   function polar_to_cartesian expressions 1.0 function deg_to_rad theta # dir
   0.5 # length

# initial state
0.0   0.0 0.0   0.0 0.0  0.01822 # t r u m

# integration
30.0 0.01 # dt dtsub

#end # for trajectory

# target trajectory r_i(t)
constant 400.0 constant 10.0

30.0 # dtmin to allow acceleration etc (before considering decreasing closure rate)

0 # verbose

#end # for closest approach

0.1 # parameter increments

# scan range limits
#0 90
#91 # steps
#end # for scan

# optimiser
flex_amoeba 1.0e-5 20.0 # cacc dcmax
#steepest_descent
#1 1.0e-8 1.0e-10 1000 # verbose acc eps maxits
#1.5 0.5 1 1.0 1.0 1.5 1.0e-8 # dcfac sfac nrecalc stepscale stepfac stepmin

#0.83 0.17

end

