**The Jadim code: simulation parameters**

Jadim is a research code developped by the IMFT to simulate two and three-phases flow with the VOF method without reconstruction of the interface.

The code is in Fortran 90 and the post-treatment can be acheived with Tecplot or Paraview, open source softwares and data can be analyzed with Matlab. In the project, the post-treatment is acheived with Paraview and Matlab.

Jadim needs at least 8 input files to run. The ***.para** le is necessary to fix the numerical parameters, ***.geom**, ***.bord** and ***.datr** descript the geometry, ***.limi** gives the boundary conditions. The ***.init** file permits to defined the initial conditions, the ***.phys** concerns the physical properties and the last one **jcl** file gives the unit number of Jadim input and output les.

In order to create the ***.geom**, ***.bord**, ***.datr** and the ***.limi**, a mesher is included witch only provide cartesian structured mesh. The geometry and the mesh are created together. The square geometry is first entirely meshed. Then a obstacle is added in order to represent the empty square in the middle of the geometry. In the obstacle, velocities and pressure fields are always equal to zero.

The inlet and the wall conditions are defined as Dirichet conditions where the velocity value is zero for a wall and different from zero for the inlet.

Simulations can be restarted from an old binary and can be run in parallele, using more than one processor to compute and therefore decreasing the CPU time.

**Mesh impact study**

The mesh can have a major influence on the results of a simulation. Therefore, a mesh study is carried out in order to investigate the impact of the mesh in the three-phase flow case. As Jadim can only sustain structured mesh, a coarse structured mesh and a refined structured mesh are tested. Two simulations are compared, one using a coarse mesh and one using a refined mesh. The main parameters of the simulations are recap in the table below:

Type of mesh | Number of cells | Velocity Inlet (m/s) | Gas Reynold Number | Time Step max | Physical Time | |

Refined Mesh | 270x352 | 0.1 | 260 | 10-4 | 1.93 sec | |

Coarse Mesh | 70x92 | 0.1 | 260 | 10-4 | 1.93 sec |

As Jadim does not give direct access to the quality of the mesh, an advanced analyzis of the results is conduct in order to appreciate the impact of the mesh on the results.

In the two pictures below, the oil contour is plotted at the dimentional time 0.025. A first observation of these results shows that a refined mesh reduce the phenomenon of numerical diffusion. Indeed, the interface between oil and the other phases obtained with a refined mesh is clearer and more accurate than the one obtained with a coarse mesh. However, oil seems to mixed with other phases in both cases.

**The critical analyze of the results must take into account the numerical diffusion phenomenon. Indeed, if a refined mesh reduce its effect, it does not eliminate it.**

* Oil volume fraction - Coarse mesh* * Oil volume fraction- Refined mesh*

In order to compare the two meshes, the phase volume fraction in the domain and the outlet oil flow rate are plotted and compare.

The analyze of these data is done in the part "analyze of the results". Here, only the impact of the mesh is studied.

The graph below shows the evolution of mean oil, gas and water volume fraction in the domain in function of an dimentionless time. In this case, the physical time of the simulation is 1.93 sec, which correponds to a dimentionless time of 0.036.

The comparison of the simulation shows that after one seconde, the oil, gas and water ratio in the domain is not the same for the both meshes. Moreover, as the gas injection is continuous, the evolution of gas should be linear in function of time. If a refined mesh gives a linear evolution of the gas volume fraction, a coarse mesh does not.

**The importante numerical diffusion observed for the coarse mesh makes the phase mixed together and therefore, the percentage of each phase in the domain is less accurate.**

The evolution of outlet oil flow rate in function of time is also an interesting graph to analyze. The value is divided by the input gas flow rate in order to work with dimentionless values.

The graph below shows that the maximum flow rate value obtained for a refined mesh is twice the value obtained for a coarse mesh. In the pictures representing the oil volume fraction at time 0.025, it can be observed that at this time, only oil goes out of the domain. Therefore, at time 0.025, the outlet oil flow rate should be equal to the input gas flow rate. The graph shows that for a refined mesh, the flow rate ratio equals to 1 at time 0.025, while a coarse mesh gives a ratio of 0.5.

**Therefore, a coase mesh makes a error of 50% on the value of the outlet oil flow rate.**

**In conclusion, both local flow features and macroscopic data are affected by the mesh quality. A refined mesh is necessary in order to have accurate results and to limit the numerical diffusion phenomenon.**

**Convergence issues**

For the first simulation carried out, real properties of oil, gas and water were used with a velocity inlet of 1m/s. Quickly, convergence issue appeared: on one hand, as the maximum time step allowed was to high, the simulation stopped due to a too weak time step and on another hand, velocity and pressure values in few cells diverged.

Even after descreasig the maximum time step, convergence issue remained. Two solutions were tried to resolve the problem:

- to multiply oil, gas and water viscosities by 100

- to decrease the velocity to 0.1 m/s

This two cases did not show convergence problem and therefore have been carried out. Results of these simulations are analyzed in the part "analyze of the results".

**CPU time**

The complexity of resolving three-phase flow induce high CPU time. Moreover, as the mesh is refined and the time step is small, simulations lasts even longer.

Therefore, the choice of the simulations is important as the project last only six weeks.