Thomas method for Crank–Nicolson scheme with a central finite analog. How to get the boundary values of the coefficients?

159 Views Asked by At

The crank nicolson scheme:

$$\begin{cases}\Large \frac{w_i^k - w_i^{k-1}}{h_{t}} = \frac{m}{2c} (\frac{w_{i+1}^k - 2w_i^k + w_{i-1}^k}{h_x^2} + \frac{w_{i+1}^{k-1} - 2w_i^{k-1} + w_{i-1}^{k-1}}{h_x^2}) & ,i = \overline{1, I-1} & ,k = \overline{1, K} \Large \\w_i^0 = \psi_i & ,i =\overline{0,I} \Large \\w_0^k = 0 & ,k = \overline{0,K} \\ \Large \frac{w_{I+1}^k - w_{I-1}^k}{2h_{x}} = -\frac{\alpha}{m}w_I^k & ,k = \overline{0, K} \end{cases} $$ I made the equation convenient for the Thomas algorithm:

$$A_{i}w_{i+1}^k + B_{i}w_i^k + C_{i}w_{i-1}^k = F_i^{k-1} $$ Where: $$A_{i} = -\gamma;$$ $$B_{i} = 1 + 2\gamma;$$ $$C_{i} = -\gamma;$$ $$ \gamma = \frac{mh_{t}}{2ch_x^2}. $$ $$F_i^{k-1} = w_i^{k-1} + \gamma(w_{i+1}^{k-1} -2w_i^{k-1} + w_{i-1}^{k-1}). $$

I want to found the coefficients in the boundaries where i = I — 1, because it is default way: but, when I put the boundary condition to the equation where i = I — 1, I do not know how I can remove $w_{I+1}^k$, Need to use $ w_{I-1}^k = \alpha_{I-1} w_{I}^k + \beta_{I-1} $, or I have another problem? Also, I don`t know how to get the values in the right bound by reason of this problem with $ w_{I+1}^k$ value from my initial condition.