# The simulations

In this part of the project, three-phase flow simulations are carried out using a simple geometry which represents oil wedged into the cap of a cave. Simulated with Fluent and Jadim with the VOF method, the results are analyzed and compared in order to conclude on the accuracy of the recovery method.

It is important to note that these results are only relevant for this particular geometry and can not be applied to the geometry of the Tarim Basin. They will allow us to compare Jadim and Fluent and will then be used by Schlumberger to validate the automata software for the gas injection recovery method.

# Presentation of the simulation

The geometry

As three-phase flow simulations are complex calculations for Jadim and Fluent, a simple geometry is used. The geometry represents one cave with oil wedged on the top and has same dimensions as the geometry used for experiments carried out in 2013.

The boundary conditions are:

- An inlet velocity which represents  the gas injection, situated on the bottom-right of the domain

- A pressure outlet which represents a connection to another cave, situated on the middle left side of the domain

- Walls otherwize which represent the rocks

The simulation starts with an initiale quantity of oil wedged which represents 37% of the domain.

A solid obstacle is defined in the middle of the rectangular geometry in order to avoid a direct oil flow into the outlet and to force gas flow to go up and therefore replace the oil.

Incompressibility

In order to know if the flow is compressible or incompressible, it is important to look at the value of the Mach number. This dimentionaless number is defined by:

$Ma= \frac {U }{ a}$   where a is the sound velocity (a=340 m/s) and  U is the velocity of the flow.

A flow can only be considered as incompressible if its Mach number is smaller than 1.

As velocities inlet used for the simulation do not exceed 1 m/s, velocities of the three-phase flow will be small enough to consider that a Mach number of the flow smaller than 1.

In the simulations, the flow will be considered as incompressible.

Physical Properties

CFD simulations are based on Navier and Stoles equations. Therefore, it is essential to know the physical properties of the differente phases as they have a direct impact on the flow behavior.

Investigate real properties of phases is difficult. Indeed, due to the large dimension of the Tarim basin, oil properties can change from one well to another. Moreover, fluids and gas properties change in function of the temperature, which is itself variable, especially is function of the depth. Regarding gas viscosity, and as gas injection has not been tested yet in the reservoir, it is not known yet if the gas properties will be modified or not before being used.

After  discussion with our supervising team, and on the advices of Mr Montaron, choices have been made to use:

- The same properties of oil and water used for the experiments carried out in summer 2013

- Gas properties of an unmodified nitrogen gas

- Determinate surface tension value between oil/air/water phases instead of oil/nitrogen water phases.

All the physical properties used for the simulations are recap in the table below:

Gravity is constant and equals to -9.81 m/s².

Turbulence

Multiphase flow simulation is a complex topic, still in development and which need long calculation times, lots of memory and high-performance material. Therefore, for this BEI, we choose small velocities in order to have a laminar flown which would not require to add turbulence models to the simulation.

Indeed, it is difficult to calculate the Reynolds Number of the flow because the velocity inside the domain is variable. In order to limit the turbulence phanomenon in the domain, the Reynolds Number of the gas is calculated, which must be small enough not to have a turbulent jet at the inlet.

$$Re_{gas}= \frac{U_{inlet}\times D\times \rho} { \mu }$$

with $\rho_{gas}=1.251 kg/m³$, $D=0.025m$ and ${ \mu_{gas}=12.10^{-6} kg/ms }$

A flow can be considered turbulent for a Re>2000. For each simulation, the Renolds Number of the gas is calculated in order to be sure that velocities used are not too high.

Moreover, for each simulation, it is important to verify that velocities in the domain are not to high.

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 fix the numerical parameters, *.geom, *.bord and *.datr descript the geometry, *.limi gives the boundary conditions. The *.init file permits to defined the initial conditions, the *.phys concerns the physical properties and the last one jcl file 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.

# Fluent Simulations

Simulation parameters

The VOF model proposed by Fluent can model two or more immiscible fluids by solving a single set of momentum equations and tracking the volume fraction of each of the fluids throughout the domain. The VOF formulation relies on the fact that two or more fluids (or phases) are not interpenetrating.

To reconstruct the interface, Fluent offers different schemes. In the geometric reconstruction and donor-acceptor schemes, FLUENT applies a special interpolation treatment to the cells that lie near the interface between two phases.

As small velocities inlet are used in order to avoid turbulence, a laminar model is selected.

Concerning the boundary conditions:

• The outlet boundary condition is a pressure outlet initialized at 0 Pa.
• The gas injection is represented by a velocity inlet boundary condition.

The initialization of the domain is an important step in the preparetion of the simulation. The domain is first initialized with water evrywhere. Then, a region is created and which represents the initial position of the oil (Adapt/ Region... Mark). Then, the region is associated to the oil (Solve/ Initialized/ Patch... Oil Volume Fraction=1).

The convergence criterions are fixed at $1\times 10^{-6}$ and the maximimum number of iteration per timestep is 30.

Only the pressure-based solver can be used.The VOF model proposed by Fluent is not available with either of   the density-based solvers. Therefore, a pressure-based solver is used.

Nota Bene:

The VOF model does not allow void regions where no fluid of any type is present. However, this restriction is not an issue in the case as the cave is initially filled up with oil and water.

Moreover, only one of the phases can be defined as a compressible ideal gas. There is no limitation on using compressible liquids using user-defined functions.

First order versus second order

With Fluent, the second-order time-stepping formulation can only be used with the VOF implicit scheme. As Jadim is only available for a second-order formulation, the second-order implicit formulation is used for the comparison between Fluent and Jadim.

However, as explicit schemes are easier to program, with only simple calculations performed at each timestep, they required smaller timestep, and thus reduce the computational time of a simualtion.

A simulation is carried out with first a second order implicit scheme and then a first order explicit scheme and the results appeared to be similar. Thus, for the parametric study which require many heavy simulations, the choice has been made to use a first-order explicit formulation to reduce the computational time.

The implicit scheme is used for time discretization, Fluent's standard finite-difference interpolation schemes, QUICK, Second Order Upwind and First Order Upwind, and the Modified HRIC schemes, are used to obtain the face fluxes for all cells, including those near the interface.

In the explicit approach, Fluent's standard finite-difference interpolation schemes are applied to the volume fraction values that were computed at the previous time step.

Mesh impact study

Geometries and meshes are realized with IcemCFD .

As shown previously on a Jadim simulation, the influence of the mesh on the results can be important. Therefore, a mesh study is carried out in order to investigate the impact of the mesh in the three-phase flow case. 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 Gas Reynold time step max Physical Time Coarse Mesh 70x88 0.1 m/s 260 $10^{-4}$ 2.41 Refined Mesh 140x176 0.1 m/s 260 $10^{-5}$ 2.43

In the two pictures below, the oil, gas and water contour are plotted at the same time. As observed for the Jadim simulations, a refined mesh reduces 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.

Refined mesh                                                                         Coarse mesh

The graph below shows that the oil and water volume fraction at the outlet are not the same for a coarse and a refined mesh. The coarse mesh  leads to an error of 7% on the results.

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.

Level Set method versus VOF method

Two simulations are carried out, one with the Level Set method and one with the VOF method. The graph below shows the outlet oil flow rate and oil and water remaining in the domain found. We can see that the results obtained are accurate and similar for the two methods: a maximum oil flow rate ratio of 11 is reach, which shows a good flow rate conservation and evolution of the oil and water volume fraction is relevant.

Therefore, the two methods can be used to simulate the problem. However, as the Level set method for a three-phase flow is not available on Jadim, all the Fluent simulations will be carried out with the VOF method.

# Analyze of the results

In this part, results of the simulations carried out with Fluent and Jadim are analyzed and compared.

As explained previously, convergence issues make three-phase flow simulations on Jadim difficult to achieve. On another hand, if Fluent seems to avoid these problems, the fact that the access to the code is not possible leads us to be critical about the results.

Therefore, a comparison of similar simulations carried out with these two softwares is important to validate the results.

Two simulations with different velocities and physical properties are realized:

- In the first simulation, a velocity of 1 m/s is used , oil, gas and water viscosities are multiplied by 100 and the gas density is multiplied by 10.

- In the second simulation, real properties of oil, gas and water are used with a velocity of 0.1 m/s.

# Post-treatment

• Matlab Post-treatment

To visualize the geometry with matlab, the command  les2asc filename geom is used.
To visualize an animation of a serie of timesteps (for instance every 2 timestep from 4 to 10), the command les2asc filename range 4 2 10 is used.

Then, a matlab script file allows to load output jadim variables in matlab, using the function fscanf. Afterwards, values of variables such as volume fraction of oil and gas, velocity, position or pressure are saved into matrices which contain a value for each cell. The loop time gives access to every timestep.

The matlab script is used to plot macroscopic dimentionless data of interest:

- The repartition of oil/water/gas volume fraction in the domain in function of time, plotted in function of a time:

$$oil_{mean}=\frac {\sum \limits_{i=1}^m \sum \limits_{j=1}^l \tau_{oil,ij}}{m \times l}$$                    $$gas_{mean}=\frac {\sum \limits_{i=1}^m \sum \limits_{j=1}^l \tau_{gas,ij}}{m \times l}$$

$$gas_{mean}=1-oil_{mean}-gas_{mean}$$

With:

$m \times l$: numbers of cells of the domain

$\tau_{oil,i}$: Oil volume fraction of cell $i$

$\tau_{gas,i}$: Gas volume fraction of cell $i$

- The outlet oil flow rate in function of time, plotted in function of time:

$$Q_{outlet}=\frac{1}{n}\sum \limits_{i=1}^n \tau_{oil,i} v_i L_{outlet}$$

With

$n$: number of outlet cells
$v_i$: outlet velocity of cell $i$
$m \times l$: numbers of cells of the domain

- The ratio of remaining and the ratio of oil recovered:

$$ratio_{oil-remaining}=\frac{oil_{initial}-Q_{Outlet}t}{oil_{initial}}$$
$$ratio_{oil-recovery}=1-ratio_{oil-remaining}$$

With

$oil_{initial}=\sum \limits_{i=1}^m \sum \limits_{i=1}^l \tau_{oil,ij} S_{cell}$
and $S_{cell}$: area of a cell

• Paraview post-treatment

Thanks to the command les2par filename range 1st-timestep interval final-timestep, jadim data can be loaded on paraview and it is possible to vizualize the different variable in function of time. In our BEI, paraview was mainly used to create video and to observe the general flow behaviour.

• Dimentionless Values

As results of this project will be used by Schlumberger, it is important to work with dimentionless variables:

- the outlet oil flow rate is divided by the inlet gas flow rate

- the time is divided by Tref, the time needed to fill up the domain with gas:

$t= \frac{ physical-time}{T_{ref}}$

$T_{ref}=\frac{S}{V_{Inlet}\times D}$

With

$S$:  surface of the domain without the obstacle

$V_{inlet}$ : velocity of the gas injection

$D$:  lenght of the inlet

# Simulation 1 : High viscosities

In this first simulation, oil, gas and water viscosities are multiplied by 100. Indeed, increasing viscosity values should allows Jadim to avoid convergence issues and to reduced numerical diffusion.

The table below recaps the main caracteristics of the simulation:

 Physical properties Velocity inlet Time step Scheme Order Time simulated Quantity of N2 injected Fluent Viscosities x100 0.1 m/s 10-4 Second Order 2.5 sec 6.25.10-3 m² Jadim Viscosities x100 0.1 m/s max. 10-4 Second Order 2.5 sec 6.25.10-3 m²

This simulation is carried out for a velocity of 0.1 m/s, 1m/s and 10 m/s. In term of convergence, CPU time and accuracy of the results, the velocity of 1 m/s appeared to be the suitable velocity for this case, for bth Fluent and Jadim simulations. Therefore, the simulations presented in this page have been carried out with a velocity of 1 m/s.

The inlet is characterized by a gas Reynolds Number of 260 at the inlet. Therefore, the gas jet at the inlet is not turbulent.

If a flow Reynold Number in the domain  is complicated   to calculate, velocities in function of time can be  observed. In  both Jadim and Fluent  simulations,  flow  velocity  does  not exceed 7 m/s. The picture  on the   right shows the velocity field at 1.5 sec with Jadim.

Thus, it is relevant to conclude that the flow  is laminar and  that turbulence models are not needed.

The two videos below show the same case simulated with Fluent and Jadim. As explained previoulsy, gas is injected on the lower right side of the domain, and the outlet is situated on the middle left side. The physical time simulated is 2.5 seconds, which correpond to an injection of %47 of gas i the domain.

Simulation carried out with Fluent

In the videos, if befferent local flow features can be observed, the global flow in the domain has the same behaviour with Fluent and Jadim. Moreover, the phenomenon of numerical diffusion is not too important and the position of the norrow gas interface is accurate. From the observation of these videos, Jadim seems to handle the three-phase flow simulation and the results seem accurate and relevant.

In order to confirm these observations, macroscopic data of interest are analyzed with the matlab post-treatment. The figure below represents the evolution of oil, water and gas volume fraction in the domain in function of a dimentionless time. Results of Fluent and Jadim simulations are compared.

The first observation is that for both simulations, oil and water volume fraction decrease as gas volume fraction increase, which corresponds to the injection of gas and the disparition of oil and water into the outlet.

Secondly, it shows that no gas injected have left the domain after an injection of 74% of nitrogen. Indeed, the evolution of the gas volume fraction is a  linear curve with represents a constant evolution in the domain.

Finally, oil, pushed by water, starts to leave the domain after an injection of 14% of gas and at the end of the simulation, after an injection of 47% of gas, 52.7% of oil wedged remains in the domain.

The results obtained with Jadim and Fluent are similar: the same amount of oil has left the domain at the end and the evolution of phases repartition is similar during this period of time. These results confirm that  Jadim predicts well flow features in a case of   high viscosities.

Then, the evolution of the outlet oil flow rate is plotted in function of a dimentionless time.

When oil starts to leave the domain after 14% of nitrogen injected, the dimentionless oil flow rate reach a maximum of 1. The previous videos show that at the time, only oil goes out of the domain. Theses observations lead to the conclution that flow conservation between the inlet and the outlet is respected.

Moreover, like the evolution of the volume fraction, the comparison of the outlet oil flow rate shows that Jadim and Fluent produce similar results in this case.

Conclusion: If local flow features observed on the videos  have differences in function of the CFD software, the study of macroscopic values of interest shows that in this case, Jadim and Fluent give similar results. Jadim seems to gives more accurate results when it does not have to deal with the small viscosity of nitrogen.

# Simulation 2: Real properties of oil, gas and water

A second simulation is carried out with real properties of gas. In order to avoid convergence issues, the timestep is reduced to $10^{-5}$ and a small velocity inlet of 0.1 m/s is used. Because of this small velocities, the computational time of the simulation is really high. Therefore, only 5% of nitrogen is injected in the domain before convergence issues appear in the Jadim simulation.

The table below recaps the main caracteristics of the simulation:

 Physical properties Velocity inlet Time step Scheme Order Time simulated Nitrogen Injected (% of the domain) Fluent Real properties 0.1 m/s $10^{-5}$ Second Order 2.8 sec 5% Jadim Real properties 0.1 m/s max. $10^{-5}$ Second Order 2.8 sec 5%

The gas injection is characterized by a Gas Reynolds Number of 26. Moreover, as for the simulation 1, the velocity field in the domain observed on paraview shows that the velocity remains small in the domain in function of time.

Thus, it is relevant to conclude that the flow  can be consider as laminar and that turbulence models are not needed.

The two videos below show the same case simulated with Fluent and Jadim. As explained previoulsy, gas is injected on the lower right side of the domain, and the outlet is situated on the middle left side. The physical time simulated is 2.8 seconds, which correponds to a dimentionless time of 0.4

Simulation carried out with Fluent

On videos, differencies between local flow features can be observed with the Fluent and Jadim simulations.

In the Jadim simulation, the gas interface is not accurate and it seems that Jadim has difficulties to handle flow features. While bubble of gas should be expected, the gas is diffused and seems to mix with oil and water.

In the Fluent simulation, the interface is more accurate but the gas seems to "desappear", probably because of numerical diffusion.

If  numerical diffusion can explained the diffusion of the gas observed with Jadim, another explanation can be found in the scale of the mesh. Indeed, the size of cells is close to 1 mm. Therefore, if the gas forms bubbles smaller than 1 mm, Jadim is not able to represent the topology changes properly. If Fluent seems to provide a accurate interface, it is important to note that it is a really strong commercial software design to always give a result.

The graph below represents the repartition of  phases in function of time. The comparison between Jadim and Fluent shows that after an injection of 5% of nitrogen, the repartition of gas and water in the domains already starts to be different.  If the simulation has been run longer, the repartirion of phases obtained with Fluent and Jadim would have probably been even more different.

If we plot the outlet oil flow rate in function of time, results obtained with Jadim and Fluent are also different. When only oil goes out of the domain, which corresponds to a maximum oil flow rate, the flow rate ratio of the Fluent simulation as a value of 0.9, which represents an error of 10%.

Due to the small velocity, only 5% of nitrogen is injected in the domain and only 4% of oil is recovered.

To conclude, the results obtained by Fluent and Jadim does not seem as accurate as in the Simulation 1. As the viscosity of the gas is small, bubbles of gas are difficult to represent and the interface between gas and other phases is hard to predict.

However, the computational time of Fluent is smaller than the one with Jadim and Fluent is a strong software which had a good capability to handle topology changes. Therefore, the parametric study will only be simulated with Fluent.