Skip to content

Volume-coupled flow tutorial #350

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

Merged
merged 42 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2332c5e
basics for new tutorial
tirgendetwas Nov 14, 2022
ee4f21e
fix blockMestDict
tirgendetwas Nov 20, 2022
178b4a7
basic components
tirgendetwas Nov 27, 2022
469470f
grading attempt
tirgendetwas Nov 28, 2022
73cc999
making it run and refining grading
tirgendetwas Dec 4, 2022
9073ead
attempt to use phi
tirgendetwas Dec 11, 2022
56ba21f
fix write interval and simplify configuration
tirgendetwas Dec 12, 2022
a42837f
cleanup and reveret
tirgendetwas Jan 2, 2023
cb94d9c
cleanup
tirgendetwas Jan 14, 2023
45b1a33
gitignore and delete IDE files
tirgendetwas Jan 16, 2023
f9a8680
feedback and switch mapping
tirgendetwas Feb 12, 2023
9f73a63
update README
tirgendetwas Feb 13, 2023
738e969
clean up
tirgendetwas May 5, 2023
03bb6cd
update mapping in config
tirgendetwas Jul 16, 2023
02fcc1c
make fluid mesh in openfoam the same size as fluid nutils
tirgendetwas Jul 21, 2023
e5b3bb4
porting to v3 in nutils participants
tirgendetwas Aug 10, 2023
a0c41f1
correct timestepping
tirgendetwas Aug 11, 2023
5f6e024
formatting
tirgendetwas Aug 13, 2023
45fdfb5
apply feedback from other branch to this branch
tirgendetwas Aug 13, 2023
8b0a326
groundwork
tirgendetwas Feb 19, 2023
bd81e41
tutorial before adding zones (not working)
tirgendetwas Mar 5, 2023
6fb10ca
attempt to fix (not working)
tirgendetwas Mar 13, 2023
bd956c5
fix config
tirgendetwas Mar 17, 2023
b504290
update microwave tutorial with two cellSets
tirgendetwas May 1, 2023
5f4fd88
adjust dummy solver and tutorial to reading Velocity
tirgendetwas Jul 24, 2023
3c3f88e
cleanup and renaming dummy solver
tirgendetwas Jul 31, 2023
b828bd3
renaming
tirgendetwas Jul 31, 2023
6417966
delete old tutorial
tirgendetwas Jul 31, 2023
2c734b2
clean up
tirgendetwas Aug 4, 2023
9a8ccb1
formatting
tirgendetwas Aug 4, 2023
c1e5e1c
port from v2 to v3
tirgendetwas Aug 10, 2023
6e8d30e
cleanup forgotten files
tirgendetwas Aug 10, 2023
4c8ee96
apply feedback
tirgendetwas Aug 11, 2023
9b78d54
README for tutorial case
tirgendetwas Aug 13, 2023
7d5c836
small fix
tirgendetwas Aug 13, 2023
0310219
linting errors
tirgendetwas Aug 13, 2023
8904b51
attempt to fix error
tirgendetwas Aug 13, 2023
aab43bb
Merge branch 'develop' into volume_coupled_flow
MakisH Aug 15, 2023
17d9775
Revert channel-transport mapping to RBF
MakisH Aug 15, 2023
75d8462
Add dimensions to meshes
MakisH Aug 15, 2023
e44cb1c
change README tutorial link
tirgendetwas Aug 16, 2023
a52f774
Rename dummy to source
MakisH Aug 16, 2023
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
65 changes: 65 additions & 0 deletions volume-coupled-flow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: Volume-coupled flow
permalink: tutorials-volume-coupled-flow.html
keywords: volume coupling, OpenFOAM, source terms
summary: A dummy source participant is coupled to a fluid in a uni-directional way over a region of the domain. The coupling enforces source terms on that region.
---

{% note %}
Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/master/volume-coupled-flow). Read how in the [tutorials introduction](https://www.precice.org/tutorials.html).
{% endnote %}

## Setup

We introduce flow into a fluid through a square-shaped source located between $$ (3.0, 1.0) $$ and $$ (3.5, 1.5) $$. The velocity at the source is constant in the x component $$ (U.x() = 10.0) $$.

The state of the $$ U.x() $$ of the fluid at $$ t = 0.5s $$ (the source region is highlighted):

![Ux](images/tutorials-volume-coupled-flow-Ux.png)

This case is a convenient starting point for volume coupling where OpenFOAM is a reading participant. The writing Nutils participant (dummy source) can be replaced by a more complex solver according to the user's needs.

## Available solvers

Fluid participant:

* OpenFOAM (buoyantPimpleFoam). For more information, have a look at the [OpenFOAM adapter documentation](https://precice.org/adapter-openfoam-overview.html).

Source participant:

* 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 v7.0.

## Running the simulation

Open two separate terminals and start the participants by calling the respective run scripts `run.sh` located in each of the participants' directory. For example:

```bash
cd fluid-openfoam
./run.sh
```

and

```bash
cd source-nutils
./run.sh
```

## Post-processing

The fluid participants generates a `.foam` file which can be visualized using, e.g., ParaView.

## Notes on the configuration

This case uses OpenFOAM's `fvOptions` to enforce source terms. Additionally, the coupled variable `U` needs to be given an alternative name in order for this to work:

```C++
FF
{
nameU U_vol;
};
```

Since OpenFOAM already uses `U`, we need to create an additional velocity variable to use specifically for the coupling. That allows us to carry the desired value over to OpenFOAM and apply it at the correct moment in the iteration. A simplified view of the workflow:

![reading-config](images/tutorials-volume-coupled-flow-config.png)
1 change: 1 addition & 0 deletions volume-coupled-flow/clean-tutorial.sh
40 changes: 40 additions & 0 deletions volume-coupled-flow/fluid-openfoam/0/T
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}

dimensions [ 0 0 0 1 0 0 0 ];

internalField uniform 300;

boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type zeroGradient;
}
lowerWall
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
defaultFaces
{
type empty;
}
}
40 changes: 40 additions & 0 deletions volume-coupled-flow/fluid-openfoam/0/U
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}

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

internalField uniform ( 0.1 0 0 );

boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type noSlip;
}
lowerWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
defaultFaces
{
type empty;
}
}
40 changes: 40 additions & 0 deletions volume-coupled-flow/fluid-openfoam/0/U_vol
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U_vol;
}

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

internalField uniform ( 0.1 0 0 );

boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
upperWall
{
type noSlip;
}
lowerWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
defaultFaces
{
type empty;
}
}
43 changes: 43 additions & 0 deletions volume-coupled-flow/fluid-openfoam/0/alphat
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object alphat;
}

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

internalField uniform 0;

boundaryField
{
inlet
{
type compressible::alphatWallFunction;
value uniform 0;
}
outlet
{
type compressible::alphatWallFunction;
value uniform 0;
}
upperWall
{
type compressible::alphatWallFunction;
value uniform 0;
}
lowerWall
{
type compressible::alphatWallFunction;
value uniform 0;
}
frontAndBack
{
type empty;
}
defaultFaces
{
type empty;
}
}
43 changes: 43 additions & 0 deletions volume-coupled-flow/fluid-openfoam/0/epsilon
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object epsilon;
}

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

internalField uniform 0.01;

boundaryField
{
inlet
{
type epsilonWallFunction;
value uniform 0.01;
}
outlet
{
type epsilonWallFunction;
value uniform 0.01;
}
upperWall
{
type epsilonWallFunction;
value uniform 0.01;
}
lowerWall
{
type epsilonWallFunction;
value uniform 0.01;
}
frontAndBack
{
type empty;
}
defaultFaces
{
type empty;
}
}
43 changes: 43 additions & 0 deletions volume-coupled-flow/fluid-openfoam/0/k
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}

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

internalField uniform 0.1;

boundaryField
{
inlet
{
type kqRWallFunction;
value uniform 0.1;
}
outlet
{
type kqRWallFunction;
value uniform 0.1;
}
upperWall
{
type kqRWallFunction;
value uniform 0.1;
}
lowerWall
{
type kqRWallFunction;
value uniform 0.1;
}
frontAndBack
{
type empty;
}
defaultFaces
{
type empty;
}
}
43 changes: 43 additions & 0 deletions volume-coupled-flow/fluid-openfoam/0/nut
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nut;
}

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

internalField uniform 0;

boundaryField
{
inlet
{
type nutkWallFunction;
value uniform 0;
}
outlet
{
type nutkWallFunction;
value uniform 0;
}
upperWall
{
type nutkWallFunction;
value uniform 0;
}
lowerWall
{
type nutkWallFunction;
value uniform 0;
}
frontAndBack
{
type empty;
}
defaultFaces
{
type empty;
}
}
Loading