Now that we have made a model of how heat flows through a material of uniform proprerties, let's explore how heat flows through a non-uniform material. Our model now will allow for each cell of the plate to be made of a different type of metal with different properties. Let's take another look at our heat conduction equation described by Fourier's Law:
$$\Large \frac{Q}{\Delta t} = -kA \frac{\Delta T}{\Delta x}$$
But now the Thermal Conductivity k is not the same for both cells! To resolve this, we take our two different
Conductivity values k1 and k2 and use their geometric mean.
$$\Large k = \frac{2}{\frac{1}{k_{1}} + \frac{1}{k_{2}}}$$
The properties of the different possible materials in our plate are listed below:
Aluminum:
Code: A
Density: 2712 (kg / m^3)
Heat Capacity: 897 (J / (kg * °C))
Thermal Conductivity: 236.0 (J / (s * m * °C))
Copper:
Code: C
Density: 8940
Heat Capacity: 385
Thermal Conductivity: 401.0
Gold:
Code: G
Density: 19320
Heat Capacity: 129
Thermal Conductivity: 318.0
Iron:
Code: I
Density = 7850
Heat Capacity: 449
Thermal Conductivity: 83.5
Lithium:
Code: L
Density = 534
Heat Capacity: 3582
Thermal Conductivity: 79.2
Silver:
Code: S
Density = 10490
Heat Capacity: 235
Thermal Conductivity: 428.0
Steel:
Code: E
Density = 7850
Heat Capacity: 475
Thermal Conductivity: 20.0
Titanium:
Code: T
Density = 4500
Heat Capacity: 523
Thermal Conductivity: 22.4
(These values taken from engineeringtoolbox.com)
Example
Let's imagine a 1-cubic-centimeter cube of Aluminum next to a 1-cubic-centimeter cube of Gold.
If the Aluminum is initially at 20°C and the Gold is at 200°C, then using a time interval Δt = 0.1 seconds our
simulation would yield the following:
Time Elapsed (s) │ T1 Initial (°C) │ T2 Initial (°C) ║ Heat Transferred (Q) │ T1 Final (°C) │ T2 Final (°C)
──────────────────┼─────────────────┼─────────────────╫──────────────────────┼───────────────┼───────────────
0.1 │ 20.000 │ 200.000 ║ 48.768 │ 40.047 │ 179.953
0.2 │ 40.047 │ 179.953 ║ 37.905 │ 55.629 │ 164.371
0.3 │ 55.629 │ 164.371 ║ 29.462 │ 67.740 │ 152.260
0.4 │ 67.740 │ 152.260 ║ 22.899 │ 77.153 │ 142.847
0.5 │ 77.153 │ 142.847 ║ 17.799 │ 84.469 │ 135.531
0.6 │ 84.469 │ 135.531 ║ 13.834 │ 90.156 │ 129.844
0.7 │ 90.156 │ 129.844 ║ 10.753 │ 94.576 │ 125.424
0.8 │ 94.576 │ 125.424 ║ 8.358 │ 98.012 │ 121.988
0.9 │ 98.012 │ 121.988 ║ 6.496 │ 100.682 │ 119.318
1.0 │ 100.682 │ 119.318 ║ 5.049 │ 102.758 │ 117.242
Immediately we can see that heat is transferred between these two cubes much more quickly than with steel, because both Aluminum and Gold have much higher Thermal Conductivities than steel. Additionally one might notice that the average temperature changes slightly over time, because the Heat Capacity and Density values of each metal are slightly different.
For our simulation, let's imagine we have 2D grid of 1cm * 1cm * 1cm cubes W columns wide by H rows deep.
At the beginning of each Δt interval, each cube will exchange heat with its orthogonal neighbors.
Note that all these exchanges happen "simultaneously", such that no two heat exchanges during the same interval will be affected by one another.
Round each cell's temperature to the nearest 0.001 °C after each iteration.
Input Data
The first line consists of two space-separated values W H N Δt T0 T1, where
W is the quantity of columns in the grid, H is the quantity of rows in the grid, N is the quantity of turns the simulation should be run for, Δt is the time interval in seconds,T0 is the initial temperature of the material in °C, and T1 is the secondary temperature in °C.The second line is a string of W * H characters, each corresponding to a "code" listed in the material properties table above
and describing the material composition of the metal plate, starting with the cube in the upper-leftmost cell of the grid and working down each row.
Initially the entire material will be kept at the temperature T0. At time = 0, certain cells in the grid will be instantly set to the temperature T1.
Those cells are listed in the third line of each group, as pairs of integers corresponding to the column and row of the cell's location in the grid (note that rows and columns are indexed at 0).
Answer
Return the average final temperature of the plate as a single decimal value.
Error should be less than 1e-6.
Example
input data:
2 1 10 0.1 20 200
AG
1 0
answer:
110.998500
A Larger Example
input data:
9 10 20 0.1 200 20
ACGILET
0 0 1 1 2 2 3 3 4 4 4 5 5 6 6 7 7 8 8 9
answer:
179.786056