Skip to content

Commit 03496d4

Browse files
Merge pull request #3 from precice/develop
Version 2 of Case Generate
2 parents e8b9e2a + fd9755a commit 03496d4

200 files changed

Lines changed: 8991 additions & 5408 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
**/__pycache__/
22
venv/
3-
_generated/
43
dist/
54
build/
65
*.egg-info/
6+
.tox/
7+
*.spec
8+
9+
# macOS
710
.DS_Store
811

9-
.idea/*
12+
# IntelliJ
13+
.idea/*
14+
15+
# Created directories during runs
16+
*_generated/
17+
*logs/

README.md

Lines changed: 47 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
# precice-generator
1+
# preCICE Case Generate
22

3-
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/precice/case-generate/check.yml?label=Examples%20generation%20and%20validation%20using%20config-checker)
3+
preCICE case-generate is a python based utility designed to simplify the generation of preCICE application cases.
4+
Such cases consist of the central `precice-config.xml` file which defines all sorts of connections and relations between
5+
involved solvers, as well as `adapter-config.json` files for each solver.
46

5-
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/precice/case-generate/installation.yml?label=Installation%20Checker)
6-
7-
![GitHub License](https://img.shields.io/github/license/precice/case-generate)
8-
9-
## Project Overview
10-
11-
The preCICE case-generate package is a Python-based utility designed to automate the generation of preCICE configuration files from
12-
simple YAML topology descriptions. This tool simplifies the process of setting up multi-physics simulations by transforming
13-
user-defined YAML configurations into preCICE-compatible XML configuration files.
7+
These files involve a lot of complex elements and modifiers, which are often times not needed.
8+
This tool introduces a simpler, easier to read and write `topology.yaml` file,
9+
which covers a wide range of features of the `precice-config.xml` file, yet with only a fraction of the complexity.
10+
An overview over the `topology.yaml` file can be found in `precicecasegenerate/schemas/README.md`.
1411

1512
## Key Features
1613

@@ -20,24 +17,31 @@ user-defined YAML configurations into preCICE-compatible XML configuration files
2017
- Comprehensive error logging and handling
2118
- Simple command-line interface
2219

23-
## Installation
20+
## Getting Started
2421

2522
### Prerequisites
2623

27-
- Python 3.9 or
28-
higher ([workflow validated](https://github.com/precice/case-generate/actions/workflows/installation.yml)
29-
with 3.9, 3.10, 3.11 and 3.12)
24+
Required dependencies are:
25+
26+
- Python ≥ 3.10
3027
- pip
31-
- venv
32-
- (preCICE library)
28+
- git for cloning the repository :)
29+
- [preCICE Config Graph](https://github.com/precice/config-graph) (will be installed during the setup)
30+
- pyyaml
31+
- jsonschema
32+
33+
Optional dependencies are:
34+
35+
- pytest
36+
- [preCICE Config Check](https://github.com/precice/config-check)
3337

3438
### Manual Installation
3539

3640
1. Clone the repository
3741

3842
```bash
3943
git clone https://github.com/precice/case-generate.git
40-
cd precice-generator
44+
cd case-generate
4145
```
4246

4347
2. Create a virtual environment
@@ -63,6 +67,11 @@ pip install build
6367
pip install -e .
6468
```
6569

70+
Optional dependencies for testing can be installed via
71+
```bash
72+
pip install -e ".[dev]"
73+
```
74+
6675
### Using Setup Scripts
6776

6877
#### Unix/macOS
@@ -92,102 +101,54 @@ precice-case-generate --help
92101
Generate a preCICE configuration file from a YAML topology called `topology.yaml`:
93102

94103
```bash
95-
precice-case-generate
104+
precice-case-generate path/to/topology.yaml
96105
```
97106

98-
or pass a topology file via argument;
99-
100-
```bash
101-
precice-case-generate -f path/to/your/topology.yaml
102-
```
107+
The only required argument is the `path/to/topology.yaml`.
103108

104109
The `precice-case-generate` tool supports the following optional parameters:
105110

106-
- `-f, --input-file`: Path to the input topology.yaml file.
107-
- **Default**: `./topology.yaml`
108-
- **Description**: Specify a custom topology file for configuration generation.
109-
110111
- `-o, --output-path`: Destination path for the generated folder.
111112
- **Default**: `./_generated/`
112-
- **Description**: Choose a specific output location for generated files.
113+
- **Description**: Choose a specific output location for the `_generated/` directory.
113114

114-
- `-v, --verbose`: Enable verbose logging.
115+
- `-v, --verbose`: Enable verbose console logging.
115116
- **Default**: Disabled
116117
- **Description**: Provides detailed logging information during execution.
117118

118-
- `--validate-topology`: Validate the input topology.yaml against the preCICE topology schema.
119-
- **Default**: Enabled
120-
- **Description**: Ensures the topology file meets the required schema specifications.
121-
122-
Example usage:
123-
```bash
124-
precice-case-generate -f custom_topology.yaml -o /path/to/output -v
125-
```
126119

127120
> [!NOTE]
128-
> You should validate your files by running them through precice-tools and the
129-
> preCICE [config-checker](https://github.com/precice/case-generate) to avoid errors.
121+
> While it is not expected, the topology generation might fail or produce faulty configuration files.
122+
> This might happen in situations where the `topology.yaml` contains multiple edge cases,
123+
> such as many data exchanges with the same `data`-tag.
124+
> The preCICE [Config Check](https://github.com/precice/config-check) is designed to identify and alert to such errors.
125+
126+
### Examples
127+
128+
Valid `topology.yaml` <-> application case pairs can be found in the `examples/` directory.
129+
They include the preCICE tutorials 1-4 as well as some more complex simulations.
130130

131131
### Configuration
132132

133133
1. Prepare a YAML topology file describing your multi-physics simulation setup.
134134
2. Use the command-line interface to generate the preCICE configuration.
135-
3. The tool will create the necessary configuration files in the `_generated/` directory.
135+
3. preCICE Case Generate will create the necessary configuration files in the `_generated/` directory.
136136

137-
## Creating Topology with MetaConfigurator
137+
## Creating Topologies with MetaConfigurator
138138

139139
You can create a topology for your preCICE simulation using the online MetaConfigurator.
140140
We provide a preloaded schema to help you get started:
141141

142142
1. Open the MetaConfigurator with the preloaded
143-
schema: [MetaConfigurator Link](https://metaconfigurator.github.io/meta-configurator/?schema=https://github.com/precice/case-generate/blob/main/precicecasegenerate/schemas/topology-schema.json&settings=https://github.com/precice/case-generate/blob/main/precicecasegenerate/templates/metaConfiguratorSettings.json)
143+
schema: [MetaConfigurator link](https://metaconfigurator.github.io/meta-configurator/?schema=https://github.com/precice/case-generate/blob/main/precicecasegenerate/schemas/topology-schema.json&settings=https://github.com/precice/case-generate/blob/main/precicecasegenerate/templates/metaConfiguratorSettings.json)
144144

145145
2. Use the interactive interface to define your topology:
146146
- The preloaded schema provides a structured way to describe your simulation components
147-
- Add configuration details on the right side of the screen
148147

149148
3. Once complete, export your topology as a YAML file
150149
- Save the generated YAML file
151-
- Use this file with the `precice-generator` tool to create your preCICE configuration
152-
- Validate the generated preCICE config
153-
with [config-checker](https://github.com/precice/config-check)
154-
- Use `precice-config-checker` and/or `precice-tools check` to validate the generated preCICE config
155-
156-
### Benefits of Using MetaConfigurator
157-
158-
- Visual, user-friendly interface
159-
- Real-time validation against our predefined schema
160-
- Reduces manual configuration errors
161-
- Simplifies topology creation process
162-
163-
## Example Configurations
164-
165-
### Normal Examples (0-5)
166-
167-
Our project provides a set of progressively complex example configurations to help you get started with preCICE
168-
simulations:
169-
170-
- Located in `examples/0` through `examples/5`
171-
- Designed for beginners and intermediate users
172-
- Each example includes:
173-
- A `topology.yaml` file defining the simulation setup
174-
- A `precice-config.xml` file
175-
- Subdirectories for different simulation components
176-
- Showcase simple, linear multi-physics scenarios
177-
- Ideal for learning basic preCICE configuration concepts
178-
179-
### Expert Examples
180-
181-
For advanced users, we offer more sophisticated configuration examples:
182-
183-
- Located in `examples/expert`
184-
- Contain more advanced usage of topology options but extend the according example with the same number
185-
- Demonstrate advanced coupling strategies and intricate topology configurations
186-
- Targeted at users with a better understanding of preCICE
187-
188-
> [!TIP]
189-
> Start with normal examples (0-5) and progress to expert examples as you become more comfortable with preCICE
190-
> configurations.
150+
- Use `precice-case-generate` to create your preCICE application case and configuration files
151+
- Validate the generated preCICE config with [config-checker](https://github.com/precice/config-check)
191152

192153
## Documentation
193154

@@ -207,10 +168,6 @@ Alongside it, you will find `README.md`, which explains the topology's parameter
207168

208169
- Ensure all dependencies are correctly installed
209170
- Verify the format of your input YAML file
210-
- Check the generated logs for detailed error information
211-
212-
## Acknowledgements
171+
- Check the generated logs (`./.logs`) for detailed process information
213172

214-
This project was started with code from the [preCICE controller](https://github.com/precice/controller) repository.
215-
The file `format_precice_config.py` was taken
216-
from [preCICE pre-commit hook file](https://github.com/precice/precice-pre-commit-hooks/blob/main/format_precice_config/format_precice_config.py)
173+
If all else fails, open a pull request describing the issue you are encountering.

examples/0/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/0/config_graph.png

-123 KB
Binary file not shown.

examples/0/fluid-su2/adapter-config.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/0/precice-config.xml

Lines changed: 0 additions & 47 deletions
This file was deleted.

examples/0/solid-calculix/adapter-config.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/0/topology.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

examples/0/vis.png

-47.3 KB
Binary file not shown.

examples/1/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)