Skip to content
Snippets Groups Projects
Commit 08e177f3 authored by Anna Mareike Kostelecky's avatar Anna Mareike Kostelecky
Browse files

[exercise][grid] minor changes to README for better readability

parent 75a50941
No related branches found
No related tags found
1 merge request!166[grid][exercise] update grid exercise
Pipeline #30400 waiting for manual action
...@@ -10,8 +10,8 @@ Here we will expand on what we've covered in the basics exercise, and the proble ...@@ -10,8 +10,8 @@ Here we will expand on what we've covered in the basics exercise, and the proble
* Navigate to the directory `dumux-course/exercises/exercise-grids/` * Navigate to the directory `dumux-course/exercises/exercise-grids/`
We'll be editing the following files during this exercise: We'll be editing the following files during this exercise:
* The __input file__: `params.input` , * The __input file__: `params.input`,
* the __problem file__: `problem.hh` , * the __problem file__: `problem.hh`,
* and the __properties file__: `properties.hh`. * and the __properties file__: `properties.hh`.
Currently our grid is defined using the following input parameters in the input file: Currently our grid is defined using the following input parameters in the input file:
...@@ -22,15 +22,17 @@ UpperRight = 60 40 ...@@ -22,15 +22,17 @@ UpperRight = 60 40
Cells = 24 16 Cells = 24 16
``` ```
The upper right point of our domain is defined using the first parameter, and all directions are split into a number of equal sized cells defined by the second parameter. The upper right point of our domain is defined using the first parameter, and all directions are split into a number of equally sized cells defined by the second parameter.
As you may have noticed, the resolution of our grid isn't quite optimal, and a finer grid could help to show a more realistic picture of the physics. As you may have noticed, the resolution of our grid isn't quite optimal. A finer grid could help to show a more realistic picture of the physics.
<br><br> <br><br>
### Task 1: Applying a Global Refinement ### Task 1: Applying a Global Refinement
<hr> <hr>
A simple strategy for addressing this resolution issue would be a global refinement. A simple strategy for addressing this resolution issue would be a global refinement.
In the Grid section of your input file, you can add a parameter "Refinement" which will apply a global refinement to the grid you provided. A refinement of value 2 will split each cell into two cells per dimension. In the `[Grid]` section of your input file, you can add a parameter `Refinement`.
This will apply a global refinement to the grid you provided. A refinement of value 2 will split each cell into two cells per dimension.
* > __Task 1__: Apply a global refinement of value 2. Make note of the increase in simulation run time. * > __Task 1__: Apply a global refinement of value 2. Make note of the increase in simulation run time.
...@@ -42,7 +44,7 @@ The simulation should take much more time. Luckily there are other ways to resol ...@@ -42,7 +44,7 @@ The simulation should take much more time. Luckily there are other ways to resol
Up until now, we have used a basic uniform structured grid. This grid is provided in the Dune environment and is called the YASP grid (Yet Another Structured Parallel Grid). Up until now, we have used a basic uniform structured grid. This grid is provided in the Dune environment and is called the YASP grid (Yet Another Structured Parallel Grid).
In the properties file, the grid properties are defined using the following command. In the properties file (`properties.hh`), the grid properties are defined using the following command.
```c++ ```c++
// Set the grid type // Set the grid type
...@@ -66,7 +68,7 @@ A YaspGrid, of dimension `dim` is used, and the coordinate system `Dune::TensorP ...@@ -66,7 +68,7 @@ A YaspGrid, of dimension `dim` is used, and the coordinate system `Dune::TensorP
To use this format, we need to set the grid property in our properties file accordingly. Our problem dimension is 2 (`dim`), and we will provide the coordinates as doubles (`ctype`). To use this format, we need to set the grid property in our properties file accordingly. Our problem dimension is 2 (`dim`), and we will provide the coordinates as doubles (`ctype`).
To switch the property we should replace the `Dune::YaspGrid<2>` argument with `Dune::YaspGrid<dim, Dune::TensorProductCoordinates<ctype, dim> >`, and the `dim` and `ctype` with `2` and `double` To switch the property we should replace the `Dune::YaspGrid<2>` argument with `Dune::YaspGrid<dim, Dune::TensorProductCoordinates<ctype, dim> >`, and the `dim` and `ctype` with `2` and `double`
In our input file, we can now specify more specific Grid sizing directions: Positions, Cells, and Grading, each of which can be defined per direction. In our input file (`params.input`), we can now specify more specific Grid sizing directions: Positions, Cells, and Grading, each of which can be defined per direction.
In order to redevelop the exact same grid that was build beforehand, we can enter the following parameters to the Grid section of the input file. In order to redevelop the exact same grid that was build beforehand, we can enter the following parameters to the Grid section of the input file.
...@@ -80,31 +82,32 @@ Grading0 = 1.0 ...@@ -80,31 +82,32 @@ Grading0 = 1.0
Grading1 = 1.0 Grading1 = 1.0
``` ```
* > __Task 2__: Following the format shown above, change the grid manager. Make the required changes to the input file and run the simulation. * > __Task 2__: Following the format shown above, change the grid type specified in `properties.hh`. Make the required changes to the input file and run the simulation.
<br><br> <br><br>
### Task 3: Grid Zoning and Grading ### Task 3: Grid Zoning and Grading
<hr> <hr>
The Positions0 and Positions1 parameters will segment the grid into zones split at the values provided. In this case, the X direction
will be made of one zone between 0 and 60, and the Y direction will be split into one zone between 0 and 40. The `Positions0` and `Positions1` parameters will segment the grid into zones split at the values provided. In this case, the X-direction
will be made of one zone between 0 and 60, and the Y-direction will be split into one zone between 0 and 40.
```bash ```bash
[Grid] [Grid]
Positions0 = 0 60 Positions0 = 0 60 #x-coordinate
Positions1 = 0 40 Positions1 = 0 40 #y-coordinate
``` ```
The Cells0 and Cells1 parameters will define a number of cells to each of the zones. The first number provided will be applied to the first zone. The `Cells0` and `Cells1` parameters will define a number of cells to each of the zones. The first number provided will be applied to the first zone.
In the first zone in the X direction, the domain is split into 24 cells. In the first zone in the Y direction, the domain is split into 16 cells. The first zone in X-direction is split into 24 cells. The first zone in Y-direction is split into 16 cells.
```bash ```bash
[Grid] [Grid]
Cells0 = 24 Cells0 = 24 #number of cells in x-direction
Cells1 = 16 Cells1 = 16 #number of cells in y-driection
``` ```
The Grading0 and Grading1 will apply a cell size grading throughout the zone in which it is applied. The `Grading0` and `Grading1` will apply a cell size grading throughout the zone in which it is applied.
The value 1.0 will split the domain evenly such that each cell has the same size in one direction. The value `1.0` will split the domain evenly such that each cell has the same size in this direction.
Any other values will distribute the cell size unevenly throughout the domain. Any other values will distribute the cell size unevenly throughout the domain.
These sizes are defined such that the next cell in the domain will be sized as the grading value multiplied by the previous cell size. These sizes are defined such that the next cell in the domain will be sized as the grading value multiplied by the previous cell size.
...@@ -136,14 +139,14 @@ Grading1 = 1.0 -1.3 1.3 1.0 ...@@ -136,14 +139,14 @@ Grading1 = 1.0 -1.3 1.3 1.0
### Task 4: Reading in a Structured Grid (*.dgf or *.msh grid files) ### Task 4: Reading in a Structured Grid (*.dgf or *.msh grid files)
<hr> <hr>
DuMuX can also read in grids from external files. There are two supported file types: `.dgf` grids, and `.msh` grids. DuMu$^\mathsf{X}$ can also read in grids from external files. There are two supported file types: `.dgf` grids, and `.msh` grids.
__`.dgf`__ grids (DUNE Grid Format grids) are developed within the dune environment and are often used in dumux tests. * __`.dgf`__ grids (DUNE Grid Format grids) are developed within the dune environment and are often used in dumux tests.
(see: [DUNE Grid Format grids](https://www.dune-project.org/doxygen/2.4.1/group__DuneGridFormatParser.html)) (see: [DUNE Grid Format grids](https://www.dune-project.org/doxygen/2.4.1/group__DuneGridFormatParser.html))
__`.msh`__ grids are made from the open-source Gmsh software, and is also supported by dumux. * __`.msh`__ grids are made from the open-source Gmsh software, and is also supported by dumux.
(see: [Gmsh](http://gmsh.info//) and [Gmsh reference manual](http://gmsh.info//doc/texinfo/gmsh.html)) (see: [Gmsh](http://gmsh.info//) and [Gmsh reference manual](http://gmsh.info//doc/texinfo/gmsh.html))
We can read in simple .dgf files using basic YaspGrids, but if we want to use more complicated external grids, we would need to use other grid formats, like UGGrid or ALUGrid. We can read in simple `.dgf` files using basic YaspGrids, but if we want to use more complicated external grids, we would need to use other grid formats, like `UGGrid` or `ALUGrid`.
For this example, we can rewrite our Grid Properties to develop an ALUGrid. The grid manager class takes the following form: For this example, we can rewrite our Grid Properties to develop an `ALUGrid`. The grid manager class takes the following form:
```c++ ```c++
GridManager<Dune::ALUGrid<dim, dimworld, elType, refinementType>> GridManager<Dune::ALUGrid<dim, dimworld, elType, refinementType>>
``` ```
...@@ -159,7 +162,7 @@ There are two external structured grid files located in the `grid/` folder (`gri ...@@ -159,7 +162,7 @@ There are two external structured grid files located in the `grid/` folder (`gri
### Task 5: Reading in a Unstructured Grid (*.dgf or *.msh grid files) ### Task 5: Reading in a Unstructured Grid (*.dgf or *.msh grid files)
<hr> <hr>
An example of an Unstructured grid is located in the `grid/` folder (`grid_unstructured.msh`) An example of an unstructured grid is located in the `grid/` folder (`grid_unstructured.msh`)
This grid is made up of triangles (simplices of dimension 2). This element type can be set in the grid properties section. This grid is made up of triangles (simplices of dimension 2). This element type can be set in the grid properties section.
......
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