Introduction

Two-phase fluid displacements often occur in cycles, alternating between displacement of the less wetting fluid by the more wetting one (imbibition or wetting) and vice versa (drainage or dewetting). Examples include rain and evaporation in soils1, and flow reversal in enhanced oil recovery2 or in CO2 geosequestration3. Remarkably, drainage–imbibition cycles exhibit significant hysteresis. Pressure–saturation (PS) trajectories do not retrace the same path when the flow direction is reversed: the pressure required to achieve a given fluid saturation in drainage differs from that in imbibition1. Challenging our understanding of PS hysteresis at the continuum (“Darcy”) scale is the multi-scale nature of two-fluid displacements in heterogeneous media: the behavior at the continuum scale is governed by micro-scale interface pinning and abrupt depinning events (instabilities or jumps)4. Due to interfacial tension, local instabilities become spatially correlated, giving rise to large, collective displacements involving large portions of the front (avalanches or Haines jumps), which appear to be a key mechanism in the origin of irreversibility, or hysteresis, in porous media flow5,6,7.

A remarkable feature of drainage–imbibition hysteresis is that it persists when displacements are carried out exceedingly slowly (quasistatically). Quasistatic hysteresis is common to a variety of disparate systems, from ferromagnetic materials to shape-memory alloys, which have a rugged free-energy landscape with multiple local minima separated by large energy barriers. The minima correspond to long-lived metastable configurations in which, in the absence of fluctuations, the system remains trapped unless an external field drives it sequentially from one metastable configuration to the next. Quasistatic hysteresis is the macroscale manifestation of micro-scale energy-dissipative events along this evolution. It is also associated with history dependence, or memory, which reflects the inaccessibility of alternative states (energy minima) due to large energy barriers8. The rugged energy landscape results from structural disorder—either quenched-in or dynamically generated. In porous and fractured media it arises from the heterogeneous nature of the solid matrix.

Classical approaches to quasistatic hysteresis is “compartment” models, in which the macroscale response is the cumulative output of multiple independent hysteretic units called hysterons7,9,10,11,12,13. Preisach and Everett models in ferromagnetism and porous media flow, respectively, belong to this general family. Compartment models can be tailored to reproduce the hysteretic behavior of a particular system, by deriving the suitable statistical distribution of hysterons from a complete set of first-order reversal PS trajectories8,13. However, they remain phenomenological in the sense that hysterons are introduced ad hoc, and the model parameters are not related to system properties such as permeability, wettability, and viscosity. Furthermore, compartment models consider all units of a given threshold to be invaded once the macroscopic forcing is exceeded, with no consideration of the spatial location of units with respect to the interface. Recently, models which include topological information in the form of Minkowski functionals were shown to capture multivaluedness in the PS relationship; however, at an appreciable computational cost14,15,16.

Here, we propose a model of quasistatic hysteresis that represents a significant improvement over phenomenological approaches such as compartment models. Our model applies to quasistatic two-phase displacements in a Hele–Shaw cell with random gap spacing. It relies on an accurate pressure balance equation for the fluid–fluid interface which simultaneously accounts for the competing effects of interfacial tension, hydrostatic pressure, and micro-scale capillary instabilities. In this way, it naturally adopts a form that resembles a fluctuationless random-field Ising model (RFIM)17,18, though written in terms of continuous variables. In contrast with phenomenological approaches, all parameters in our model have a clear, identifiable physical meaning, thus making it accessible eventually to detailed experimental scrutiny. The model captures interactions among neighboring heterogeneities through the in-plane interfacial tension, as well as the resulting lateral correlations that give rise to collective capillary rearrangements of the fluid–fluid interface between successive metastable equilibrium configurations (Haines jumps). At large scale, these collective events produce jerky PS curves featuring drainage–imbibition hysteresis cycles and return-point memory of internal PS trajectories, for which there is ample experimental evidence5,19,20.

Results

Interface model: theory and numerical implementation

To derive an interface model for quasistatic imbibition and drainage, we consider the following disordered medium: A thin open fracture with spatially variable aperture. A physical realization of this medium is an imperfect Hele–Shaw cell where localized gap-thickness variations are produced by randomly placed heterogeneities or “defects” (constrictions and expansions; Fig. 1). Though the model applies generally to any two immiscible fluids of different density and viscosity, it is formulated below for a viscous liquid and a gas as wetting and nonwetting fluids. This enables comparison with the experiments in ref. 21 for an isolated defect.

Fig. 1: Schematic view of the imperfect Hele–Shaw cell.
figure 1

The cell is inclined by an angle α, which results in an effective gravity ge. The gap thickness fluctuates between b0 and b0 ± δb, where δb is the thickness of defects (orange blocks in the zoom-in). The local interface height, separating the wetting and nonwetting fluids (dark and light shading, respectively) is given by h(x).

The variability in gap thickness induces variability in capillary pressure, pc, through the change in the out-of-plane curvature of the meniscus. By contrast the interfacial tension induced by the in-plane curvature produces a restoring force through a localized Young–Laplace term that approximates curvature by the Laplacian of the interface height h(x). As explained in detail in Supplementary Note 1, the balance between these two pressure contributions and hydrostatic and driving pressures leads to the following stochastic differential equation for the equilibrium configurations of the interface height h(x) at a given external pressure head H (imposed pressure at the cell’s inlet):

$$\gamma \frac{{{{{\rm{d}}}}}^{2}h(x)}{{{{\rm{d}}}}{x}^{2}}-\rho g\sin \alpha \ h(x)+\rho gH+{p}_{{{{\rm{c}}}}}[x,h(x)]=0,$$
(1)

where γ is the fluid–fluid surface tension, g the gravitational acceleration, and ρ the wetting fluid density. Here, we neglect gravitational effects in the nonwetting fluid. For a static contact angle θ the local capillary pressure is \({p}_{{{{\rm{c}}}}}(x,y)=2\gamma \cos \theta /b(x,y)\), where b(xy) = b0 − δb(xy) is the local gap thickness (b0 is the unperturbed gap thickness, and δb > 0 and δb < 0 correspond to constrictions and expansions, respectively). The cell is tilted (by an angle α) to prevent viscous fingering in drainage, which would interfere with the effect of disorder. For compactness of notation we define an effective gravity \({g}_{{{{\rm{e}}}}}=g\sin \alpha\), and the external pressure P = ρgH (Fig. 1). The Hamiltonian corresponding to Eq. (1) is given by

$${{{\mathcal{H}}}}=\int {{{\rm{d}}}}x\frac{\gamma }{2}{\left[\frac{{{{\rm{d}}}}h(x)}{{{{\rm{d}}}}x}\right]}^{2}+\int {{{\rm{d}}}}x\int\nolimits_{\!\!\!\!\!0}^{h(x)}{{{\rm{d}}}}y\left[\rho {g}_{{{{\rm{e}}}}}y-P-{p}_{{{{\rm{c}}}}}(x,y)\right].$$
(2)

We define a local effective field pe(x) as the negative functional derivative of \({{{\mathcal{H}}}}\) with respect to h(x), \({p}_{{{{\rm{e}}}}}(x)=-\delta {{{\mathcal{H}}}}/\delta h(x)\). Equation (1) for the interface height is obtained by setting pe(x) = 0, such that h(x) minimizes the Hamiltonian \({{{\mathcal{H}}}}\), see Supplementary Note 2.

We note that the pressure balance equation (1) is a specific form of the quenched Edwards–Wilkinson (qEW) equation22,23 in which the driving force is given by  −ρgeh(x) + P. Upon a small change in P, the configuration of the interface changes until this driving force compensates the two pressure terms of capillary origin. At each step (P value), the average equilibrium position of the interface corresponds to a new Jurin height—where capillary rise is restrained by gravity. Each new Jurin height is then an absorbing state of the dynamics24. The qEW equation plays a salient role in the context of elastic manifolds in random media, as the representative model for a whole universality class of critical non-equilibrium interfacial problems25,26,27. Eq. (1) can be identified also with a first-order approximation in dh/dx of the fluctuationless RFIM for fluid fronts in disordered media, in the quasistatic limit28,29,30,31. These two models, the qEW equation and the fluctuationless RFIM, have been subjected to intense scrutiny regarding interfacial kinetic roughening and avalanche dynamics, and typically formulated in terms of effective parameters. Here by contrast all parameters in Eq. (1) have direct physical meaning. Moreover, to the best of our knowledge, this is the first time that an interfacial equation like Eq. (1) is used to investigate hysteresis and memory of interfacial configurations.

The numerical implementation of our model uses an iterative algorithm inspired by the method used for simulating the fluctuationless RFIM. We discretize the horizontal direction equidistantly, xn = nΔx. For a given external pressure P, we use synchronous updating to resolve the equilibrium configuration, corresponding to the vanishing local effective field pe(x) = 0: the local height h(xn) is increased in imbibition by δh for all sites n which are out-of-equilibrium, pe(xn) > 0. This procedure is repeated until pe(xn) is everywhere smaller than a tolerance ϵ. During drainage the criterion pe(xn) < 0 decreases the local interface height by δh until pe(xn) > −ϵ. Details of the numerical implementation are given in “Methods”.

Hysteresis across a single mesa defect

We begin by considering the case of a single mesa-shaped defect which locally reduces the gap thickness. This case has been studied theoretically and experimentally in ref. 21 as exponent of a fundamental mechanism for hysteresis that does not depend on disorder. Since it admits also an analytical solution (Supplementary Note 3) it serves here as a benchmark for our numerical implementation of Eq. (1). Figure 2a, b shows the simulated interface positions at various external pressures during imbibition and drainage, highlighting three specific external forcing values, H (marked 1–3; see Supplementary Movie 1 for the complete sequence). The interface is flat both before touching and after leaving the defect. During imbibition, the interface experiences an instability when it first touches the defect: the sudden increase of the out-of-plane curvature pulls the central part of the interface into the defect and forces it to deform abruptly. The abrupt change of the front upon touching the defect corresponds to the passage from a metastable configuration to a stable one when the former reaches its limit of metastability21. This instability manifests in an abrupt increase of saturation (relative volume fraction of the wetting phase, Sw) in the PS relationship (Fig. 2c). The deformed interface then maintains the same shape until it reaches the edge of the defect, where it remains pinned until it flattens and leaves the defect. This motion is fully reversible because as the interface exits the defect only one stable configuration exists21. During drainage, the meniscus is pinned upon contact with the defect until it recovers the fully deformed shape, and then advances keeping this shape (Fig. 2b). Upon reaching the edge of the defect it snaps irreversibly back to a flat interface. The jump in drainage occurs at a lower external pressure than in imbibition, giving rise to the elementary hysteresis cycle in the PS relation shown in Fig. 2c. The simulated interfaces for the three highlighted H values are compared in Fig. 2d, e (imbibition and drainage, respectively) with experiments from ref. 21 for identical system geometry and fluid properties, and with the analytical solution given in the “Methods”. The numerical and analytical solutions are in perfect agreement, predicting the experimental data with no fitting parameters.

Fig. 2: Imbibition–drainage across a single mesa defect.
figure 2

A Hele–Shaw cell with an elongated constriction (in gray) exposes a fundamental mechanism for hysteresis. Panels (a)–(c) show the numerical simulations, and (d, e) their validation against experiments and theory. Results for three external forcing values (H) are highlighted by numbers (1,2,3). The sequences of interface configurations in panels (a), (b), (d) and (e) are shown in terms of the height h along the cell (centered around x = 0). Green and brown lines and symbols refer to imbibition and drainage displacements, respectively. a In imbibition, the interface experiences an instability and deforms as soon as it contacts the defect (from 1 to 2), while it gets pinned at the end of the defect (3), leaving it gradually. b In drainage, the interface gets pinned when it first contacts the defect (3), deforming gradually in a reversible manner (through the same deformation states as in imbibition), to finally experience a jump at the edge of the defect, where it flattens out again. c The jumps from one stable configuration to another (sharp changes in wetting-phase saturation Sw) upon entering the defect in imbibition and leaving it in drainage occur at different values of H, giving rise to pressure–saturation hysteresis. d, e The excellent agreement between the simulation (line), theory (solid symbols) and an experiment (single instance; open symbols) in both imbibition (d) and drainage (e) displacements validates our model.

Hysteresis in disordered media

We now turn to disordered media, examining the collective effect of the interactions between multiple microscopic events associated with spatial heterogeneity (multiple defects) and its impact on the macroscopic PS relationship. Interfacial tension introduces spatial correlations through the in-plane interfacial curvature, such that capillary-induced pinning or depinning of the front in one location affect their occurrence in other locations. This propagates in a cascade process that eventually modifies the configuration of the entire interface. Competition between interfacial tension and effective gravity (Eq. (1)) leads to a lateral correlation length \({\ell }_{{{{\rm{g}}}}}=\sqrt{\gamma /(\rho {g}_{{{{\rm{e}}}}})}\) which extends beyond the typical size of gap-thickness fluctuations21. This explains how strongly nonlinear behavior emerges from an equation that is derived for dh/dx 1.

The disorder introduced by randomly placed defects of variable thickness δb gives rise to a distribution of pc values. We separate pc into \({p}_{{{{\rm{c}}}}}^{0}+\delta {p}_{{{{\rm{c}}}}}\), where \({p}_{{{{\rm{c}}}}}^{0}=2\gamma \cos \theta /{b}_{0}\) and \(\delta {p}_{{{{\rm{c}}}}}={p}_{{{{\rm{c}}}}}^{0}(\delta b/{b}_{0})/(1-\delta b/{b}_{0})\). We model δpc as a random variable that takes on the value 0 with probability 1−ψ and a value drawn from a Gaussian distribution of zero mean and standard deviation σ0 with probability ψ (where ψ represents the relative fraction of defects in the cell). This creates a rugged energy landscape which is manifested by spatially rough interfaces and Haines jumps. The latter are abrupt, notable changes to the interface configuration and therefore to the wetting-phase saturation, resulting in jerky PS behavior (Fig. 3; see Supplementary Movie 2 for the dynamics).

Fig. 3: Hysteresis in a model disordered medium.
figure 3

A disordered system (1200 × 1200 units) with heterogeneous gap thickness provides hysteresis. Panel (a) shows the primary imbibition and drainage pressure–saturation (PS) trajectories, and an internal subcycle (P and Sw are the external pressure and wetting-phase saturation, respectively). For any given P (e.g. dashed gray line), the figure shows that the saturation Sw is history-dependent (four open circles). Return-point memory is apparent in the internal cycle (inset shows a zoom-in). Arrows indicate the displacement direction. Green and brown lines distinguish between imbibition and drainage, respectively, with dark and light referring to primary and secondary trajectories. The dotted green line represents the initial part of the primary imbibition trajectory, which rejoins the imbibition trajectory of the larger cycle. Panel (b) shows part of the disordered medium, color-coded to indicate the normalized local defect strength \(\delta {p}_{{{{\rm{c}}}}}/{p}_{{{{\rm{c}}}}}^{0}\). The effective gravity ge in our setup points in the  −y direction. Four interfaces at the same imposed P are shown. Dp and Ip correspond to the primary drainage and imbibition trajectories, and Ds and Is to the internal subcycle—the same four points marked with open circles on the PS curves in panel (a). The figure demonstrates that hysteresis is evident both in the PS relationship, a macroscopic property, and in the interfacial configurations, a microscopic feature.

The average height of the consecutive equilibrium configurations reached by the interface is given by the corresponding Jurin height. Hence, the average slope of the PS retention curves is dictated by the imposed effective gravity, whose relative importance in comparison with capillary forces is measured by a Bond number, Bo. In the limit of very small Bo (nearly horizontal cell) the dominance of capillarity allows for larger avalanches, and a larger change in saturation in response to a given change in external forcing, so that the PS curves become nearly horizontal, as observed experimentally32. For further analysis of the impact of Bo see Supplementary Note 5. In standard retention experiments, where the setup limits the sample size so that gravity becomes negligible relative to capillary forces (small Bo) the PS curves are nearly horizontal1.

A remarkable property of the model is its ability to capture the memory properties of PS trajectories. An internal hysteresis cycle rejoins the primary PS trajectory exactly at the point where the internal cycle was initiated (“return-point memory”, RPM; Fig. 3a), with exactly the same interface shape. This is also true for cycles within internal cycles (not shown here), revealing that not only PS trajectories are infinitely multivalued, but also that their actual value depends on the previous sequence of return points in the current trajectory, which is stored in the interfacial configuration evolution (Fig. 3b). This RPM property is shared by a number of seemingly disparate slowly driven disordered systems with a rugged, complex free-energy landscape, from cellular automata33 to ferromagnetic and shape-memory polycrystalline materials34. RPM has been observed experimentally as a robust feature in two-phase flows in porous media5,19,20. Our own preliminary experiments in a Hele–Shaw cell featuring randomly placed mesa-shaped constrictions confirm, within experimental accuracy, the numerically observed behaviors, also in terms of the RPM property. In contrast to the fluctuationless RFIM, our model involves continuous variables h(x) interacting through a Laplacian term. Nevertheless, the RPM property can be rigorously proved by analogous arguments (see Supplementary Note 4), bringing new insights about the interfacial dynamics of two-phase flows in disordered media implicit in the energy minimization leading to Eq. (1).

Hysteresis depends on the underlying microstructural heterogeneity in a non-trivial manner, as a result of the interactions among defects associated with surface tension. We consider the impact of the width of the distribution of pc, \({\sigma }_{{p}_{{{{\rm{c}}}}}}\), on the strength of the hysteresis cycles, ΔP. The latter is measured by the average pressure difference between drainage and imbibition. We find that increasing \({\sigma }_{{p}_{{{{\rm{c}}}}}}\) results in stronger hysteresis (increasing ΔP); an example is shown in Fig. 4a (each curve is the ensemble-averaged PS values over 15 disorder realizations; see Supplementary Note 6). We find that ΔP grows as \(\Delta P \sim {({\sigma }_{{p}_{{{{\rm{c}}}}}})}^{n}\) with n ≈ 1.4. Interestingly, this scaling holds for systems with different types of defect distributions (Fig. 4b). It also holds for: (1) dichotomic distributions of δpc with various relative fraction of defects ψ; and (2) with defects placed on a regular grid, with disorder introduced only through variations in δpc (see Supplementary Note 7). The common features of these different scenarios are the existence of a finite length scale characterizing the geometry relative to the correlation length g, and a finite defect thickness characterizing the disorder (e.g., its variance). In the single defect case, the saturation jump and therefore the hysteresis strength is linearly proportional to the defect strength, δpc21. The nonlinear dependence of ΔP on \({\sigma }_{{p}_{{{{\rm{c}}}}}}\) in disordered media is a result of interactions among the heterogeneities due to lateral correlation caused by interfacial tension. Note that the length of influence g (here ~10 mm) is larger than the typical distance between the defects (~0.1 mm for ψ = 0.35 occupancy). ΔP is a measure of the energy barrier that needs to be overcome when alternating from imbibition to drainage. Our results point to a nonlinear dependence of this energy barrier on the width of the disorder distribution.

Fig. 4: Impact of the underlying microstructural heterogeneity.
figure 4

Panel (a) shows that the width of the hysteresis cycle in pressure, P, vs. wetting-phase saturation, Sw, increases with the width of the distribution of the defect strength pc. The distribution width is defined as \({\sigma }_{{p}_{{{{\rm{c}}}}}}/{p}_{{{{\rm{c}}}}}^{0}\) (legend), obtained by normalizing the standard deviation of pc, \({\sigma }_{{p}_{{{{\rm{c}}}}}}\) by the reference value \({p}_{{{{\rm{c}}}}}^{0}=2\gamma \cos \theta /{b}_{0}\). The cases shown here correspond to Gaussian distributions of δpc. Panel (b) shows that the hysteresis strength ΔP (averaged pressure difference between drainage and imbibition) grows as \(\Delta P \sim {({\sigma }_{{p}_{{{{\rm{c}}}}}})}^{n}\) with n ≈ 1.4 (straight line). Different δpc distributions are considered here: Gaussian (same as in panel a; solid circles), a half-sided Gaussian (positive values only; open circles), and a dichotomic distribution (δpc equal to 0 or a given positive value; diamonds).

Discussion

Hysteresis is a consequence of energy dissipation; in our quasistatic approach the dissipation occurs through the irreversible release of elastic energy in Haines jumps35. A preliminary estimation based on Eq. (2) demonstrates that a single avalanche can dissipate a substantial amount of the energy stored in the deformed interface, in line with recent experimental estimations36. Furthermore, since the RPM property ensures that the two-fluid interface recovers its original configuration in a closed imbibition–drainage cycle, it follows that the total energy dissipated in the cycle equals the total work made by the driving pressure in the cycle, i.e. the area enclosed in the PS cycle37. Thus, our results provide direct evidence that the dissipated energy increases with microstructural heterogeneity (Fig. 4).

Over the last century, fluid–fluid interface pinning via localized forces has been studied extensively, suggesting their intimate link to the measured (macroscopic) hysteresis. Yet, how this qualitative knowledge could be cast into a quantitative, physics-based predictive model remained elusive. Our work achieves that by deriving ab initio a model which relies on physical and measurable parameters only, allowing its rigorous validation against experimental and analytical data. Accounting for the impact of the microstructure, our model presents a significant stride from compartment models which consider disorder statistically, such that for a given external pressure all pores which are thermodynamically available in terms of capillary thresholds are filled regardless of their location relative to the interface7,38. In contrast, our model includes the essential distinction between availability and accessibility. We anticipate that the fundamental disorder and capillary mechanisms uncovered in this article can be transferred to more complex porous and fractured media. This new understanding will provide a much needed step change in our ability to design and monitor energy production, water resources and environmental engineering operations.

Methods

Numerical model implementation

The numerical solution of Eq. (1) for a given configuration of pc(xy) is based on the minimization of the Hamiltonian, Eq. (2). Discretizing in space in the x direction, xk = kΔx, provides the following effective field (pressure imbalance) pe(x):

$${p}_{{{{\rm{e}}}}}({x}_{k})=\frac{\gamma \left({h}_{k+1}+{h}_{k-1}-2{h}_{k}\right)}{\Delta {x}^{2}}-\rho {g}_{{{{\rm{e}}}}}{h}_{k}+P+{p}_{{{{\rm{c}}}}}({x}_{k},{h}_{k}),$$
(3)

where we set h(xk) = hk. In imbibition (increasing h), after incrementing the external forcing P, the effective field is evaluated at all positions xk. At all the positions which are out-of-equilibrium, pe(xk) > ϵ, the interface height h(xk) is simultaneously updated—incremented by a constant δh. Note that in imbibition (drainage) pe is locally increased (decreased) when touching a positive defect, δb > 0, and decreased (increased) when touching a negative defect, δb < 0. Advancing the interface at the location of the defect decreases pe(xk). Due to surface tension (first term in Eq. (3)), this update affects neighboring interface positions, perturbing them away from equilibrium. Thus, when pe is again evaluated at all xk for the new interface configuration, the heights h(xk) are updated if pe(xk) > 0. These iterative search is repeated until equilibrium is met at all xk, pe(xk) < ϵ. For drainage, the procedure is identical however with opposite signs: The interface height is decreased synchronously by δh at every out-of-equilibrium position xk, repeatedly until equilibrated everywhere, pe(xk) > −ϵ. A pseudocode of the algorithm is provided as Supplementary Methods.

The discretization Δx, the accuracy ϵ, and the height increment δh need to satisfy the following criteria. First, we note that very “weak” defects (small δb) for which pc(xky) < ϵ are invisible to this algorithm. Furthermore, one needs to ensure that the iterative increments in the gravitational potential energy and surface tension terms are sufficiently small, ρgeδh ϵ and γδh/Δx2 < ϵ, respectively. This means that δh ϵ/ρge and Δx > (γδh/ϵ)1/2. At the same time, Δx must be smaller than \({\ell }_{{{{\rm{g}}}}}=\sqrt{\gamma /\rho {g}_{{{{\rm{e}}}}}}\) in order to resolve the interface curvature. Typically though, Δx will be smaller than the minimum defect width. If these conditions are not fulfilled, the effective field may accumulate negative (positive) values in imbibition (drainage). This in turn can lead to the following artifact: Upon reverting the flow direction and thus the equilibrium condition—from pe(x) < ϵ (imbibition) to pe(x) > −ϵ (drainage) and vice versa—the interface becomes immediately unstable and advances without changing the external forcing P. In all the simulations presented in this paper, we used steps of ΔH = 0.05 mm, numerical resolution of Δx = 0.1 mm and δh = 5 × 10−6 mm, and accuracy of ϵ = 0.01 Pa.

Experimental and numerical data for a single mesa defect

We perform an imbibition–drainage cycle by forcing oil in and out of a dry (air-filled) Hele–Shaw cell with a single mesa defect: a rectangular elevation of the bottom plate, locally reducing the gap thickness b0 by δb (Fig. 1). The cell is tilted at an angle α to avoid fingering instabilities. Interfacial instability in the form of viscous fingering is controlled by the sign of Bo−Ca, where Ca is the ratio of viscous to capillary forces39. Tilting the cell enforces Bo−Ca > 0, thus preventing fingering. The oil is forced in and out of the cell by raising and lowering an oil reservoir connected to the cell inlet (y = 0), which sets the pressure head H. The experiment in Fig. 2 is simulated with our model using the same conditions: w = 3 mm, \(\alpha ={2}^{o}21^{\prime}\) (ge = 0.4018 m s−2, \(\sin \alpha =0.0401\)), δb = 0.06 mm, b0 = 0.56 mm, considering perfect wettability of the oil (vanishing static contact angle θ). The numerical model results are in excellent agreement with the experimental data and the analytical solution (below), as demonstrated in Figs. 2, 5.

Fig. 5: Validation of the numerical algorithm.
figure 5

The maximum meniscus deformation ηc, cf. Eq. (6), is evaluated for 36 different settings, obtained by combinations of the following parameters: undisturbed gap thickness b0 [0.46, 0.56, 0.66] mm; sample tilt angle \(\alpha \in [{2}^{o}21^{\prime} ,{3}^{o}19^{\prime} ,{4}^{o}9^{\prime} ,{5}^{o}3^{\prime} ]\); and defect width w [3, 9, 27] mm (the different symbols highlight the latter). The data from the 36 cases is collapsed by its presentation in a non-dimensional form (some cases overlap), suggested by Eq. (6). The slope of the straight line is equal to \(\cos \theta\) (here \(\cos \theta =1\)). The excellent agreement between the simulated results (symbols) and the analytical, theoretical prediction (line) demonstrates our model accurate numerical implementation and convergence. It also predicts the corresponding experimental data, cf. Fig. 3 in ref. 21.

Analytical solution for a single mesa defect

In the following, we present analytical solutions for the interface height for a single mesa defect. For details of the derivations see Supplementary Note 3.

We consider a rectangular positive defect centered in x = 0, of width w and length (extending from y = d to y = d + ). The defect strength is denoted by \({a}_{0}={p}_{{{{\rm{c}}}}}^{0}\delta b/({b}_{0}-\delta b)\). For convenience, we define \({H}_{{{{\rm{e}}}}}=(H+{p}_{{{{\rm{c}}}}}^{0}/\rho g)/\sin \alpha\) and \(k=\rho {g}_{{{{\rm{e}}}}}/[1-\exp (-w/2{\ell }_{{{{\rm{g}}}}})]\), where \({\ell }_{{{{\rm{g}}}}}={(\gamma /\rho {g}_{{{{\rm{e}}}}})}^{1/2}\). During imbibition, while He < d the interface is flat and h(x) = He. After the meniscus touches the defect (Hed), capillarity sucks the interface into the defect and deforms it such that

$$h(x)={H}_{{{{\rm{e}}}}}+\frac{{a}_{{{{\rm{e}}}}}({H}_{{{{\rm{e}}}}})}{\rho {g}_{{{{\rm{e}}}}}}\exp (-| x| /{\ell }_{{{{\rm{g}}}}})\sinh (w/2{\ell }_{{{{\rm{g}}}}})$$
(4)

for x > w/2 and

$$h(x)={H}_{{{{\rm{e}}}}}+\frac{{a}_{{{{\rm{e}}}}}({H}_{{{{\rm{e}}}}})}{\rho {g}_{{{{\rm{e}}}}}}\left[1-\exp (-w/2{\ell }_{{{{\rm{g}}}}})\cosh (x/{\ell }_{{{{\rm{g}}}}})\right]$$
(5)

for x ≤ w/2. The effective defect strength ae(He) = a0 for He < d +  − a0/k and ae(He) = k(d +  − He) for d +  − a0/k < He < d + . For He ≥ d + , the interface straightens and leaves the defect. The maximum deformation ηc = h(x = 0) − He of the interface is given by

$${\eta }_{{{{\rm{c}}}}}= \frac{a_0}{\rho g_{{{\rm{e}}}}}[ 1 - {{{\rm{exp}}}}(-w/2l_{{{\rm{g}}}})].$$
(6)

During drainage (decreasing He), the interface height is described by Eqs. (4)–(5) as long as the defect is fully wet, i.e. \(H_{{{{\rm{e}}}}} > H_{{{{\rm{c}}}}} = d-a_0 [1 - {{{\rm{exp}}}}(-w/l_{{{\rm{g}}}})]/2\rho g_{{{{\rm{e}}}}}\). For He < Hc, the width w in Eqs. (4)–(5) is replaced by the effective width

$${w}_{{{{\rm{e}}}}}({H}_{{{{\rm{e}}}}})=-{\ell }_{{{{\rm{g}}}}}{{{\mathrm{ln}}}}\,\left(1-\left[1-\exp (-w/{\ell }_{{{{\rm{g}}}}})\right]\frac{d - H_{{{{\rm{e}}}}}}{d - H_{{{{\rm{c}}}}}}\right).$$
(7)

Equation (7) indicates that we would increase with decreasing He, which is not possible because it cannot exceed the physical width w. Therefore, the interface will snap-off at Hc.

Numerical data for disordered media

The simulations presented in the paper are using the following parameters: (a) material properties of γ = 20.7 mN m−1; g = 9.81 m s−2 and Δρ = ρ = 998 kg m−3 (considering oil and air as wetting and nonwetting fluids); (b) setup using b0 = 0.46 mm; \(\alpha ={2}^{o}21^{\prime}\); defects of size 4 × 4 units, randomly populated with occupancy ψ = 0.35; and incremental changes of external forcing ΔH = 0.05 mm; and (c) numerical resolution of Δx = 0.1 mm; δh = 5 × 10−6 mm; and ϵ = 0.01 Pa. Case-specific settings include: (i) Fig. 3: sample size of 1200 × 1200 units, with δpc drawn from a Gaussian distribution with standard deviation of \({\sigma }_{{p}_{c}}=11.7\) Pa centered around zero; (ii) Fig. 4a: 400 × 400 units (averaging over 15 realizations for each \({\sigma }_{{p}_{c}}\)); and (iii) Fig. 4b: 800 × 800 units.