Skip to content

Simulators

The voids.simulators sub-package provides ready-to-run simulation entry points that wire together extraction, solving, and reporting into complete pipelines.


Single-Phase Flow Simulator

voids.simulators.run_singlephase

main

main()

Run the canonical single-phase demonstration workflow and print JSON.

Notes

The workflow builds the default linear-chain example, solves steady single-phase flow along the x-direction, and prints a compact JSON summary containing total flow rate, permeability, residual norm, mass-balance error, and pore pressures.

Source code in src/voids/simulators/run_singlephase.py
def main() -> None:
    """Run the canonical single-phase demonstration workflow and print JSON.

    Notes
    -----
    The workflow builds the default linear-chain example, solves steady
    single-phase flow along the x-direction, and prints a compact JSON summary
    containing total flow rate, permeability, residual norm, mass-balance error,
    and pore pressures.
    """

    net = make_linear_chain_network()
    result = solve(
        net,
        fluid=FluidSinglePhase(viscosity=1.0),
        bc=PressureBC("inlet_xmin", "outlet_xmax", pin=1.0, pout=0.0),
        axis="x",
    )
    summary = {
        "Q": result.total_flow_rate,
        "Kx": result.permeability["x"] if result.permeability else None,
        "residual_norm": result.residual_norm,
        "mass_balance_error": result.mass_balance_error,
        "p": result.pore_pressure.tolist(),
    }
    print(json.dumps(summary, indent=2))