## 2 Materials and Methods
### Variational Formulation
#### 2.2.3 Domain Discretization
\]  
which is equivalent to  
\[x(\xi)=x_{1}+(x_{2}-x_{1})\xi;\] \[y(\xi)=y_{1}+(y_{2}-y_{1})\xi.\]  
Thus, we have \(\varphi_{\widehat{i}}(\xi)=(\varphi_{i}(x(\xi),y(\xi))\) and  
\[\frac{\partial T_{e}}{\partial\xi}=\frac{\partial x}{\partial\xi}\overrightarrow {i}+\frac{\partial y}{\partial\xi}\overrightarrow{j}=(x_{2}-x_{1}) \overrightarrow{i}+(y_{2}-y_{1})\overrightarrow{j}.\]  
Regarding the border, there are two cases. First case:  
\[(\varphi_{j},\varphi_{i})_{k_{e}}=\int_{k_{e}}\varphi_{j}\varphi_{\widehat{i} }dx=\int_{\widehat{k}}\varphi_{\widehat{j}}(\xi)\varphi_{\widehat{i}}(\xi) \left\|\frac{\partial T_{e}}{\partial\xi}\right\|d\xi=\left\|\frac{\partial T _{e}}{\partial\xi}\right\|\int_{\widehat{k}}\varphi_{\widehat{j}}\varphi_{ \widehat{i}}d\xi=\left\|\frac{\partial T_{e}}{\partial\xi}\right\|(\varphi_{ \widehat{j}}\varphi_{\widehat{i}})_{\widehat{k}}\]  
Second case:  
\[(1,\varphi_{i})_{k_{e}}=\int_{k_{e}}\varphi_{i}dx=\int_{\widehat{k}}\varphi_{ \widehat{i}}(\xi)\left\|\frac{\partial T_{e}}{\partial\xi}\right\|d\xi= \left\|\frac{\partial T_{e}}{\partial\xi}\right\|\int_{\widehat{k}}\varphi_{ \widehat{i}}d\xi=\left\|\frac{\partial T_{e}}{\partial\xi}\right\|(1,\varphi_ {\widehat{i}})_{\widehat{k}}\]  
These inner products are used to determine the elements of the \(M\), \(W\), \(H\), and \(N\) matrices, as defined in (20). These internal products over the elements and contour elements are combinations of integrals over the reference element (triangle and reference line segment). These integrals over the reference elements are calculated, and their results are stored in matrices nominated for stiffness submatrices. Replacing \(\varphi_{\widehat{i}}\) and \(\varphi_{\widehat{j}}\) with (23), (24), and (25) in the integrals to be calculated, and considering all combinations between functions, we have  
\[\left((\varphi_{\widehat{i}},\varphi_{\widehat{j}})_{\widehat{k}} \right)_{\widehat{i}\widehat{j}} = \int_{0}^{1}\int_{0}^{1-\xi}\left( \begin{array}{c}\xi\\ \eta\\ 1-\xi-\eta\end{array} \right)\left( \begin{array}{cc}\xi&\eta&1-\xi-\eta\end{array}  \right)d\eta d\xi\] \[= \int_{0}^{1}\int_{0}^{1-\xi}\left( \begin{array}{cc}\xi^{2}& \xi\eta&-\xi(\xi+\eta-1)\\ \xi\eta&\eta^{2}&-\eta(\xi+\eta-1)\\ -\xi(\xi+\eta-1)&-\eta(\xi+\eta-1)&(\xi+\eta-1)^{2}\end{array} \right)d\eta d\xi\] \[= \left( \begin{array}{cc}\frac{1}{\xi^{2}}&\frac{1}{\xi^{2}}& \frac{1}{\xi^{2}}\\ \frac{1}{\xi^{2}}&\frac{1}{\xi^{2}}&\frac{1}{\xi^{2}}\end{array} \right);\]\[\left(\left(\frac{\partial\varphi_{\widehat{i}}}{\partial\xi^{ \prime}},\frac{\partial\varphi_{\widehat{j}}}{\partial\xi}\right)_{\widehat{i} \widehat{j}}\right)_{\widehat{i}\widehat{j}} = \int_{0}^{1}\int_{0}^{1-\xi}\frac{\partial}{\partial\xi}\left( \begin{array}{c}\xi\\ \eta\\ 1-\xi-\eta\end{array} \right)\frac{\partial}{\partial\xi}\left( \begin{array}[] {cc}\xi&\eta&1-\xi-\eta\end{array} \right)d\eta d\xi\] \[= \int_{0}^{1}\int_{0}^{1-\xi}\left( \begin{array}{cc}\xi&0&-\xi\\ \eta&0&-\eta\\ 1-\eta-\xi&0&\xi+\eta-1\end{array} \right)d\eta d\xi=\left( \begin{array}{cc} \frac{1}{2}&0&-\frac{1}{2}\\ 0&0&0\\ -\frac{1}{2}&0&\frac{1}{2}\end{array} \right);\]  
\[\left(\left(\frac{\partial\varphi_{\widehat{i}}}{\partial\eta},\frac{ \partial\varphi_{\widehat{j}}}{\partial\xi}\right)_{\widehat{i}\widehat{j}} \right)_{\widehat{i}\widehat{j}} = \int_{0}^{1}\int_{0}^{1-\xi}\frac{\partial}{\partial\eta}\left( \begin{array}{c}\xi\\ \eta\\ 1-\xi-\eta\end{array} \right)\frac{\partial}{\partial\xi}\left( \begin{array}[] {cc}\xi&\eta&1-\xi-\eta\end{array} \right)d\eta d\xi\] \[= \int_{0}^{1}\int_{0}^{1-\xi}\left( \begin{array}{cc}0&0&0\\ 1&0&-1\\ -1&0&1\end{array} \right)d\eta d\xi=\left( \begin{array}{cc}0&0&0\\ \frac{1}{2}&0&-\frac{1}{2}\\ -\frac{1}{2}&0&\frac{1}{2}\end{array} \right);\]  
\[\left(\left(\frac{\partial\varphi_{\widehat{i}}}{\partial\xi^{ \prime}},\frac{\partial\varphi_{\widehat{j}}}{\partial\eta}\right)_{\widehat{i }\widehat{j}}\right)_{\widehat{i}\widehat{j}} = \int_{0}^{1}\int_{0}^{1-\xi}\frac{\partial}{\partial\xi}\left( \begin{array}{c}\xi\\ \eta\\ 1-\xi-\eta\end{array}