Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Darcy flow in a 2D domain with varying permeability

div(−kμgrad(p))=0\mathrm{div}\left(-\frac{k}{\mu} \mathrm{grad}(p)\right) = 0

This is 2D Darcy flow: a source-free, elliptic pressure equation for flow through a porous medium with permeability kk and viscosity μ\mu. The domain contains a circular region of low permeability embedded in a higher-permeability background. The top and bottom walls are no-flux (Neumann, ∂p/∂n=0\partial p/\partial n = 0), and a fixed pressure drop between the left and right ends (p=1p=1 at x=0x=0, p=0p=0 at x=2Lx=2L) drives the flow through and around the low-permeability inclusion.

Imports

Parameters and permeability field

A circular inclusion of low permeability k_int sits in a background of permeability k_ext.

Grid, boundary conditions and face permeabilities

Axis 0 (y) has no-flux walls at both ends; axis 1 (x) has the fixed pressure drop that drives the flow.

Assembling the flux and divergence operators, and solving for the pressure

Cell-centered fluxes for plotting

Pressure contour and streamlines

<Figure size 640x480 with 2 Axes>

Checking the result

This Darcy problem is source-free and steady, so div(flux)=0\mathrm{div}(\mathrm{flux}) = 0 everywhere: no reaction or accumulation term absorbs an imbalance. The net volumetric flux entering through the pressure boundary at x=0x=0 must therefore equal the net flux leaving through the pressure boundary at x=2Lx=2L (a global mass balance). A sign error in the flux assembly, or an unconverged or wrong solve, breaks this balance.

Flux in  (x=0):   1.757774e-01
Flux out (x=2L):  1.757774e-01
Relative imbalance:  2.430e-13
Imbalance at machine precision confirms mass is conserved; a large value would point to a sign error in the flux assembly or an unconverged solve.