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 | /*! | ||
8 | * \file | ||
9 | * \ingroup NonEquilibriumModel | ||
10 | * \brief A MpNc specific newton solver. | ||
11 | * | ||
12 | * This solver calls the velocity averaging in the model after each iteration. | ||
13 | */ | ||
14 | |||
15 | #ifndef DUMUX_NONEQUILIBRIUM_NEWTON_SOLVER_HH | ||
16 | #define DUMUX_NONEQUILIBRIUM_NEWTON_SOLVER_HH | ||
17 | |||
18 | #include <dumux/common/pdesolver.hh> | ||
19 | #include <dumux/nonlinear/newtonsolver.hh> | ||
20 | |||
21 | namespace Dumux { | ||
22 | /*! | ||
23 | * \ingroup NonEquilibriumModel | ||
24 | * \brief A nonequilibrium specific newton solver. | ||
25 | * | ||
26 | * This solver calls the velocity averaging in the problem after each iteration. | ||
27 | */ | ||
28 | template <class Assembler, class LinearSolver> | ||
29 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | class NonEquilibriumNewtonSolver : public NewtonSolver<Assembler, LinearSolver> |
30 | { | ||
31 | using ParentType = NewtonSolver<Assembler, LinearSolver>; | ||
32 | |||
33 | using typename ParentType::Backend; | ||
34 | using typename ParentType::SolutionVector; | ||
35 | static constexpr bool assemblerExportsVariables = Detail::PDESolver::assemblerExportsVariables<Assembler>; | ||
36 | |||
37 | public: | ||
38 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
5 | using ParentType::ParentType; |
39 | using typename ParentType::Variables; | ||
40 | |||
41 | 445 | void newtonEndStep(Variables &varsCurrentIter, | |
42 | const SolutionVector &uLastIter) final | ||
43 | { | ||
44 | 445 | ParentType::newtonEndStep(varsCurrentIter, uLastIter); | |
45 | 445 | const auto& uCurrentIter = Backend::dofs(varsCurrentIter); | |
46 | |||
47 | // Averages the face velocities of a vertex. Implemented in the model. | ||
48 | // The velocities are stored in the model. | ||
49 | if constexpr(!assemblerExportsVariables) | ||
50 | 1335 | this->assembler().gridVariables().calcVelocityAverage(uCurrentIter); | |
51 | else | ||
52 | varsCurrentIter.calcVelocityAverage(uCurrentIter); | ||
53 | 445 | } | |
54 | }; | ||
55 | |||
56 | } // end namespace Dumux | ||
57 | #endif | ||
58 |