Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Basic algorithm: 1. Get from the user the names of the input and output files. 2. Read from the input file the initial temps for

image text in transcribedimage text in transcribed

Basic algorithm: 1. Get from the user the names of the input and output files. 2. Read from the input file the initial temps for top, right, bottom, and left sides of plate. 3. Read from the input file the tolerance for equilibrium. 4. Initialize the edges of the 2D grid with initial temps you got from the input file, and initialize the inner cells of the grid to 0.0. 5. Continue updating temperature values within inner cells until equilibrium is reached. 6. Output to the output file the values of the inner cells of the grid after equilibrium obtained. Step 5 details When updating the grid's temperatures always start at the top, left inner cell and update that row before updating the row below it. So, the first cell to be updated will be grid[1][1], then grid[1][2], and so on. Never change an edge cell's temperature. A cell's new temperature will always be the average of the 4 cells adjacent to it, the cells immediately above, below, left, and right of the cell. You should update all inner cells of the entire grid, while always keeping track of the largest difference between the old value and the new calculated value for a cell. Once you have completely updated the grid, if your max difference is within the tolerance level, equilibrium has been reached. You are done. Go ahead and output the temperatures in each cell of your grid. If not, you need to update the entire grid again. You are required to use 2D arrays, NOT vectors, for this assignment. The grid dimensions will always be the same as the grid example above (6 X 8). Input/Output File Specifications Input and output file names come from the user. Ask for input file first. Input File The input file will have the 4 starting temps on one line, each separated by a space and the tolerance on the second line. 29 45 0 15 0.5 Output File When completed, the output file should list the temperatures of the inner cells only: 20.6404 22.6151 23.94425.7453 28.7711 34.1826 16.4471 17.5668 19.1289 21.852826.5254 34.0902 13.1644 12.8385 13.9106 16.615121.7503 30.7639 8.81194 7.2602 7.58734 9.3525513.3295 22.2734 Basic algorithm: 1. Get from the user the names of the input and output files. 2. Read from the input file the initial temps for top, right, bottom, and left sides of plate. 3. Read from the input file the tolerance for equilibrium. 4. Initialize the edges of the 2D grid with initial temps you got from the input file, and initialize the inner cells of the grid to 0.0. 5. Continue updating temperature values within inner cells until equilibrium is reached. 6. Output to the output file the values of the inner cells of the grid after equilibrium obtained. Step 5 details When updating the grid's temperatures always start at the top, left inner cell and update that row before updating the row below it. So, the first cell to be updated will be grid[1][1], then grid[1][2], and so on. Never change an edge cell's temperature. A cell's new temperature will always be the average of the 4 cells adjacent to it, the cells immediately above, below, left, and right of the cell. You should update all inner cells of the entire grid, while always keeping track of the largest difference between the old value and the new calculated value for a cell. Once you have completely updated the grid, if your max difference is within the tolerance level, equilibrium has been reached. You are done. Go ahead and output the temperatures in each cell of your grid. If not, you need to update the entire grid again. You are required to use 2D arrays, NOT vectors, for this assignment. The grid dimensions will always be the same as the grid example above (6 X 8). Input/Output File Specifications Input and output file names come from the user. Ask for input file first. Input File The input file will have the 4 starting temps on one line, each separated by a space and the tolerance on the second line. 29 45 0 15 0.5 Output File When completed, the output file should list the temperatures of the inner cells only: 20.6404 22.6151 23.94425.7453 28.7711 34.1826 16.4471 17.5668 19.1289 21.852826.5254 34.0902 13.1644 12.8385 13.9106 16.615121.7503 30.7639 8.81194 7.2602 7.58734 9.3525513.3295 22.2734

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

Describe the team dynamics at Facebook.

Answered: 1 week ago

Question

The paleolithic age human life, short write up ?

Answered: 1 week ago

Question

3. Is there opportunity to improve current circumstances? How so?

Answered: 1 week ago

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago