Download Numerical Solutions of Laplace's Equation - Assignment 6 | CS 2073 and more Assignments Computer Science in PDF only on Docsity! CS 2073, Engineering Programming Assign. 6 03:25:08 CST, Mon Mar 26 2001 Programming Assignment 6: Numerical Solution of Laplace’s Equation CS 2073, Computer Programming with Engineering Applications Spring Semester, 1992 For this assignment, please first read the attached informal description, taken from a 1978 Fortran textbook: A FORTRAN Coloring Book, by Roger E. Kaufman, MIT Press. This assignment starts with a region filled with liquid. There are fixed temperatures maintained on the boundaries. An interative method determines the final steady-state temperature distribution. The portion studied is just a two-dimensional slice through the liquid-filled region. Please study this nine page write-up carefully because, along with the bad jokes, it describes the program very well. In general you should try to write flexible programs, using named constants. A sample set of constants and types to use for this assignments is the following: const (* below, m’s used for rows, n’s for columns *) m1 = 20; (* top of inner space at 212 degrees*) m2 = 40; (* bottom of inner space at 212 degrees*) m3 = 60; (* lower boundary at 32 degrees *) m0 = 30; (* start of liquid on the outside "bath" at 32 degrees*) n1 = 20; (* left side of inner space at 212 degrees *) n2 = 40; (* right side of inner space at 212 degrees *) n3 = 60; (* far right boundary *) border = ’#’; blank = ’ ’; templow = 32.0; (* low temp along edges in the "bath" *) temphigh = 212.0; (* high temp in the central rectangle *) tempmed = 100.0; (* medium temp at the top *) type atype = array[0..m3+1, 0..n3+1] of real; (* rows and columns *) (* assumes that [0,0] is upper left corner *) ctype = array[0..m3+1, 0..n3+1] of char; (* matching character array *) var a: atype; c: ctype; You should also use reasonable procedures and functions to implement the various parts of the program. Again a sample of some header declarations follows: procedure initialize(var a:atype; var c: ctype); procedure step(var a:atype; var change: real); (* one iteration *) procedure store(var a:atype; var c: ctype); (* stores proper char in c *) procedure display(var c: ctype); (* prints c out *) When you run your program, use 0.25 degrees for the criterion for deciding when to Page 1 CS 2073, Engineering Programming Assign. 6 03:25:08 CST, Mon Mar 26 2001 terminate, as discussed by Kaufman. Print the number of steps needed to meet the criterion. Finally, your program should use letters from A to Z to indicate the temperature range in the final output, inserting the proper character in the array c, and the printing c. You should also output a temperature “key,” showing which letter is used for a given temperature range. An example key is shown below. Temperature key Temp Letter 32 Z 36 Y 40 Y 44 X 48 X 52 W 56 W 60 V 64 V 68 U 72 T 76 T 80 S 84 S 88 R 92 R 96 Q 100 Q 104 P 108 O 112 O 116 N 120 N 124 M 128 M 132 L 136 L 140 K 144 J 148 J 152 I 156 I 160 H 164 H 168 G 172 G 176 F 180 E 184 E 188 D 192 D 196 C 200 C 204 B 208 B 212 A Page 2