Skip to content
Snippets Groups Projects
Commit 5f93961d authored by Ned Coltman's avatar Ned Coltman
Browse files

[exercises][ff-pm][interface] Add a further discussion to how subgrid works

parent 47cc58d3
No related branches found
No related tags found
1 merge request!153Update exercise-coupled-ff-pm
...@@ -148,23 +148,32 @@ the analytical solution of $`v_x`$ on the free flow domain. Play around with the ...@@ -148,23 +148,32 @@ the analytical solution of $`v_x`$ on the free flow domain. Play around with the
__Task C: Change the shape of interface__ __Task C: Change the shape of interface__
Now we want to include a non-flat interface between the two domains. We use `dune-subgrid` to construct two grids for the two domains from one common host grid. To do so, open `main.cc` in the subfolder `interface` again and search for `TODO: dumux-course-task 1.C`. Comment out the first code block and uncomment the second. This will instantiate a host grid and define two helper lambda functions that are used to choose elements from to host grid for the respective sub grid. In the given case, the domain is split in two haves, separated by a sinusoidal interface. Now we want to include a non-flat interface between the two domains.
We use [`dune-subgrid`](https://doi.org/10.1007/s00607-009-0067-2) to construct two grids for the two domains from one common host grid.
Our hostgrid will be a Dune-Yasp grid (`Dune::YaspGrid<2, Dune::TensorProductCoordinates<double, dim> >`)
and the bounds and resolution of the domain will be set in the `params.input`file under the group `[Grid]`.
This hostgrid, along with `elementSelector` functions defining some spatial cut of this domain, are passed to the grid manager to create each subdomain grid.
To introduce this, open `main.cc` in the subfolder `interface` again and search for `TODO: dumux-course-task 1.C`.
Comment out the first code block and uncomment the second.
This will instantiate a host grid and define two helper lambda functions that are used to choose elements from to host grid for the respective sub grid.
In the given case, the domain is split in two halves, separated by a sinusoidal interface.
```cpp ```cpp
auto elementSelectorFreeflow = [&](const auto& element) auto elementSelectorFreeflow = [&](const auto& element)
{ {
double interface = params.amplitude * std::sin(( element.geometry().center()[0] -params.offset) / params.scaling * 2.0 * M_PI) + params.baseline; double interface = params.amplitude * std::sin(( element.geometry().center()[0] - params.offset) / params.scaling * 2.0 * M_PI) + params.baseline;
return element.geometry().center()[1] > interface; return element.geometry().center()[1] > interface;
}; };
auto elementSelectorPorousMedium = [&](const auto& element) auto elementSelectorPorousMedium = [&](const auto& element)
{ {
double interface = params.amplitude * std::sin(( element.geometry().center()[0] - params.offset) / params.scaling * 2.0 * M_PI) + params.baseline; double interface = params.amplitude * std::sin(( element.geometry().center()[0] - params.offset) / params.scaling * 2.0 * M_PI) + params.baseline;
return element.geometry().center()[1] < interface; return element.geometry().center()[1] < interface;
}; };
``` ```
Make sure, that you have uncommented the lines including the grid managers in both properties files Make sure that you have uncommented the lines including the grid managers in both properties files
```cpp ```cpp
#include <dumux/io/grid/gridmanager_sub.hh> #include <dumux/io/grid/gridmanager_sub.hh>
``` ```
...@@ -197,7 +206,7 @@ The final result should look something like this: ...@@ -197,7 +206,7 @@ The final result should look something like this:
*Extra Points:* *Extra Points:*
Rather than enforcing a pressure difference across the domain, an inflow velocity profile could be set. Rather than enforcing a pressure difference across the domain, an inflow velocity profile could be set.
What changes to the boundary conditions in the free-flow domain would you make to introduce this? What conditions can be enforced on the right boundary? What changes to the left boundary conditions in the free-flow domain would you make to introduce this? What conditions can be enforced on the right boundary?
Hint: A relation between velocity and position is used for the vertical velocity component in the original form of the `initialAtPos` method. Hint: A relation between velocity and position is used for the vertical velocity component in the original form of the `initialAtPos` method.
### 2. Changing the porous medium model ### 2. Changing the porous medium model
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment