#### 4.1. Governing Equations

Computational fluid dynamics (CFD) provide a qualitative and quantitative prediction of fluid flows by means of mathematical and numerical methods. These simulation tools represent an important technological advance towards the detailed understanding of the flow, allowing theoretical considerations regarding the physical behavior of the flow, with mathematical formulations for tri-dimensional modelling analyses [

7]. These models make possible, not only to study the behavior of turbulent and laminar flows, but also the multiple forms of exchanges of energy, flow phases, vorticity and turbulence levels [

9].

The CFD model used in this work was COMSOL Multiphysics 4.3.b, which presents accurate results for several fluid flow problems [

10]. COMSOL is a finite element method (FEM) software, which uses the mass conservation and the RANS (Reynolds averaged Navier–Stokes) equations as governing flow equations:

FEM is a computational method that divides an object into smaller elements. Each element is assigned to a set of characteristic equations that are then solved as a set of simultaneous equations to estimate the behavior of the object [

15]. From the available turbulence models, the

k-

ε model was selected. The

k-

ε models [

16] are the most common and most used models worldwide mostly for industrial applications due to its good convergence rate and relatively low memory requirements. This model solves two variables:

k, the turbulence kinetic energy and

ε, the rate of dissipation of turbulence kinetic energy. This turbulence model relies on several assumptions, the most important of which is that the Reynolds number is high enough. It is also important that the turbulence is in equilibrium in boundary layers, which means that the production equals the dissipation. These assumptions limit the accuracy of the model because they are not always true, since it does not respond correctly to flows with adverse pressure gradients that can result in under predicting the spatial extension of recirculation zones [

17]. Furthermore, in the description of rotating flows, the model often shows poor agreement with experimental data [

18]. In most cases, the limited accuracy is a fair trade-off for computational resources saved compared to more complex turbulence models.

While it is possible to modify the

k-

ε model so that it describes the flow in wall regions, this is not always desirable because of the very high resolution requirements. Instead, analytical expressions are used to describe the flow at the walls [

15]. These formulations are known as wall functions. Wall functions ignore the flow field in the buffer region and analytically compute a nonzero fluid velocity at the wall [

17,

18,

19].

Thus, by using wall functions, the wall lift-off in viscous units

${\delta}_{w}^{+}$ needs to be checked. This value alerts if the mesh at the wall is fine enough and should be 11.06 everywhere. If the mesh resolution in the direction normal to the wall is too coarse, then this value will be greater than 11.06, and a finer boundary layer mesh needs to be applied in these regions. The second variable that should be checked when using wall functions is the wall lift-off

${\delta}_{w}$ (in length units) [

18]. This variable is related to the assumed thickness of the viscous layer and should be small relative to the surrounding dimensions of the geometry. If it is not, then the mesh in these regions must be refined, as well.

The wall functions in COMSOL are such that the computational domain is assumed to start a distance

${\delta}_{w}$ from the wall (

Figure 9).

Nevertheless, in all simulations the fluid was water, with constant density and viscosity equal to 999.62 Kg/m^{3} and $1.0097\times {10}^{-6}$ m^{2}/s, respectively.

In the CFD model, three types of boundary conditions were assigned: inlet, outlet and solid walls. For the inlet boundary condition, the pressure was set, as for the outlet condition, the average velocity. The no-slip condition was considered, which stated that the walls were impermeable. Thus, the boundary conditions used to defined the inlet condition, are governed by the set of the following equations [

16]:

where

${p}_{0}$ is the input value (of pressure),

${I}_{T}$ is the turbulent intensity,

${L}_{T}$ corresponds to the turbulence length scale,

l is the mixing length defined by [

20], and

${U}_{ref}$ is the reference velocity scale.

For the outlet condition, the boundary conditions are expressed by Equation (10), where

${U}_{0}$ corresponds to the average velocity (input value) and, the first equation represents the normal outflow velocity magnitude:

#### 4.2. Mesh Definition and Solution Convergence

As for the mesh definition, the geometry was discretized into smaller units, called mesh elements. Its resolution and element quality are important aspects to take into account, when validating the model, since the decreasing of resolution can originate low accuracy results [

21]. Meanwhile, low mesh element quality can lead to convergence issues [

22,

23,

24].

All calculations have been performed on a PC (Intel 5, CPU 3.90 GHz, RAM 8 GB) with 4 cores and threads running in parallel. The model default uses a physic controlled mesh, which defines, automatically, the size attributes and operations sequences necessary to create a mesh adapted to the problem. This mesh is automatically created and adapted for the model’s physics settings. The default physics-controlled meshing sequences create meshes that consist of different element types and size features, which can be used as a starting point to add, move, disable, and delete meshing operations. Each meshing operation is built in the order it appears in the meshing sequence to produce the final mesh [

23]. Customizing the meshing sequence helps to reduce memory requirements by controlling the number, type, and quality of elements, thereby creating an efficient and accurate simulation [

25].

For the fluid-flow model, since the mesh is adapted to the physic setting, the mesh is finer than the default one, with a boundary layer (

Figure 10a) in order to solve the thin layer near the solid walls where the gradients of the flow variables are high [

26,

27,

28,

29].

To ensure a proper and acceptable accuracy of the results, COMSOL uses an invariant form of the damped Newton method. Starting with

${Z}_{0}$, the linear model (MUMPS) is solved for the Newton step (

$\delta Z$) [

16]. Afterwards, a new iteration is calculated, according to Equation (7), where

${\lambda}^{\prime}$ is the damping factor:

The model estimates the error of the new iteration and, if the error of the current iteration is bigger than the previous one, the code decreases the damping factor and a new iteration process restarts. This procedure will occur until either the error is smaller than the error calculated in the previous iteration or the damping factor reaches its minimum value (i.e.,

$1\times {10}^{-4}$). When a successful step is reached, the algorithm computes the next iteration. The iteration process finish when the relative tolerance exceeds the relative computed error. The model stops the iteration when the relative error is smaller than

$1\times {10}^{-3}$ and the damping factor is equal to 1. Otherwise the solution would not converge and the iteration would continue.

Figure 11 presents the convergence solution reached.

#### 4.3. Calibration and Validation

According to the input data and the respective geometries, presented in

Table 2 and in

Figure 12, numerical simulations were made and compared with the experimental tests.

Figure 13 presents the velocity profiles obtained in the CFD model and in the experimental tests, for the same section of the UDV measurements.

The velocity profiles in

Figure 13, related to UDV, presents some spikes. This behavior is justified by the presence of fluctuations in the velocity and the existence of vortexes, both characteristic of deviations on the flow direction. Despite this, the results present a good approximation between the experimental data and the CFD results. In

Figure 14 is represented the velocity contours in the pipe cross section for the two different volume flow rates.

In order to assess the associated errors of the volume flow rate measured by the flowmeter, if the velocity distribution is equal to the numerical model, several automatic procedures were implemented. The first step involves the definition of limits presented in

Figure 4. The relevant data for this analysis was the one associated to the electrodes cross section of the flowmeter. The data redrawn from the model is a plan with the three coordinates, x, y and z and the average velocity, U. Each two coordinates are associated a velocity and each limit to a certain weight. Therefore, the velocity at points located near the limits (with a maximum error of 0.5%) was multiplied by the corresponding weighting factor (

Figure 15).

The subsequent step is the interpolation of points between limits, which were multiplied by the correspondent weighting factor. This procedure was made for all limits except the ones that are closer to the electrodes. The limits near the electrodes were very difficult to assess, since closely to the electrodes the weight was not entirely known. Thus, another assumption was taken, i.e., the weighting factor was calculated according to

Figure 16. This function was defined and validated through the available experimental data. The x variable is the value resulted from the subtraction of the number of the total data point with the ones in the region near to the electrodes section.

Knowing the remaining factor, the velocity was obtained through the sum of the velocity of each point, multiplied by the corresponding weighting factor, and then divided by the sum of the weighting factors. The error was then determined (

Table 3) by applying Equation (12).

The theoretical error of the flowmeters ought to increase with the decrease in the volume flow rate. Thus, it is clear that the error associated to 12 m

^{3}/h are bigger than 100 m

^{3}/h (

Table 3). For the volume flow rate of 100 m

^{3}/h it is verified that the error associated to geometry 1 is the smallest one. From the two experimental tests, geometry 2 corresponds to the worst scenario, since the pipe is not long enough to dissipate the flow perturbations caused by the profile vertical curves.

The difference between CFD and the lab tests is twofold: minor installation problems, such as the position of the gasket inserted in between flanges causing obstructions to the reading, and the level of detail of the CFD model.

The error associated to the position of the gasket is important and, in several situations, avoidable errors. In these experiments it is mathematically improbable to assume that the errors could be preventable. However, in practice, since the number of gaskets is much smaller, these errors can be disregarded if engineering good practices are follow.