home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / MCAD254.ZIP / APPL / RELAX.MCD < prev    next >
Encoding:
Text File  |  1988-07-19  |  2.7 KB  |  120 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 42 1 39 
  11. a1,38,39,37
  12. Copyright (c) 1988 by MathSoft, Inc.
  13. .TXT 1 -42 2 15 
  14. a2,14,78,22
  15. THE LAPLACE
  16. EQUATION
  17. .TXT 0 16 3 65 
  18. a3,64,62,150
  19. This document solves for the steady state temperatures over a 
  20. rectangular plate with fixed temperatures along the edges, 
  21. using a relaxation method.
  22. .TXT 0 65 1 13 
  23. a1,12,78,11
  24. /equations
  25. .TXT 4 -80 2 19 
  26. a2,18,77,31
  27. number of nodes
  28. on each edge:
  29. .TXT 0 24 1 12 
  30. a1,11,44,10
  31. vertical:
  32. .EQN 0 11 1 7 
  33. M~8
  34. .EQN 0 15 1 11 
  35. m~M-1
  36. .EQN 0 14 1 12 
  37. i:0;m
  38. .TXT 0 16 1 71 
  39. a1,70,76,69
  40. Some node selection functions and corresponding averaging functions:
  41. .TXT 1 -58 1 14 
  42. a1,13,44,12
  43. horizontal:
  44. .EQN 0 13 1 7 
  45. N~8
  46. .EQN 0 15 1 11 
  47. n~N-1
  48. .EQN 0 14 1 12 
  49. j:0;n
  50. .EQN 1 16 1 48 
  51. notedge(i,j)~(i>0)*(j>0)*(i<m)*(j<n)
  52. .TXT 1 -80 1 43 
  53. a1,42,77,41
  54. guess for temperature at interior nodes:
  55. .EQN 0 44 2 11 
  56. M[(i,j):0
  57. .TXT 1 36 1 22 
  58. a1,21,76,20
  59. for interior nodes:
  60. .TXT 1 -80 1 20 
  61. a1,19,77,18
  62. temperature on...
  63. .TXT 1 4 1 65 
  64. a1,64,80,63
  65. top                left               bottom             right
  66. .EQN 0 76 3 61 
  67. I(C,i,j)~(1/4)*(C[(i+1,j)+C[(i-1,j)+C[(i,j+1)+C[(i,j-1)-4*C[(i,j))
  68. .EQN 2 -76 2 11 
  69. M[(0,j):2
  70. .EQN 0 19 2 11 
  71. M[(i,0):1
  72. .EQN 0 19 2 12 
  73. M[(m,j):-2
  74. .EQN 0 19 2 12 
  75. M[(i,n):-1
  76. .TXT 2 19 1 50 
  77. a1,49,76,48
  78. for insulated edges, not including the corners:
  79. .EQN 1 -80 1 23 
  80. WRITEPRN(matrix):M
  81. .TXT 0 27 3 50 
  82. a3,49,47,118
  83. After calculating this screen, disable the 
  84. equation at the left with the equation command. 
  85. Then press [Ctrl][PgDn].
  86. .EQN 1 53 1 36 
  87. top(i,j)~(i≈0)*(j>0)*(j<n)
  88. .EQN 2 0 3 52 
  89. T(C,i,j)~(1/4)*(C[(0,j-1)+C[(0,j+1)+2*C[(1,j)-4*C[(i,j))
  90. .EQN 2 -80 1 22 
  91. A:READPRN(matrix)
  92. .TXT 0 27 2 46 
  93. a2,45,47,72
  94. Now press [F10] C P repeatedly to iterate.
  95. B approaches the solution. 
  96. .TXT 2 81 1 39 
  97. a1,38,52,37
  98. ...and similarly for the other edges
  99. .EQN 1 -108 2 44 
  100. B[(i,j):A[(i,j)+if(notedge(i,j),I(A,i,j),0)
  101. .TXT 0 80 1 15 
  102. a1,14,78,13
  103. [Ctrl][PgDn]
  104. .EQN 2 -29 1 23 
  105. WRITEPRN(matrix):B
  106. .TXT 0 29 3 78 
  107. a3,77,75,160
  108. For example, if the right, left, and bottom edges of the plate are held at 
  109. fixed temperatures and the top edge is insulated, the relaxation equation 
  110. will be:
  111. .EQN 2 -29 2 25 
  112. max((|(A-B)){49})=?
  113. .TXT 1 -21 1 20 
  114. a1,19,52,18
  115. largest residual:
  116. .EQN 1 50 2 67 
  117. B[(i,j):A[(i,j)+if(notedge(i,j),I(A,i,j),if(top(i,j),T(A,i,j),0))
  118. .EQN 1 -67 8 54 
  119. B={18994}?
  120.