home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e004 / 1.img / DIFFUSE.MCD < prev    next >
Encoding:
Text File  |  1987-10-22  |  1.3 KB  |  64 lines

  1. .MCD 20000 0
  2. .CMD PLOTFORMAT logs=0,0 subdivs=1,1 size=5,15 type=l
  3. .CMD FORMAT  rd=d ct=10 im=i et=3 zt=15 pr=3 mass length time charge
  4. .CMD SET ORIGIN 0
  5. .CMD SET TOL 0.001000
  6. .CMD MARGIN 0
  7. .CMD LINELENGTH 78
  8. .CMD SET PRNCOLWIDTH 8
  9. .CMD SET PRNPRECISION 4
  10. .TXT 0 1 4 27 
  11. a4,26,24,65
  12. SIMULATE DIFFUSION       
  13. 
  14. Based on the diffusion 
  15. equation ...
  16. .EQN 0 34 5 25 
  17. ?f(x,t):d^2/dx^2*f(x,t)
  18. .TXT 6 -35 1 32003 
  19. b1,32002,78,66
  20. Approximate this differential equation with a difference equation
  21. .EQN 2 1 1 12 
  22. t:0;9
  23. .TXT 0 18 1 34 
  24. a1,33,59,32
  25. ... ranges over time increments
  26. .EQN 1 -18 1 13 
  27. x:1;49
  28. .TXT 0 18 1 35 
  29. a1,34,60,33
  30. ... ranges over space increments
  31. .EQN 1 -18 1 10 
  32. α:.25
  33. .TXT 0 18 1 58 
  34. a1,57,60,56
  35. ... α diffuses to left and right in each time increment
  36. .TXT 2 -19 1 31 
  37. a1,30,78,29
  38. Initial conditions: time t=0
  39. .EQN 2 0 2 11 
  40. f[(0,x):0
  41. .EQN 0 16 2 11 
  42. f[(0,0):0
  43. .EQN 0 16 2 12 
  44. f[(0,50):0
  45. .TXT 0 16 2 20 
  46. a2,19,30,26
  47. ... 0 everywhere
  48. but ...
  49. .EQN 3 -17 2 12 
  50. f[(0,25):1
  51. .TXT 0 17 1 23 
  52. a1,22,31,21
  53. ... 1 in the middle.
  54. .TXT 3 -48 1 37 
  55. a1,36,78,35
  56. Difference equation for diffusion:
  57. .EQN 2 1 2 47 
  58. f[(t+1,x):f[(t,x)+α*(f[(t,x-1)-2*f[(t,x)+f[(t,x+1))
  59. .TXT 3 -1 1 46 
  60. a1,45,78,44
  61. Now plot concentration at t=0, t=4, and t=9
  62. .EQN 3 2 21 73 
  63. &&f[(0,x),f[(4,x),f[(9,x){1,1,20,50,l}@&&x
  64.