Modeling 2D Heat Conduction Using Matlab & Central Divided Difference Method

AI Thread Summary
The discussion focuses on modeling a 2D steady-state heat conduction problem using Matlab and the central divided difference method. The user aims to simulate heat propagation from a duct at 60 degrees Celsius into surrounding earth, represented by an 8x8 temperature matrix with specific boundary conditions. They plan to iteratively update the matrix using a for loop, applying the central differencing formula to calculate new temperature values based on neighboring points. The user successfully confirms that their syntax for updating the matrix elements works, allowing for straightforward modifications and iterations. Overall, the approach demonstrates a practical application of numerical methods in Matlab for solving heat conduction problems.
grufff
Messages
2
Reaction score
0
1. The problem statement

I'd like to use Matlab to help me model and solve a simple 2D steady state heat conduction problem:

A square section duct is buried in the Earth some distance below the surface. This duct is at a steady temperature of 60 degrees C. I need to use the central divided difference method to show how the heat from the duct propagates into the surrounding earth, and provide temperatures at different points across a 2D section (end on) view.

Below is 8x8 matrix representing the known and initial value guesses for temperatures: 4 degrees all across the surface, -17 degrees at lowest depth of interest, linear temperature gradient between those two values at some distance to the right of the duct, and the duct itself on the left hand side at 60 degrees (rows 4 & 5, columns 1 & 2). All of the 10 degree values are initial guesses to get the iterative process under way.

4 4 4 4 4 4 4 4
10 10 10 10 10 10 10 1
10 10 10 10 10 10 10 -2
60 60 10 10 10 10 10 -5
60 60 10 10 10 10 10 -8
10 10 10 10 10 10 10 -11
10 10 10 10 10 10 10 -14
-17 -17 -17 -17 -17 -17 -17 -17

(sorry, can't get my matrix properly aligned in here)

The Attempt at a Solution



Intend to write an m file script setting A = above matrix. Start a for loop with i = 1:(some value, however many iterations I might need).

Define a new 8x8 matrix B, using central divided differencing with data pulled from A to create each element of matrix B

Once this process is complete, set A = B (to map all the newly calculated values from B onto A), and return to start of loop to run through next iteration. Repeat until desired accuracy is reached.

Central differencing requires me to sum values from "north, south, east and west" of my point of interest and divide by 4 to find a new value. For example, to calculate value of B(2,2), I use values around that point from A as follows:

B(2,2) = (A(1,2)+A(3,2)+A(2,1)+A(2,3))/4

I've guessed at that syntax, can anyone please give me a working example?

Also can I build my 8x8 B matrix from a simple list of expressions similar to above, one for each element to be defined?

ie:

B(2,2) = (A(1,2)+A(3,2)+A(2,1)+A(2,3))/4
B(2,3) = (A(1,3)+A(3,3)+A(2,2)+A(2,4))/4
etc.

I'd really appreciate any advice or comments anyone might have for me, this is my first Matlab experience.
 
Physics news on Phys.org
Sorry to reply to my own post, but I'm okay with this now. The script was really quite straightforward to write.

The syntax

B(2,2) = (A(1,2)+A(3,2)+A(2,1)+A(2,3))/4
B(2,3) = (A(1,3)+A(3,3)+A(2,2)+A(2,4))/4

does work fine. It's simple to modify the matrix in this way, and then loop it for repeated iterations.
 
Back
Top