## 2 Mathematical and Numerical Modeling
### Numerical Solution of Heat Transfer in Solid Domain  
The temperature field is determined numerically by solving Equation (8) for every assumed geometry (\(H/L\), \(H_{0}/L_{0}\), \(H_{1}/L_{1}\), \(H_{2}/L_{2}\), \(S_{1}/H_{0}\), \(\alpha\), and \(\beta\)) during the optimization process. With the temperature field calculated, the \(\theta_{max}\) is defined by a function given by Equation (19), which represents the objective function (OF) of the optimization problem. The numerical solution is obtained in this work with the finite element method (FEM) [24]. The code for numerical solutions is developed in the MATLAB(r) environment, using the PDE (partial differential equations) toolbox [25], based on triangular quadratic elements. The grid is non-uniform in both \(\widetilde{x}\) and \(\widetilde{y}\) directions and varied from one geometry to the next. The appropriate mesh size is defined by successive refinements, multiplying the number of elements four times from a current mesh size to the next. The used mesh grid was determined after successive refinements and tests to reach the independent mesh solution in the computational domain. The criterion employed to find the correct mesh with the total number of elements is represented by the following equation:  
\[\left|\frac{\left(\theta_{max}^{i}-\theta_{max}^{i+1}\right)}{\theta_{max}^{i} }\right|<2\times 10^{-4} \tag{20}\]  
The appropriated mesh size is found when the Equation (20) is satisfied, \(\theta_{max}^{i}\) representing the max temperature value evaluated with current mesh size, and \(\theta^{i+1}\)\({}_{max}\) corresponds to the refined mesh value, i.e., approximately four times more elements than previous mesh. Table 1 shows the test of the solution independent of the mesh, it can be noted that the independent solution is achieved before three refinements with a total of 20.486 triangular elements. Figure 2a,b shows the coarse and fine mesh with triangular elements, respectively. Figure 2b also show the one half of the domain numerically solved. The mesh test was implemented with a follow geometric configuration: \(\varphi_{\text{c}}\) = 0.1; \(\varphi_{1}\) = 0.015; \(\varphi_{2}\) = 0.015; \(H/L\) = 1; \(H_{0}/L_{0}\) = 6; \(S_{1}/H_{0}\) = 0.5; \(H_{1}/L_{1}\) = 0.4; \(H_{2}/L_{2}\) = 0.4; \(\alpha\) = \(\beta\) = 0. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Number of Elements** & \(\theta_{max}\) & \(1\) (\(\theta^{i}\)\({}_{max}\)\(-\)\(\theta^{i+1}\)\({}_{max}\))\(1/\theta^{i}\)\({}_{max}\) \\ \hline
1.265 & 0.16767 & \(1.2\times 10^{-3}\) \\
5.132 & 0.16787 & \(4.579\times 10^{-4}\) \\
20.486 & 0.16795 & \(1.866\times 10^{-4}\) \\
82.592 & 0.16798 & \(7.307\times 10^{-5}\) \\
325.431 & 0.16799 & - \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Results of grid independence test. Figure 2: Triangular mesh used by FEM from MATLAB® PDE toolbox: (**a**) coarse mesh with 1250 triangular elements; (**b**) symmetric half of the domain numerically solved during optimization process with a fine mesh of triangular elements. The implemented code accuracy was validated from the comparison of results of other cooling cavities, investigated in the work of [7; 10] for a T-shaped cavity, and the result of [6], for a double T-shaped cavity. However, an extra area constraint is required, named here as \(\psi\) for the adequate comparison of the numerical model present in this work with the literature references. This new constraint means the occupied area of solid by the cavity. Therefore, considering \(\alpha=\beta=0^{\circ}\), for the double Y-shaped cavity, the \(\psi\) is given by the following equation:  
\[\psi=\frac{H_{0}(2L_{2}+L_{0})}{HL} \tag{21}\]  
The geometry used to the accuracy test is similar to the second construction in T-shape [7] and has the following geometric configuration: \(\psi=0.5\), \(\varphi_{\rm c}=0.1\); \(\varphi_{1}=0.02\); \(\varphi_{2}=0.02\); \(H/L=1\); \(H_{0}/L_{0}=20\); \(S_{1}/H_{0}=\)0.45; \(H_{1}/L_{1}=14\); \(H_{2}/L_{2}=0.14\); \(\alpha=\beta=0^{\circ}\).