diff --git a/.github/ISSUE_TEMPLATE/issue-template.md b/.github/ISSUE_TEMPLATE/issue-template.md new file mode 100644 index 000000000..f9bb0b5a6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue-template.md @@ -0,0 +1,26 @@ +--- +name: Issue template +about: Check this out before opening an issue + +--- + + + +- Tutorials state (last commit / release): +- Versions of solvers and adapters used: +- preCICE version: +- Log files: diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..24599fcab --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,3 @@ + diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml new file mode 100644 index 000000000..cfdecee79 --- /dev/null +++ b/.github/workflows/check-links.yml @@ -0,0 +1,14 @@ +name: Check links +on: [push, pull_request] +jobs: + check_links: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + - name: Check links in markdown files (markdown-link-check) + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'no' + config-file: '.markdown-link-check-config.json' diff --git a/.github/workflows/check-markdown.yml b/.github/workflows/check-markdown.yml new file mode 100644 index 000000000..63a0df9ad --- /dev/null +++ b/.github/workflows/check-markdown.yml @@ -0,0 +1,14 @@ +name: Lint docs +on: [push, pull_request] +jobs: + check_md: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + - name: Lint markdown files (markdownlint) + uses: articulate/actions-markdownlint@v1 + with: + config: .markdownlint.json + files: '.' + ignore: changelog-entries diff --git a/.github/workflows/checks.yaml b/.github/workflows/check-scripts.yaml similarity index 56% rename from .github/workflows/checks.yaml rename to .github/workflows/check-scripts.yaml index 48aa02cdb..5ced647ff 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/check-scripts.yaml @@ -1,10 +1,14 @@ -name: Checks +name: Check scripts on: [push, pull_request] jobs: - checks: + check_scripts: runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v2 - run: bash tools/check.sh - run: bash tools/check-size.sh + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + env: + SHELLCHECK_OPTS: -e SC1091 diff --git a/.markdown-link-check-config.json b/.markdown-link-check-config.json new file mode 100644 index 000000000..ec8d5c1b1 --- /dev/null +++ b/.markdown-link-check-config.json @@ -0,0 +1,3 @@ +{ + "aliveStatusCodes": [429, 403, 200] +} \ No newline at end of file diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 000000000..151ee39b6 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,4 @@ +{ + "MD013": false, + "MD033": false +} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..ad39c9fd7 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,130 @@ +# Contributor Covenant Code of Conduct + + + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +info at precice.org. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d5e38d090..250255aa5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,5 @@ +# Contribute to the preCICE tutorials + It is amazing that you want to contribute a tutorial case for preCICE! -We welcome contributions and we have a few guidelines and tips that you can follow in the [preCICE website](https://precice.org/community-contribute-to-precice.html). \ No newline at end of file +We welcome contributions and we have a few guidelines and tips that you can follow in the [preCICE website](https://precice.org/community-contribute-to-precice.html). diff --git a/elastic-tube-1d/README.md b/elastic-tube-1d/README.md index 064e514e1..f91f85b2d 100644 --- a/elastic-tube-1d/README.md +++ b/elastic-tube-1d/README.md @@ -5,6 +5,7 @@ keywords: OpenFOAM, python summary: The 1D Elastic Tube is a FSI case, that consists of an internal flow in a flexible tube. The flow is unsteady and incompressible. This tutorial contains C++ and Python variants of the fluid and solid solvers. Running the simulation takes just 1-2 minutes. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/elastic-tube-1d). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} ## Setup @@ -12,9 +13,10 @@ We want to simulate the internal flow in a flexible tube as shown in the figure ![FSI3 setup](images/tutorials-elastic-tube-1d-setup.png) -The flow is assumed to be incompressible flow and gravity is neglected. Due to the axisymmetry, the flow can be described using a quasi-two-dimensional continuity and momentum equations. The motivation and exact formulation of the equations that we consider can be found in [2]. +The flow is assumed to be incompressible flow and gravity is neglected. Due to the axisymmetry, the flow can be described using a quasi-two-dimensional continuity and momentum equations. The motivation and exact formulation of the equations that we consider can be found in [2]. The following parameters have been chosen: + - Length of the tube: L = 10 - Inlet velocity: $$ v_{inlet} = 10 + 3 sin (10 \pi t) $$ - Initial cross sectional area = 1 @@ -23,27 +25,25 @@ The following parameters have been chosen: - Fluid density: $$ \rho = 1 $$ - Young modulus: E = 10000 - ## Available solvers Both fluid and solid participant are supported in: -* *C++*: An example solver using the intrinsic [C++ API of preCICE](couple-your-code-api.html). This solver also depends on LAPACK (e.g. on Ubuntu `sudo apt-get install liblapack-dev`) -* *Python*: An example solver using the preCICE [Python bindings](installation-bindings-python.html). This solver also depends on the Python libraries `numpy scipy matplotlib vtk mpi4py`, which you can get from your system package manager or with `pip3 install --user `. - +- *C++*: An example solver using the intrinsic [C++ API of preCICE](https://www.precice.org/couple-your-code-api.html). This solver also depends on LAPACK (e.g. on Ubuntu `sudo apt-get install liblapack-dev`) +- *Python*: An example solver using the preCICE [Python bindings](https://www.precice.org/installation-bindings-python.html). This solver also depends on the Python libraries `numpy scipy matplotlib vtk mpi4py`, which you can get from your system package manager or with `pip3 install --user `. ### Building the C++ Solver In order to use the C++ solver, you first need to build the scripts `FluidSolver` and `SolidSolver`. Each script needs to be built separately. -``` +```bash cd fluid-cpp mkdir build && cd build cmake .. make all ``` -``` +```bash cd solid-cpp mkdir build && cd build cmake .. @@ -52,38 +52,43 @@ make all Building can be skipped if you do not plan to use the C++ version. -## Running the Simulation +## Running the Simulation ### C++ -Open two separate terminals and start each participant by calling the respective run script. +Open two separate terminals and start each participant by calling the respective run script. -``` +```bash cd fluid-cpp ./run.sh ``` + and -``` + +```bash cd solid-cpp ./run.sh ``` -The solvers use the parameters `N = 100`, `tau = 0.01`, `kappa = 100` by default and can be modified in the solver. +The solvers use the parameters `N = 100`, `tau = 0.01`, `kappa = 100` by default and can be modified in the solver. ### Python Open two separate terminals and start each participant by calling the respective run script. Only serial run is possible: -``` +```bash cd fluid-python ./run.sh ``` + and -``` + +```bash cd solid-python ./run.sh ``` -Parameters such as `N` can be modified directly at the `FluidSolver.py` and at the `SolidSolver.py`. The parameters must be consistent between the different solvers and participants. + +Parameters such as `N` can be modified directly at the `FluidSolver.py` and at the `SolidSolver.py`. The parameters must be consistent between the different solvers and participants. **Optional:** Visualization and video output of the fluid participant can be triggered via the options `--enable-plot` and `--write-video` of `FluidSolver.py`. To generate .vtk files during execution, you need to add the flag `--write-vtk`. @@ -94,21 +99,27 @@ Parameters such as `N` can be modified directly at the `FluidSolver.py` and at t ## Post-processing The results from each simulation are stored in each `fluid-/output/` folder. You can visualize these VTK files using the provided `plot-diameter.sh` script + ```bash ./plot-diameter.sh ``` + which will try to visualize the results from both fluid cases, if available. This script calls the more flexible `plot-vtk.py` Python script, which you can use as + ```bash python3 plot-vtk.py /output/ ``` + Note the required arguments specifying which quantity to plot (`pressure`, `velocity` or `diameter`) and the name prefix of the target vtk files. -For example, to plot the diameter of the fluid-python case using the default prefix for VTK files, `plot-diamter.sh` executes: +For example, to plot the diameter of the fluid-python case using the default prefix for VTK files, `plot-diameter.sh` executes: + ```bash python3 plot-vtk.py diameter fluid-python/output/out_fluid_ ``` + ![FSI3 setup](images/tutorials-elastic-tube-1d-diameter.png) ## References @@ -119,8 +130,3 @@ python3 plot-vtk.py diameter fluid-python/output/out_fluid_ [3] M. Mehl, B. Uekermann, H. Bijl, D. Blom, B. Gatzhammer, and A. van Zuijlen. Parallel coupling numerics for partitioned fluid-structure interaction simulations. CAMWA, 2016. - - - - - diff --git a/elastic-tube-3d/README.md b/elastic-tube-3d/README.md index 186c6d3ac..5da2a3a3b 100644 --- a/elastic-tube-3d/README.md +++ b/elastic-tube-3d/README.md @@ -5,21 +5,23 @@ keywords: FSI, OpenFOAM, CalculiX, nearest-projection, IMVJ summary: Tutorial for an FSI simulation of a three-dimensional expanding tube scenario --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/elastic-tube-3d). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup The expanding tube test case involves a cylindrical fluid domain surrounded by a solid domain. A pressure inlet boundary condition is applied at the inlet for 3 milliseconds, and then 0 set to zero for a further 7 millisecond. The pressure of the fluid expands the tube which then relaxes once the pressure decreases. -The expanding tube test case comes with the interface surface mesh connectivity of the solid domain. This allows the use of nearest-projection mapping of the displacements of the solid domain. In order to run the example with nearest projection mapping, the "node-mesh-with-connectivity" has been specified in the `solid-calculix/config.yml` file. More details can be found in the [CalculiX configuration description](adapter-calculix-config.html#nearest-projection-mapping). +The expanding tube test case comes with the interface surface mesh connectivity of the solid domain. This allows the use of nearest-projection mapping of the displacements of the solid domain. In order to run the example with nearest projection mapping, the "node-mesh-with-connectivity" has been specified in the `solid-calculix/config.yml` file. More details can be found in the [CalculiX configuration description](https://www.precice.org/adapter-calculix-config.html#nearest-projection-mapping). ## Available solvers Fluid participant: -* OpenFOAM. This tutorial is known to work with OpenFOAM 4.1, 5.0, but it should also work with newer versions. The case files are prepared for the latest versions of OpenFOAM and use the solver `pimpleFoam`. In case you are using a previous OpenFOAM version you need to adjust the solver to `pimpleDyMFoam` in the `Fluid/system/controlDict` file. For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM. This tutorial is known to work with OpenFOAM 4.1, 5.0, but it should also work with newer versions. The case files are prepared for the latest versions of OpenFOAM and use the solver `pimpleFoam`. In case you are using a previous OpenFOAM version you need to adjust the solver to `pimpleDyMFoam` in the `Fluid/system/controlDict` file. For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). Solid participant: -* CalculiX. This tutorial is known to work with CalculiX 2.15, but it should also work with newer versions. For more information, have a look at the [CalculiX adapter documentation](adapter-calculix-overview.html). +* CalculiX. This tutorial is known to work with CalculiX 2.15, but it should also work with newer versions. For more information, have a look at the [CalculiX adapter documentation](https://www.precice.org/adapter-calculix-overview.html). ## Running the simulation diff --git a/flow-over-heated-plate-nearest-projection/README.md b/flow-over-heated-plate-nearest-projection/README.md index 29a010d9e..2799d57a8 100644 --- a/flow-over-heated-plate-nearest-projection/README.md +++ b/flow-over-heated-plate-nearest-projection/README.md @@ -2,36 +2,39 @@ title: Flow over heated plate nearest projection permalink: tutorials-flow-over-heated-plate-nearest-projection.html keywords: OpenFOAM, nearest-projection, CHT -summary: This tutorial introduces an example simulation setup for a nearest-projection mapping. At the moment, it only contains an example with the OpenFOAM adapter. The demonstrated "flow over a heated plate" scenario is exactly the same as in the `buoyantPimpleFoam-laplacianFoam` tutorial. +summary: This tutorial introduces an example simulation setup for a nearest-projection mapping, based on the "flow over a heated plate" scenario. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/flow-over-heated-plate-nearest-projection). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup -The setup is exactly the same as described in our [flow-over-heated-plate tutorial](tutorials-flow-over-heated-plate.html). +The setup is exactly the same as described in our [flow-over-heated-plate tutorial](https://www.precice.org/tutorials-flow-over-heated-plate.html). ## Available solvers Fluid participant: -* OpenFOAM (buoyantPimpleFoam). For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM (buoyantPimpleFoam). For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). Solid participant: -* OpenFOAM (laplacianFoam). For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). - -The solvers are currently only OpenFOAM related. For information regarding the nearest-projection mapping, have a look in the [OpenFOAM configuration section](adapter-openfoam-config.html). +* OpenFOAM (laplacianFoam). For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). +The solvers are currently only OpenFOAM related. For information regarding the nearest-projection mapping, have a look in the [OpenFOAM configuration section](https://www.precice.org/adapter-openfoam-config.html). ## Running the Simulation Open two separate terminals and start each participant by calling the respective run script. -``` +```bash cd fluid-openfoam ./run.sh ``` + and -``` + +```bash cd solid-openfoam ./run.sh ``` @@ -43,8 +46,10 @@ You can also run OpenFOAM in parallel by `./run.sh -parallel`. If you are using As we are defining two meshes for each participant, we need to define them in the `precice-config.xml` and `preciceDict` configuration files. Additionally, we need to enable the `connectivity` switch for the adapter. ### Changes in `precice-config.xml` + In order to map from face nodes to face centers, both meshes need to be specified. The nodes-based mesh uses the write data and the centers-based mesh uses the read data. Have a look in the given `precice-config.xml` in this tutorial. Example: `Temperature` is calculated by the `Fluid` participant and passed to the `Solid` participant. Therefore, it is the write data of the participant `Fluid` and the read data of the participant `Solid`. This results in the following two meshes for this data: -``` + +```xml @@ -52,16 +57,16 @@ In order to map from face nodes to face centers, both meshes need to be specifie ``` + All further changes follow from this interface splitting. Have a look in the given config files for all details. ### Notes on 2D Cases From the preCICE point of view, the simulation here is in 3D, as opposed to the original 2D case, as is often the case with 3D solvers (such as OpenFOAM). In such cases, we recommend keeping the out-of-plane thickness of the domain small and comparable to the in-plane cell size. Otherwise, the face centers will have a large distance to the face nodes, which might trigger a preCICE warning and preCICE may even filter out one of the meshes, especially in parallel simulations. - ## Post-processing -Have a look at the [flow-over heated-plate](tutorials-flow-over-heated-plate.html) tutorial for the general aspects of post-processing. +Have a look at the [flow-over heated-plate](https://www.precice.org/tutorials-flow-over-heated-plate.html) tutorial for the general aspects of post-processing. Since we now defined mesh connectivity on our interface, we can export the coupling interface with the tag `` in our `precice-config.xml`. Visualizing these files (e.g. using ParaView) will show a triangular mesh, even though you use hexahedral meshes. This has nothing to do with your mesh and is just caused by the way the connectivity is defined in preCICE. As described above, the function `setMeshTriangles` is used to define the connectivity. Hence, every interface cell/face is represented by two triangles. The following image should give you an impression of a possible triangulated coupling mesh, which consists purely of hexahedral cells: diff --git a/flow-over-heated-plate-steady-state/README.md b/flow-over-heated-plate-steady-state/README.md index 66d7c5e64..6e92f7d5d 100644 --- a/flow-over-heated-plate-steady-state/README.md +++ b/flow-over-heated-plate-steady-state/README.md @@ -2,12 +2,14 @@ title: Flow over heated plate steady state permalink: tutorials-flow-over-heated-plate-steady-state.html keywords: CHT, steady-state, Code_Aster, OpenFOAM -summary: Using a steady-state OpenFOAM solver for a CHT coupling with Code_Aster. +summary: Using a steady-state OpenFOAM solver for a CHT coupling with code_aster. This tutorial is based on the "flow over a heated plate" scenario. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/flow-over-heated-plate-steady-state). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup -The setup for this tutorial is similar to the [flow over a heated plate](tutorials-flow-over-heated-plate.html) using OpenFOAM. In this tutorial OpenFOAM is used as the solver for the fluid domain, and code_aster is the solver for the solid domain. A difference here is that we are using a steady-state OpenFOAM solver for demonstration purposes, therefore the results between the two tutorials are not comparable. +The setup for this tutorial is similar to the [flow over a heated plate](https://www.precice.org/tutorials-flow-over-heated-plate.html) using OpenFOAM. In this tutorial OpenFOAM is used as the solver for the fluid domain, and code_aster is the solver for the solid domain. A difference here is that we are using a steady-state OpenFOAM solver for demonstration purposes, therefore the results between the two tutorials are not comparable. {% include note.html content="This is a pseudo-2D case, but we still set a 3D `solver-interface` in `precice-config.xml`, because the code_aster case is set up like this at the moment. Contributions here are particularly welcome!" %} @@ -15,11 +17,11 @@ The setup for this tutorial is similar to the [flow over a heated plate](tutoria Fluid participant: -* OpenFOAM. We use buoyantSimpleFoam instead of the transient buoyantPimpleFoam. For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM. We use buoyantSimpleFoam instead of the transient buoyantPimpleFoam. For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). Solid participant: -* code_aster. The [code_aster adapter documentation](adapter-code_aster.html) is oriented on this tutorial case. In particular the described configuration settings. +* code_aster. The [code_aster adapter documentation](https://www.precice.org/adapter-code_aster.html) is oriented on this tutorial case. In particular the described configuration settings. ## Running the Simulation diff --git a/flow-over-heated-plate-steady-state/solid-codeaster/run.sh b/flow-over-heated-plate-steady-state/solid-codeaster/run.sh index 1dbe48f7f..3860a6a10 100755 --- a/flow-over-heated-plate-steady-state/solid-codeaster/run.sh +++ b/flow-over-heated-plate-steady-state/solid-codeaster/run.sh @@ -4,7 +4,8 @@ set -e -u echo "Warning: this case requires a manual preparation step for code_aster." echo "You also need to set an absolute path as exchange-directory in precice-config.xml." echo "See the tutorial and code_aster adapter documentation pages for more:" -echo "https://www.precice.org/adapter-code_aster.html\n" +echo "https://www.precice.org/adapter-code_aster.html" +echo "" export TUTORIAL_ROOT=${PWD} export PRECICE_PARTICIPANT=Solid diff --git a/flow-over-heated-plate/README.md b/flow-over-heated-plate/README.md index 01a6f0ff2..c512ec4b9 100644 --- a/flow-over-heated-plate/README.md +++ b/flow-over-heated-plate/README.md @@ -2,9 +2,11 @@ title: Flow over heated plate permalink: tutorials-flow-over-heated-plate.html keywords: tutorial, CHT, conjugate-heat transfer, OpenFOAM, FEniCS, Nutils -summary: This tutorial describes how to run a conjugate heat transfer coupled simulation using preCICE and any fluid-solid solver combination of our [officially provided adapter codes](adapters-overview.html). +summary: This tutorial describes how to run a conjugate heat transfer coupled simulation using preCICE and any fluid-solid solver combination of our officially provided adapter codes. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/flow-over-heated-plate). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup This scenario consists of one fluid and one solid participant and it is inspired by Vynnycky et al. [1]. A fluid enters a channel with temperature $$ T_\infty $$, where it comes in contact with a solid plate. The plate is heated at its bottom and has a constant temperature of $$ T_{hot} $$. @@ -21,27 +23,30 @@ By default, the fluid participant reads heat-flux values and the solid participa Fluid participant: -* OpenFOAM (buoyantPimpleFoam). For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM (buoyantPimpleFoam). For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). Solid participant: -* OpenFOAM (laplacianFoam). For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM (laplacianFoam). For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). -* FEniCS. For more information, have a look at the [FeniCS adapter documentation](adapter-fenics.html). +* FEniCS. For more information, have a look at the [FeniCS adapter documentation](https://www.precice.org/adapter-fenics.html). ## Running the Simulation All listed solvers can be used in order to run the simulation. Open two separate terminals and start the desired fluid and solid participant by calling the respective run script `run.sh` located in the participant directory. For example: -``` +```bash cd fluid-openfoam ./run.sh ``` + and -``` + +```bash cd solid-fenics ./run.sh ``` + in order to use OpenFOAM and FEniCS for this test case. Feel free to try different combinations, they should all run and give approximately similar results. ## Post-processing @@ -63,7 +68,7 @@ You may use additional filters, such as the Calculator and the Plot Over Line, t First generate the output for each run by adding export to the participant `Solid` in `precice-config.xml`: -``` +```xml @@ -74,7 +79,7 @@ First generate the output for each run by adding export to the participant `Soli After that running a case from this tutorial will export data into `solid-*/preCICE-output`. To visualize and compare these results run `python3 plot-final-interface-temperature.py` (You can install the required python packages by running `pip3 install -r plot-final-interface-temperature-requirements.txt`). This will plot the dimensionless temperature `theta = (T-300)/(310-300)` (with `T` being the temperature) across the coupling interface, i.e. where the solid and the fluid meet and exchange heat. The x-axis shows the x coordinate and the y-axis the dimensionless temperature `theta` at the interface. If you want to exclude certain cases, simply comment out the corresponding lines in the script. For reference see below: -![](images/tutorials-flow-over-heated-plate-results-comparison.png) +![Comparison of the results with different solvers](images/tutorials-flow-over-heated-plate-results-comparison.png) ## References diff --git a/heat-exchanger/README.md b/heat-exchanger/README.md index 39c1d5de0..d08cadb05 100644 --- a/heat-exchanger/README.md +++ b/heat-exchanger/README.md @@ -5,11 +5,12 @@ keywords: CHT, OpenFOAM, CalculiX summary: Tutorial for a shell-and-tube heat exchanger, using OpenFOAM and CalculiX --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/heat-exchanger). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + This tutorial describes how to run a conjugate heat transfer simulation with two separate OpenFOAM solvers and CalculiX. The files for this tutorial are located in this repository (directory CHT/heat_exchanger). This tutorial is based on [a case](https://www.simscale.com/projects/cheunglucia/heat_exchanger_-_cht_simulation/) prepared with [SimScale](https://www.simscale.com/) by [Lucia Cheung Yau](https://github.com/ludcila) for her [Master's Thesis](https://www5.in.tum.de/pub/Cheung2016_Thesis.pdf). - ## Setup This scenario consists of two fluid and one solid participant and represents a [shell-and-tube heat exchanger](https://en.wikipedia.org/wiki/Shell_and_tube_heat_exchanger). The geometry includes an (adiabatic) shell, in which an _inner fluid_ flows. It enters from the top-right inlet and exits from the bottom-left, after getting redirected several times by baffles. The geometry also includes a set of tubes, in which an _outer fluid_ flows from left to right. The two fluids enter in different temperatures and exchange heat through the (thick) solid walls of the tubes. This is a steady-state simulation and the flow is considered laminar. @@ -22,9 +23,9 @@ We define the participants `Inner-Fluid`, `Solid`, and `Outer-Fluid` and two int ## Available solvers -* OpenFOAM. `buoyantSimpleFoam` is used for fluid flow (both participants). This is a solver for steady-state, buoyant, turbulent flow of compressible fluids for ventilation and heat transfer. For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM. `buoyantSimpleFoam` is used for fluid flow (both participants). This is a solver for steady-state, buoyant, turbulent flow of compressible fluids for ventilation and heat transfer. For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). -* CalculiX. For more information, have a look at the [CalculiX adapter documentation](adapter-calculix-overview.html). +* CalculiX. For more information, have a look at the [CalculiX adapter documentation](https://www.precice.org/adapter-calculix-overview.html). ## Running the Simulation diff --git a/multiple-perpendicular-flaps/README.md b/multiple-perpendicular-flaps/README.md index 22353b653..7c107fde2 100644 --- a/multiple-perpendicular-flaps/README.md +++ b/multiple-perpendicular-flaps/README.md @@ -5,11 +5,13 @@ keywords: multi-coupling, OpenFOAM, deal.II, FSI summary: In this case, a fluid and two solids are coupled together using a fully-implicit multi-coupling scheme. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/multiple-perpendicular-flaps). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Case Setup In the following tutorial we model a fluid flowing through a channel. Two solid, elastic flaps are fixed to the floor of this channel. The flaps oscillate due to the fluid pressure building up on its surface. In this case, a fluid and two solids are coupled together using a fully-implicit multi-coupling scheme. The case setup is shown here: -![](images/tutorials-multiple-perpendicular-flaps-setup-two-flaps.png) +![Setup](images/tutorials-multiple-perpendicular-flaps-setup-two-flaps.png) The simulated flow domain is 6 units long (x) and 4 units tall (z). The flaps are clamped at the bottom (z=0) and they are 1 unit tall (z), 0.1 units long (x), and 0.3 units wide (y). Being located at x=-1 and x=1, the flaps split the domain into three equal parts. @@ -19,11 +21,11 @@ The inflow velocity is 5 m/s (uniform) on the left boundary. At the outlet, pressure is set to zero and velocity to `zeroGradient`. The top, bottom and flap are walls with a `noslip` condition. -For a case showing fluid-structure interaction only (no multi-coupling), take a look at the [single perpendicular flap tutorial](tutorials-perpendicular-flap.html). +For a case showing fluid-structure interaction only (no multi-coupling), take a look at the [single perpendicular flap tutorial](https://www.precice.org/tutorials-perpendicular-flap.html). ## Why multi-coupling? -This is a case with three participants: the fluid and each flap. In preCICE, there are two options to [couple more than two participants](configuration-coupling-multi.html). The first option a composition of bi-coupling schemes, in which we must specify the exchange of data in a participant to participant manner. However, such a composition is not suited for combining multiple strong fluid-structure interations [1]. Thus, in this case, we use the second option, fully-implicit multi-coupling. +This is a case with three participants: the fluid and each flap. In preCICE, there are two options to [couple more than two participants](https://www.precice.org/configuration-coupling-multi.html). The first option a composition of bi-coupling schemes, in which we must specify the exchange of data in a participant to participant manner. However, such a composition is not suited for combining multiple strong fluid-structure interations [1]. Thus, in this case, we use the second option, fully-implicit multi-coupling. We can set this in our `precice-config.xml`: @@ -44,58 +46,69 @@ Most of the coupling details are specified in the file `precide-config.xml`. Her For the simulation of the solid participants we use the deal.II adapter. In deal.II, the geometry of the domain is specified directly on the solver. The two flaps in our case are essentially the same but for the x-coordinate. The flap geometry is given to the solver when we select the scenario in the '.prm' file. - ``` - set Scenario = PF - ``` +```text +set Scenario = PF +``` + But to specify the position of the flap along the x-axis, we must specify it in the `Solid1/linear_elasticity.prm` file as follows: - ``` - set Flap location = -1.0 - ``` +```text +set Flap location = -1.0 +``` + While in case of `Solid2/linear_elasticity.prm` we write: - ``` - set Flap location = 1.0 - ``` +```text +set Flap location = 1.0 +``` + The scenario settings are implemented similarly for the nonlinear case. ## Running the Simulation + 1. Preparation: - To run the coupled simulation, copy the deal.II executable `linear_elasticity` or `nonlinear_elasticity` into the main folder. To learn how to obtain the deal.II executable take a look at the description on the [deal.II-adapter page](adapter-dealii-overview.html). + To run the coupled simulation, copy the deal.II executable `linear_elasticity` or `nonlinear_elasticity` into the main folder. To learn how to obtain the deal.II executable take a look at the description on the [deal.II-adapter page](https://www.precice.org/adapter-dealii-overview.html). 2. Starting: We are going to run each solver in a different terminal. It is important that first we navigate to the simulation directory so that all solvers start in the same directory. To start the `Fluid` participant, run: - ``` + + ```bash cd fluid-openfoam ./run.sh ``` + to start OpenFOAM in serial or - ``` + + ```bash cd fluid-openfoam ./run.sh -parallel ``` + for a parallel run. The solid participants are only designed for serial runs. To run the `Solid1` participant, execute the corresponding deal.II binary file e.g. by: - ``` + + ```bash cd solid-left-dealii ./run.sh -linear ``` + Finally, in the third terminal we will run the solver for the `Solid2` participant by: - ``` + + ```bash cd solid-right-dealii ./run.sh -linear ``` + In case we want to run the nonlinear case, simply replace the flag`-linear` by `-nonlinear`. ## Postprocessing After the simulation has finished, you can visualize your results using e.g. ParaView. Fluid results are in the OpenFOAM format and you may load the `fluid-openfoam.foam` file. Looking at the fluid results is enough to obtain information about the behaviour of the flaps. You can also visualize the solid participants' vtks though. -![](images/tutorials-multiple-perpendicular-flaps-results.png) +![Example visualization](images/tutorials-multiple-perpendicular-flaps-results.png) ## References [1] H. Bungartz, F. Linder, M. Mehl, B. Uekerman. A plug-and-play coupling approach for parallel multi-field simulations. 2014. - diff --git a/partitioned-elastic-beam/README.md b/partitioned-elastic-beam/README.md index 573518e16..f497afb32 100644 --- a/partitioned-elastic-beam/README.md +++ b/partitioned-elastic-beam/README.md @@ -5,6 +5,8 @@ keywords: Structure-Structure Coupling, CalculiX, solid mechanics summary: This tutorial describes how to run a structure-structure interaction simulation with CalculiX running on both sides. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/partitioned-elastic-beam). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup We have a rectangular linear elastic beam of dimensions 1 x 1 x 8 m, divided in two subdomains by a splitting plane at z = 6 m. This plane corresponds to the coupling surface. Both ends of the beam (z = 0 and z = 8 m) are fixed. A mechanical load F = -0.001 N is applied constantly along the y-axis onto a small set of nodes near the end of the beam. These boundary conditions can be seen in the input files `beam.inp`. Initial conditions are zero both for position and velocity. Other parameters can be found and customized in the `.inp` files. @@ -13,8 +15,7 @@ We have a rectangular linear elastic beam of dimensions 1 x 1 x 8 m, divided in ## Available solvers -* CalculiX. CalculiX is used for both structural parts. For more information, have a look at the [CalculiX adapter documentation](adapter-calculix-overview.html) for more. - +* CalculiX. CalculiX is used for both structural parts. For more information, have a look at the [CalculiX adapter documentation](https://www.precice.org/adapter-calculix-overview.html) for more. ## Running the Simulation diff --git a/partitioned-heat-conduction-complex/README.md b/partitioned-heat-conduction-complex/README.md index f2893b1b4..a5024ae00 100644 --- a/partitioned-heat-conduction-complex/README.md +++ b/partitioned-heat-conduction-complex/README.md @@ -2,9 +2,11 @@ title: Partitioned heat conduction (complex setup) permalink: tutorials-partitioned-heat-conduction-complex.html keywords: FEniCS, Heat conduction -summary: This tutorial is the advanced version of the `partitioned-heat-conduction` tutorial. More advanced features and geometries may be used. +summary: This tutorial is the advanced version of the "partitioned heat conduction" tutorial, showcasing more advanced features and geometries. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/partitioned-heat-conduction-complex). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup This case is an advanced version of `partitioned-heat-conduction`. Some advanced features offered by this case: diff --git a/partitioned-heat-conduction/README.md b/partitioned-heat-conduction/README.md index 3ee1cf6d0..6929d0d7c 100644 --- a/partitioned-heat-conduction/README.md +++ b/partitioned-heat-conduction/README.md @@ -5,6 +5,8 @@ keywords: FEniCS, Nutils, Heat conduction summary: We solve a simple heat equation. The domain is partitioned and the coupling is established in a Dirichlet-Neumann fashion. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/partitioned-heat-conduction). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup We solve a partitioned heat equation. For information on the non-partitioned case, please refer to [1, p.37ff]. In this tutorial the computational domain is partitioned and coupled via preCICE. The coupling roughly follows the approach described in [2]. @@ -36,21 +38,21 @@ For choosing whether you want to run the Dirichlet-kind and a Neumann-kind parti For running the case, open two terminals run: -``` +```bash cd fenics ./run.sh -d ``` and -``` +```bash cd fenics ./run.sh -n ``` If you want to use Nutils for one or both sides of the setup, just `cd nutils`. The FEniCS case also supports parallel runs. Here, you cannot use the `run.sh` script, but must simply execute -``` +```bash mpirun -n heat.py -d ``` @@ -60,7 +62,7 @@ You can mix the Nutils and FEniCS solver, if you like. Note that the error for a ## Visualization -Output is written into the folders `fenics/out` and `nutils`. +Output is written into the folders `fenics/out` and `nutils`. For FEniCS you can visualize the content with paraview by opening the `*.pvd` files. The files `Dirichlet.pvd` and `Neumann.pvd` correspond to the numerical solution of the Dirichlet, respectively Neumann, problem, while the files with the prefix `ref` correspond to the analytical reference solution, the files with `error` show the error and the files with `ranks` the ranks of the solvers (if executed in parallel). diff --git a/partitioned-pipe/README.md b/partitioned-pipe/README.md index f29413dff..9070cacc6 100644 --- a/partitioned-pipe/README.md +++ b/partitioned-pipe/README.md @@ -5,6 +5,8 @@ keywords: tutorial, FF, fluid-fluid coupling, OpenFOAM, pimpleFoam, sonicLiquidF summary: This tutorial describes how to run a partitioned fluid simulation using preCICE. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/partitioned-pipe). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup This scenario consists of two pipes connected in series. A fluid enters from the left (here $$ z=0 $$) boundary of the Fluid1 participant with a uniform velocity profile ($$ u_{in} = 0.1 m/s $$) and zero pressure gradient. In its starting, uncoupled state, it exits from the right side (outlet: zero velocity gradient, zero pressure). This is also the coupling interface with Fluid2, which has the same boundary conditions as Fluid1. @@ -15,20 +17,22 @@ On the coupling interface, Fluid1 sends velocity and pressure gradient to Fluid2 Both for Fluid1 and Fluid2, the following participants are available: -* OpenFOAM (pimpleFoam). An incompressible OpenFOAM solver. For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM (pimpleFoam). An incompressible OpenFOAM solver. For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). -* OpenFOAM (sonicLiquidFoam). A compressible OpenFOAM solver. For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM (sonicLiquidFoam). A compressible OpenFOAM solver. For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). ## Running the Simulation All listed solvers can be used in order to run the simulation. Open two separate terminals and start the desired fluid1 and fluid2 participants by calling the respective run script. For example: -``` +```bash cd fluid1-openfoam-pimplefoam ./run.sh ``` + and -``` + +```bash cd fluid2-openfoam-sonicliquidfoam ./run.sh ``` diff --git a/perpendicular-flap/README.md b/perpendicular-flap/README.md index 1b222f6ea..a65042a7e 100644 --- a/perpendicular-flap/README.md +++ b/perpendicular-flap/README.md @@ -2,9 +2,11 @@ title: Perpendicular flap permalink: tutorials-perpendicular-flap.html keywords: fluid-structure interaction, FSI, OpenFOAM, FEniCS, Nutils, deal.II, Calculix, SU2, -summary: This tutorial describes how to run a fluid-structure interaction using preCICE and any fluid-solid solver combination of our [officially provided adapter codes](adapters-overview.html). +summary: This tutorial describes how to run a fluid-structure interaction using preCICE and any fluid-solid solver combination of our officially provided adapter codes. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/perpendicular-flap). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup We model a two-dimensional fluid flowing through a channel. A solid, elastic flap is fixed to the floor of this channel. The flap oscillates due to the fluid pressure building up on its surface. The setup is shown schematically here: @@ -17,35 +19,37 @@ The simulated flow domain is 6 units long (x) and 4 units tall (y). The flap is Fluid participant: -* OpenFOAM. For older OpenFOAM versions, the solver name differs: If you are using OpenFOAM v1712 / 5.x or older have a look at `fluid-openfoam/system/controlDict` and set the appropriate solver name. The solver can run in parallel using the command line argument `run.sh -parallel`. For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM. For older OpenFOAM versions, the solver name differs: If you are using OpenFOAM v1712 / 5.x or older have a look at `fluid-openfoam/system/controlDict` and set the appropriate solver name. The solver can run in parallel using the command line argument `run.sh -parallel`. For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). -* Nutils. For more information, have a look at the [Nutils adapter documentation](adapter-nutils-overview.html). This Nutils solver requires at least Nutils v6.0. +* Nutils. For more information, have a look at the [Nutils adapter documentation](https://www.precice.org/adapter-nutils.html). This Nutils solver requires at least Nutils v6.0. -* SU2. As opposed to the other two fluid codes, SU2 is in particular specialized for compressible flow. Therefore the default simulation parameters haven been adjusted in order to pull the setup into the compressible flow regime. For more information, have a look at the [SU2 adapter documentation](adapter-su2-overview.html). +* SU2. As opposed to the other two fluid codes, SU2 is in particular specialized for compressible flow. Therefore the default simulation parameters haven been adjusted in order to pull the setup into the compressible flow regime. For more information, have a look at the [SU2 adapter documentation](https://www.precice.org/adapter-su2-overview.html). Solid participant: -* FEniCS. The structural model is currently limited to linear elasticity. For more information, have a look at the [FeniCS adapter documentation](adapter-fenics.html). +* FEniCS. The structural model is currently limited to linear elasticity. For more information, have a look at the [FeniCS adapter documentation](https://www.precice.org/adapter-fenics.html). -* CalculiX. In order to allow a reasonable comparison to all solid codes, the geometrically non-linear solver has been disabled and only a linear model is used by default. For more information, have a look at the [CalculiX adapter documentation](adapter-calculix-overview.html) +* CalculiX. In order to allow a reasonable comparison to all solid codes, the geometrically non-linear solver has been disabled and only a linear model is used by default. For more information, have a look at the [CalculiX adapter documentation](https://www.precice.org/adapter-calculix-overview.html) -* deal.II. This tutorial is intended to be used with the linear solid solver, but works with the nonlinear solver as well. Please copy the solver executables to the `solid-dealii` folder or make it discoverable at runtime and update the `solid-dealii/run.sh` script. For more information, have a look at the [deal.II adapter documentation](adapter-dealii-overview.html). +* deal.II. This tutorial works only with `Model = linear` since the deal.II codes were developed with read data `Stress` instead of `Force` as applied here (example given in Turek-Hron-FSI) in the first place. The `./run.sh` script takes the compiled executable `elasticity` as input argument (`run.sh -e=/path/to/elasticity`) and is required in case the executable is not discoverable at runtime (e.g. has been added to the system `PATH`). For more information, have a look at the [deal.II adapter documentation](https://www.precice.org/adapter-dealii-overview.html). ## Running the Simulation All listed solvers can be used in order to run the simulation. Open two separate terminals and start the desired fluid and solid participant by calling the respective run script `run.sh` located in the participant directory. For example: -``` +```bash cd fluid-openfoam ./run.sh ``` + and -``` + +```bash cd solid-fenics ./run.sh ``` -in order to use OpenFOAM and FEniCS for this test case. +in order to use OpenFOAM and FEniCS for this test case. ## Post-processing @@ -55,7 +59,6 @@ CalculiX exports results in `.frd` format, which you can visualize in CGX (`cgx As we defined a watchpoint on the 'Solid' participant at the flap tip (see `precice-config.xml`), we can plot it with gnuplot using the script `plot-displacement.sh.` You need to specify the directory of the selected solid participant as a command line argument, so that the script can pick-up the desired watchpoint file, e.g. `plot-displacement.sh solid-fenics`. The resulting graph shows the x displacement of the flap tip. You can modify the script to plot the force instead. - ![Flap watchpoint](images/tutorials-perpendicular-flap-displacement-watchpoint.png) There is moreover a script `plot-all-displacements.sh` to plot and compare all possible variants. This script expects all watchpoint logs to be available in a subfolder `watchpoints` in the format `openfoam-dealii.log` or similar. If you want to use this script, you need to copy the files over accordingly. diff --git a/quickstart/README.md b/quickstart/README.md index 10fb312c4..b77bbc029 100644 --- a/quickstart/README.md +++ b/quickstart/README.md @@ -19,33 +19,49 @@ To get a feeling what preCICE does, watch a [short presentation](https://www.you ## Installation 1. Get and install preCICE. For Ubuntu 20.04 (Focal Fossa), this is pretty easy: [download](https://github.com/precice/precice/releases/latest) and install our binary package by clicking on it or using the following commands: + ```bash wget https://github.com/precice/precice/releases/download/v2.2.0/libprecice2_2.2.0_focal.deb sudo apt install ./libprecice2_2.2.0_focal.deb ``` - - Are you using something else? Just pick what suits you best on [this overview page](installation-overview.html). - - Facing any problems? [Ask for help](community-channels.html). -2. We will use OpenFOAM here and in many of our tutorial cases, so [install OpenFOAM](adapter-openfoam-support.html): + + - Are you using something else? Just pick what suits you best on [this overview page](https://www.precice.org/installation-overview.html). + - Facing any problems? [Ask for help](https://www.precice.org/community-channels.html). +2. We will use OpenFOAM here and in many of our tutorial cases, so [install OpenFOAM](https://www.precice.org/adapter-openfoam-support.html): + ```bash # Add the signing key, add the repository, update (check this): wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash # Install OpenFOAM v2012: - sudo apt-get install openfoam2012-dev + sudo apt install openfoam2012-dev + # Enable OpenFOAM by default in your system and apply now: + echo "source /usr/lib/openfoam/openfoam2012/etc/bashrc" >> ~/.bashrc + source ~/.bashrc ``` -3. Download and install the [OpenFOAM-preCICE adapter](adapter-openfoam-get.html): + +3. Install a few common dependencies that we will need later: + + ```bash + sudo apt install build-essential pkg-config cmake git + ``` + +4. Download and install the [OpenFOAM-preCICE adapter](https://www.precice.org/adapter-openfoam-get.html): + ```bash git clone --branch=master --depth 1 https://github.com/precice/openfoam-adapter cd openfoam-adapter ./Allwmake cd .. ``` -4. Get the quickstart tutorial case: + +5. Get the quickstart tutorial case: + ```bash git clone --branch=master --depth 1 https://github.com/precice/tutorials.git cd tutorials/quickstart ``` -If you prefer to easily try everything in an isolated environment, you may prefer using our [demo virtual machine](installation-vm.html). +If you prefer to easily try everything in an isolated environment, you may prefer using our [demo virtual machine](https://www.precice.org/installation-vm.html). ## Case setup @@ -57,23 +73,40 @@ In order to gain more control over the rigid body oscillation, a rotational spri ## Building the rigid body solver -Before starting the coupled simulation, the rigid body solver needs to be built using CMake. You can run the following commands from the `quickstart/` directory to build the `rigid_body_solver.cpp` -``` -cd solid-cpp +Before starting the coupled simulation, we need to build the rigid body solver. You can run the following commands from the `solid-cpp` directory to build the `rigid_body_solver.cpp`: + +```bash +cd tutorials/quickstart/solid-cpp cmake . && make ``` ## Running the coupled simulation -You may run the two simulations in two different terminals and watch their output on the screen using `./run.sh` (or `./run.sh -parallel`, option only available for OpenFOAM) from inside the directory of each participant. You can cleanup the simulation using `./clean-tutorial.sh`. +You may run the two simulations in two different terminals and watch their output on the screen using `./run.sh` from inside the directory of each participant: + +```bash +# Terminal window 1 +cd tutorials/quickstart/solid-cpp +./run.sh +``` + +```bash +# Terminal window 2 +cd tutorials/quickstart/fluid-openfoam +./run.sh +# Alternative, in parallel: ./run.sh -parallel +``` + +You can also run OpenFOAM in parallel: `./run.sh -parallel`. +Before the simulation again, cleanup the results and temporary files using `./clean-tutorial.sh`. -In serial, the simulation should take roughly 30 seconds to compute. +In serial, the simulation should take less than a minute to compute (simulated time: 2.5s). ## Visualizing the results -You can visualize the simulation results of the `Fluid` participant using ParaView and loading the (empty) file `Fluid.foam`. The rigid body does not generate any readable output files, but the motion can be observed in the OpenFOAM data. +You can visualize the simulation results of the `Fluid` participant using ParaView and loading the (empty) file `fluid-openfoam/fluid-openfoam.foam`. The rigid body does not generate any readable output files, but the OpenFOAM data should be enough for now: click "play" in ParaView, the flap should already be moving! 🎉 -In addition, one could visualize the coupling meshes, including the exchanged coupling data. preCICE generates the relevant files during the simulation and stores them in the directory `coupling-meshes`. In order to visualize the results, load the VTK files in ParaView and apply a `Glyph` filter. Depending on the specific ParaView version, you might additionally need to disable the `ScaleArray` option by selecting `No scale array`, since the exchanged data might be inappropriate for a scaling operation. You can further add a `Warp By Vector` filter with `Displacement` to deform the coupling data. The result should look as follows: +You may be curious what displacements OpenFOAM received from the rigid body solver. We can actually easily visualize the coupling meshes, including the exchanged coupling data: preCICE generates the relevant files during the simulation and stores them in the directory `solid-cpp/coupling-meshes`. Load these VTK files in ParaView and apply a `Glyph` filter with `Glyph Type: Arrow`,`Orientation Array: Displacement`, and `Scale Array: No scale array`. You can further add a `Warp By Vector` filter with `Displacement` to deform the coupling data. The result should look as follows: ![result](images/quickstart-result.png) @@ -81,10 +114,10 @@ In addition, one could visualize the coupling meshes, including the exchanged co To become a preCICE pro: -* Get an overview of the [preCICE docs](docs.html). -* See what users talk about in the [preCICE forum](https://precice.discourse.group/). -* Run [tutorials with other coupled solvers](tutorials.html). -* Watch some [preCICE videos](https://www.youtube.com/c/preCICECoupling/). -* Meet our [community](community.html). -* Find out how to [couple your own solver](couple-your-code-overview.html). -* Tell us [your story](community-projects.html). \ No newline at end of file +- Get an overview of the [preCICE docs](https://www.precice.org/docs.html). +- See what users talk about in the [preCICE forum](https://precice.discourse.group/). +- Run [tutorials with other coupled solvers](https://www.precice.org/tutorials.html). +- Watch some [preCICE videos](https://www.youtube.com/c/preCICECoupling/). +- Meet our [community](https://www.precice.org/community.html). +- Find out how to [couple your own solver](https://www.precice.org/couple-your-code-overview.html). +- Tell us [your story](https://www.precice.org/community-projects.html). diff --git a/quickstart/solid-cpp/CMakeLists.txt b/quickstart/solid-cpp/CMakeLists.txt index 4024b0f9d..5f4f81702 100644 --- a/quickstart/solid-cpp/CMakeLists.txt +++ b/quickstart/solid-cpp/CMakeLists.txt @@ -2,6 +2,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.10.2) SET(TARGET "rigid_body_solver") PROJECT(${TARGET} LANGUAGES CXX DESCRIPTION "rigid_body_solver") +# The rigid body solver requires c++14 +SET(CMAKE_CXX_STANDARD 14) +SET(CMAKE_CXX_EXTENSIONS OFF) +SET(CMAKE_CXX_STANDARD_REQUIRED ON) + FIND_PACKAGE(precice REQUIRED CONFIG) ADD_EXECUTABLE( ${TARGET} diff --git a/quickstart/solid-cpp/clean.sh b/quickstart/solid-cpp/clean.sh index ccbff3c12..a0ed77ed3 100755 --- a/quickstart/solid-cpp/clean.sh +++ b/quickstart/solid-cpp/clean.sh @@ -1,4 +1,4 @@ -#bin/sh +#!/bin/sh set -e -u . ../../tools/cleaning-tools.sh diff --git a/tools/check-size.sh b/tools/check-size.sh index 9c0300c04..e6d071382 100755 --- a/tools/check-size.sh +++ b/tools/check-size.sh @@ -12,8 +12,8 @@ NOCOLOR='\033[0m' IGNORE="tools" tutorials=$(find . -maxdepth 1 -type d -not -name ".*" | grep -vE $IGNORE | sed "s/^.\///") -echo "Limit for regular images: "${MAXIMUMSIZE}" kb" -echo "Limit for gifs: "${MAXIMUMGIFSIZE}" kb" +echo "Limit for regular images: ${MAXIMUMSIZE} kb" +echo "Limit for gifs: ${MAXIMUMGIFSIZE} kb" # For all tutorials do for tutorial in $tutorials; do images=$(find ./"${tutorial}"/images -type f 2> /dev/null | sed "s/^.\///") diff --git a/tools/check.sh b/tools/check.sh index ef3325d1b..e78121b18 100755 --- a/tools/check.sh +++ b/tools/check.sh @@ -5,13 +5,13 @@ CODE=0 # Check tutorials IGNORE="tools|quickstart" -tutorials=$(find -maxdepth 1 -type d -not -name ".*" | grep -vE $IGNORE | sed "s/^.\///") +tutorials=$(find . -maxdepth 1 -type d -not -name ".*" | grep -vE $IGNORE | sed "s/^.\///") for tutorial in $tutorials; do # Check permalinks - docs=$(find ./$tutorial -maxdepth 1 -type f -name "*.md" | xargs grep -l "permalink:" | sed "s/^.\///") + docs=$(find "./$tutorial" -maxdepth 1 -type f -name "*.md" -print0 | xargs grep -l "permalink:" | sed "s/^.\///") for doc in $docs; do - link=$(grep "permalink:" $doc | sed "s/permalink: \+//") + link=$(grep "permalink:" "$doc" | sed "s/permalink: \+//") prefix="tutorials-$tutorial" if ! [[ $link =~ ^$prefix ]]; then @@ -25,7 +25,7 @@ for tutorial in $tutorials; do echo done - images=$(find ./$tutorial/images -type f 2> /dev/null | sed "s/^.\///") + images=$(find "./$tutorial/images" -type f 2> /dev/null | sed "s/^.\///") prefix="tutorials-$tutorial-" for img in $images; do if ! [[ $img =~ ^$tutorial/images/$prefix ]]; then @@ -40,9 +40,9 @@ for tutorial in $tutorials; do done # Check quickstart -docs=$(find ./quickstart -maxdepth 1 -type f -name "*.md" | xargs grep -l "permalink:" | sed "s/^.\///") +docs=$(find ./quickstart -maxdepth 1 -type f -name "*.md" -print0 | xargs grep -l "permalink:" | sed "s/^.\///") for doc in $docs; do - link=$(grep "permalink:" $doc | sed "s/permalink: \+//") + link=$(grep "permalink:" "$doc" | sed "s/permalink: \+//") prefix="quickstart" if ! [[ $link =~ ^$prefix ]]; then diff --git a/tools/clean-tutorial-base.sh b/tools/clean-tutorial-base.sh index dd6fc4f26..6661e6561 100755 --- a/tools/clean-tutorial-base.sh +++ b/tools/clean-tutorial-base.sh @@ -1,6 +1,7 @@ #!/bin/sh set -e -u +# shellcheck disable=SC1091 . ../tools/cleaning-tools.sh clean_tutorial . diff --git a/turek-hron-fsi3/README.md b/turek-hron-fsi3/README.md index 517d7148b..c4064bebb 100644 --- a/turek-hron-fsi3/README.md +++ b/turek-hron-fsi3/README.md @@ -5,6 +5,8 @@ keywords: OpenFOAM, deal.II, verification summary: The Turek-Hron FSI cases are well-established numerical benchmarks and, therefore, well suited for verification of preCICE itself and the used adapters. In this tutorial, we focus on the FSI3 case, which presents the most challenging case in terms of added mass. Please note that the meshes of this case are significantly finer than for other tutorials. Running the simulation might take a few hours. We do not recommend to run this tutorials as your first preCICE tutorial. --- +{% include note.html content="Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/turek-hron-fsi3). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html)." %} + ## Setup The setup is shown schematically here: @@ -17,24 +19,26 @@ For more information please refer to the original publication of the benchmark [ Fluid participant: -* OpenFOAM. For more information, have a look at the [OpenFOAM adapter documentation](adapter-openfoam-overview.html). +* OpenFOAM. For more information, have a look at the [OpenFOAM adapter documentation](https://www.precice.org/adapter-openfoam-overview.html). {% include important.html content="For the parabolic inflow profile, this tutorial requires groovyBC. groovyBC is part of swak4Foam. You can find more explanations in [openfoamwiki.net](https://openfoamwiki.net/index.php/Contrib/swak4Foam) or get it from an [unofficial GitHub mirror](https://github.com/Unofficial-Extend-Project-Mirror/openfoam-extend-swak4Foam-dev.git). Please follow the building instructions there." %} Solid participant: -* deal.II. For more information, have a look at the [deal.II adapter documentation](adapter-dealii-overview.html). This tutorial requires the nonlinear solid solver. Please copy the nonlinear solver executable to the `solid-dealii` folder or make it discoverable at runtime and update the `solid-dealii/run.sh` script. +* deal.II. For more information, have a look at the [deal.II adapter documentation](https://www.precice.org/adapter-dealii-overview.html). This tutorial requires the nonlinear solid solver. Please copy the nonlinear solver executable to the `solid-dealii` folder or make it discoverable at runtime and update the `solid-dealii/run.sh` script. ## Running the Simulation Open two separate terminals and start each participant by calling the respective run script. -``` +```bash cd fluid-openfoam ./run.sh ``` + and -``` + +```bash cd solid-dealii ./run.sh ``` @@ -46,7 +50,6 @@ You may adjust the end time in the `precice-config.xml`, or interupt the executi In the first few timesteps, many coupling iterations are required for convergence. Don't lose hope, things get better quickly. - ## Post-processing You can visualize the results of the coupled simulation using e.g. ParaView. Fluid results are in the OpenFOAM format and you may load the `fluid-openfoam.foam` file. Solid results are in VTK format. @@ -57,7 +60,6 @@ There is an [known issue](https://github.com/precice/openfoam-adapter/issues/26) Moreover, as we defined a watchpoint at the flap tip (see `precice-config.xml`), we can plot it with gnuplot using the script `plot-displacement.sh`. The resulting graph shows the vertical (y) displacement of the tip of the flap. - ![FSI3 watchpoint](images/tutorials-turek-hron-fsi3-tip-plot.png) Before running the simulation again, you may want to cleanup any result files using the script `clean-tutorial.sh`. @@ -65,11 +67,13 @@ Before running the simulation again, you may want to cleanup any result files us ## Mesh refinement In `fluid-openfoam/system/`, we provide three different fluid meshes: + * `blockMeshDict`: the default mesh with approximately 21k cells, * `blockMeshDict_refined`: a refined mesh with approximately 38k cells, * `blockMeshDict_double_refined`: a refined mesh with approximately 46k cells. If you want to use one of the two refined meshes, simply swap the `blockMeshDict`: + ```bash mv blockMeshDict blockMeshDict_original mv blockMeshDict_refined blockMeshDict @@ -82,7 +86,7 @@ For the double-refined mesh, it is wisely to use local basis functions in the RB support-radius="0.011" constraint="consistent" /> ``` -You can find more information on RBF data mapping in the [documentation](configuration-mapping.html#radial-basis-function-mapping). +You can find more information on RBF data mapping in the [documentation](https://www.precice.org/configuration-mapping.html#radial-basis-function-mapping). ## References