Skip to content

Commit 7470dab

Browse files
committed
Update and extend the contributing guidelines for tutorials
1 parent 2241f12 commit 7470dab

File tree

1 file changed

+56
-16
lines changed

1 file changed

+56
-16
lines changed

pages/community/community-contribute-to-precice.md

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,63 @@ You can also use preCICE from the [develop branch](https://github.com/precice/pr
5252

5353
After working on your new simulation case, you may want to share it with the community to use as a starting point,
5454
or to demonstrate a new feature. We welcome contributions to our [tutorials repository](https://github.com/precice/tutorials/)
55-
and we will discuss it with you over a few review iterations.
56-
57-
A few guidelines:
58-
- Contribute only the files necessary for running the tutorial (no results or user-specific files).
59-
- Provide a `README.md` file documenting the scenario setup, the dependencies, how to run it, how to visualize the results, and an example picture or video of the results.
60-
- Provide run scripts (`runFluid`, `runSolid`, potentially `Allrun`) to run your cases.
61-
- Provide an `Allclean` script to clean any derived files of the simulation.
55+
and we will discuss it with you over a few [review](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/reviewing-proposed-changes-in-a-pull-request) iterations.
56+
57+
### Structure of a tutorial
58+
59+
Our tutorials generally follow a file structure similar to this:
60+
```bash
61+
- <tutorial>/ # e.g. perpendicular-flap/
62+
- README.md # description of the case
63+
- precice.config.xml # a works-with-all preCICE configuration file
64+
- clean-tutorial.sh # a symbolic link (see ../tools/)
65+
- <visualization scripts> # gnuplot or simple Python scripts
66+
- images/ # any images used by the documentation
67+
- <participant1-solver1>/ # e.g. fluid-openfoam/
68+
- run.sh # a short script to run the solver1 case
69+
- clean.sh # a short script to clean the solver1 case
70+
- <the solver1 files>
71+
- <participant2-solver2>/ # e.g. solid-dealii/
72+
- run.sh
73+
- clean.sh
74+
- <the solver2 files>
75+
```
76+
Your case may already fit into one of the existing tutorials. If not, feel free to start a new one!
77+
78+
### Guidelines and hints
79+
80+
- Contribute only the files necessary for running the tutorial (no results or user-specific files). You can check this by looking at the "Files changed" tab on GitHub.
81+
- In the `README.md` file, document the scenario setup, the dependencies, how to run it, how to visualize the results, and an example picture or video of the results. Follow the general structure in the existing tutorials.
82+
- The run scripts (`run.sh`) should be very short. You can probably reuse some of the scripts we already provide.
83+
- For the `clean.sh` script, you can use the functions provided in `tools/cleaning-tools.sh`
6284
- If there is already a `precice-config.xml` for the case you are simulating, please use the same one (or contribute changes to that). We want that all solvers that can simulate a given case use the same preCICE configuation file.
63-
- Clean-up the files: remove commented-out code, remove scripts that are not needed.
64-
- Naming conventions:
65-
- Directories use `-` to separate words, not `_`, and only use lowercase.
66-
- Data and mesh names should start with uppercase and use `-` as separator.
67-
- Data names are in singular, e.g. `Stress`, `Displacement`.
68-
- Mesh names start with the participant/domain name, e.g. `Fluid-Mesh`.
69-
- Watchpoints should be describing the point, not use a generic name.
70-
71-
We are currently working in [restructuring our tutorials](https://github.com/orgs/precice/projects/5) and we will be able to provide more guidelines soon.
85+
86+
### Naming conventions
87+
88+
- Directories use `-` to separate words, not `_`, and only use lowercase.
89+
- Data and mesh names should start with uppercase and use `-` as separator.
90+
- Data names are in singular, e.g. `Stress`, `Heat-Flux`.
91+
- Mesh names start with the participant/domain name, e.g. `Fluid-Mesh`.
92+
- Watchpoint names should be describing the point, not be a generic name.
93+
94+
### What to check before submitting
95+
- Check your shell scripts with [shellcheck](https://github.com/koalaman/shellcheck/):
96+
```bash
97+
shellcheck <script.sh>
98+
```
99+
and format them with any formatted (e.g. make sure there is an empty line at the end of the script).
100+
Please start your shell scripts with `#!/bin/sh` and enable exit on error and undefined variables: `set -e -u`.
101+
- Format your `precice-config.xml` file with the [preCICE formatting tools](dev-docs-dev-tooling.html#formatting-the-code):
102+
```bash
103+
precice/tools/formatting/config-formatter -i precice-config.xml
104+
```
105+
- Format your Python scripts with PEP8:
106+
```bash
107+
autopep8 --in-place --aggressive --aggressive --max-line-length 120 <file>.py
108+
```
109+
- Check your `precice-config.xml` file with the [config-visualizer](tooling-config-visualization.html). Are there any unused meshes or data?
110+
- Remove any comments and any explicitly-set defaults from the `precice-config.xml`. Don't worry if this sounds complicated, we will let you know in the review.
111+
- Clean-up the files: remove commented-out code, remove scripts that are not needed, add case-specific files in a `.gitignore`.
72112

73113
## Contributing code
74114

0 commit comments

Comments
 (0)