Beginning with my code from the assignment, I added a coulomb force to account for the electrostatic
Copyright By PowCoder代写 加微信 powcoder
attraction between the rocket and the cloud. Since they are oppositely charged, and I defined rrelcloud
to be the vector from the cloud to the rocket, the coulomb force will be in the opposite direction as
rrelcloud.
rrelcloud = r-vector(-1e3, 3e3)
clouddist=magnitude(rrelcloud)
Fc = -8.99e9*charge^2/clouddist^3*rrelcloud
This coulomb force was then added to the net force equation:
!!Acceleration
a = (Fg+Fd+Ft+Fc)/m
I also added a halt condition to stop the simulation if the rocket comes within 400 m of the cloud:
TIME 0 TO 1200 halt((ry<0) or (ry>10e6) or (clouddist<400))
I found that the rocket is struck by lightning at the coordinates (-669,3224):
From question 1), I found that the time where the rocket is struck by lightning is 1.089 s.
I want the Coulomb force to go to zero after the rocket is struck by lightning. I added a conditional
statement to only apply the Coulomb force before this time:
tcharge = 1.0889
Fc = (if(t
I found that the rocket hits the earth at (-6.36e6, -5.87e6):
Complete Flex Code:
TITLE ‘LT52CD4’ { the problem identification }
COORDINATES cartesian1 { coordinate system, 1D,2D,3D, etc }
VARIABLES { system variables }
r (threshold=1e-5) = vector(rx,ry)
v (threshold=1e-5) = vector(vx,vy)
SELECT { method controls }
ngrid = 1 !low FEM density speeds up solution with no downside when not using
DEFINITIONS { parameter definitions }
vi = 7*330
vhat = v/(magnitude(v)+1e-3)
!!Rocketry
tstart = 3*60
mfueli=mi*.50
tfuel = tstart+mfueli/q
Ft = (if (t>tstart and t
!MONITORS { show progress }
PLOTS { save result displays }
for t= 0 by endtime/50 to endtime
history(rho) at (0) vs h
history(p) at (0) vs h
history(ry,vy, 200e3) at(0)
history(magnitude(Fg)/m, g0, magnitude(Ft)/m, magnitude(Fd)/m,
magnitude(Fc)/m) at(0)
history(ry) at (0)vs (rx) report(rx) report ry
history((ry+rearth)/rearth) at (0)vs (rx/rearth) report(rx)
history(Energy) at (0)
history(EnergyDelta) at(0)
report val(Energy,0)
report val(EnergyDelta,0)
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com