**2. Materials and Methods**

The authors have realized a C++ library according to the OpenFOAM coding standard in order to perform numerical simulations of scroll machines by means of the custom predefined mesh generation method. The first step in this method is the realization of a body-fitted structured grid starting from the scroll geometry. This kind of grid is characterized by elements of good quality and well-defined connectivity rules. When the path of the moving parts is known, a set of structured meshes can be generated in advance in order to describe chronologically sequential positions of the moving bodies.

In this case, an increment in time corresponds to an increment of the crank angle, so the user is able to define a number of angular positions of the mobile spiral that have to be meshed. When the actual simulation is executed, the nodes of these predefined meshes become control points for the grid nodes in order to maintain good element quality. The mesh nodes pass through the control points, but the connectivity of the mesh remains the same. In this way, both re-meshing and interpolations are avoided during the analysis. One of the advantages of this strategy is that it is respectful of the space conservation law. Moreover, mass and energy imbalances derived from interpolation procedures are not a concern in this case because no interpolation is performed.

#### *2.1. Body-Fitted Structured Grid*

The structured grid generation process of a scroll machine has been achieved as follows: STRUCTURED DOMAIN DEFINITION

The generation of a structured mesh of all the scroll domains, including the ports region, is a very challenging task. It could be very difficult to model narrow gaps and complex features of the geometry. Consequently, it has been decided to isolate a portion of the machine that includes the mobile scroll, as represented in Figure 1.

**Figure 1.** Structured domain of the scroll machine.

The two edges of the structured domain are imported as a list of points, representing the control points for two different spline curves. This region has been discretized by means of a structured strategy, while the other parts can be meshed with unstructured algorithms. Then, the connection between the two regions must be performed with one of the interface strategies implemented in OpenFOAM.

#### MOBILE SPIRAL DISCRETIZATION

The mesh boundary discretization starts from the mobile spiral edge, where the boundary points are defined according to criteria based on the variation of the slope of the straight line tangent to the spiral. The variation of the slope is maintained constant along the mobile spiral in order to have a finer discretization in the central region of the machine, where the high pressure port is placed.

The position of the points on the mobile edge remains the same during the whole meshing process. The points are translated with the spiral in order to represent different angular position, but their relative positions do not change.

#### FIXED SPIRAL AND CASING DISCRETIZATION

The other edge of the structured domain is represented by the fixed spiral merged with a portion of the casing profile. The points are collocated on the fixed edge in order to create lines as normal to the edges as possible.

In the central region of the machine, where it is not possible to create lines normal to both the edges, a special treatment is introduced: the points on the fixed edge follow a squared cosine distribution with variable parameters (related to phase and period) in function of the crank angle. The user has to find the best fitting parameters for few main angular positions of the mobile scroll, and then, the intermediate parameters are interpolated from the main ones. The first guess for the internal nodes is then provided by a transfinite interpolation.

ELLIPTIC INTERNAL MESH GENERATION

The second step is an elliptic mesh generator with a control map that imposes the orthogonality of the grid at the boundary. This method has been developed according to the work presented by Spekreijse [45]. This meshing strategy is characterized by a transformation from a computational space (*ξ*,*η*) to the cartesian domain (x,y), passing through a parameter space (s,t), as represented in Figure 2.

The Picard iteration method with a finite difference discretization has been applied for the solution of a system of nonlinear elliptic equations, reported below:

$$P^{k-1} \mathbf{x}\_{\tilde{\xi}\tilde{\xi}}^k + 2\mathbf{Q}^{k-1} \mathbf{x}\_{\tilde{\xi}\eta}^k + R^{k-1} \mathbf{x}\_{\eta\eta}^k + \mathbf{S}^{k-1} \mathbf{x}\_{\tilde{\xi}}^k + T^{k-1} \mathbf{x}\_{\eta}^k = \mathbf{0}$$

where *x* represents the position vector and the subscripts *ξ* and *η* represent a derivative in function of the variables of the computational space. The apexes *k* and *k-1* refer to the current and previous iteration of the Picard method, respectively. In this system of equations, the coefficients *P*, *Q*, and *R* can be calculated using the derivatives of the position vectors at the previous iteration in the function of the computational space variables. On the contrary, in order to evaluate *S* and *T*, the derivative of the position vectors relative to the parameter space variables are needed. The variables of the parameter space are calculated by means of the following Laplace equations:

$$
\Delta s(\xi, \eta) = 0
$$

$$
\Delta t(\xi, \eta) = 0
$$

where *s* and *t* represent the unknowns of the systems while the orthogonality at the boundary is reached by imposing a Neumann boundary condition at the boundaries of interest. The Laplace equations have been discretized by means of the finite volume strategy, and the resulting systems have been solved using a BiConjugate Gradient Stabilized (BiCGSTAB) method.

The structured mesh is generated in two dimensions and then extruded in order to create a three-dimensional computational grid.

**Figure 2.** Transformation from computational space to cartesian domain. Adapted from Reference [45].
