How discretised PDE forms a matrix (matrix entries question)

21 Views Asked by At

Below you can see an example of discretising a PDE. What I don't get is how does it so happen that the entries $b_{ii}$ are defined the way below? Where does the minus sign come from? If we have that $i=j$ then $u_i-u_i=0$, so shouldn't the entries b_{ii} be vacuously zero? Would appreciate some insight.

enter image description here enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

You are confusing your entries $b_{ij}$. Look at the term $$ \sum_{j\in n_i}\frac{a_{i,j}l_{i,j}}{h_{i,j}}(u_j-u_i) $$ You can write this as $$ \sum_{j\in n_i}\frac{a_{i,j}l_{i,j}}{h_{i,j}}(u_j-u_i)= \sum_{j\in n_i/\lbrace i\rbrace}\frac{a_{i,j}l_{i,j}}{h_{i,j}}u_j- u_i\sum_{j\in n_i}\frac{a_{i,j}l_{i,j}}{h_{i,j}}=(\boldsymbol{B}U)_i $$ Hence, you can see your entry $$ b_{i,i}=-\sum_{j\in n_i}\frac{a_{i,j}l_{i,j}}{h_{i,j}} $$ You won't have $u_i$ in the matrix, it's a linear system of equations.