version 3.8
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
15#ifndef DUMUX_NONEQUILIBRIUM_NEWTON_SOLVER_HH
16#define DUMUX_NONEQUILIBRIUM_NEWTON_SOLVER_HH
17
20
21namespace Dumux {
28template <class Assembler, class LinearSolver>
29class NonEquilibriumNewtonSolver : public NewtonSolver<Assembler, LinearSolver>
30{
32
33 using typename ParentType::Backend;
34 using typename ParentType::SolutionVector;
35 static constexpr bool assemblerExportsVariables = Detail::PDESolver::assemblerExportsVariables<Assembler>;
36
37public:
38 using ParentType::ParentType;
39 using typename ParentType::Variables;
40
41 void newtonEndStep(Variables &varsCurrentIter,
42 const SolutionVector &uLastIter) final
43 {
44 ParentType::newtonEndStep(varsCurrentIter, uLastIter);
45 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 this->assembler().gridVariables().calcVelocityAverage(uCurrentIter);
51 else
52 varsCurrentIter.calcVelocityAverage(uCurrentIter);
53 }
54};
55
56} // end namespace Dumux
57#endif
An implementation of a Newton solver.
Definition: nonlinear/newtonsolver.hh:181
virtual void newtonEndStep(Variables &vars, const SolutionVector &uLastIter)
Indicates that one Newton iteration was finished.
Definition: nonlinear/newtonsolver.hh:604
typename Backend::DofVector SolutionVector
Definition: nonlinear/newtonsolver.hh:186
VariablesBackend< typename ParentType::Variables > Backend
Definition: nonlinear/newtonsolver.hh:185
A nonequilibrium specific newton solver.
Definition: porousmediumflow/nonequilibrium/newtonsolver.hh:30
void newtonEndStep(Variables &varsCurrentIter, const SolutionVector &uLastIter) final
Indicates that one Newton iteration was finished.
Definition: porousmediumflow/nonequilibrium/newtonsolver.hh:41
const Assembler & assembler() const
Access the assembler.
Definition: common/pdesolver.hh:121
Detail::PDESolver::AssemblerVariables< Assembler > Variables
export the type of variables that represent a numerical solution
Definition: common/pdesolver.hh:71
Defines a high-level interface for a PDESolver.
Definition: adapt.hh:17
Reference implementation of a Newton solver.