Skip to content

Commit 3b59bdc

Browse files
MakisHuekerman
andauthored
Update contributing page clarifying tutorial structure rules (#331)
Co-authored-by: Benjamin Uekermann <[email protected]>
1 parent 1842a93 commit 3b59bdc

File tree

1 file changed

+68
-29
lines changed

1 file changed

+68
-29
lines changed

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

Lines changed: 68 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ and merge them as soon as possible.
2525
These pages are written in [Markdown](https://guides.github.com/features/mastering-markdown/) (a very easy language)
2626
and we also have a [cheatsheet](docs-meta-cheatsheet.html) specifically for this website.
2727

28-
We [migrated](docs-meta-migration-guide.html) our documentation from multiple different sources to this website in December 2020
29-
and some topics may still be incomplete. This is a perfect opportunity to contribute!
30-
3128
## Reporting issues
3229

3330
After discussing a problem in one of our [community channels](community-channels.html), we may conclude that this is a bug
@@ -58,62 +55,104 @@ You can also use preCICE from the [develop branch](https://github.com/precice/pr
5855
After working on your new simulation case, you may want to share it with the community to use as a starting point,
5956
or to demonstrate a new feature. We welcome contributions to our [tutorials repository](https://github.com/precice/tutorials/)
6057
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.
61-
If you roughly follow the guidelines in this section, your contribution could be merged very quickly.
58+
If you roughly follow the guidelines in this section, your contribution could be merged very quickly. Since we aim to maintain and update all tutorials, it is important for us that every tutorial merged follows the same structure and conventions.
6259

6360
{% tip %}
6461
Get in touch with us early and we will be very happy to help you with every step! Open a first draft Pull Request on GitHub and we can together bring it into a fitting shape.
6562
{% endtip %}
6663

6764
First time working with Git? Watch a [short lecture on the GitHub workflow](https://www.youtube.com/watch?v=kAqp2hhv-DU), or a [longer lecture on Git](https://missing.csail.mit.edu/2020/version-control/).
6865

66+
### What to contribute and where?
67+
68+
Your case may already fit into one of the existing tutorials. If not, feel free to start a new one! A new case typically needs a new preCICE configuration file.
69+
70+
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.
71+
72+
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 configuration file.
73+
6974
### Structure of a tutorial
7075

7176
Our tutorials generally follow a file structure similar to this:
7277

7378
```bash
74-
- <tutorial>/ # e.g. perpendicular-flap/
75-
- README.md # description of the case
76-
- precice.config.xml # a works-with-all preCICE configuration file
77-
- clean-tutorial.sh # a symbolic link (see ../tools/)
78-
- <visualization scripts> # gnuplot or simple Python scripts
79-
- images/ # any images used by the documentation
80-
- <participant1-solver1>/ # e.g. fluid-openfoam/
81-
- run.sh # a short script to run the solver1 case
82-
- clean.sh # a short script to clean the solver1 case
79+
- <tutorial>/ # e.g. perpendicular-flap/
80+
- README.md # description of the case
81+
- precice.config.xml # a works-with-all preCICE configuration file
82+
- clean-tutorial.sh # a symbolic link (see ../tools/)
83+
- <participant1-solver1>/ # e.g. fluid-openfoam/
84+
- run.sh # a short script to run the solver1 case
85+
- clean.sh # a short script to clean the solver1 case
8386
- <the solver1 files>
84-
- <participant2-solver2>/ # e.g. solid-dealii/
87+
- <participant2-solver2>/ # e.g. solid-dealii/
8588
- run.sh
8689
- clean.sh
8790
- <the solver2 files>
8891
```
8992

90-
Your case may already fit into one of the existing tutorials. If not, feel free to start a new one!
93+
Other files you may encounter are the following:
94+
95+
```bash
96+
- <tutorial>/
97+
- <visualization scripts> # gnuplot or simple Python scripts
98+
- images/ # any images used by the documentation
99+
- solver-<code>/ # any configurable, tutorial-specific code, e.g., solver-fenics
100+
- reference-results/ # results from different case combinations, used for regression tests
101+
- <case_combination>.tar.gz # Git LFS objects, generated from GitHub Actions
102+
```
103+
104+
### The run.sh scripts
105+
106+
Each run script must be executable for a default case without any arguments. Optional arguments can include `-parallel`, or anything that triggers a special case. Such a uniform interface not only makes the workflow more predictable, but it also facilitates automation, avoiding special cases.
107+
108+
These scripts should generally be very short and not include too much automation that would obfuscate the main steps. Remember: The tutorials serve as examples to copy from and extend, most often by replacing one participant with another.
91109

92-
### Guidelines and hints
110+
There are several helper scripts and functions in `tools/`; using these will make your scripts simpler.
93111

94-
- 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.
95-
- Start a draft [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) early on, so that people know that someone is working on this. In the description, gradually include everything we may need to review and run your tutorial:
96-
- Why is this case a good fit for our tutorials? What is different from other tutorials?
97-
- How did you create the setup? Do we need any additional tools?
98-
- Which versions of preCICE, adapters, and solvers have you tried?
99-
- If it is a solver we don't already support, how can we get it?
100-
- How should the results look like? A screenshot would be very helpful.
101-
- 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. Don't forget to adapt the `permalink:` field in the beginning of the file.
102-
- The run scripts (`run.sh`) should be very short. You can probably reuse some of the scripts we already provide.
103-
- For the `clean.sh` script, you can use the functions provided in `tools/cleaning-tools.sh`
104-
- 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 configuration file.
105-
- If you add a complete new tutorial case, the case also needs to be added to the [tutorials sidebar](https://github.com/precice/precice.github.io/blob/master/_data/sidebars/tutorial_sidebar.yml) on the [tutorials website section](tutorials.html). Please open a pull request to the [website repository](https://github.com/precice/precice.github.io). Please note that we will only merge this one with the next release of the tutorials, such that the list of tutorial cases on the website does not deviate from the list of released tutorial cases.
112+
### Tutorial-specific codes
113+
114+
In case a tutorial-specific code example is needed for this tutorial, and this can be reused among participants, add that in `solver-<code>/`.
115+
116+
You don't need to have a participant-specific configuration file in a participant case (even though that would be nice). Instead, you can hard-code the configuration of each participant in the code and select the respective participant via a command-line argument. A case-specific `run.sh` that provides the participant as command-line argument is enough.
117+
118+
If you write any output, it would be very helpful to keep it tidy (e.g., in a dedicated `output/` directory).
119+
120+
### The README file
121+
122+
In the `README.md` file, following the general structure of the existing tutorials, document:
123+
124+
- the scenario setup,
125+
- the dependencies,
126+
- how to run the tutorial,
127+
- how to visualize the results, and
128+
- an example picture or video of the results.
129+
- Don't forget to adapt the `permalink:` field in the beginning of the file.
130+
131+
{% note %}
132+
If you add a complete new tutorial case, the case also needs to be added to the [tutorials sidebar](https://github.com/precice/precice.github.io/blob/master/_data/sidebars/tutorial_sidebar.yml) on the [tutorials website section](tutorials.html). Please open a pull request to the [website repository](https://github.com/precice/precice.github.io). Please note that we will only merge this one with the next release of the tutorials, such that the list of tutorial cases on the website does not deviate from the list of released tutorial cases.
133+
{% endnote %}
106134

107135
### Naming conventions
108136

109137
- Directories use `-` to separate words, not `_`, and only use lowercase.
138+
- We use `_` for separating case combinations, e.g., in the reference results: `fluid-openfoam_solid-calculix.tar.gz`.
110139
- Data and mesh names should start with uppercase and use `-` as separator.
111140
- Data names are in singular, e.g. `Stress`, `Heat-Flux`.
112141
- Mesh names start with the participant/domain name, e.g. `Fluid-Mesh`.
113142
- Mesh names of participants with multiple interfaces contain the interface in the mesh name, e.g. `Fluid-Upstream-Mesh`. For meshes on which it is important to distinguish between face centers and face nodes, the modifier comes at the end, e.g. `Fluid-Upstream-Mesh-Centers`.
114143
- Watchpoint names should be describing the point, not be a generic name.
115144
- Images need to be named as `tutorials-<tutorial>-<image>.png` to be correctly displayed on the website. You can then refer to them as `![title](images/tutorials-<tutorial>-<image>.png)`. Subdirectories are not allowed.
116145

146+
### Open a pull request
147+
148+
Start a draft [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) early on, so that people know that someone is working on this. In the description, gradually include everything we may need to review and run your tutorial:
149+
150+
- Why is this case a good fit for our tutorials? What is different from other tutorials?
151+
- How did you create the setup? Do we need any additional tools?
152+
- Which versions of preCICE, adapters, and solvers have you tried?
153+
- If it is a solver we don't already support, how can we get it?
154+
- How should the results look like? A screenshot would be very helpful.
155+
117156
### Optional: Help us with some checks
118157

119158
There are a few technical things to take care of before we can merge your contribution. If you find any of these steps to be complicated, we will be happy to directly edit your branch to apply them.
@@ -139,7 +178,7 @@ After your PR gets reviewed, approved, and merged, the website will be built aut
139178

140179
## Sharing a simulation case
141180

142-
Did you create a nice simulation case that could be useful for more people, but is not simple enough to serve as a tutorial? You can alternatively share it in the [community projects](https://precice.discourse.group/c/community-projects/11) category of our forum.
181+
Did you create a nice simulation case that could be useful for more people, but is not simple enough to serve as a tutorial, or you don't want to invest any more time shaping it into a tutorial? You can alternatively share it in the [community projects](https://precice.discourse.group/c/community-projects/11) category of our forum.
143182

144183
## Contributing code
145184

0 commit comments

Comments
 (0)