Simulations of fluid moving through deforming rock are only trustworthy if the code carries the two-way feedback the physics requires. Pore pressure changes the stress on the rock skeleton. The resulting deformation changes porosity and permeability. Those changes then reshape the pressure field on the next step. These simulators are usually written in two or more languages: a Python or JVM driver handles orchestration and optimization loops, and C, C++ or Fortran kernels handle the matrices. The pressure, stress and permeability arrays cross that language boundary on every step. A small mistake at the crossing can quietly turn a two-way coupled model into a one-way one without crashing anything. Examples include passing a copy instead of a view, updating permeability in native code after the flow matrix has already been assembled, or flipping the sign convention for compressive stress. The output still looks smooth and plausible. It is simply the wrong physics.
We propose a static analyzer, meaning a tool that reasons about the source code without running it. It builds one data-flow graph spanning the managed driver and the native kernels, labels the arrays with their physical roles, and checks two properties. The first is that the pressure → stress → strain → permeability → pressure cycle exists as a dependency carried from one time step to the next. The second is that every array crossing the language boundary agrees on dimension, sign convention, grid location and memory layout. The bet is that a "coupling completeness" check of this kind catches a class of silent errors that existing cross-language analyzers do not look for and that standard verification problems only catch for the configurations they happen to run.
Why this matters, and what is missing
The physics literature says plainly that one-way coupling gives qualitatively wrong answers, not just slightly less accurate ones. Pressure-Stress Coupling: Connotation and Denotation reviews pressure–stress coupling across basins and fields. It reports that coupling intensity decides whether rock fails in tension or in shear. It reports a coupling ratio window of 0.5 to 0.65 that suppressed fault activation during CO2 injection in the St. Lawrence Basin. It names software integration of bidirectional feedback laws as an open challenge, though it proposes no code-level remedy. Study on the deformation mechanism of abutment slope and its influence on the dam during the impoundment of high arch dam attributes valley contraction to fluid diffusing into abutment fissures, which a decoupled model would not reproduce.
The stakes also compound under optimization. The optimal grouting area and cable distribution design for guaranteeing roadway stability while considering fluid mechanical effects via the CMOEAD algorithm wraps a Biot–Darcy FLAC3D model in an evolutionary optimizer and reports driving water inflow from 113 to 0.19 m³/h against a 0.2 m³/h safety threshold. That margin is only meaningful if every one of the many simulator calls carried the feedback correctly. These papers motivate the proposal. They show that a broken loop changes conclusions that matter for safety.
On the software side, a set of cross-language analyzers shows that treating the language boundary as an opaque box hides real defects. ReuNify lifts React Native JavaScript into Soot's intermediate form and finds 70% more code and an 84% larger call graph than single-language analysis. IAceFinder joins Java and LLVM-bitcode analysis across the Java Native Interface (Java's mechanism for calling C/C++) to find 23 access-control inconsistencies. JGREAnalyzer pairs libclang with Soot to find reference-table exhaustion bugs. Bilingual Problems builds cross-language data-flow graphs for Node.js native extensions and finds that 30% of packages with flows to type-conversion APIs lack sufficient type checks. CPSMELL detects structural smells across Python/C bindings in deep learning frameworks with 98.17% validated accuracy.
These works supply our method: binding resolution, joint Python/C++ parsing, and cross-language data-flow graphs. Their targets, however, are security policies, type confusion, resource leaks and code structure. None asks whether a data-flow cycle that the domain requires is actually present. None attaches physical meaning to the values that cross the boundary. Exploring Multi-Programming-Language Commits adds that commits touching several languages are more defect-prone, which suggests the boundary is where these simulators are likely to break.
One prior result constrains the design directly. A Sound Flow-Sensitive Heap Abstraction for the Static Analysis of Android Applications shows that flow-insensitive analysis gives far more false alarms: FlowDroid reaches 0.58 specificity against 0.79 for flow-sensitive fsHornDroid at recall 1.0 on DroidBench. Flow-sensitive analysis respects the order of statements; flow-insensitive analysis treats all writes as if they could happen anywhere. The same paper also states that its heap model does not extend into native code.
That limitation is exactly our problem. A flow-insensitive analyzer sees that native code writes the permeability array and concludes the loop is closed. It cannot tell whether the write happens before or after the flow matrix is assembled, or whether it lands on the buffer the driver actually reads.
Core Claim
A cross-language analysis has two key ingredients. The first is order-aware dependencies carried across loop iterations through native in-place writes. The second is a small vocabulary of physical-role tags: pressure, effective stress, volumetric strain, porosity, permeability, and the Biot coefficient. Together, these ingredients can detect coupling-breaking defects in poroelastic simulators that pass standard verification problems in their default configuration. Neither ingredient alone is enough. Without flow sensitivity, broken loops look closed. Without physical tags, the analysis reduces to generic taint tracking, which marks every array as reachable from every other and gives no meaningful cycle check.
Research Program
The analyzer has three layers. The first layer builds a joint graph over Python driver code and C/C++ kernels, linked through Python/C API, pybind11 and ctypes bindings. It uses the parsing approach of CPSMELL for binding resolution and libclang-based native call graphs in the style of JGREAnalyzer. Fortran kernels are a stretch goal.
The second layer adds a small, user-supplied specification of a few dozen lines. It names which variables or function arguments carry which physical role, along with the units, the sign convention (whether compression is positive), the grid location (cell centers or nodes) and the memory order. These tags propagate through arithmetic and copies, and pointer aliases into native buffers are resolved with a points-to analysis, i.e., an analysis of which pointers can refer to the same memory.
The third layer runs two checks inside each recognized time-stepping or nonlinear-iteration loop. The cycle check requires a chain of dependencies from the pressure at step $n$ to the pressure at step $n+1$ that passes through, in order, effective stress, volumetric strain, porosity or permeability, and the assembled flow operator. Each link must be a definite write that occurs before the next read in program order, on the same memory object. The contract check compares tags on both sides of every boundary crossing and flags mismatches. Typical examples are a pressure array in pascals passed to a kernel expecting megapascals, or a tension-positive stress passed to a compression-positive constitutive law.
The research question is whether native in-place updates can be handled precisely enough at reasonable cost. We will reuse the recency idea from fsHornDroid on the managed side, which allows the analysis to overwrite a value it knows was just replaced (a "strong update"). On the native side, we will treat buffers allocated once and reused across iterations as single objects that permit such overwrites. That assumption is common in solver kernels, and we will state it explicitly where it is unsound.
Baselines
The naive reference point is what the field does today: run the simulator's own verification suite on the classical analytical poroelastic problems, Terzaghi consolidation and Mandel's problem. Mandel's problem is a strong test because its transient pressure overshoot appears only with genuine two-way coupling. We will run the suite in each code's default configuration and count a defect as caught when the error against the analytical solution exceeds the tolerance the code's own tests use.
The strongest dynamic competitor is hybrid call-path tracing in the style of PieProf. PieProf joins native and Python stack frames at runtime, and we adapt it to record actual reads and writes of the tagged arrays. We then check the same cycle property on the observed trace. It gets the same physical-tag specification and the same wall-clock budget as our static analysis, spent running the example inputs shipped with each code.
The strongest static competitor is a single-language analysis that stubs native calls conservatively, as FlowDroid does. It is paired with the structural smell checks of CPSMELL.
Two ablations isolate our ingredients. One replaces order-aware native modeling with a flow-insensitive version. The other drops the physical tags in favor of untyped taint. No reported result was found on Lacuna for static or dynamic analysis of coupled multiphysics solvers. The only comparable published figures concern other domains, such as fsHornDroid's 0.79 versus FlowDroid's 0.58 specificity and CPSMELL's 98.17% accuracy, so absolute numbers will not transfer.
We count it as beating the baselines if three things hold. The analyzer must detect a clear majority of injected coupling defects that the verification suite misses. It must do so at no more than a handful of false alarms per code base, a target we set rather than borrow from prior work. And the flow-insensitive ablation must show markedly lower precision.
Why not just…?
Why not just run Mandel's and Terzaghi's problems? This is the most serious competitor, and for defects on the default code path it may well match us. Its weakness is coverage. Analytical problems exercise one material model, one boundary-condition set and one solver option, while bugs often sit in the permeability law or the option branch that the test does not take. The experiment settles this directly by reporting, for every mutant, whether the analytical suite, our analyzer, or both catch it. If the suite catches nearly everything we catch, the static tool is not worth its cost, and we will say so.
Why not just trace at runtime instead of analyzing statically? Dynamic tracing has no false paths and is cheaper to build, so it is a real threat. Like the analytical tests, it only sees the configurations it executes. The static tools in the file show the general pattern: JGREAnalyzer scanned an entire Android release in under 15 minutes, and IAceFinder used static reachability to direct the dynamic work it needed. The configuration-stratified comparison below measures how much tracing misses. If tracing on shipped examples matches our recall, we will instead propose static analysis only as a way to choose which configurations to trace.
Why not just use a units library in the Python driver? Unit-tracking libraries catch dimension errors that stay inside Python. They lose all information at the native call, which is the black-box gap that ReuNify and Bilingual Problems document. They also say nothing about whether the feedback cycle exists. The tag-free ablation and the stub baseline together measure what is lost when we stop at the boundary.
Why not just use a monolithic commercial solver and trust it? Codes like FLAC3D used in the CMOEAD study cannot be analyzed in this way. The CMOEAD study also shows that users wrap such solvers in their own scripting and optimization loops, and those wrappers can still break the coupling. We will analyze user-written driver layers where the source is available.
Proposed Experiments
No existing benchmark targets this question, so building one is part of the contribution. We will select several open-source poroelastic codes that have a Python front end and C/C++ kernels. Into each we will inject coupling-breaking mutants of six kinds:
- hoisting the permeability update out of the time loop;
- passing a copied array where a shared view is expected;
- reordering native writes so they occur after operator assembly;
- flipping stress sign conventions;
- applying the Biot coefficient twice or not at all;
- swapping cell-centered and node-centered pressure, or row-major and column-major layout.
We will also seed contract-preserving mutations that should not be flagged, to measure false alarms.
As a second, smaller set, we will mine past bug-fix commits in those projects that touch both languages and mention coupling. Real defects in this set count more than injected ones.
The metrics are:
- recall on mutants, split by mutant kind;
- false alarms on unmutated code and on the harmless mutants;
- analysis time;
- for every mutant, the physical consequence, measured as the deviation from the analytical Mandel solution and as whether the predicted failure mode flips between tensile and shear. This links each software defect to the consequence the Pressure-Stress Coupling review identifies.
The decisive check is the configuration-stratified comparison: what fraction of mutants that only change behavior on non-default options or material laws are caught by our static analysis, by runtime tracing, and by the analytical suite. The proposal's central claim stands or falls on that fraction, together with a clear precision gap between our analyzer and the flow-insensitive ablation.
References
- Pressure-Stress Coupling: Connotation and Denotation
- Study on the deformation mechanism of abutment slope and its influence on the dam during the impoundment of high arch dam
- The optimal grouting area and cable distribution design for guaranteeing roadway stability while considering fluid mechanical effects via the CMOEAD algorithm
- ReuNify: A Step Towards Whole Program Analysis for React Native Android Apps
- Uncovering Cross-Context Inconsistent Access Control Enforcement in Android
- JNI Global References Are Still Vulnerable: Attacks and Defenses
- Bilingual Problems: Studying the Security Risks Incurred by Native Extensions in Scripting Languages
- Automated detection of inter-language design smells in multi-language deep learning frameworks
- Exploring multi-programming-language commits and their impacts on software quality: An empirical study on Apache projects
- A Sound Flow-Sensitive Heap Abstraction for the Static Analysis of Android Applications
- Toward Efficient Interactions between Python and Native Libraries