StrataTrapper
Field scale model generation and upscaling toolkit
Install / Use
/learn @ImperialCollegeLondon/StrataTrapperREADME
Field scale model generation and upscaling toolkit
Repository: github.com/ImperialCollegeLondon/StrataTrapper
- The StrataTrapper codes
- Structure
- Running
- Output compression
- MEX acceleration
- Versions
- Contributing
- References

The StrataTrapper codes
This is the StrataTrapper upscaling toolkit. It can also generate heterogeneous fine-scale models with specific correlation lengths to re-upscale given coarse-scale two-phase flow models.
Another tool is the reduced-physics model CO2GraVISim.
In StrataTrapper-models
repository, we publish field-scale models upscaled with StrataTrapper.
Structure
Top-level scripts and functions are in the repository root,
and the rest is in src/ folder.
demo.m script is an implementation of the running guideline below.
Feel free to play with it and use as an example for your own scripts.
Running
- Run
startup.mto setup MATLAB Path.- Optional: start a parallel pool to run computations there.
- Read or generate target coarse grid dimensions and input fine-scale porosity and permeability for each coarse block.
- Setup input rock-fluid properties and algorithm options represented by
ParamsandOptionsclasses. Pass an array ofParamsfor multiple-region models. - Create integer
maskto:- filter out impermeable cells
and/or compute an arbitrary subset of cells by putting
0s - Put index
nof the input array ofParamsto map coarse cells to the corresponding regions
- filter out impermeable cells
and/or compute an arbitrary subset of cells by putting
- Run
strata_trapperfunction with arbitrary number of parallel workers optionally enabling a UI progress bar. - Visualise outputs with
plot_resultfunction - Export the outputs to PFLOTRAN-OGS
or OPM Flow format
using
ogs_exportoropm_exportfunction, respectively.
Tips:
- Usually, MATLAB runs
startup.mscripts automatically if they are in a startup folder. - The heaviest part of the algorithm is essentially parallel with no synchronisation. So, using several parallel workers usually results in a proportional performance boost.
Output compression
By default, strata_trapper outputs one set of saturation tables
per coarse cell per direction.
Such a number might be found too big in some situations.
With quantize,
toolkit can now compress the set of saturation tables
if they are similar enough or the acceptable approximation error is high.
Read compression README for more details.
MEX acceleration
We provide the CodeGenMex class to automatically build
a MEX-accelerated version of computationally-demanding functions
such as upscale.
% 1. compile MEX functions
codegen_mex = CodeGenMex().config().build();
% 2. use strata_trapper normally
...
% 3. recompile MEX functions when the source code changes
codegen_mex.build();
% 4. delete MEX functions to use the original
codegen_mex.clear();
Requires MATLAB Coder.
Versions
The original version of the toolkit is v0.1.0.
It has its own structure and some unique functionality,
so it may worth attention as much as later versions.
CHANGELOG.md describes the version history and key changes.
Other versions can be accessed via tags and releases sections of the repository.
Contributing
Everyone is welcome to open issues and pull requests.
References
The StrataTrapper algorithm as well as motivation and theory behind it are in the paper:
Samuel J. Jackson, Samuel Krevor
Small-Scale Capillary Heterogeneity Linked to Rapid Plume Migration During CO2 Storage
Geophysical Research Letters | 2020
https://doi.org/10.1029/2020GL088616
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
