Element Mass Matrix ~~~~~~~~~~~~~~~~~~~~~~ We have .. math:: \mathbb{M}^e(T_k) =\frac{|T_k|}{12}\begin{pmatrix} 2 & 1 & 1\\ 1 & 2 & 1\\ 1 & 1 & 2 \end{pmatrix} Then with :math:`\MAT{K}_g` definition (see Section :ref:`PresentationOptV2-label`) , we obtain .. math:: \MAT{K}_g(3(i-1)+j,k)=|T_k|\frac{1+\delta_{i,j}}{12} \quad 1\le i,j \le 3, We represent in figure :num:`figurebuild2dkgmassoptv2` the corresponding row-wise operations. .. _figureBuild2dKgMassOptV2: .. figure:: images/Build2D_Kg_Mass_OptV2.png :width: 800px :scale: 100% :align: center Construction of :math:`\mathbb{K}_g` associated to 2d **Mass** matrix in So the vectorized algorithm for :math:`\mathbb{K}_g` computation is simple and given in Algorithm :num:`elemmassmat2dp1vectoralgo`. .. admonition:: Algorithm :num:`elemmassmat2dp1vectoralgo` .. _ElemMassMat2DP1vectoralgo: .. figure:: images/ElemMassMat2DP1_algo.png :width: 600px :scale: 100% :align: center Vectorized algorithm for :math:`\mathbb{K}_g` associated to 2d **Mass** matrix .. note:: .. automodule:: pyOptFEM.FEM2D.elemMatrixVec :members: ElemMassMat2DP1Vec :noindex: Element Stiffness Matrix ~~~~~~~~~~~~~~~~~~~~~~~~~~~ We have :math:`\forall (\il,\jl)\in\ENS{1}{3}^2` .. math:: \mathbb{S}_{\il,\jl}^e(T_k)= |T_k| \DOT{\GRAD\BasisFunc_{\jl}^k}{\GRAD\BasisFunc_{\il}^k}. Using vectorized algorithm function :math:`\FNametxt{GradientVec2D}` given in Algorithm :num:`gradientvec2dalgo`, we obtain the vectorized algorithm :num:`elemstiffmat2dp1vectoralgo` for :math:`\mathbb{K}_g` computation for the **Stiffness** matrix in 2d. .. admonition:: Algorithm :num:`elemstiffmat2dp1vectoralgo` .. _ElemStiffMat2DP1vectoralgo: .. figure:: images/ElemStiffMat2DP1_algo.png :width: 600px :scale: 100% :align: center Vectorized algorithm for :math:`\mathbb{K}_g` associated to 2d **Stiffness** matrix .. note:: .. automodule:: pyOptFEM.FEM2D.elemMatrixVec :members: ElemStiffMat2DP1Vec :noindex: Element Elastic Stiffness Matrix ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - We define on :math:`T_k` the local *alternate* basis :math:`\mathcal{B}_a^k` by .. math:: \mathcal{B}_a^k=\{\BasisFuncTwoD_1^k,\hdots,\BasisFuncTwoD_6^k\}=\left\{ \begin{pmatrix} \BasisFunc_1^k \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ \BasisFunc_1^k \end{pmatrix}, \begin{pmatrix} \BasisFunc_2^k \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ \BasisFunc_2^k\end{pmatrix}, \begin{pmatrix} \BasisFunc_3^k \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ \BasisFunc_3^k \end{pmatrix} \right\} where :math:`\BasisFunc_\il^k=\BasisFunc_{\me(\il,k)}.` With notations of :ref:`Presentation-label`, we have :math:`\forall (\il,\jl) \in \ENS{1}{6}^2` .. math:: \StiffElasElem_{\il,\jl}(T_k)= \int_{T_k} \Odv^t(\BasisFuncTwoD^k_\jl) \mathbb{C}\Odv(\BasisFuncTwoD^k_\il)d\q= \int_{T_k} \mathcal{H}(\BasisFuncTwoD^k_\jl,\BasisFuncTwoD^k_\il)(\q)d\q with, :math:`\forall \vecb{u}=(u_1,u_2)\in\HUnD{\DOM}^2,` :math:`\forall \vecb{v}=(v_1,v_2)\in\HUnD{\DOM}^2,` .. math:: \begin{array}{lcl} \mathcal{H}(\vecb{u},\vecb{v})&=&{\footnotesize \DOT{\begin{pmatrix} \gamma & 0\\ 0 & \mu \end{pmatrix}\GRAD u_1 }{\GRAD v_1} +\DOT{\begin{pmatrix} 0 & \lambda\\ \mu & 0 \end{pmatrix}\GRAD u_2 }{\GRAD v_1}}\\ &+&{\footnotesize\DOT{\begin{pmatrix} 0 & \mu\\ \lambda & 0 \end{pmatrix}\GRAD u_1 }{\GRAD v_2}+ \DOT{\begin{pmatrix} \mu & 0\\ 0 &\gamma\end{pmatrix}\GRAD u_2 }{\GRAD v_2}} \end{array} :label: eq_StiffElasHop For example, we can explicitly compute the first two terms in the first column of :math:`\StiffElasElem(T_k)` which are given by .. math:: \begin{array}{lcl} \StiffElasElem_{1,1}(T_k)&=&\int_{T_k} \mathcal{H}(\BasisFuncTwoD^k_{1},\BasisFuncTwoD^k_{1})(\q)d\q\\ &=&\int_{T_k} \mathcal{H}\left( \begin{pmatrix} \BasisFunc^k_{1}\\ 0 \end{pmatrix}, \begin{pmatrix} \BasisFunc^k_{1}\\ 0 \end{pmatrix} \right)(\q)d\q\\ &=&|T_k| \DOT{\begin{pmatrix} \gamma & 0\\ 0 & \mu \end{pmatrix}\GRAD \BasisFunc^k_{1} }{\GRAD \BasisFunc^k_{1}} =|T_k|\left(\gamma\DP{\BasisFunc^k_{1}}{x}\DP{\BasisFunc^k_{1}}{x}+\mu\DP{\BasisFunc^k_{1}}{y}\DP{\BasisFunc^k_{1}}{y}\right). \end{array} and .. math:: \begin{array}{lcl} \StiffElasElem_{2,1}(T_k)&=&\int_{T_k} \mathcal{H}(\BasisFuncTwoD^k_{1},\BasisFuncTwoD^k_{2})(\q)d\q\\ &=&\int_{T_k} \mathcal{H}\left( \begin{pmatrix} \BasisFunc^k_{1}\\ 0 \end{pmatrix}, \begin{pmatrix} 0\\ \BasisFunc^k_{1} \end{pmatrix} \right)(\q)d\q\\ &=&|T_k| \DOT{\begin{pmatrix} 0 & \mu\\ \lambda & 0 \end{pmatrix}\GRAD \BasisFunc^k_{1} }{\GRAD \BasisFunc^k_{1}} =|T_k|(\lambda+\mu)\DP{\BasisFunc^k_{1}}{x}\DP{\BasisFunc^k_{1}}{y}. \end{array} Using vectorized algorithm function :math:`\FNametxt{GradientVec2D}` given in Algorithm :num:`gradientvec2dalgo`, we obtain the vectorized algorithm :num:`elemstiffmat2dp1vectoralgo` for :math:`\mathbb{K}_g` computation for the **Elastic Stiffness** matrix in 2d. .. admonition:: Algorithm :num:`elemstiffelasmatba2dp1vectoralgo` .. _ElemStiffElasMatBa2DP1vectoralgo: .. figure:: images/ElemStiffElasMatBa2DP1_algo.png :width: 600px :scale: 100% :align: center Vectorized algorithm for :math:`\mathbb{K}_g` associated to 2d **Elastic Stiffness** matrix .. note:: .. automodule:: pyOptFEM.FEM2D.elemMatrixVec :members: ElemStiffElasMatBaVec2DP1 :noindex: - We define on :math:`T_k` the local *block* basis :math:`\mathcal{B}_b^k` by .. math:: \mathcal{B}_b^k=\{\BasisFuncTwoDB_1^k,\hdots,\BasisFuncTwoDB_6^k\}=\left\{ \begin{pmatrix} \BasisFunc_1^k \\ 0 \end{pmatrix}, \begin{pmatrix} \BasisFunc_2^k \\ 0 \end{pmatrix}, \begin{pmatrix} \BasisFunc_3^k \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ \BasisFunc_1^k \end{pmatrix}, \begin{pmatrix} 0 \\ \BasisFunc_2^k\end{pmatrix}, \begin{pmatrix} 0 \\ \BasisFunc_3^k \end{pmatrix} \right\} where :math:`\BasisFunc_\il^k=\BasisFunc_{\me(\il,k)}.` For example, using formula :eq:`eq_StiffElasHop`, we can explicitly compute the first two terms in the first column of :math:`\StiffElasElem(T_k)` which are given by .. math:: \begin{array}{lcl} \StiffElasElem_{1,1}(T_k)&=&\int_{T_k} \mathcal{H}(\BasisFuncTwoDB^k_{1},\BasisFuncTwoDB^k_{1})(\q)d\q\\ &=&\int_{T_k} \mathcal{H}\left( \begin{pmatrix} \BasisFunc^k_{1}\\ 0 \end{pmatrix}, \begin{pmatrix} \BasisFunc^k_{1}\\ 0 \end{pmatrix} \right)(\q)d\q\\ &=&|T_k| \DOT{\begin{pmatrix} \gamma & 0\\ 0 & \mu \end{pmatrix}\GRAD \BasisFunc^k_{1} }{\GRAD \BasisFunc^k_{1}} =|T_k|\left(\gamma\DP{\BasisFunc^k_{1}}{x}\DP{\BasisFunc^k_{1}}{x}+\mu\DP{\BasisFunc^k_{1}}{y}\DP{\BasisFunc^k_{1}}{y}\right). \end{array} and .. math:: \begin{array}{lcl} \StiffElasElem_{2,1}(T_k)&=&\int_{T_k} \mathcal{H}(\BasisFuncTwoDB^k_{1},\BasisFuncTwoDB^k_{2})(\q)d\q\\ &=&\int_{T_k} \mathcal{H}\left( \begin{pmatrix} \BasisFunc^k_{1}\\ 0 \end{pmatrix}, \begin{pmatrix} \BasisFunc^k_{2}\\ 0 \end{pmatrix} \right)(\q)d\q\\ &=&|T_k| \DOT{\begin{pmatrix} \gamma & 0\\ 0 & \mu \end{pmatrix}\GRAD \BasisFunc^k_{1} }{\GRAD \BasisFunc^k_{2}} =|T_k|\left(\gamma\DP{\BasisFunc^k_{1}}{x}\DP{\BasisFunc^k_{2}}{x}+\mu\DP{\BasisFunc^k_{1}}{y}\DP{\BasisFunc^k_{2}}{y} \right). \end{array} Using vectorized algorithm function :math:`\FNametxt{GradientVec2D}` given in Algorithm :num:`gradientvec2dalgo`, we obtain the vectorized algorithm :num:`elemstiffelasmatbb2dp1vectoralgo` for :math:`\mathbb{K}_g` computation for the **Elastic Stiffness** matrix in 2d. .. admonition:: Algorithm :num:`elemstiffelasmatbb2dp1vectoralgo` .. _ElemStiffElasMatBb2DP1vectoralgo: .. figure:: images/ElemStiffElasMatBb2DP1_algo.png :width: 600px :scale: 100% :align: center Vectorized algorithm for :math:`\mathbb{K}_g` associated to 2d **Elastic Stiffness** matrix .. note:: .. automodule:: pyOptFEM.FEM2D.elemMatrixVec :members: ElemStiffElasMatBbVec2DP1 :noindex: