From f28cf7e2c8162e33f7086568fe65f9594fb6e536 Mon Sep 17 00:00:00 2001 From: Ned Coltman <edward.coltman@iws.uni-stuttgart.de> Date: Wed, 1 Apr 2020 21:49:10 +0200 Subject: [PATCH] [ex-main][propertiesheader] Update README.md --- exercises/exercise-mainfile/README.md | 30 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/exercises/exercise-mainfile/README.md b/exercises/exercise-mainfile/README.md index 8119e960..68257ed9 100644 --- a/exercises/exercise-mainfile/README.md +++ b/exercises/exercise-mainfile/README.md @@ -33,12 +33,17 @@ Locate all the files you will need for this exercise * The __main file__ for the __compressible, stationary__ problem : `exercise1pbmain.cc` * The __main file__ for the __compressible, instationary__ problem : `exercise1pcmain.cc` * The shared __problem file__: `1pproblem.hh` +* The shared __properties file__: `properties.hh` * The shared __spatial parameters file__: `1pspatialparams.hh` * The __input file__ for the __incompressible, stationary__ problem: `exercise_mainfile_a.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` -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 second problem is a nonlinear problem and uses newton's method to solve the system. The third problem is nonlinear and additionally instationary. Therefore, a time loop needs to be included in the main file. +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 second problem is a nonlinear problem and uses newton's method to solve the system. +The third problem is nonlinear and additionally instationary. +Therefore, a time loop needs to be included in the main file. The general structure of any main file in DuMuX is: @@ -48,7 +53,8 @@ The general structure of any main file in DuMuX is: // define the type tag for this problem using TypeTag = Properties::TTag::OnePCompressible; ``` -The `TypeTag` is created in the `1pproblem.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 `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. * A gridmanager tries to create the grid either from a grid file or the input file: @@ -56,7 +62,8 @@ The `TypeTag` is created in the `1pproblem.hh`. There, you can see that it inher GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; gridManager.init(); ``` -* 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: +* 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: ```c++ // create the finite volume grid geometry @@ -86,7 +93,8 @@ IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields 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. If the problem is time dependent, we additionally need a time loop. An example for that is given in `exercise1pcmain.cc`: +* 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`: ```c++ // get some time loop parameters @@ -179,13 +187,21 @@ paraview 1p_incompressible_stationary.pvd ### Task 3: Analytical differentiation <hr> -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. 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. +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. +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. -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. To implement that, follow the tips in the `exercise1pamain.cc` and the `1pproblem.hh` marked by: +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. +To implement that, follow the tips in the `exercise1pamain.cc` and the `properties.hh` marked by: ```c++ // TODO: dumux-course-task 3 ``` -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. You just need to include `incompressiblelocalresidual.hh` in your `1pproblem.hh` and use that instead of the `immisciblelocalresidual.hh` which is used as a default for all immiscible models. +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. +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. Additionally, you need to set the differentiation method in the main file `exercise1pamain.cc` to analytic. -- GitLab