My post is structured in four parts:
I give you some information about the context my principal questions refer to.
I will tell you what I believe to know about the Thomas Algorithm. If I am wrong in any regards, correct me please.
I suggest two approaches on how to implement time stepping for the heating process.
I will state my questions
Part I: Background Information
I use the finite-difference-method to simulate Joule-heating.
The first PDE is the Laplace-equation. As a solution it delivers the electrical potential field. This potential field is used to calculate the joule-heating, which is the source term in the heat-diffusion equation. Thus, for subseqent analysis we can regard the potential field/joule heating as given.
The second PDE is the heat-diffusion equation for an instationary/time-dependent heating. I use the Peaceman-Rachford scheme to split the heat-diffusion-equation in two half-time steps. Below you can see the heat-diffusion equation casted in the time-splitting scheme of Peaceman-Rachford:
This term $\mu_x=\frac{\lambda dt}{\rho c_p \Delta x^2}$ is called Fourier-number, where $\lambda$ is the thermal conductivity, $\rho$ is the densitiy, $c_p$ is the specific heat, $dt$ is the time step, $\Delta x$ is the spacial step in x-direction. $\delta_x^2$ is the differential operator for the second derivative. Subsequently, $\delta_x^2T_{ij}=T_{i+1,j}-2T_{i,j}+T_{i-1,j}$. The same applies analogously to $\mu_y$. $F_{i,j}$ is the source term representing the joule heating.
I apply the Thomas algorithm to each of both equations of the Peaceman-Rachford-scheme to solve for the temperature field over a geometry in the x-y-plane.
Based on the Joule-heating, material parameters, an initial value for the temperature field and the boundary conditions the algorithm is supposed to compute the instationary/transient temperature field. Of course, it also should be capable of computing the heating up to the stationary state.
Part II: What do I believe to know about the Thomas Algorithm
- It is a direct solver for linear equation systems with tridiagonal coefficient matrices. Direct means that - depending on the number of linear equations of the system - you can solve the linear equation systems with a fixed number of basis operations or rather you don't need to perform iterations over the solution vector. In case of the Thomas Algorithm the number of basic operations is of Order 0(N4), where N stand for the number of equations.
- It is an exact solver, you can obtain exact solution provided that the personal computer does not have any round off errors.
- You should be able to get a result after running your Thomas-Algorithm over your linear equation systems only ONCE, i.e. you don't need to iterate your solution over and over again and therefore you don't need a convergence criterion.
Part III: time stepping
1. approach
After finishing the first time step, I take the solved temperature field as the input for the second time step. After finishing the second time step, I take the solved temperature field as the input for the third time step and so forth for all subsequent time steps. The pseudo-code for this method can be seen below
PSEUDO-CODE START
number_iteration = 100;
dt = 0.01 s;
for i = 1:number_iteration
do{
Use temperature field of time step n as input for first equation of PR-Scheme, i.e. apply following equation:
$(1-\frac{\lambda dt}{\rho c_p \Delta x^2}\delta_x^2)T_{i,j}^{n+0.5}=(1+\frac{\lambda dt}{\rho c_p \Delta y^2}\delta_y^2)T_{i,j}^{n}+\frac{\ dt}{2}F_{i,j}^{n+0.5}$
Apply Thomas Algorithm to first equation of PR-Scheme (directly above) to solve for temperature field of time step n+0.5.
Use temperature field of time step n+0.5 as input for second equation of PR-Scheme, i.e. apply subsequent equation:
$(1-\frac{\lambda dt}{\rho c_p \Delta y^2}\delta_y^2)T_{i,j}^{n+1}=(1+\frac{\lambda dt}{\rho c_p \Delta x^2}\delta_x^2)T_{i,j}^{n+0.5}+\frac{\ dt}{2}F_{i,j}^{n+0.5}$
Apply Thomas Algorithm to second equation of PR-Scheme (directly above) to solve for temperature field of time step n+1.
}
PSEUDO-CODE END
For each time step dt = 0.01 s is used. The overall simulation time amounts to 1 s (100 runs x 0.01 s).
2. approach
How does the approach 2 differs from approach 1? Approach 2 accumulates the time steps by dt = dt + dt_inc. Approach 1 always uses a constant time step dt. This is the only difference. Subsequently, in approach 2 an increased dt is used for calculating the temperature field for the next time step. The pseudo-code for this approach is stated below:
PSEUDO-CODE START
number_iteration = 100
dt = 0 s;
dt_inc = 0.01 s;
for i=1:number_iteration
do {
dt = dt + dt_inc
Use temperature field of time step n as input for first equation of PR-Scheme, i.e. apply following equation:
$(1-\frac{\lambda dt}{\rho c_p \Delta x^2}\delta_x^2)T_{i,j}^{n+0.5}=(1+\frac{\lambda dt}{\rho c_p \Delta y^2}\delta_y^2)T_{i,j}^{n}+\frac{\ dt}{2}F_{i,j}^{n+0.5}$
Apply Thomas Algorithm to first equation of PR-Scheme (directly above) to solve for temperature field of time step n+0.5.
Use temperature field of time step n+0.5 as input for second equation of PR-Scheme, i.e. apply subsequent equation:
$(1-\frac{\lambda dt}{\rho c_p \Delta y^2}\delta_y^2)T_{i,j}^{n+1}=(1+\frac{\lambda dt}{\rho c_p \Delta x^2}\delta_x^2)T_{i,j}^{n+0.5}+\frac{\ dt}{2}F_{i,j}^{n+0.5}$
Apply Thomas Algorithm to second equation of PR-Scheme (directly above) to solve for temperature field of time step n+1.
}
PSEUDO-CODE END
Part III: Questions
Which approach is the right one?