Generates File and Folder Structure, including all of the necessary files to quickly kickstart a simulation
Project description
precice-generator
Project Overview
The preCICE case-generate package is a Python-based utility designed to automate the generation of preCICE configuration files from simple YAML topology descriptions. This tool simplifies the process of setting up multi-physics simulations by transforming user-defined YAML configurations into preCICE-compatible XML configuration files.
Key Features
- Automated preCICE configuration generation
- YAML-based input parsing
- Flexible topology description support
- Comprehensive error logging and handling
- Simple command-line interface
Installation
Prerequisites
- Python 3.9 or higher (workflow validated with 3.9, 3.10, 3.11 and 3.12)
- pip
- venv
- (preCICE library)
Manual Installation
- Clone the repository
git clone https://github.com/precice/case-generate.git
cd precice-generator
- Create a virtual environment
# On Unix/macOS
python -m venv venv
source venv/bin/activate
# On Windows
python -m venv venv
.\venv\Scripts\activate
- Install the project
# Upgrade pip and install build tools
python -m pip install --upgrade pip
pip install build
# Install the project in editable mode
pip install -e .
Using Setup Scripts
Unix/macOS
./setup_scripts/install_dependencies.sh
Windows
.\setup_scripts\install_dependencies.ps1
Verifying Installation
- Test the CLI tool
precice-case-generate --help
Usage
Command-Line Interface
Generate a preCICE configuration file from a YAML topology called topology.yaml:
precice-case-generate
or pass a topology file via argument;
precice-case-generate -f path/to/your/topology.yaml
The precice-case-generate tool supports the following optional parameters:
-
-f, --input-file: Path to the input topology.yaml file.- Default:
./topology.yaml - Description: Specify a custom topology file for configuration generation.
- Default:
-
-o, --output-path: Destination path for the generated folder.- Default:
./_generated/ - Description: Choose a specific output location for generated files.
- Default:
-
-v, --verbose: Enable verbose logging.- Default: Disabled
- Description: Provides detailed logging information during execution.
-
--validate-topology: Validate the input topology.yaml against the preCICE topology schema.- Default: Enabled
- Description: Ensures the topology file meets the required schema specifications.
Example usage:
precice-case-generate -f custom_topology.yaml -o /path/to/output -v
[!NOTE] You should validate your files by running them through precice-tools and the preCICE config-checker to avoid errors.
Configuration
- Prepare a YAML topology file describing your multi-physics simulation setup.
- Use the command-line interface to generate the preCICE configuration.
- The tool will create the necessary configuration files in the
_generated/directory.
Creating Topology with MetaConfigurator
You can create a topology for your preCICE simulation using the online MetaConfigurator. We provide a preloaded schema to help you get started:
-
Open the MetaConfigurator with the preloaded schema: MetaConfigurator Link
-
Use the interactive interface to define your topology:
- The preloaded schema provides a structured way to describe your simulation components
- Add configuration details on the right side of the screen
-
Once complete, export your topology as a YAML file
- Save the generated YAML file
- Use this file with the
precice-generatortool to create your preCICE configuration - Validate the generated preCICE config with config-checker
- Use
precice-config-checkerand/orprecice-tools checkto validate the generated preCICE config
Benefits of Using MetaConfigurator
- Visual, user-friendly interface
- Real-time validation against our predefined schema
- Reduces manual configuration errors
- Simplifies topology creation process
Example Configurations
Normal Examples (0-5)
Our project provides a set of progressively complex example configurations to help you get started with preCICE simulations:
- Located in
examples/0throughexamples/5 - Designed for beginners and intermediate users
- Each example includes:
- A
topology.yamlfile defining the simulation setup - A
precice-config.xmlfile - Subdirectories for different simulation components
- A
- Showcase simple, linear multi-physics scenarios
- Ideal for learning basic preCICE configuration concepts
Expert Examples
For advanced users, we offer more sophisticated configuration examples:
- Located in
examples/expert - Contain more advanced usage of topology options but extend the according example with the same number
- Demonstrate advanced coupling strategies and intricate topology configurations
- Targeted at users with a better understanding of preCICE
[!TIP] Start with normal examples (0-5) and progress to expert examples as you become more comfortable with preCICE configurations.
Documentation
The template for our topology.yaml file can be found in the schemas folder.
Alongside it, you will find README.md, which explains the topology's parameters.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Open a Pull Request
Troubleshooting
- Ensure all dependencies are correctly installed
- Verify the format of your input YAML file
- Check the generated logs for detailed error information
Acknowledgements
This project was started with code from the preCICE controller repository.
The file format_precice_config.py was taken
from preCICE pre-commit hook file
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file precice_case_generate-0.1.1.tar.gz.
File metadata
- Download URL: precice_case_generate-0.1.1.tar.gz
- Upload date:
- Size: 40.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a61a674a157fc3487ab983e15e916b06fa8837317e969a1758a7e90a886b116b
|
|
| MD5 |
bfadcb82ff6111c493105d33d14c1763
|
|
| BLAKE2b-256 |
779dd5ea59f35c207b2c01cb22217b07ef0d521445a2e054333fb64ea1bc98e7
|
Provenance
The following attestation bundles were made for precice_case_generate-0.1.1.tar.gz:
Publisher:
release.yml on precice/case-generate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
precice_case_generate-0.1.1.tar.gz -
Subject digest:
a61a674a157fc3487ab983e15e916b06fa8837317e969a1758a7e90a886b116b - Sigstore transparency entry: 260334244
- Sigstore integration time:
-
Permalink:
precice/case-generate@7a5a236ba3e0cee52838557376a956ded31cab77 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/precice
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7a5a236ba3e0cee52838557376a956ded31cab77 -
Trigger Event:
push
-
Statement type:
File details
Details for the file precice_case_generate-0.1.1-py3-none-any.whl.
File metadata
- Download URL: precice_case_generate-0.1.1-py3-none-any.whl
- Upload date:
- Size: 51.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0352c84850c51e506f89bb3bb8b3308e07a7f8901420400de49cf6a2e3d496e2
|
|
| MD5 |
a131c329aa67dfcb0bab371f780f1dc0
|
|
| BLAKE2b-256 |
a4298f312fa6b1c24c3b95a04caf5c67ce19c64b8169c49e8bbacb37f81bb04e
|
Provenance
The following attestation bundles were made for precice_case_generate-0.1.1-py3-none-any.whl:
Publisher:
release.yml on precice/case-generate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
precice_case_generate-0.1.1-py3-none-any.whl -
Subject digest:
0352c84850c51e506f89bb3bb8b3308e07a7f8901420400de49cf6a2e3d496e2 - Sigstore transparency entry: 260334261
- Sigstore integration time:
-
Permalink:
precice/case-generate@7a5a236ba3e0cee52838557376a956ded31cab77 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/precice
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7a5a236ba3e0cee52838557376a956ded31cab77 -
Trigger Event:
push
-
Statement type: