First, we need to define the problem size and parameters. Let's assume we have a 2D domain of size Nx by Ny, and we want to solve the heat conduction equation with implicit Euler for time and central differencing for space:
main.m351 chars10 lines
Next, we need to set up the coefficient matrix and the rhs vector using pointers. The coefficient matrix will have (NxNy) rows and columns, and the rhs vector will have (NxNy) elements. To use pointers, we need to define the indices of the matrix elements and rhs vector elements.
main.m1247 chars41 lines
Finally, we can use the Jacobi solver to solve the system of equations. We can define a function for the Jacobi solver, and use it to iterate the solution until convergence.
main.m630 chars29 lines
This will give us the solution for the heat conduction equation using implicit Euler, central differencing, and the Jacobi solver.
gistlibby LogSnag