25#ifndef DUMUX_RICHARDS_NEWTON_SOLVER_HH
26#define DUMUX_RICHARDS_NEWTON_SOLVER_HH
43template <
class Assembler,
class LinearSolver>
46 using Scalar =
typename Assembler::Scalar;
48 using SolutionVector =
typename Assembler::ResidualType;
49 using Indices =
typename Assembler::GridVariables::VolumeVariables::Indices;
50 enum { pressureIdx = Indices::pressureIdx };
53 using ParentType::ParentType;
65 void choppedUpdate_(SolutionVector &uCurrentIter,
66 const SolutionVector &uLastIter,
67 const SolutionVector &deltaU)
final
69 uCurrentIter = uLastIter;
70 uCurrentIter -= deltaU;
76 const auto& gridGeometry = this->
assembler().gridGeometry();
77 for (
const auto& element : elements(gridGeometry.gridView()))
79 auto fvGeometry =
localView(gridGeometry);
80 fvGeometry.bindElement(element);
82 for (
auto&& scv : scvs(fvGeometry))
84 auto dofIdxGlobal = scv.dofIndex();
87 const auto& spatialParams = this->
assembler().problem().spatialParams();
88 const auto elemSol =
elementSolution(element, uCurrentIter, gridGeometry);
93 const auto fluidMatrixInteraction = Deprecated::makePcKrSw(Scalar{}, spatialParams, element, scv, elemSol);
95 const Scalar pcMin = fluidMatrixInteraction.pc(1.0);
96 const Scalar pw = uLastIter[dofIdxGlobal][pressureIdx];
98 const Scalar pn = max(this->
assembler().problem().nonwettingReferencePressure(), pw + pcMin);
99 const Scalar pcOld = pn - pw;
100 const Scalar SwOld = max(0.0, fluidMatrixInteraction.sw(pcOld));
103 const Scalar pwMin = pn - fluidMatrixInteraction.pc(SwOld - 0.2);
104 const Scalar pwMax = pn - fluidMatrixInteraction.pc(SwOld + 0.2);
108 uCurrentIter[dofIdxGlobal][pressureIdx] = clamp(uCurrentIter[dofIdxGlobal][pressureIdx], pwMin, pwMax);
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:38
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethod::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:115
A high-level interface for a PDESolver.
Definition: common/pdesolver.hh:55
const Assembler & assembler() const
Access the assembler.
Definition: common/pdesolver.hh:92
An implementation of a Newton solver.
Definition: nonlinear/newtonsolver.hh:177
virtual void solutionChanged_(const SolutionVector &uCurrentIter)
Update solution-depended quantities like grid variables after the solution has changed.
Definition: nonlinear/newtonsolver.hh:790
int numSteps_
actual number of steps done so far
Definition: nonlinear/newtonsolver.hh:871
bool enableResidualCriterion() const
Definition: nonlinear/newtonsolver.hh:809
void computeResidualReduction_(const SolutionVector &uCurrentIter)
Definition: nonlinear/newtonsolver.hh:795
A Richards model specific Newton solver.
Definition: porousmediumflow/richards/newtonsolver.hh:45
Declares all properties used in Dumux.
Reference implementation of a Newton solver.