version 3.10.0
Loading...
Searching...
No Matches
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-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
14
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
virtual void newtonEndStep(Variables &vars, const SolutionVector &uLastIter)
Indicates that one Newton iteration was finished.
Definition nonlinear/newtonsolver.hh:609
NewtonSolver(std::shared_ptr< Assembler > assembler, std::shared_ptr< LinearSolver > linearSolver, const Communication &comm=Dune::MPIHelper::getCommunication(), const std::string &paramGroup="", const std::string &paramGroupName="Newton", int verbosity=2)
Definition nonlinear/newtonsolver.hh:209
typename Backend::DofVector SolutionVector
Definition nonlinear/newtonsolver.hh:188
VariablesBackend< typename ParentType::Variables > Backend
Definition nonlinear/newtonsolver.hh:187
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
Definition common/pdesolver.hh:121
Detail::PDESolver::AssemblerVariables< Assembler > Variables
Definition common/pdesolver.hh:71
Defines a high-level interface for a PDESolver.
constexpr bool assemblerExportsVariables
Definition common/pdesolver.hh:35
Definition adapt.hh:17
Reference implementation of a Newton solver.