## 2 Materials and Methods
### Variational Formulation
#### 2.2.3 Domain Discretization
_{\tilde{k}} &\left(\dfrac{\partial\varphi_{j}}{\partial\xi},\dfrac{\partial\varphi_{j}}{ \partial\eta}\right)_{k_{c}},\dfrac{\partial\varphi_{j}}{\partial\eta}\right)_{ \tilde{k}},\) and repeating the process to \(\left(\dfrac{\partial\varphi_{j}}{\partial\eta},\dfrac{\partial\varphi_{j}}{ \partial\eta}\right)_{\tilde{k}},\) and \(\left(\dfrac{\partial\varphi_{j}}{\partial\eta},\dfrac{\partial\varphi_{j}}{ \partial\eta}\right)_{k_{c}},\) we have  
\[\left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial x}\right)_{k_{c}} =|\det T_{c}|T(1,:)\cdot Sm\cdot T(1,:)^{\prime};\] \[\left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial y}\right)_{k_{c}} =|\det T_{c}|T(1,:)\cdot Sm\cdot T(2,:)^{\prime};\] \[\left(\dfrac{\partial\varphi_{j}}{\partial y},\dfrac{\partial \varphi_{i}}{\partial x}\right)_{k_{c}} =|\det T_{c}|T(2,:)\cdot Sm\cdot T(1,:)^{\prime};\] \[\left(\dfrac{\partial\varphi_{j}}{\partial y},\dfrac{\partial \varphi_{i}}{\partial y}\right)_{k_{c}} =|\det T_{c}|T(2,:)\cdot Sm\cdot T(2,:)^{\prime}.\]  
Using this notation, the term \((\
abla\varphi_{j}\|\
abla\varphi_{i})_{k_{c}}\) is as follows:  
\[(\
abla\varphi_{j}\|\
abla\varphi_{i})_{k_{c}} = \left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial x}\right)_{k_{c}}+\left(\dfrac{\partial\varphi_{j}}{ \partial y},\dfrac{\partial\varphi_{i}}{\partial y}\right)_{k_{c}}\] \[= |\det JT_{c}|\cdot[T(1,:)\cdot Sm\cdot T(1,:)^{\prime}+T(2,:) \cdot Sm\cdot T(2,:)^{\prime}].\]  
Third case:  
\[\left(\dfrac{\partial\varphi_{j}}{\partial x},\varphi_{i}\right) _{k_{c}} = \iint_{k_{c}}\dfrac{\partial\varphi_{j}}{\partial x}\varphi_{i} dydx\] \[= \iint_{\tilde{k}}\left(T_{11}\dfrac{\partial\varphi_{\tilde{k}}} {\partial\xi}+T_{12}\dfrac{\partial\varphi_{\tilde{j}}}{\partial\eta}\right) \varphi_{\tilde{k}}|\det JT_{c}|d\eta d\xi\] \[= |\det JT_{c}|\iint_{\tilde{k}}\left(T_{11}\dfrac{\partial\varphi _{\tilde{j}}}{\partial\xi}\varphi_{\tilde{i}}+T_{12}\dfrac{\partial\varphi_{ \tilde{j}}}{\partial\eta}\varphi_{\tilde{i}}\right)d\eta d\xi\] \[= |\det JT_{c}|\left[T_{11}\iint_{\tilde{k}}\dfrac{\partial\varphi _{\tilde{j}}}{\partial\xi}\varphi_{\tilde{i}}d\eta d\xi+T_{12}\iint_{\tilde{k}} \dfrac{\partial\varphi_{\tilde{j}}}{\partial\eta}\varphi_{i}d\eta d\xi\right]\] \[\left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial y}\right)_{k_{c}} =|\det T_{c}|T(1,:)\cdot Sm\cdot T(2,:)^{\prime};\]0 \[\left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial y}\right)_{k_{c}} =|\det T_{c}|T(1,:)\cdot Sm\cdot T(2,:)^{\prime};\]1  
Repeating the process to \(\left(\dfrac{\partial\varphi_{j}}{\partial y},\varphi_{i}\right)_{k_{c}}\), we have  
\[\left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial y}\right)_{k_{c}} =|\det T_{c}|T(1,:)\cdot Sm\cdot T(2,:)^{\prime};\]2When dealing with integrals over boundary elements (line segments), the same notation as for triangles is used, noting that they have different dimensions. The \(\varphi\) in the reference element \(\widehat{k}\) are  
\[\left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial y}\right)_{k_{c}} =|\det T_{c}|T(1,:)\cdot Sm\cdot T(2,:)^{\prime};\]3 \[\left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial y}\right)_{k_{c}} =|\det T_{c}|T(1,:)\cdot Sm\cdot T(2,:)^{\prime};\]4  
The linear transformation \(T_{e}:\widehat{k}\to k_{e}\) that relates a reference element \(\widehat{k}\) to a generic element \(k_{e}\); that is, that relates  
\[\left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial y}\right)_{k_{c}} =|\det T_{c}|T(1,:)\cdot Sm\cdot T(2,:)^{\prime};\]5 \[\left(\dfrac{\partial\varphi_{j}}{\partial x},\dfrac{\partial \varphi_{i}}{\partial y}\right)_{k_{c}} =|\det T_{c}|T(1,:)\cdot Sm\cdot T(2,:)^{\prime};\]6  
is defined by  
\[T_{e}(\xi)= \begin{pmatrix}x_{2}-x_{1}\\ y_{2}-y_{1}\end{pmatrix} \xi+ \begin{pmatrix}x_{1}\\ y_{1}\end{pmatrix}