Question
This assignment is to write a C++ program that simulates the steady-state condition of a rectangular / square metal plate that has all 4 edges
This assignment is to write a C++ program that simulates the steady-state condition of a rectangular / square metal plate that has all 4 edges clamped / restrained to 0 degrees Celsius, with the exact center of the plate heated to a constant 200 degrees Celsius. To simulate this condition, create static double plate[21][21]={0}, a doubly dimensioned array of type double, with 21 rows and 21 columns all initialized to 0 (degrees). Then set the middle element, plate[21/2][21/2] = 200. In this method, for every given element in the 21 x 21 matrix, the new temperature of a cell is the average of the temperatures of its 4 neighboring cells. (Given that the array elements representing the edges [all of row zero, all of row 20, all of column 0, and all of column 20], and the central element [row=10, column=10] are never recalculated.) By repeatedly iterating over the whole plate, each cells temperature will gradually reach a steady state value. You can stop iterating when the maximum temperature change over the whole plate, for any cell, from the previous pass to the current pass, [excluding the edges and center,] on the plate drops below 0.0001 degrees. When your program reaches this degree of steady-state condition, you should print out the temperatures of the plate, including the edges and center, (to the hundredth of a degree.) The temperatures should be symmetrical, top-bottom, left-right. Please avoid numeric literals [21, 200, 0.0001, etc.] in your code. Instead use defined constants or const int values. When you make your code parameterized {declare double plate[MAXROWS][MAXCOLS] = {0}; plate[MAXROWS/2][MAXCOLS/2] = HITEMP;} you will be able to easily modify the code with only one or two changes to the defined constants. Since the plate and the final temperature distribution is symmetrical, create a solution that only allocates the upper half of the matrix and solves the simulation. Create a solution that only allocates the upper 1/4th of the plate, and solves the simulation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started