I want to generate a code for simulating three phase (water, oil, gas) flow in soil and it needs to calculate capillary pressure between each two phase as a function of saturation, soil properties, and fluid surface tension
There are empirical equations available to model capillary pressure as a function of saturation. Brooks-Corey equation or van Genuchten equation are used in models. The curve fitting parameters in these equations are dependent on soil type and poresize distribution.
There are empirical equations available to model capillary pressure as a function of saturation. Brooks-Corey equation or van Genuchten equation are used in models. The curve fitting parameters in these equations are dependent on soil type and poresize distribution.
There has been a lot of discussions on dynamic capillary pressure as well, which tries to relate static capillary pressure (e.g., see the paper above by Prof Babchin and reference 12 in the paper) and dynamic capillary pressure using a capillary damping coefficient or a relaxation coefficient. We have published on various aspects which are all in my publication list - please have a look.
There is no short cuts, so I suggest you look at all of the suggestions above and beyond (e.g., you can also look papers by Ken Sorbie; Martin Blunt, etc). For 3-phase flow, you can still impose the same definitions and equations for Pc, just for more than one fluid pairs, e.g., water-oil and oil-air for air-water-oil system. There are not a lot of studies for dynamic capillary pressure for 3-phase flow. There are different approaches for measuring Pc, e.g., flow through expt, pressure cell, centrifuge method, etc. Micromodel studies are also there.