This repository presents a Maple-based statistical workflow for modelling pressure–depth relationships across six wells and estimating pressure gradients within reservoir intervals. It demonstrates model formulation, ordinary and weighted least-squares regression, residual diagnostics, reservoir-effect testing, and multiwell comparison.
Project status: The individual-well analyses and combined candidate Models A–E have been implemented. Final model comparison and manuscript reporting are being refined.
- Statistical modelling and scientific programming in Maple.
- Construction and interpretation of indicator and interaction terms.
- Ordinary least squares, weighted least squares, and variance modelling.
- Regression diagnostics and evidence-based model selection.
- Analytical derivation of reservoir-specific pressure gradients.
- Organisation and documentation of a traceable, version-controlled multiwell workflow.
Pressure generally changes with depth, but the relationship may vary between wells and between reservoir and non-reservoir intervals. A single untested linear equation can conceal these differences and may also produce unreliable uncertainty estimates when the residual variance is not constant.
This project therefore develops and diagnoses a pressure–depth model for each well before comparing the wells in a combined framework. The fitted pressure gradient is subsequently used as an input to a fluid-flow formulation.
- Quantify the pressure–depth relationship for each well.
- Test whether reservoir intervals have a different pressure level or gradient.
- Diagnose nonlinearity, non-normal residuals, and non-constant residual variance.
- Use weighted least squares where ordinary least squares is inadequate.
- Derive pressure-gradient expressions from the selected regression models.
- Compare shared and well-specific pressure–depth behaviour across all six wells.
Each well contains observations of:
- depth, expressed as true vertical depth subsea (TVDSS);
- pressure;
- fluid or interval classification; and
- reservoir membership.
The number and depth distribution of observations differ between wells. Reservoir membership is represented by an indicator:
Depth is centred separately within each well:
Here,
The main candidate model is
where:
-
$P_j$ is the observed pressure; -
$a_0$ is the reference pressure for a non-reservoir observation at the centred depth; -
$b_D$ is the non-reservoir pressure gradient; -
$b_R$ represents a reservoir-associated pressure offset; -
$b_{DR}$ represents the change in gradient associated with a reservoir interval; and -
$\varepsilon_j$ is the unexplained residual error.
The resulting pressure-gradient equations are
and
The interaction term is interpreted and retained only when it is supported by the data and the model diagnostics.
- Import and verify the pressure, depth, and reservoir variables.
- Centre depth using the mean depth of the relevant well.
- Fit the initial ordinary least-squares model.
- Inspect residuals against fitted values, centred depth, and reservoir class.
- Examine the residual Q–Q plot and Shapiro–Wilk result as supporting diagnostics.
- Compare reasonable alternatives, including log-pressure, quadratic-depth, and weighted least-squares models.
- Select the simplest scientifically meaningful model that adequately addresses the observed residual pattern.
- Derive the pressure gradient from the full-precision fitted coefficients.
- Separate regression workflows have been completed for all six wells.
- Ordinary least-squares diagnostics revealed non-constant residual spread in several of the individual-well models.
- Weighted least squares produced a more uniform residual pattern where heteroscedasticity was present and was therefore selected for those wells.
- Reservoir–depth interactions were evaluated rather than assumed automatically; unsupported terms were not interpreted as established physical effects.
- Final pressure-gradient expressions are derived from the selected models using the full-precision Maple estimates, rather than coefficients rounded for presentation.
- The combined analysis is evaluating whether a common multiwell trend is adequate or whether well-specific slopes and curvature are required.
These findings are methodological summaries. Numerical coefficients and inferential results are retained in the working Maple outputs and will be summarised in the public-facing documentation after publication.
The combined stage focuses on reservoir observations. Let
| Model | Maple basis terms | Interpretation |
|---|---|---|
| A | Each well has its own reference pressure, while all wells share one linear pressure–depth gradient. | |
| B | Model A |
Each well has its own reference pressure, while all wells share one linear gradient and one quadratic curvature. |
| C | Model B |
Each well has its own reference pressure and quadratic curvature, while the linear gradient remains common. |
| D | Model B |
Each well has its own reference pressure and linear gradient, while the quadratic curvature remains common. |
| E | Model D |
Each well has its own reference pressure, linear gradient, and quadratic curvature. |
Models D and E therefore distinguish two scientifically different possibilities. Model D permits well-specific pressure gradients but constrains the wells to share a common curve. Model E relaxes that final constraint and permits each well to have its own curve.
The models do not form a single unbranched sequence. Model A is nested within Model B; Model B is nested within both Models C and D; and Models C and D are each nested within Model E. Nested-model and partial
multiwell-pressure-depth-regression/
├── README.md
├── maple-code/
│ ├── 01_individual_well_models.mpl
│ └── 02_combined_well_model.mpl
└── worksheets/
├── 01_individual_well_models.mw
└── 02_combined_well_model.mw
.mwfiles retain the complete Maple worksheets, including formatted mathematics, outputs, and plots..mplfiles provide text-based Maple source code that can be reviewed and compared directly on GitHub.01_individual_well_modelscontains the separate modelling and diagnostic workflow for the six wells.02_combined_well_modelcontains the combined Models A–E and their comparison.
- Maple for data handling, regression, diagnostics, symbolic expressions, and visualisation.
- Git and GitHub for version control, documentation, and transparent research development.
- Download or clone the repository.
- Open
worksheets/01_individual_well_models.mwin Maple to view the six individual-well analyses. - Open
worksheets/02_combined_well_model.mwto view the combined Models A–E and their comparison. - Review the corresponding files in
maple-code/to inspect the analysis commands as plain text. - Where an authorised dataset is required, configure the data path locally before executing the analysis.
An .mpl script can be read from an active Maple session after the correct working directory and data paths have been configured:
read "maple-code/01_individual_well_models.mpl";
read "maple-code/02_combined_well_model.mpl";
This analysis is being prepared for academic publication. Publication figures, final comparison tables, and final numerical results are intentionally excluded from the public-facing documentation at this stage. They will be added after publication, together with the article citation and the persistent identifier for the archived code release.
The exact Maple version and final execution requirements will also be recorded with the publication release.
The original well data are not distributed with this repository because their use may be governed by data-owner or licensing restrictions. Public files should use anonymised well labels and must not contain restricted coordinates, identifiers, raw measurements, or other proprietary information.
The repository is intended to demonstrate the modelling workflow. Any example data added later should be synthetic, anonymised, or explicitly authorised for redistribution.
Before any pre-publication public release, the .mw and .mpl files must be checked for embedded data, numerical outputs, and other unpublished or restricted information. The working repository should remain private unless a sanitised release has been approved under the relevant journal and data-owner requirements.
The full article citation, software citation, and repository DOI will be added after publication.
Dr Iwa Abiola Akanni
Physicist and researcher working in geophysics, fluid flow in porous media, and applied statistical modelling.
GitHub: REBELABS