Skip to main content

Simulação de escoamento multifásico permanente e transiente.

Project description

drawing


Marlim3 is a 1D multiphase flow simulator developed by Petrobras.

Core capabilities (steady-state and transient)

  • Production wells
  • Injection wells: Water or gas injection wells, both single-phase and multiphase
  • Networks
    • Production networks
    • Injection networks
    • Gas lift loops
  • Artificial Lift models: gas lift valves, pumps

Advanced modeling

  • Natural convection: 2D solutions for natural convection analysis in confined spaces (single-phase or two-phase), such as pipeline cross-sections during production shutdowns
  • Compositional fluid model library
  • Near wellbore model: radial and 2D models to consider phenomena such as water coning
  • Thermal diffusion: 2D and 3D coupled to the 1D flow model

Installation

Option 1: Install via pip

Install Marlim3 as a Python package:

pip install marlim3

Option 2: Use the executable directly

You can download the Marlim3 executable for Linux, Windows or Mac from the Releases section on GitHub. This standalone executable allows you to run simulations directly from the terminal, without the need to install the Python package. Detailed instructions are provided below.

Option 3: Developer setup (uv)

For development, use uv to manage the Python environment and dependencies.

Step 1 — Install dependencies and the Python package:

uv sync --locked --group dev

This creates a .venv with Python 3.12+, installs all dev tools (pytest, flake8, jupyter, etc.), and installs marlim3 in editable mode. After this step you can already use import marlim3 in your scripts:

uv run python -c "import marlim3; print(marlim3.__version__)"

Step 2 — Build and register the C++/Fortran executable (required to run simulations):

See Compilation below. After building, copy build/Marlim3 to marlim3/ and run:

MARLIM3_SKIP_BUILD=1 uv sync --locked

MARLIM3_SKIP_BUILD=1 skips local CMake compilation. Set MARLIM3_SKIP_EXECUTABLE_RESOLUTION=1 only when an import must not resolve or download the executable.

Usage

Option 1: Python Package

Use Marlim3 as a Python library in your scripts:

import marlim3

# Your simulation code here
# Example: configure and run simulations programmatically

For examples, refer to the tutorials available in the docs folder.

Option 2: Command-Line Executable

Run Marlim3 directly from the terminal using the compiled executable available in the Releases section on GitHub.

Available Commands

There are four simulation types available:

1. Simple Production System

./executable_name -d directory_name -i input_file

2. Simple Injection System

./executable_name -d directory_name -i input_file -s INJETOR

3. Flow Network

./executable_name -d directory_name -i input_file -s REDE

4. Natural Convection in Cross-Section

./executable_name -d directory_name -i input_file -s CONVECNAT

Command-Line Arguments

  • -d directory_name: Output directory for simulation results
  • -i input_file: Input file name (JSON format)
  • -s SIMULATION_TYPE: Simulation type (INJETOR, REDE, or CONVECNAT)

Platform-Specific Notes

Linux/macOS:

./Marlim3 -d ./output -i simulation.json -s REDE

Windows:

Marlim3.exe -d .\output -i simulation.json -s REDE

Tip: To export results to the current working directory, use ./ (Linux/macOS) or .\ (Windows) as the directory name.

Compilation

Compilation is only necessary if you need to rebuild the executable from source.

Requirements

  • GCC/G++ >= 9.0
  • GFortran >= 9.0
  • CMake >= 3.16

Build the executable

The project uses CMake presets. Available presets:

Preset Platform Description
gcc-release / gcc-debug Linux / macOS GCC portable build with GNU runtime linking configured by CMake
mingw-release / mingw-debug Windows MinGW portable build with full static linking
clang-release / clang-debug Linux / macOS Clang 20 + GFortran portable build

Release assets are built and tested for Linux x64, Windows x64, and macOS ARM64. Linux, Windows, and macOS ARM64 release executables are built so end users do not need GCC runtime libraries installed.

Linux

cmake --preset gcc-release
cmake --build --preset gcc-release -j$(nproc)

MacOS - Apple

On macOS, install Homebrew GCC and CMake before building locally:

brew install gcc cmake
cmake --preset gcc-release
cmake --build --preset gcc-release -j$(sysctl -n hw.ncpu)

Windows (MSYS2 / MinGW64)

Ensure g++ and gfortran are in your PATH (e.g., via MSYS2 with the mingw-w64-x86_64-gcc and mingw-w64-x86_64-gcc-fortran packages).

cmake --preset mingw-release
cmake --build --preset mingw-release -j%NUMBER_OF_PROCESSORS%

The resulting build/Marlim3.exe is fully statically linked and does not require external DLLs.

The compiled executable is placed at build/Marlim3.

To use it with the Python package, copy it to the marlim3/ directory:

cp build/Marlim3 marlim3/

Then activate the package locally (skipping recompilation):

MARLIM3_SKIP_BUILD=1 uv sync --locked

MARLIM3_SKIP_BUILD=1 skips local CMake compilation; installed packages can still download the release executable on import.

Run tests

uv run pytest tests/ -v

Run the GUI

uv sync --group gui
uv run streamlit run gui/app.py

The GUI auto-detects the executable from build/Marlim3.

Note

Several resources and portions of the source code are currently written in Portuguese. We plan to gradually translate all content into English.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marlim3-3.6.5.tar.gz (80.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marlim3-3.6.5-py3-none-any.whl (77.0 kB view details)

Uploaded Python 3

File details

Details for the file marlim3-3.6.5.tar.gz.

File metadata

  • Download URL: marlim3-3.6.5.tar.gz
  • Upload date:
  • Size: 80.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for marlim3-3.6.5.tar.gz
Algorithm Hash digest
SHA256 637552e359a581d105148c5827221018d44254690c34faaace6a178fff52c715
MD5 70f0055c0edf64bd67e3bc3b2217b86b
BLAKE2b-256 5253556aa9b24f95bfc88cf2245921b5121522eb5364a8adde809fd5a06d5847

See more details on using hashes here.

File details

Details for the file marlim3-3.6.5-py3-none-any.whl.

File metadata

  • Download URL: marlim3-3.6.5-py3-none-any.whl
  • Upload date:
  • Size: 77.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for marlim3-3.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7a4030213cd785e956be76e86426a8fb01ff6e370473f2d334eca1e2264dd988
MD5 0d79e66467896b06160f1d44edf6d3c4
BLAKE2b-256 1c982a052b1e7b0ab1373a3e0a2f94a96a058554b95208cb936d16396e1eb067

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page