From d54fe25cace10879e7846f67cedc20b3d8955db1 Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Fri, 22 Apr 2022 09:49:53 +0200 Subject: [PATCH] Update documentation of implicit BTCS --- doc/ADI_scheme.org | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/doc/ADI_scheme.org b/doc/ADI_scheme.org index d47f3cb..7a0b0c7 100644 --- a/doc/ADI_scheme.org +++ b/doc/ADI_scheme.org @@ -195,23 +195,36 @@ A similar treatment can be applied to the BTCS implicit scheme. *** implicit BTCS -\begin{equation}\displaystyle - \frac{C_i^{j+1} -C_i^{j}}{\Delta t} = \alpha\frac{\frac{C^{j+1}_{i+1}-C^{j+1}_{i}}{\Delta x}-\frac{C^{j+1}_{i}-C^{j+1}_{i-1}}{\Delta x}}{\Delta x} +First, we define the Backward time difference: + +\begin{equation} + \frac{\partial C }{\partial t} = \frac{C^j_i - C^{j-1}_i}{\Delta t} \end{equation} -In practice, we evaluate the first derivatives of $C$ w.r.t. $x$ on -the boundaries of each cell (i.e., $(C_{i+1}-C_i)/\Delta x$ on the -right boundary of the i-th cell and $(C_{i}-C_{i-1})/\Delta x$ on its -left cell boundary) and then repeat the differentiation to get the -second derivative of $C$ on the the cell centre $i$. +Second the spatial derivative approximation: -This discretization works for all internal cells, but not for the -boundaries. To properly treat them, we need to account for the -discrepancy in the discretization. +\begin{equation} + \frac{\partial^2 C }{\partial t} = \frac{\frac{C^{j}_{i+1}-C^{j}_{i}}{\Delta x}-\frac{C^{j}_{i}-C^{j}_{i-1}}{\Delta x}}{\Delta x} +\end{equation} -For the first (left) cell, whose center is at $x=dx/2$, we can -evaluate the left gradient with the left boundary using such distance, -calling $l$ the numerical value of a constant boundary condition: +Taking the 1D diffusion equation from [[eqn:1]] and substituting each term by the +equations given above leads to the following equation: + +\begin{equation}\displaystyle + \frac{C_i^{j} -C_i^{j-1}}{\Delta t} = \alpha\frac{\frac{C^{j}_{i+1}-C^{j}_{i}}{\Delta x}-\frac{C^{j}_{i}-C^{j}_{i-1}}{\Delta x}}{\Delta x} +\end{equation} + +Since we are not able to solve this system w.r.t unknown values in $C^{j-1}$ we +are shifting each j by 1 to $j \to (j+1)$ and $(j-1) \to j$ which leads to: + +\begin{align}\displaystyle +\frac{C_i^{j+1} - C_i^{j}}{\Delta t} & = \alpha\frac{\frac{C^{j+1}_{i+1}-C^{j+1}_{i}}{\Delta x}-\frac{C^{j+1}_{i}-C^{j+1}_{i-1}}{\Delta x}}{\Delta x} \nonumber \\ + & = \alpha\frac{C^{j+1}_{i-1} - 2C^{j+1}_{i} + C^{j+1}_{i+1}}{\Delta x^2} +\end{align} + +This only applies to inlet cells with no ghost node as neighbor. For the left +cell with its center at $\frac{dx}{2}$ and the constant concentration on the +left ghost node called $l$ the equation goes as followed: \begin{equation}\displaystyle \frac{C_0^{j+1} -C_0^{j}}{\Delta t} = \alpha\frac{\frac{C^{j+1}_{1}-C^{j+1}_{0}}{\Delta x}- @@ -225,7 +238,7 @@ C_0^{j+1} & = C_0^{j} + \frac{\alpha \cdot \Delta t}{\Delta x^2} \cdot \left( C & = C_0^{j} + \frac{\alpha \cdot \Delta t}{\Delta x^2} \cdot \left( C^{j+1}_{1}- 3 C^{j+1}_{0} +2l \right) \end{align} -Now we define variable $s_x$ as following: +Now we define variable $s_x$ as followed: \begin{equation} s_x = \frac{\alpha \cdot \Delta t}{\Delta x^2}