Guest User

Untitled

a guest
May 26th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. dt = 0.0001 # time step, delta t
  2. tmax = 25 # max time, s
  3. t = np.linspace(0, tmax, num=tmax/dt) # time vector
  4. nt = len(t) # total number of time steps
  5.  
  6. def rates(c, t):
  7. """
  8. w = wood-oil as conc[0]
  9. nv = non-volatiles as conc[1]
  10. v = volatiles as conc[2]
  11. """
  12. Knv = 0.3
  13. Kv = 0.8
  14. rw = -(Knv + Kv) * c[0]
  15. rnv = Knv * c[0]
  16. rv = Kv * c[0]
  17. return [rw, rnv, rv]
  18.  
  19. cc = sp.odeint(rates, [1, 0, 0], t)
  20.  
  21. def dCdt(c, t):
  22. """
  23. w = wood-oil as conc[0]
  24. nv = non-volatiles as conc[1]
  25. v = volatiles as conc[2]
  26. """
  27. Knv = 0.3
  28. Kv = 0.8
  29. Kr1 = 9.2e7; r1 = 2.5
  30. Kcr = 4.1e-5; cr = 0.9
  31. Kc1 = 3.7e5; c1 = 1.1
  32. Kd = 8.0e-4; d = 0.9
  33. Ka = 6.1e-6; a = 1.4
  34. Kg = 1.8e-4; g = 0.8
  35. Kr2 = 37.0e5; r2 = 0.7
  36. rw = -(Knv + Kv)*c[0]
  37. rnv = Knv*c[0] - Kr1*c[1]**r1 - Kcr*c[1]**cr - Kc1*c[1]**c1
  38. rv = Kv*c[0] + Kcr*c[1]**cr - Kd*c[2]**d - Ka*c[2]**a - Kg*c[2]**g - Kr2*c[2]**r2
  39. return [rw, rnv, rv]
  40.  
  41. cc2 = sp.odeint(dCdt, [1, 0, 0], t)
Add Comment
Please, Sign In to add comment