# Multi-Material Topology Optimization Taking into Account the Position of Material Interfaces in 3D
## 3 Methods
### Sensitivity Analysis
 \tag{31}\]  
It only has components in the two tangential directions. The third missing partial derivative \(\frac{\partial W_{ind}}{\partial\boldsymbol{n}}\) is calculated using the chain rule:  
\[ \begin{split}\frac{\partial W_{ited}}{\partial\boldsymbol{n}}& =\frac{1}{2}\bigg{(}\frac{\partial\sigma_{nn}^{t}}{\partial \sigma_{nn}}\frac{\partial\sigma_{nn}}{\partial\boldsymbol{n}}\varepsilon_{nn} ^{t}+\sigma_{nn}^{t}\frac{\partial\varepsilon_{nn}^{t}}{\partial\varepsilon_{ nn}}\frac{\partial\varepsilon_{nn}}{\partial\boldsymbol{n}}\bigg{)}\\ &+\frac{1}{2}\beta\text{sgn}(\sigma_{ns}\varepsilon_{ns})\bigg{(} \frac{\partial\sigma_{ns}}{\partial\boldsymbol{n}}\varepsilon_{ns}+\sigma_{ ns}\frac{\partial\varepsilon_{ns}}{\partial\boldsymbol{n}}\bigg{)}\\ &+\frac{1}{2}\beta\text{sgn}(\sigma_{nt}\varepsilon_{nt})\bigg{(} \frac{\partial\sigma_{nt}}{\partial\boldsymbol{n}}\varepsilon_{nt}+\sigma_{ nt}\frac{\partial\varepsilon_{nt}}{\partial\boldsymbol{n}}\bigg{)}.\end{split}  \tag{32}\]  
If the following relationships are inserted in Equation (32)  
\[ \begin{split}\frac{\partial\sigma_{nn}}{\partial\boldsymbol{n}}& =2\sigma\boldsymbol{n},\hskip 85.358268 pt\frac{\partial \varepsilon_{nn}}{\partial\boldsymbol{n}}=2\varepsilon\boldsymbol{n}\\ \frac{\partial\sigma_{ns}}{\partial\boldsymbol{n}}& =\sigma\boldsymbol{s}+\bigg{(}\frac{\partial\boldsymbol{s}}{ \partial\boldsymbol{n}}\bigg{)}^{T}\sigma\boldsymbol{n},\hskip 85.358268 pt\frac{ \partial\varepsilon_{ns}}{\partial\boldsymbol{n}}=\varepsilon\boldsymbol{s}+ \bigg{(}\frac{\partial\boldsymbol{s}}{\partial\boldsymbol{n}}\bigg{)}^{T} \varepsilon\boldsymbol{n}\end{split}  \tag{33}\]and analogous for \(\frac{\partial\varepsilon_{nt}}{\partial n}\) and \(\frac{\partial\varepsilon_{nt}}{\partial n}\), the result is:  
\[ \begin{split}\frac{\partial W_{tud}}{\partial n}&= \frac{1}{2}\bigg{(}\epsilon_{m}^{t}\frac{\partial\sigma_{m}^{t}}{\partial \sigma_{m}}\sigma\mathbf{n}+\sigma_{m}^{t}\frac{\partial\epsilon_{nn}^{t}}{ \partial\epsilon_{nn}}\mathbf{\varepsilon n}\bigg{)}\\ &+\frac{1}{2}\beta\text{sgn}(\sigma_{ns}\varepsilon_{ns})\bigg{(} \varepsilon_{ns}\bigg{[}\mathbf{\sigma s}+\bigg{(}\frac{\partial\mathbf{s}}{\partial \mathbf{n}}\bigg{)}^{T}\sigma\mathbf{n}\bigg{]}+\sigma_{ns}\bigg{[}\mathbf{\epsilon s}+ \bigg{(}\frac{\partial\mathbf{s}}{\partial\mathbf{n}}\bigg{)}^{T}\mathbf{\varepsilon n} \bigg{]}\bigg{)}\\ &+\frac{1}{2}\beta\text{sgn}(\sigma_{nt}\varepsilon_{nt})\bigg{(} \varepsilon_{nt}\bigg{[}\mathbf{\sigma t}+\bigg{(}\frac{\partial\mathbf{t}}{\partial \mathbf{n}}\bigg{)}^{T}\sigma\mathbf{n}\bigg{]}+\sigma_{nt}\bigg{[}\mathbf{\varepsilon t }+\bigg{(}\frac{\partial\mathbf{t}}{\partial\mathbf{n}}\bigg{)}^{T}\mathbf{\varepsilon n} \bigg{]}\bigg{)}\end{split}  \tag{34}\]  
As shown above, the tangent vectors \(\mathbf{s}\) and \(\mathbf{t}\) are calculated using the Householder transformation (see Equations (12) and (13)). Consequently, the two partial derivatives \(\frac{\partial\mathbf{s}}{\partial n}\) and \(\frac{\partial\mathbf{t}}{\partial n}\) are calculated as follows:  
\[ \begin{split}\frac{\partial\mathbf{s}}{\partial n}&= \left\{\begin{array}{ccc}0&-1&0\\ \frac{n_{y}^{2}}{(n_{x}+1)^{2}}&-\frac{n_{y}}{n_{x}+1}&0\\ \frac{n_{y}n_{z}}{(n_{x}+1)^{2}}&-\frac{n_{x}}{n_{x}+1}&-\frac{n_{y}}{n_{x}+1 }\end{array}\right.\end{array},n_{x}\geq 0,\\ \left[\begin{array}{ccc}0&1&0\\ -\frac{n_{y}^{2}}{(n_{x}-1)^{2}}&\frac{2n_{y}}{n_{x}-1}&0\\ -\frac{n_{y}n_{z}}{(n_{x}-1)^{2}}&\frac{n_{y}}{n_{x}-1}&\frac{n_{y}}{n_{x}-1 }\end{array}\right],n_{x}<0,\\ \frac{\partial\mathbf{t}}{\partial\mathbf{n}}&=\left\{\begin{array}{ccc}0&0&-1\\ \frac{n_{y}n_{z}}{(n_{x}+1)^{2}}&-\frac{n_{z}}{n_{x}+1}&-\frac{n_{y}}{n_{x}+1 }\end{array}\right.,n_{x}\geq 0,\\ \frac{n_{z}^{2}}{(n_{x}+1)^{2}}&0&-\frac{2n_{y}}{n_{x}+1}\end{array},n_{x}<0, \\ \left[\begin{array}{ccc}0&0&1\\ \frac{n_{y}n_{z}}{(n_{x}-1)^{2}}&\frac{n_{z}}{n_{x}-1}&\frac{n_{y}}{n_{x}-1 }\\ -\frac{n_{z}^{2}}{(n_{x}-1)^{2}}&0&\frac{2n_{z}}{n_{x}-1}\end{array}\right],n_{ x}<0.\end{split}