compgen
Summary
compgen is a Python toolkit for generating simulation data for two phase composite materials. It will generate structures, invoke physics codes to simulate the response for a variety of material properties, and write summaries of the results.
Install
compgen requires Python 3.13 or newer.
- (Optional) Create and activate a virtual environment.
- Install the package:
pip install compgen- To use the reconstruction generator,
pip install compgen[mcrpy]. mcrpy depends on TensorFlow, which currently supports Python up to 3.13, so use Python 3.13 for this option. - To develop compgen, or to run the tests and demos, clone this repository and run
pip install -e .[dev,demos]from its root.
- Install the mesher and physics codes you want to use:
Inputs
compgen pipes together several steps to generate results:
- Generate a composite structure -- the distribution of two materials A and B over a periodic domain. We use pixelated fixed grids to define this distribution.
- Make an unstructured finite element mesh of the fixed grid representation, smoothing interfaces. This might involve first filtering the fixed grid representation, then calling a mesh generator.
- Setup input files for the physics codes describing the problem physics and boundary conditions.
- Actually run the physics code. This might require multiple calls, for example if we're interested in properties in different loading directions.
- Post process the output from the physics code into a common format. We use an HDF5 format.
compgen provides a simple API (runner.run) for doing all of this based on json input files. You need two input files to invoke the runner:
- A problem file defining the steps outlined above -- which structure generator, mesh, physics, solver, etc.
- A system file letting compgen know how to run external tools (meshers and physics codes).
There are examples of each file type to make up the 2D and 3D demos, described below.
Tests and demos
First set environment variables:
MOOSE_DIRto the root directory of your moose installationCUBIT_DIRto the root directory of your CUBIT directory, if you want to run the demos using sculpt. This is not necessary for the verification tests.
Run the tests
Run the tests with pytest. The general tests in the tests directory do not require MOOSE and are quick and cheap to run. The verification tests in tests/verification are more expensive and require MOOSE.
Run the demos
There are complete demos that generate random structures, call MOOSE to solve for some material properties, and store the results. These demos live in demos/complete. The subdirectories first split
the problems into different physics/types of material properties and then into 2D and 3D examples.
License headers
Every source file (*.py and the MOOSE *.i templates) must start with the contents of LICENSE as a comment header. CI enforces this.
python scripts/add_license.pyadds the header to any tracked source file that is missing it (or pass specific files as arguments).python scripts/check_license.pyreports files missing the header and exits non-zero if there are any.
Pre-commit hooks
The license check, black, and pylint run as pre-commit hooks on the files staged for each commit. To enable them, install the dev dependencies and then install the hooks once per clone:
pip install -e .[dev]
pre-commit install
To run the hooks by hand against every file, use pre-commit run --all-files.
Metadata
Release files for compgen 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| compgen-0.1.0.tar.gz | 40.1 kB | With provenance | Details for compgen-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| compgen-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for compgen-0.1.0-py3-none-any.whl |
Total release size: 103.8 kB
Release files / compgen-0.1.0.tar.gz
| Download URL | compgen-0.1.0.tar.gz |
|---|---|
| Size | 40.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
025ed69120bffd4bc8e1758bdb7091e5e6058b59c1492543d6c1f4e7e54c690c
|
|
BLAKE2b-256 checksum How to use checksums |
5d3878c6535c1697aa963e393b2c7e61a7b2abc1115301622ae83b7bbe9f29bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 6, 2026.
Transparency logRelease files / compgen-0.1.0-py3-none-any.whl
| Download URL | compgen-0.1.0-py3-none-any.whl |
|---|---|
| Size | 63.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
776c20e76d3f5f545515d95b2791f21dae5e9790b2d5bb0359bfb2333b39c477
|
|
BLAKE2b-256 checksum How to use checksums |
dcbcc36a81837f760f1085403abe38627cd8a9e657f9b7b0d7dbf1ab35d7d027
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 6, 2026.
Transparency logSecurity for compgen 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for compgen-0.1.0.tar.gz
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 Nov 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.