Skip to content
Snippets Groups Projects
Commit 8a6ebaab authored by Katharina Heck's avatar Katharina Heck
Browse files

Merge branch 'fix/readme-for-release-3-5' into 'master'

[readme][exercise-mainfile] adapt to changes for release 3.5

See merge request !119
parents 7f135069 baec331b
No related branches found
No related tags found
1 merge request!119[readme][exercise-mainfile] adapt to changes for release 3.5
Pipeline #14431 passed
...@@ -39,10 +39,10 @@ Locate all the files you will need for this exercise ...@@ -39,10 +39,10 @@ Locate all the files you will need for this exercise
* The __input file__ for the __compressible, stationary__ problem: `exercise_mainfile_b.input` * The __input file__ for the __compressible, stationary__ problem: `exercise_mainfile_b.input`
* The __input file__ for the __compressible, instationary__ problem: `exercise_mainfile_c.input` * The __input file__ for the __compressible, instationary__ problem: `exercise_mainfile_c.input`
Please pay special attention to the similarities and differences in the three main files. Please pay special attention to the similarities and differences in the three main files.
The first main file is solved linearly and does not need a newton solver or any other nonlinear solver method. The first main file is solved linearly and does not need a newton solver or any other nonlinear solver method.
The second problem is a nonlinear problem and uses newton's method to solve the system. The second problem is a nonlinear problem and uses newton's method to solve the system.
The third problem is nonlinear and additionally instationary. The third problem is nonlinear and additionally instationary.
Therefore, a time loop needs to be included in the main file. Therefore, a time loop needs to be included in the main file.
The general structure of any main file in DuMuX is: The general structure of any main file in DuMuX is:
...@@ -53,7 +53,7 @@ The general structure of any main file in DuMuX is: ...@@ -53,7 +53,7 @@ The general structure of any main file in DuMuX is:
// define the type tag for this problem // define the type tag for this problem
using TypeTag = Properties::TTag::OnePCompressible; using TypeTag = Properties::TTag::OnePCompressible;
``` ```
The `TypeTag` is created in the `properties.hh`. There, you can see that it inherits from the __OneP__ and additionally from the __CCTpfaModel__. The `TypeTag` is created in the `properties.hh`. There, you can see that it inherits from the __OneP__ and additionally from the __CCTpfaModel__.
The latter defines the discretization method, which is in this case the cell-centered tpfa method. The latter defines the discretization method, which is in this case the cell-centered tpfa method.
* A gridmanager tries to create the grid either from a grid file or the input file: * A gridmanager tries to create the grid either from a grid file or the input file:
...@@ -62,14 +62,13 @@ The latter defines the discretization method, which is in this case the cell-cen ...@@ -62,14 +62,13 @@ The latter defines the discretization method, which is in this case the cell-cen
GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager;
gridManager.init(); gridManager.init();
``` ```
* We create the finite volume grid geometry, the problem, solution vector and the grid variables and initialize them. * We create the finite volume grid geometry, the problem, solution vector and the grid variables and initialize them.
Additionally, we initialize the vtk output. Each model has a predefined model specific output with relevant parameters for that model: Additionally, we initialize the vtk output. Each model has a predefined model specific output with relevant parameters for that model:
```c++ ```c++
// create the finite volume grid geometry // create the finite volume grid geometry
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>; using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); auto gridGeometry = std::make_shared<GridGeometry>(leafGridView);
fvGridGeometry->update();
// the problem (initial and boundary conditions) // the problem (initial and boundary conditions)
using Problem = GetPropType<TypeTag, Properties::Problem>; using Problem = GetPropType<TypeTag, Properties::Problem>;
...@@ -93,7 +92,7 @@ IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields ...@@ -93,7 +92,7 @@ IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(0.0); vtkWriter.write(0.0);
``` ```
* Then, we need to assemble and solve the system. Depending on the problem, this can be done with a linear solver or a nonlinear solver. * Then, we need to assemble and solve the system. Depending on the problem, this can be done with a linear solver or a nonlinear solver.
If the problem is time dependent, we additionally need a time loop. An example for that is given in `exercise1pcmain.cc`: If the problem is time dependent, we additionally need a time loop. An example for that is given in `exercise1pcmain.cc`:
```c++ ```c++
...@@ -187,21 +186,21 @@ paraview 1p_incompressible_stationary.pvd ...@@ -187,21 +186,21 @@ paraview 1p_incompressible_stationary.pvd
### Task 3: Analytical differentiation ### Task 3: Analytical differentiation
<hr> <hr>
In the input file `exercise_1p_a.input`, you will see that there is a variable `BaseEpsilon`. In the input file `exercise_1p_a.input`, you will see that there is a variable `BaseEpsilon`.
This defines the base for the epsilon used in the numeric differentiation. This defines the base for the epsilon used in the numeric differentiation.
If that value is too small, you will see that the solution of the numeric differentiation is not correct. If that value is too small, you will see that the solution of the numeric differentiation is not correct.
Change that value to $`1 \cdot 10^{-15}`$ and have a look at the solution. Change that value to $`1 \cdot 10^{-15}`$ and have a look at the solution.
For the incompressible one phase problem, it is also possible to have an analytic solution method. For the incompressible one phase problem, it is also possible to have an analytic solution method.
In this case, the epsilon does not play a role anymore, since the derivatives are calculated analytically. In this case, the epsilon does not play a role anymore, since the derivatives are calculated analytically.
To implement that, follow the tips in the `exercise1pamain.cc` and the `properties.hh` marked by: To implement that, follow the tips in the `exercise1pamain.cc` and the `properties.hh` marked by:
```c++ ```c++
// TODO: dumux-course-task 3 // TODO: dumux-course-task 3
``` ```
For the analytic solution of your immiscible problem, you need analytic solutions for the derivatives of the jacobian. For the analytic solution of your immiscible problem, you need analytic solutions for the derivatives of the jacobian.
For that, we have a special local residual, the `OnePIncompressibleLocalResidual` which provides that. For that, we have a special local residual, the `OnePIncompressibleLocalResidual` which provides that.
You just need to include `incompressiblelocalresidual.hh` in your `properties.hh` You just need to include `incompressiblelocalresidual.hh` in your `properties.hh`
and use that instead of the `immisciblelocalresidual.hh` which is used as a default for all immiscible models. and use that instead of the `immisciblelocalresidual.hh` which is used as a default for all immiscible models.
Additionally, you need to set the differentiation method in the main file `exercise1pamain.cc` to analytic. Additionally, you need to set the differentiation method in the main file `exercise1pamain.cc` to analytic.
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