-
-
Notifications
You must be signed in to change notification settings - Fork 129
Water Hammer Tutorial #660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the clean PR! See some first comments on the structure.
I have not yet looked into the codes or the parameters, I would do that once the locations of the files have converged, to not lose track of the suggestions and changes.
The 3D and 3D-3D cases run, anything with the 1D code does not at the moment, but this is probably related to my system (see also #648 (comment)).
Please add some content to the PR description as well.
water-hammer/results/I/p
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The results/ folder is very nice for your thesis, but not something for the tutorials. Eventually, this directory (with a copy of the rest) would be something for Zenodo or a separate repository on the LRZ GitLab.
We could also then take these application case guidelines into account: https://precice.org/community-guidelines-application-cases.html
water-hammer/images/plotting_all.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visualization scripts (for tutorials) should be in the root directory of the tutorial. See the structure of a tutorial in https://precice.org/community-contribute-to-precice.html#structure-of-a-tutorial
water-hammer/case-1d-3d/fluid3d-openfoam/constant/thermodynamicProperties
Outdated
Show resolved
Hide resolved
| - **Pressure** from upstream to downstream | ||
|
|
||
| This allows realistic simulation of pressure wave propagation. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something nice to have here would be the config visualization (see other tutorials for examples):
|
|
||
| ```bash | ||
| cd case-3d/fluid3d-openfoam-uncoupled && ./run.sh | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A visualization section is missing.
| --- | ||
|
|
||
| ## Setup | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to cite the original work (paper and dataset) here.
In the PR description, I would expect an overview of the changes to that.
water-hammer/README.txt
Outdated
|
|
||
| ## Setup | ||
|
|
||
| This tutorial demonstrates how to model the **water hammer phenomenon** — a transient pressure surge caused by a rapid change in flow — using **partitioned coupling** with [preCICE](https://precice.org). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of the link to preCICE (which should be clear from the context), I would expect here a problem definition and a reference to the original benchmark.
| <precice-configuration experimental="true"> | ||
| <log> | ||
| <sink | ||
| filter="%Severity% >= trace and %Rank% = 0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the final state, the logging level should be the default:
| filter="%Severity% >= trace and %Rank% = 0" | |
| filter="%Severity% > debug and %Rank% = 0" |
(same in all files)
water-hammer/README.txt
Outdated
| In one terminal, execute | ||
|
|
||
| ```bash | ||
| cd case-1d/fluid1d-python-uncoupled && ./run.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running with scipy works but throws a (maybe useful) warning:
NutilsDeprecationWarning: providing evaluation arguments as keyword arguments is deprecated, please use the "arguments" parameter instead
In /home/gc/repos/precice/tutorials/water-hammer/case-1d/fluid1d-python-uncoupled/Fluid1D.py:107
DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
In /home/gc/repos/precice/tutorials/water-hammer/case-1d/fluid1d-python-uncoupled/Fluid1D.py:111
I modified run.sh to NUTILS_MATRIX=scipy python3 Fluid1D.py and I added scipy to requirements.txt to get this.
water-hammer/results/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is failing the markdown-lint check. For now, just rename it to README.txt (but see the discussion about the location of the results directory).
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
REmove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
Remove decorative headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some first comments. I still need to run the case and look into the Nutils scripts.
|
|
||
| ddtSchemes | ||
| { | ||
| //default Euler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of commented-out options in fvSchemes and fvSolution files. Is there a reason to keep them around?
| @@ -0,0 +1,12 @@ | |||
| #!/bin/bash | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a good practice, exit when there are errors or undefined variables:
| set -e -u | |
water-hammer/README.md
Outdated
| @@ -0,0 +1,166 @@ | |||
| --- | |||
| title: Partitioned Water Hammer | |||
| keywords: OpenFOAM, Nutils, preCICE, multiscale, fluid, transient | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since "multiscale" can also refer to micro-macro coupling:
| keywords: OpenFOAM, Nutils, preCICE, multiscale, fluid, transient | |
| keywords: OpenFOAM, Nutils, preCICE, geometric-multiscale, fluid, transient |
water-hammer/README.md
Outdated
| In this tutorial, the computational domain is split into two coupled regions: a 1D pipe section and a 3D pipe section. | ||
| The coupling is performed using **preCICE**. | ||
|
|
||
| Case setup inspired by [1]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Case setup inspired by [1]. | |
| The case setup is inspired by [1]. |
water-hammer/README.md
Outdated
|
|
||
| Case setup inspired by [1]. | ||
| This tutorial extends the study conducted in [2], which implemented the water hammer benchmark using a 1D-3D coupling with preCICE. | ||
| In that study, the cross-section of the pipe was squared. It has been changed to a circular cross-section in the present tutorial. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| In that study, the cross-section of the pipe was squared. It has been changed to a circular cross-section in the present tutorial. | |
| In that study, the cross-section of the pipe was square. In this tutorial, this has been changed to a circular cross-section. |
water-hammer/README.md
Outdated
| Case setup inspired by [1]. | ||
| This tutorial extends the study conducted in [2], which implemented the water hammer benchmark using a 1D-3D coupling with preCICE. | ||
| In that study, the cross-section of the pipe was squared. It has been changed to a circular cross-section in the present tutorial. | ||
| `1D` denotes the reduced-order domain (e.g., a Nutils solver) and `3D` denotes the full 3D CFD domain (e.g., OpenFOAM). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid starting a sentence with a code snippet or number:
| `1D` denotes the reduced-order domain (e.g., a Nutils solver) and `3D` denotes the full 3D CFD domain (e.g., OpenFOAM). | |
| In the following, `1D` denotes the reduced-order domain (e.g., a Nutils solver) and `3D` denotes the full 3D CFD domain (e.g., OpenFOAM). |
water-hammer/README.md
Outdated
| In that study, the cross-section of the pipe was squared. It has been changed to a circular cross-section in the present tutorial. | ||
| `1D` denotes the reduced-order domain (e.g., a Nutils solver) and `3D` denotes the full 3D CFD domain (e.g., OpenFOAM). | ||
|
|
||
| The problem consists of a straight pipe of length `L = 1000 m` and diameter `D = 2 m`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use math mode, if you want: https://precice.org/docs-meta-cheatsheet.html#latex-math-syntax
water-hammer/README.md
Outdated
|
|
||
|  | ||
|
|
||
| preCICE configuration for the 3D-1D simulation (image generated using the [precice-config-visualizer](https://precice.org/tooling-config-visualization.html)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to duplicate:
| preCICE configuration for the 3D-1D simulation (image generated using the [precice-config-visualizer](https://precice.org/tooling-config-visualization.html)) | |
| preCICE configuration for the 3D-1D simulation: |
water-hammer/README.md
Outdated
| ## Available solvers | ||
|
|
||
| * OpenFOAM (sonicLiquidFoam). A compressible OpenFOAM solver. For more information, have a look at the [OpenFOAM adapter documentation](https://precice.org/adapter-openfoam-overview.html) | ||
| * Nutils v9. A Python-based finite element framework. For more information, see the [Nutils adapter documentation](https://precice.org/adapter-nutils.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Nutils v9. A Python-based finite element framework. For more information, see the [Nutils adapter documentation](https://precice.org/adapter-nutils.html) | |
| * Nutils. A Python-based finite element framework. For more information, see the [Nutils adapter documentation](https://precice.org/adapter-nutils.html). This Nutils solver requires Nutils v9. |
(for consistency with other tutorials)
| ./setcase.sh 3d1d | ||
| ``` | ||
|
|
||
| Open **two terminals** and start the corresponding participants for your chosen setup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default symlink is to 3d1d, but that scenario only comes next. Let's change that to 1d3d.

Checklist:
changelog-entries/<PRnumber>.md.