Skip to main content

Xcompact3d Toolbox

  • QA: CI CodeQL pre-commit.ci status Quality Gate Status Coverage
  • Docs: Docs badge badge
  • Package: PyPI - Version PyPI - Python Version PyPI - Downloads
  • Meta: Wizard Template Checked with mypy Hatch project Ruff PyPI - License EffVer Versioning

Overview

It is a Python package designed to handle the pre and postprocessing of the high-order Navier-Stokes solver XCompact3d. It aims to help users and code developers to build case-specific solutions with a set of tools and automated processes.

The physical and computational parameters are built on top of traitlets, a framework that lets Python classes have attributes with type checking, dynamically calculated default values, and ‘on change’ callbacks. In addition to ipywidgets for an user friendly interface.

Data structure is provided by xarray (see Why xarray?), that introduces labels in the form of dimensions, coordinates and attributes on top of raw NumPy-like arrays, which allows for a more intuitive, more concise, and less error-prone developer experience. It integrates tightly with dask for parallel computing and hvplot for interactive data visualization.

Finally, Xcompact3d-toolbox is fully integrated with the new Sandbox Flow Configuration. The idea is to easily provide everything that XCompact3d needs from a Jupyter Notebook, like initial conditions, solid geometry, boundary conditions, and the parameters. It makes life easier for beginners, that can run any new flow configuration without worrying about Fortran and 2decomp. For developers, it works as a rapid prototyping tool, to test concepts and then compare results to validate any future Fortran implementation.

Installation

It is possible to install using pip:

pip install xcompact3d-toolbox

There are other dependency sets for extra functionality:

pip install xcompact3d-toolbox[visu] # interactive visualization with hvplot and others

To install from source, clone de repository:

git clone https://github.com/fschuch/xcompact3d_toolbox.git

And then install it interactively with pip:

cd xcompact3d_toolbox
pip install -e .

You can install additional dependencies as well:

pip install -e .[visu]

Now, any change you make at the source code will be available at your local installation, with no need to reinstall the package every time.

Examples

  • Importing the package:

    import xcompact3d_toolbox as x3d
    
  • Loading the parameters file (both .i3d and .prm are supported, see #7) from the disc:

    prm = x3d.Parameters(loadfile="input.i3d")
    prm = x3d.Parameters(loadfile="incompact3d.prm")
    
  • Specifying how the binary fields from your simulations are named, for instance:

  • If the simulated fields are named like ux-000.bin:

    prm.dataset.filename_properties.set(
       separator = "-",
       file_extension = ".bin",
       number_of_digits = 3
    )
    
  • If the simulated fields are named like ux0000:

    prm.dataset.filename_properties.set(
       separator = "",
       file_extension = "",
       number_of_digits = 4
    )
    
  • There are many ways to load the arrays produced by your numerical simulation, so you can choose what best suits your post-processing application. All arrays are wrapped into xarray objects, with many useful methods for indexing, comparisons, reshaping and reorganizing, computations and plotting. See the examples:

  • Load one array from the disc:

    ux = prm.dataset.load_array("ux-0000.bin")
    
  • Load the entire time series for a given variable:

    ux = prm.dataset["ux"]
    
  • Load all variables from a given snapshot:

    snapshot = prm.dataset[10]
    
  • Loop through all snapshots, loading them one by one:

    for ds in prm.dataset:
       # compute something
       vort = ds.uy.x3d.first_derivative("x") - ds.ux.x3d.first_derivative("y")
       # write the results to the disc
       prm.dataset.write(data = vort, file_prefix = "w3")
    
  • Or simply load all snapshots at once (if you have enough memory):

    ds = prm.dataset[:]
    
  • It is possible to produce a new xdmf file, so all data can be visualized on any external tool:

  • Loop through all snapshots, loading them one by one:

  • User interface for the parameters with IPywidgets:

    ds = prm.dataset[:]
    
  • It is possible to produce a new xdmf file, so all data can be visualized on any external tool:

    prm.dataset.write_xdmf()
    
  • User interface for the parameters with IPywidgets:

    prm = x3d.ParametersGui()
    prm
    

    An animation showing the graphical user interface in action

© 2020 Felipe N. Schuch. All content is under MIT License. This project was previously distributed under the GPL-3.0 License and has since been relicensed under the MIT License.

Metadata

Release files for xcompact3d-toolbox 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xcompact3d-toolbox 1.5.0
File Size Uploaded
xcompact3d_toolbox-1.5.0.tar.gz 417.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xcompact3d-toolbox 1.5.0
File Interpreter ABI Platform
xcompact3d_toolbox-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 485.8 kB

Release files / xcompact3d_toolbox-1.5.0.tar.gz

Download URL xcompact3d_toolbox-1.5.0.tar.gz
Size 417.3 kB
Tags Source
SHA-256 checksum
How to use checksums
219b942912006c18ec73c56b42dd33393d622c0dfcf19107d246c8dac5fa57e2
BLAKE2b-256 checksum
How to use checksums
8ac97fef2888860e15247549b4bf6481bd1e14803c0881b88e48eb309822384e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / xcompact3d_toolbox-1.5.0-py3-none-any.whl

Download URL xcompact3d_toolbox-1.5.0-py3-none-any.whl
Size 68.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45095c4cfcf84adcb4a272ddad9c8fc2164cd39c5cbc0226a8833c8e051504c2
BLAKE2b-256 checksum
How to use checksums
67052b15f5a699335250d60a42aadba87147bc5a3187f749ab329167e0ec705b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page