sofiabelen / Two-Phase-Filtration

Hydrodynamics Solver: Ideal Gas and Pentane Filtration
MIT License
6 stars 0 forks source link

Hydrodynamics Solver: Nitrogen and Pentane Filtration

Check out this post for a more detailed description!

Directory Structure

Initial and Boundary Conditions

Alt text

Methods Used

Alt text

  1. Second order finite difference method for spatial discretization using a staggered grid.

  2. Explicit predictor-corrector method according to the Heun scheme for time integration.

  3. Newton-Raphson method for finding pressure and gas saturation.

Algorithm

  1. We are given the densities $\rho_i = \rho_i(t)$.

  2. Finding the pressure and gas saturation using the Newton-Raphson method from the condition of equality of the pressure of the gas and the liquid:

$$P = P_1 \left( \frac{\rho_1}{s} \right) = P_2 \left( \frac{\rho_2}{1 - s}\right)$$

  1. Calculation of fluxes from Darcy's law.

  2. Calculation of the densities $\rho_i(t + \Delta t)$ based on the known fluxes.

  3. Renaming $\rho_i = \rho_i(t + \Delta t)$ and moving on to the next time step.

Results

Alt text

Alt text

How to Run

TODO: PkgTemplates.jl

In normal mode:

julia src/main.jl

In debug mode:

JULIA_DEBUG=Main julia src/main.jl