13#ifndef DUMUX_RICHARDS_NEWTON_SOLVER_HH 
   14#define DUMUX_RICHARDS_NEWTON_SOLVER_HH 
   18#include <dune/common/parallel/communication.hh> 
   19#include <dune/common/parallel/mpihelper.hh> 
   37          class Comm = Dune::Communication<Dune::MPIHelper::MPICommunicator> >
 
   40    using Scalar = 
typename Assembler::Scalar;
 
   42    using Indices = 
typename Assembler::GridVariables::VolumeVariables::Indices;
 
   43    enum { pressureIdx = Indices::pressureIdx };
 
   50    using ParentType::ParentType;
 
   64                        const SolutionVector &uLastIter,
 
   65                        const ResidualVector &deltaU) 
final 
   67        auto uCurrentIter = uLastIter;
 
   68        Backend::axpy(-1.0, deltaU, uCurrentIter);
 
   74            const auto& gridGeometry = this->
assembler().gridGeometry();
 
   75            auto fvGeometry = 
localView(gridGeometry);
 
   76            for (
const auto& element : elements(gridGeometry.gridView()))
 
   78                fvGeometry.bindElement(element);
 
   80                for (
auto&& scv : scvs(fvGeometry))
 
   82                    auto dofIdxGlobal = scv.dofIndex();
 
   85                    const auto& spatialParams = this->
assembler().problem().spatialParams();
 
   86                    const auto elemSol = 
elementSolution(element, uCurrentIter, gridGeometry);
 
   88                    const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol);
 
   89                    const Scalar pcMin = fluidMatrixInteraction.pc(1.0);
 
   90                    const Scalar pw = uLastIter[dofIdxGlobal][pressureIdx];
 
   92                    const Scalar pn = max(this->
assembler().problem().nonwettingReferencePressure(), pw + pcMin);
 
   93                    const Scalar pcOld = pn - pw;
 
   94                    const Scalar SwOld = max(0.0, fluidMatrixInteraction.sw(pcOld));
 
   97                    const Scalar pwMin = pn - fluidMatrixInteraction.pc(SwOld - 0.2);
 
   98                    const Scalar pwMax = pn - fluidMatrixInteraction.pc(SwOld + 0.2);
 
  102                    uCurrentIter[dofIdxGlobal][pressureIdx] = clamp(uCurrentIter[dofIdxGlobal][pressureIdx], pwMin, pwMax);
 
 
 
Base class for linear solvers.
Definition solver.hh:27
typename Assembler::ResidualType ResidualVector
Definition nonlinear/newtonsolver.hh:189
int numSteps_
actual number of steps done so far
Definition nonlinear/newtonsolver.hh:888
bool enableResidualCriterion() const
Definition nonlinear/newtonsolver.hh:878
NewtonSolver(std::shared_ptr< Assembler > assembler, std::shared_ptr< LinearSolver > linearSolver, const Communication &comm=Dune::MPIHelper::getCommunication(), const std::string ¶mGroup="", const std::string ¶mGroupName="Newton", int verbosity=2)
Definition nonlinear/newtonsolver.hh:209
virtual void solutionChanged_(Variables &vars, const SolutionVector &uCurrentIter)
Update solution-dependent quantities like grid variables after the solution has changed.
Definition nonlinear/newtonsolver.hh:856
typename Backend::DofVector SolutionVector
Definition nonlinear/newtonsolver.hh:188
VariablesBackend< typename ParentType::Variables > Backend
Definition nonlinear/newtonsolver.hh:187
void computeResidualReduction_(const Variables &vars)
Definition nonlinear/newtonsolver.hh:864
const Assembler & assembler() const
Definition common/pdesolver.hh:121
Detail::PDESolver::AssemblerVariables< Assembler > Variables
Definition common/pdesolver.hh:71
detects which entries in the Jacobian have to be recomputed
Definition partialreassembler.hh:420
A Richards model specific Newton solver.
Definition porousmediumflow/richards/newtonsolver.hh:39
void choppedUpdate_(Variables &varsCurrentIter, const SolutionVector &uLastIter, const ResidualVector &deltaU) final
Update the current solution of the Newton method.
Definition porousmediumflow/richards/newtonsolver.hh:63
Defines all properties used in Dumux.
Element solution classes and factory functions.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition localview.hh:26
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethods::cctpfa||GridGeometry::discMethod==DiscretizationMethods::ccmpfa, CCElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for cell-centered schemes.
Definition cellcentered/elementsolution.hh:101
Reference implementation of a Newton solver.
Detects which entries in the Jacobian have to be recomputed.