CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Two Phase Darcy flow with gravity -> problem (https://www.cfd-online.com/Forums/openfoam-programming-development/82113-two-phase-darcy-flow-gravity-problem.html)

 Cyp November 17, 2010 08:58

Two Phase Darcy flow with gravity -> problem

Hi everybody!

I am currently working on a Darcy two phase flow solver with IMPES method (IMplicit Pressure Explicit Saturation). I want to simulate a two phase flow in porous media in 3D. It is why I use permeability tensor fields. These permeabilities depend on the liquid saturation

Here is the snippet I programmed in OpenFOAM:
Code:

```         M_beta  = K*pow(S,2)/mu_beta;         M_gamma = K*pow((scalar(1.0)-S),2)/mu_gamma;         phi_beta  = linearInterpolate( (rho_beta*M_beta & g))  & mesh.Sf();         phi_gamma = linearInterpolate( (rho_gamma*M_gamma & g)) & mesh.Sf();         fvScalarMatrix pEqn         (             fvm::laplacian((M_beta + M_gamma),p)         == fvc::div(phi_beta) + fvc::div(phi_gamma)         );            pEqn.relax();         pEqn.solve();         fvScalarMatrix SEqn         (           fvm::ddt(eps,S) - fvm::laplacian(diffS,S)         == (fvc::laplacian(M_beta,p)) -  fvc::div(phi_beta)         );         SEqn.relax();         SEqn.solve();         U_beta = -(M_beta&fvc::grad(p))+((rho_beta*M_beta)&g);         U_gamma = -(M_gamma&fvc::grad(p))+((rho_gamma*M_gamma)&g);```
where
- S and p are volScalarFields
- M_beta and M_gamma are volTensorFields.
- K is a dimensionedTensor

The compilation is ok.

As a validation case, I simulate a the flow through a 1D vertical column: I inject a liquid at the top of column initially filled up with gas. the simulation is correct on a case without gravity (g= (0 0 0)). However, the code diverges when I tried to simulate a flow with gravity (g = (0 -9.81 0)).

Is there something wrong with the gravity in my code ?

Best Regards,
Cyp

 All times are GMT -4. The time now is 23:40.