Skip to content
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

Restructure quickstart #145

Merged
merged 23 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e59abf1
Add the quickstart fluid case
davidscn Jan 8, 2021
086cc7f
Add solid-cpp participant
davidscn Jan 8, 2021
d72e794
Add remaining quickstart case files
davidscn Jan 8, 2021
842f8a2
Update the solid run script
davidscn Jan 8, 2021
cb66df7
Update README and overview image
davidscn Jan 28, 2021
a88fce0
Remove unstructured quickstart case
davidscn Feb 5, 2021
77cc94f
Add brackets for bash variables and adapt removeObsoleteFolders
davidscn Mar 10, 2021
b3579aa
Apply suggestions from code review
davidscn Mar 10, 2021
415bfd6
Remove solverdummy step in quickstart
davidscn Mar 10, 2021
b7bbc86
Remove files referring to the old preCICE version from clean script
davidscn Mar 10, 2021
aa534a2
Remove exported vtks when cleaning the case
davidscn Mar 10, 2021
5dab9e8
Port case to 2D OpenFOAM and apply naming conventions
davidscn Mar 10, 2021
6c45f5a
Apply suggestions from code review
davidscn Mar 11, 2021
27e8889
Update links in 'What's next' section
davidscn Mar 11, 2021
9851eb8
Merge branch 'restructure-quickstart' of https://github.com/DavidSCN/…
davidscn Mar 11, 2021
9d7bcd6
Add a result image
davidscn Mar 11, 2021
8a18aa7
Merge branch 'develop' into restructure-quickstart
davidscn Apr 12, 2021
481aade
Rename images according to naming conventions
davidscn Apr 12, 2021
645f415
Add new cleaning tools
davidscn Apr 12, 2021
875ddd1
Apply naming conventions of quickstart images
davidscn Apr 12, 2021
5eac8fd
Restore files from develop merge conflicts
davidscn Apr 12, 2021
f7ff060
Restore files from merge conflict
davidscn Apr 12, 2021
e3f366e
Clean exported vtk files
davidscn Apr 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 35 additions & 12 deletions quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Quickstart
permalink: quickstart.html
keywords: tutorial, quickstart
summary: "Install preCICE on Linux (e.g. via a Debian package), and then couple two OpenFOAM solvers with the OpenFOAM-preCICE adapter."
summary: "Install preCICE on Linux (e.g. via a Debian package) and couple an OpenFOAM fluid solver (using the OpenFOAM-preCICE adapter) with an example rigid body solver in C++."
layout: "page"
comments: false
search: true
Expand All @@ -16,28 +16,51 @@ toc: false
## Start here

1. To get a feeling what preCICE does, watch a [short presentation](https://www.youtube.com/watch?v=FCv2FNUvKA8), a [longer training session](https://www.youtube.com/watch?v=FCv2FNUvKA8), or [click through a tutorial in your browser](http://run.precice.org/).
2. Get and install preCICE. For Linux systems, this is pretty easy. Just pick what suits you best on [this overview page](installation-overview.html). Facing any problems? [Ask for help](community-channels.html).
2. Get and install preCICE. For Linux systems, this is pretty easy, for macOS and Windows still possible with a bit more effort. Just pick what suits you best on [this overview page](installation-overview.html). Facing any problems? [Ask for help](community-channels.html).
- For example, [download](https://github.com/precice/precice/releases/latest) and install our binary package for Ubuntu 20.04 (Focal Fossa) by clicking on it or using the following commands:
```shell
wget https://github.com/precice/precice/releases/download/v2.1.1/libprecice2_2.1.1_focal.deb
sudo apt install ./libprecice2_2.1.1_focal.deb
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
```
3. Build and couple two [C++ solverdummies](https://github.com/precice/precice/tree/master/examples/solverdummies/cpp).
4. You probably want to couple a solver you are already using, such as OpenFOAM. Since many of our tutorials use it, [install OpenFOAM](adapter-openfoam-support.html).
5. Download and install the [OpenFOAM-preCICE adapter](adapter-openfoam-get.html).
6. [Couple OpenFOAM with OpenFOAM](https://github.com/precice/openfoam-adapter/wiki/Tutorial-for-CHT:-Flow-over-a-heated-plate). This testcase is part of the OpenFOAM adapter.
- If you prefer to try everything in an isolated environment, you may prefer using our [demo virtual machine](installation-vm.html).
3. We will use OpenFOAM here and in many of our tutorial cases, so [install OpenFOAM](adapter-openfoam-support.html) (most compatible version: latest ESI/OpenFOAM.com).
4. Download and install the [OpenFOAM-preCICE adapter](adapter-openfoam-get.html).
5. Couple OpenFOAM with a C++ rigid body solver. [Find the case in our tutorials](https://github.com/precice/tutorials/quickstart) and keep reading. You can either `git clone` the [tutorials repository](https://github.com/precice/tutorials), or [directly download the current state](https://github.com/precice/tutorials/archive/master.zip).

## What's next?

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](https://github.com/precice/precice/wiki#2-getting-started---tutorials).
* Watch some [preCICE videos](https://www.youtube.com/channel/UCxZdSQdmDrheEqxq8g48t6A).
* Register to our [virtual preCICE Workshop 2021](precice-workshop-2021.html).
* 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).


{% include important.html content="We are currently working on a really nice getting started page. Till then, we hope these tips already help." %}
## About the case

This tutorial deals with a fluid-structure interaction problem. The fluid part of the simulation is computed using OpenFOAM and the rigid body motion is a rigid body model (implemented in C++) with only a single degree of freedom, namely the deflection angle of the flap in the channel. The rigid body is fixed in the origin at (0,0) and the force exerted by the fluid on the rigid body structure causes an oscillatory rotation of the body. The simulation runs for 2.5 seconds. In order to gain more control over the rigid body oscillation, a rotational spring is applied at the rigid body origin. After 1.5 seconds we increase the spring constant by a factor of 8 to stabilize the coupled problem. Feel free to modify these parameters (directly in `rigid_body_solver.cpp`) and increase the simulation time (in `precice-config.xml`).

![overview](images/quickstart-setup.png)

### 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 this directory to build the `rigid_body_solver.cpp`
```
cd 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 the `run.sh` scripts (or `run.sh -parallel`, option only available for OpenFOAM) located in each participant directory. You can cleanup the simulation using `clean.sh`.


In serial, the simulation takes roughly 30 seconds to compute.

### Visualizing the results

You can visualize the simulation results of the `Fluid` participant using ParaView (use `paraFoam` to trigger the OpenFOAM native reader or load the (empty) file `Fluid.foam` into ParaView). The rigid body doesn't generate any readable output files, but the motion can be observed in the OpenFOAM data. 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 would look the following way:

![result](images/quickstart-result.png)
1 change: 1 addition & 0 deletions quickstart/clean-tutorials.sh
54 changes: 54 additions & 0 deletions quickstart/fluid-openfoam/0/U
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{

flap
{
type movingWallVelocity;
value uniform (0 0 0);
}

top
{
type noSlip;
}

bottom
{
type noSlip;
}

inlet
{
type fixedValue;
value uniform (1 0 0);
}

outlet
{
type zeroGradient;
}

front
{
type empty;
}
back
{
type empty;
}
}

// ************************************************************************* //
52 changes: 52 additions & 0 deletions quickstart/fluid-openfoam/0/p
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
flap
{
type zeroGradient;
}

top
{
type zeroGradient;
}

bottom
{
type zeroGradient;
}

inlet
{
type zeroGradient;
}

outlet
{
type fixedValue;
value uniform 0;
}

front
{
type empty;
}
back
{
type empty;
}
}

// ************************************************************************* //
53 changes: 53 additions & 0 deletions quickstart/fluid-openfoam/0/pointDisplacement
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FoamFile
{
version 2.0;
format ascii;
class pointVectorField;
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 0 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
inlet
{
type fixedValue;
value uniform (0 0 0);
}

outlet
{
type fixedValue;
value uniform (0 0 0);
}

flap
{
type fixedValue;
value $internalField;
}

top
{
type slip;
}

bottom
{
type slip;
}
front
{
type empty;
}
back
{
type empty;
}
}

// ************************************************************************* //
6 changes: 6 additions & 0 deletions quickstart/fluid-openfoam/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e -u

. ../../tools/cleaning-tools.sh

clean_openfoam .
22 changes: 22 additions & 0 deletions quickstart/fluid-openfoam/constant/dynamicMeshDict
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object dynamicMeshDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dynamicFvMesh dynamicMotionSolverFvMesh;

motionSolverLibs ("libfvMotionSolvers.so");

solver displacementLaplacian;

displacementLaplacianCoeffs {

diffusivity quadratic inverseDistance (flap);

}
14 changes: 14 additions & 0 deletions quickstart/fluid-openfoam/constant/transportProperties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location constant;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

transportModel Newtonian;

nu nu [0 2 -1 0 0 0 0 ] 0.001;
pRef pRef [1 -1 -2 0 0 0 0 ] 0.0;
11 changes: 11 additions & 0 deletions quickstart/fluid-openfoam/constant/turbulenceProperties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location constant;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

simulationType laminar;
8 changes: 8 additions & 0 deletions quickstart/fluid-openfoam/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -e -u

blockMesh
touch fluid-openfoam.foam

../../tools/run-openfoam.sh "$@"
. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs
Loading