3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/nonequilibrium/newtonsolver.hh
Go to the documentation of this file.
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
27#ifndef DUMUX_NONEQUILIBRIUM_NEWTON_SOLVER_HH
28#define DUMUX_NONEQUILIBRIUM_NEWTON_SOLVER_HH
29
31
32namespace Dumux {
39template <class Assembler, class LinearSolver>
40class NonEquilibriumNewtonSolver : public NewtonSolver<Assembler, LinearSolver>
41{
43
44 using typename ParentType::Backend;
45 using typename ParentType::SolutionVector;
46 static constexpr bool assemblerExportsVariables = Detail::exportsVariables<Assembler>;
47
48public:
49 using ParentType::ParentType;
50 using typename ParentType::Variables;
51
52 void newtonEndStep(Variables &varsCurrentIter,
53 const SolutionVector &uLastIter) final
54 {
55 ParentType::newtonEndStep(varsCurrentIter, uLastIter);
56 const auto& uCurrentIter = Backend::dofs(varsCurrentIter);
57
58 // Averages the face velocities of a vertex. Implemented in the model.
59 // The velocities are stored in the model.
60 if constexpr(!assemblerExportsVariables)
61 this->assembler().gridVariables().calcVelocityAverage(uCurrentIter);
62 else
63 varsCurrentIter.calcVelocityAverage(uCurrentIter);
64 }
65};
66
67} // end namespace Dumux
68#endif
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Detail::AssemblerVariables< Assembler > Variables
export the type of variables that represent a numerical solution
Definition: common/pdesolver.hh:82
const Assembler & assembler() const
Access the assembler.
Definition: common/pdesolver.hh:121
An implementation of a Newton solver.
Definition: nonlinear/newtonsolver.hh:216
virtual void newtonEndStep(Variables &vars, const SolutionVector &uLastIter)
Indicates that one Newton iteration was finished.
Definition: nonlinear/newtonsolver.hh:638
typename Backend::DofVector SolutionVector
Definition: nonlinear/newtonsolver.hh:221
VariablesBackend< typename ParentType::Variables > Backend
Definition: nonlinear/newtonsolver.hh:220
A nonequilibrium specific newton solver.
Definition: porousmediumflow/nonequilibrium/newtonsolver.hh:41
void newtonEndStep(Variables &varsCurrentIter, const SolutionVector &uLastIter) final
Indicates that one Newton iteration was finished.
Definition: porousmediumflow/nonequilibrium/newtonsolver.hh:52
Reference implementation of a Newton solver.