GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/examples/biomineralization/main.cc
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 67 78 85.9%
Functions: 1 1 100.0%
Branches: 162 370 43.8%

Line Branch Exec Source
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 //
4 // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 // ## The main file
8 // This files contains the main program flow for the biomineralization example. Here we can see the programme sequence and how the system is solved using newton's method.
9 //
10 // [[content]]
11 //
12 // ### Included header files
13 // <details>
14 // [[exclude]]
15 // Some generic includes.
16 #include <config.h>
17 #include <iostream>
18 #include <dumux/io/container.hh>
19 // [[/exclude]]
20
21 // These are DUNE helper classes related to parallel computations
22 #include <dune/common/parallel/mpihelper.hh>
23
24 // The following headers include functionality related to property definition or retrieval, as well as
25 // the retrieval of input parameters specified in the input file or via the command line.
26 #include <dumux/common/properties.hh>
27 #include <dumux/common/parameters.hh>
28 #include <dumux/common/initialize.hh>
29
30 // The following files contain the nonlinear Newtown method, the linear solver and the assembler
31 #include <dumux/nonlinear/newtonsolver.hh>
32 #include <dumux/linear/istlsolvers.hh>
33 #include <dumux/linear/linearalgebratraits.hh>
34 #include <dumux/linear/linearsolvertraits.hh>
35 #include <dumux/assembly/fvassembler.hh>
36 #include <dumux/assembly/diffmethod.hh>
37
38 // The following class provides a convenient way of writing of dumux simulation results to VTK format.
39 #include <dumux/io/vtkoutputmodule.hh>
40
41 // The gridmanager constructs a grid from the information in the input or grid file. There is a specification for the different supported grid managers.
42 // Many different Dune grid implementations are supported, of which a list can be found
43 // in `gridmanager.hh`.
44 #include <dumux/io/grid/gridmanager_yasp.hh>
45
46 // We include the problem file which defines initial and boundary conditions to describe our example problem
47 //remove #include "problem.hh"
48 #include "properties.hh"
49 // </details>
50 //
51
52 // ### The main function
53 // We will now discuss the main program flow implemented within the `main` function.
54 // At the beginning of each program using Dune, an instance `Dune::MPIHelper` has to
55 // be created. Moreover, we parse the run-time arguments from the command line and the
56 // input file:
57 // [[codeblock]]
58 1 int main(int argc, char** argv) try
59 {
60 1 using namespace Dumux;
61
62 // maybe initialize MPI and/or multithreading backend
63
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Dumux::initialize(argc, argv);
64
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto& mpiHelper = Dune::MPIHelper::instance();
65
66 // parse command line arguments and input file
67
9/28
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
4 Parameters::init(argc, argv);
68 // [[/codeblock]]
69
70 // For convenience we define the type tag for this problem.
71 // The type tags contain all the properties that are needed to run the simulations.
72 1 using TypeTag = Properties::TTag::MICPColumnSimpleChemistry;
73
74 // ### Step 1: Create the grid
75 // The `GridManager` class creates the grid from information given in the input file.
76 // This can either be a grid file, or in the case of structured grids, one can specify the coordinates
77 // of the corners of the grid and the number of cells to be used to discretize each spatial direction. The latter is the case for this example.
78 // [[codeblock]]
79
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager;
80
5/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
2 gridManager.init();
81
82 // we compute on the leaf grid view
83
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 const auto& leafGridView = gridManager.grid().leafGridView();
84 // [[/codeblock]]
85
86 // ### Step 2: Setting up the problem
87 // We create and initialize the finite volume grid geometry, the problem, the linear system, including the jacobian matrix, the residual and the solution vector and the gridvariables.
88 // We need the finite volume geometry to build up the subcontrolvolumes (scv) and subcontrolvolume faces (scvf) for each element of the grid partition.
89 1 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
90
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2 auto gridGeometry = std::make_shared<GridGeometry>(leafGridView);
91
92 // We now instantiate the problem, in which we define the boundary and initial conditions.
93 1 using Problem = GetPropType<TypeTag, Properties::Problem>;
94
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 auto problem = std::make_shared<Problem>(gridGeometry);
95
96 // get some time loop parameters
97 1 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
98
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto tEnd = getParam<Scalar>("TimeLoop.TEnd");
99
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize");
100
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto dt = getParam<Scalar>("TimeLoop.DtInitial");
101
102 // We initialize the solution vector
103 1 using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
104
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 SolutionVector x;
105
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 problem->applyInitialSolution(x);
106
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 auto xOld = x;
107
108 // on the basis of this solution, we initialize the grid variables
109 1 using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
110
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry);
111
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 gridVariables->init(x);
112
113 // We initialize the vtk output module. Each model has a predefined model specific output with relevant parameters for that model.
114 // [[codeblock]]
115
8/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
4 VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name());
116 1 using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
117
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
3 vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
118
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 GetPropType<TypeTag, Properties::IOFields>::initOutputModule(vtkWriter); //!< Add model specific output fields
119 // We add permeability as a specific output
120
7/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 vtkWriter.addField(problem->getPermeability(), "Permeability");
121 // We update the output fields before write
122
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 problem->updateVtkOutput(x);
123
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 vtkWriter.write(0.0);
124 // [[/codeblock]]
125
126 // We instantiate the time loop and define an episode index to keep track of the the actual episode number
127 // [[codeblock]]
128 1 int episodeIdx = 0;
129 // We set the initial episodeIdx in the problem to zero
130
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 problem->setEpisodeIdx(episodeIdx);
131 // We set the time loop with episodes (check points)
132
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2 auto timeLoop = std::make_shared<CheckPointTimeLoop<Scalar>>(0.0, dt, tEnd);
133
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 timeLoop->setMaxTimeStepSize(maxDt);
134 // [[/codeblock]]
135
136 // ### Step 3 Setting episodes specified from file
137 // In this example we want to specify the injected reactant solutions at certain times.
138 // This is specified in an external file `injections_checkpoints.dat`.
139 // Within the following code block, the parameter file read and the time for the injection are extracted.
140 // Based on that, the checkpoints for the simulation are set.
141
142 // [[codeblock]]
143 // We use a time loop with episodes if an injection parameter file is specified in the input
144
6/14
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
5 if (hasParam("Injection.NumInjections"))
145 {
146 // We first read the times of the checkpoints from the injection file
147
4/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
4 const auto injectionCheckPoints = readFileToContainer<std::vector<double>>("injection_checkpoints.dat");
148
149 // We set the time loop with episodes of various lengths as specified in the injection file
150 // set the episode ends /check points:
151
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
4 timeLoop->setCheckPoint(injectionCheckPoints.begin(), injectionCheckPoints.end());
152
153 // We also set the initial episodeIdx in the problem to zero, as in the problem the boundary conditions depend on the episode.
154
3/6
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
3 problem->setEpisodeIdx(episodeIdx);
155 }
156
157 // If nothing specified, we do not need to use episodes
158 else
159 {
160 // In this case, we set the time loop with one big episodes
161 timeLoop->setCheckPoint(tEnd);
162 }
163 // [[/codeblock]]
164
165 // ### Step 4 Solving the instationary problem
166
167 // We create and initialize the assembler with a time loop for the transient problem.
168 // Within the time loop, we will use this assembler in each time step to assemble the linear system.
169 // Additionally the linear and non-linear solvers are set
170 // [[codeblock]]
171 1 using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>;
172
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld);
173
174 // We set the linear solver
175 1 using LinearSolver = ILUBiCGSTABIstlSolver<
176 LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>
177 >;
178
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 auto linearSolver = std::make_shared<LinearSolver>();
179
180 // We set the non-linear solver
181 1 using NewtonSolver = NewtonSolver<Assembler, LinearSolver>;
182
12/28
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 1 times.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
5 NewtonSolver nonLinearSolver(assembler, linearSolver);
183 // [[/codeblock]]
184
185 // #### The time loop
186 // We start the time loop and solve a new time step as long as `tEnd` is not reached. In every time step,
187 // the problem is assembled and solved, the solution is updated, and when a checkpoint is reached the solution
188 // is written to a new vtk file. In addition, statistics related to CPU time, the current simulation time
189 // and the time step sizes used is printed to the terminal.
190
191 // [[codeblock]]
192
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 timeLoop->start(); do
193 {
194 // We set the time and time step size to be used in the problem
195
6/12
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 275 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 275 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 275 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 275 times.
✗ Branch 17 not taken.
1650 problem->setTime( timeLoop->time() + timeLoop->timeStepSize() );
196
4/8
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 275 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 275 times.
✗ Branch 11 not taken.
1100 problem->setTimeStepSize( timeLoop->timeStepSize() );
197
198 // Solve the linear system with time step control
199
2/4
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
550 nonLinearSolver.solve(x, *timeLoop);
200
201 // Update the old solution with the one computed in this time step and move to the next one
202
1/2
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
275 xOld = x;
203
2/4
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
550 gridVariables->advanceTimeStep();
204
2/4
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
550 timeLoop->advanceTimeStep();
205
206 // We update the output fields before write
207
2/4
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
550 problem->updateVtkOutput(x);
208
209 // We write vtk output on checkpoints or every 20th timestep
210
8/8
✓ Branch 0 taken 262 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 262 times.
✓ Branch 3 taken 13 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 257 times.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 257 times.
550 if (timeLoop->timeStepIndex() % 20 == 0 || timeLoop->isCheckPoint())
211 {
212 // update the output fields before write
213
2/4
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
36 problem->updateVtkOutput(x);
214
215 // write vtk output
216
3/6
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 18 times.
✗ Branch 8 not taken.
54 vtkWriter.write(timeLoop->time());
217 }
218 // We report statistics of this time step
219
2/4
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
550 timeLoop->reportTimeStep();
220
221 // If episodes/check points are used, we count episodes and update the episode indices in the main file and the problem.
222
7/32
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 275 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 275 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 275 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 275 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 275 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
1100 if (hasParam("Injection.NumInjections") || hasParam("TimeLoop.EpisodeLength"))
223 {
224
4/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 269 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 269 times.
550 if (timeLoop->isCheckPoint())
225 {
226 6 episodeIdx++;
227 12 problem->setEpisodeIdx(episodeIdx);
228 }
229 }
230
231 // set the new time step size that is suggested by the newton solver
232
9/10
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 274 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 274 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 274 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 274 times.
✓ Branch 9 taken 275 times.
✗ Branch 10 not taken.
1375 timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize()));
233
234
4/6
✓ Branch 1 taken 275 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 274 times.
✓ Branch 7 taken 1 times.
550 } while (!timeLoop->finished());
235
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
2 timeLoop->finalize(leafGridView.comm());
236 // [[/codeblock]]
237
238
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 if (mpiHelper.rank() == 0)
239
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Parameters::print();
240
241 1 return 0;
242 }
243
244 // ### Exception handling
245 // In this part of the main file we catch and print possible exceptions that could
246 // occur during the simulation.
247 // [[details]] error handler
248 // [[codeblock]]
249 // errors related to run-time parameters
250 catch (const Dumux::ParameterException &e)
251 {
252 std::cerr << std::endl << e << " ---> Abort!" << std::endl;
253 return 1;
254 }
255 catch (const Dune::DGFException & e)
256 {
257 std::cerr << "DGF exception thrown (" << e <<
258 "). Most likely, the DGF file name is wrong "
259 "or the DGF file is corrupted, "
260 "e.g. missing hash at end of file or wrong number (dimensions) of entries."
261 << " ---> Abort!" << std::endl;
262 return 2;
263 }
264 catch (const Dune::Exception &e)
265 {
266 std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl;
267 return 3;
268 }
269 // [[/codeblock]]
270 // [[/details]]
271 // [[/content]]
272