In order to discretize the gears inside a transmission, it is fundamental to rely on a robust mesh generator. Native applications of OpenFOAM® are *blockMesh* and *snappyHexMesh*. The former is a utility that builds full structured mesh providing the user with extremely high control on every aspect of the mesh generation process; however, it can be applied to rather simple domains and is not suitable for gearboxes. The latter is a utility that builds hexahedral dominant grids and can be applied also to complex domains. Nevertheless, it is quite a time- and memory-consuming tool that does not represent the optimal solution in these situations. Another alternative is represented by *cfMesh*, an external grid generator that in its base version can be installed freely as a library that communicates with OpenFOAM®. It exploits shared-memory parallelization (SMP) and is generally faster than *snappyHexMesh*, which is based on distributed-memory parallelization (DMP). However, the meshing process is not so easy to control especially near the gears where refinements are applied. Third party software (commercial or opensource) can be used as well to create the numerical mesh that can be successively converted to the OpenFOAM® format. In this regard, Salome (SALOME n.d.) is a powerful opensource pre-processor that can build polyhedral grids giving the user a good control over the meshing parameters. This software is highly appreciated because it comes with a developed Graphical User Interface (GUI) that makes the meshing process simpler.

Since the correct setup of the CFD simulation of gearboxes is already demanding from a modeling point of view (multiphase with dynamic mesh and turbulence must be considered simultaneously), it is fundamental to choose the meshing strategy that mostly reduces the complexity of the virtual model and, possibly, that requires the lowest interaction with the user, i.e., automatized process. Before explaining the remeshing strategy used in this work, a review of the possibilities currently available is provided, and the main advantages and limitations are discussed.

### Overset mesh approach

The overset mesh approach (also called overlapping grids method or chimera framework) was implemented by (Benek et al. 1944; Benek et al. 1985). The strategy is based on the creation of a fixed background mesh that contains the meshes of the moving features, which are not conformal among them, but overlap themselves. By doing so, the grid is rigidly moved during the calculations, thus the overall mesh is not deformed. During the simulation the computational cells can be identified by the solver as holes (that represent the patches and do not require any solution since no fluid is passing through), calculated (that represent the regions of the domain where no overlapping occurs), and interpolated (that are the cells in the overset regions in which the solution of the equations are computed by interpolating the results between the background mesh and the overset meshes). This approach is very effective since there is no need to create a single mesh that contains all the features, but all the grids corresponding to the moving domains can be created separately and then “overlapped” to the background mesh. This implies that a high-quality global mesh can be obtained due to the decomposition in smaller domains. However, the main drawback of this approach is related to the computational effort in gearboxes simulation derived from the continuous interpolation process that takes place every timestep. Proprietary codes such as STAR-CCM+ (STAR-CCM+ n.d.), ANSYS FLUENT (ANSYS FLUENT n.d.), and FLOW-3D (FLOW-3D n.d.) are implemented with this technique which comes from years of usage and validation. On the contrary, the overlapping grids method was implemented in OpenFOAM® only in some distributions, meaning that further developments are needed to reach a maturity comparable to commercial software. Application of this technique to geared transmissions can be found in (Arisawa et al. 2017; Arisawa et al. 2009; Saegusa and Kawai 2014; Renjith et al. 2015; Deshpande et al. 2018; Cho et al. 2019; Patel and Anto 2019; Hu et al. 2019; Renjith et al. 2017). The results of the simulations allowed to calculate the efficiency of the transmissions and to verify the lubricant distribution in several operating conditions. Studies on gearboxes exploiting the overset mesh technique have been done only in commercial codes.

### Immersed boundary method

The immersed boundary method (IBM) was initially used by (Peskin 1972) to study the flow around a heart valve. This method does not require the grid to follow the geometrical features; a source term in the momentum equation is added allowing the adaptation of the flow to the considered solid boundaries rather than an actual mesh motion. The complete description on the implementation of this method in OpenFOAM® can be found in (Jasak and Tukovic n.d.). The main drawbacks of this method are related to the low resolution of the computational cells near the boundary layer of the walls and to the complex implementation of the boundary conditions at the immersed boundary. This approach was used by (Burberi et al. 2016) to study two mating spur gears. They concluded that the IBM lead to an overestimation of the losses, but can be a valid approach to initialize the flow fields. This can be explained through the non-alignment of the edges to the wall. Therefore, this method is usually considered not appropriate for the simulation of gearboxes.

### Local remeshing Approach

One of the most advanced techniques to handle mesh deformations is the local remeshing approach (LRA). This method requires to have tetrahedrons in the remeshing region and exploits the spring-based smoothing algorithm. Being the elements’ edges considered as linked springs, the movement of the grid in the dynamic mesh region causes a force on each node that connects the springs that can be formulated exploiting the Hook’s law:

$$ {\overset{\rightharpoonup }{F}}_i=\sum \limits_j^{n_i}{k}_{ij}\left(\Delta \overset{\rightharpoonup }{x_j}-\Delta {\overset{\rightharpoonup }{x}}_i\right) $$

(1)

where *k*_{ij} is the spring constant between nodes *i* and *j*, \( \Delta \overset{\rightharpoonup }{x_j} \) and \( \Delta {\overset{\rightharpoonup }{x}}_i \) represent the displacements of the node *j* and *i*, and ni stands for the nodes linked to node *i*. The term *k*_{ij} is calculated as:

$$ {k}_{ij}=\frac{1}{\sqrt{\mid {x}_j-{x}_i\mid }} $$

(2)

The solution of the equilibrium of forces is achieved iteratively from:

$$ \Delta {\overset{\rightharpoonup }{x}}_i^{m+1}=\frac{\sum \limits_j^{n_i}{k}_{ij}\Delta {\overset{\rightharpoonup }{x}}_j^m}{\sum \limits_j^{n_i}{k}_{ij}} $$

(3)

This equation can be solved by updating the positions of the nodes (which are known from the displacements) at the next timestep:

$$ {\overset{\rightharpoonup }{x}}_i^{n+1}={\overset{\rightharpoonup }{x}}_i^n+\Delta {\overset{\rightharpoonup }{x}}_i^{n_{\mathrm{converged}}} $$

(4)

Based on the quality of the cells in the remeshing domain, the too distorted elements are substituted with new valid cells and the fields are interpolated. By doing so, the movement of the boundaries is accomplished. The application of this method to gearboxes led to significant advancements in the analysis of such systems, allowing the study of spur gears (Gorla et al. 2013), spiral bevel gears (Hu et al. 2018), and planetary gearboxes (Liu et al. 2018) in commercial software.

OpenFOAM® handles small mesh deformation applying a Laplacian smoothing. However, when the deformation is excessive, the mesh should be (locally or globally) updated/substituted. Some commercial software are already implemented with the local remeshing approach, which has proven to be effective, but the mesh updating procedure is left to the software and not to the user. In this regard, a global mesh substitution could introduce significant benefits, which are discussed in the next paragraph.

### Global remeshing approach

In order to model intersecting solid bodies as mating gears, a full automatic procedure (Concli et al. 2016) has been implemented in OpenFOAM®: the global remeshing approach (GRA). The algorithm exploits Salome and Python (Python n.d.) to automate the geometry and meshing procedure, and a script in Bash (Bash n.d.) that controls all the dictionaries and the solution in OpenFOAM®. The Laplace smoothing equation and the pseudo solid equation are used to describe the motion (**z**) of the boundaries:

$$ \nabla \bullet \left(\gamma \nabla \mathbf{z}\right)=0 $$

(5)

$$ {x}^{n+1}={x}^n+\Delta t\ \boldsymbol{z} $$

(6)

where *γ* is the diffusivity, x is the grid’s nodes position and t is the current timestep. The rotation of the wheels is accomplished through the creation of several grids corresponding to subsequent gears’ positions. The results are interpolated from mesh to mesh until the regime condition is reached. The interpolation procedure follows an inverse distance weighting 2^{nd} order method.

This modeling technique has the great advantage of giving the user a perfect control on the elements’ size, which are kept constant throughout the simulation, thus allowing a stable timestep while maintaining the Courant number lower than 1 and avoiding convergence issues:

$$ {C}_n=\frac{\delta t\mid \boldsymbol{u}\mid }{\delta x}<1 $$

(7)

where *δt* is the timestep, ∣*u*∣ is velocity magnitude in a cell and *δx* represents the length of a computational cell in the flow direction. The computational advantage given by the remeshing process is enhanced by the mesh generation itself. In fact, for spur gears it is sufficient to mesh only a surface representing the 2D representation of the box and the wheels’ partition. This plane is then appropriately extruded creating the whole 3D domain. The element type is therefore a triangular prism. This kind of cells exhibits outstanding quality parameters, making it possible to reach a maximum non-orthogonality below 35 and a maximum skewness below 1. When the mesh deforms as a consequence of the gears’ rotation, these quality indicators worsen. The allowed maximum non-orthogonality and skewness after the deformation is imposed to be 70 and 2 respectively. If one of these thresholds are exceeded, a new mesh is provided as input and the results are mapped onto the new valid grid. The non-orthogonality (angle between the line connecting two cell centers and the normal of their common face) and the skewness (distance between the intersection of the line connecting two cell centers with their common face and the center of that face) are fundamental parameters that indicate the quality of a mesh. Especially in cases as this one (where the domain deforms as a consequence of the boundaries rotation), it is determinant for the success of the simulation to build high-quality grids. Running simulations with poor quality parameters will make it difficult to reach stability and convergence, introducing diffusion errors in the simulation. A maximum non-orthogonality of 75 and a maximum skewness of 4 are considered as threshold to run a simulation. Since the simulation of gearboxes involves also dynamic domains, these limits have been further lowered to 70 and to 2 to try to reach maximum stability. Works dealing with this methodology can be found in (Mastrone et al. 2020; Concli and Gorla 2017; Lucchini et al. 2015; Montenegro et al. 2014).

The main limitation of the GRA is represented by the fact that the procedure is effective as far as an extrusion algorithm can be exploited (as in spur gears). Geometries that do not fall into this category cannot benefit from the fast remeshing process. For this reason, the authors have implemented a strategy that can be used to study also more complex geometries with a dramatic reduction of the computational effort. The detailed explanation of this procedure is explained in the next paragraph.