I am writing a code for steady state heat transfer on a rectangular domain. I am specifying temperature on the edges - nonzero Dirichlet boundary condition. The equations can be written in form of
$$KT=Q$$ $K$ is conductivity matrix, $T$ is unknown nodal temperature vector, and $Q$ is thermal load vector consisting of internal heat generation. For example, the system can look like
$$\begin {bmatrix} K_{11} & K_{12} & K_{13} & \dots & K_{1N}\\ K_{21} & K_{22} & K_{23} & \dots & K_{2N}\\ \vdots\\ K_{N1} & K_{N2} & K_{N3} & \dots & K_{NN} \end{bmatrix} \begin {bmatrix} 100\\ 200\\ \vdots\\ T_N \end{bmatrix} = \begin {bmatrix} Q_1\\ Q_2\\ \vdots\\ Q_N \end{bmatrix} $$
Non zero temperatures are applied on the edges of the rectangular domain (non-homogeneous Dirichlet boundary condition). How can I handle computationally non-zero Dirichlet boundary condition to solve for unknown temperature vector?
And another one in my own project (not commented, but look to function starting on line 28): https://github.com/tjolsen/YAFEL/blob/master/src/boundary_conditions/DirichletBC.cpp#L28
In either case, it is helpful for you to be familiar with typical sparse matrix storage schemes, since they operate directly on the internals of the matrix (i.e. it's not a simple double "for" loop over the rows and columns)
– Tyler Olsen Dec 03 '17 at 02:38