The 2D unsteady heat conduction equation with implicit Euler in time and central differencing in space can be written as follows:
where u is the temperature field, alpha is the thermal diffusivity, and dx, dy and dt are the grid spacings in the x, y, and t directions, respectively.
We can discretize the equation using central differencing as:
where k is the time step index, i and j are the grid indices in the x and z directions, respectively.
This discretized equation can be written as:
where
and F is the right-hand side vector given by
where u_star is the temperature field from the previous time step.
To solve the matrix equation using Jacobi method in Matlab, we can write the following code:
main.m1446 chars64 lines
This code sets up the 2D grid, initializes the temperature field with a boundary condition, and sets up the coefficient matrix and the right-hand side vector for the implicit scheme. It then solves the matrix equation using Jacobi method iteratively for each time step until convergence is reached. Finally, it reshapes the solution into a 2D grid and plots the temperature field over the domain.
gistlibby LogSnag