# Plotting the transient temperature profile of a 2D grid using finite-difference solver

1 view (last 30 days)
turtle smith on 6 May 2022
Edited: Torsten on 7 May 2022
I understand that for heat conduction through a plane 2D wall with constant thermal conductivity and no energy generated I can use this equasion for an interior node.
I can solve this by hand for small node problems but I really don't know how to set up the for loop to run for a large grid size. Anything would be helpful thank you.
Also if you wanted some variables to use it's for a square grid of various nodes.
T_Left side = 100
T_Top side = 200
T_Right = adiabatic (IDK how you would set this up)

Torsten on 7 May 2022
Edited: Torsten on 7 May 2022
Order the temperatures in the grid points
(e.g. T11, T12,T13,...,T1_nx,T21,T22,...,T2_nx,...,T_ny,1,T_ny,2,...T_ny,nx).
Write down the equation for temperature in the (nx*ny) grid points.
Put the coefficients in a matrix A of size (nx*ny) x (nx*ny) on the left-hand side and the constant terms in a vector b of size (nx*ny,1) on the right-hand side.
You'll get a matrix equation
A*T = b
for the temperatures T where A is a matrix with 5 bands.
Now you can solve for T using backslash:
T = A\b.