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;
50 using MaterialLaw =
typename Assembler::Problem::SpatialParams::MaterialLaw;
52 enum { pressureIdx = Indices::pressureIdx };
55 using ParentType::ParentType;
67 void choppedUpdate_(SolutionVector &uCurrentIter,
68 const SolutionVector &uLastIter,
69 const SolutionVector &deltaU)
final
71 uCurrentIter = uLastIter;
72 uCurrentIter -= deltaU;
78 const auto& gridGeometry = this->
assembler().gridGeometry();
79 for (
const auto& element : elements(gridGeometry.gridView()))
81 auto fvGeometry =
localView(gridGeometry);
82 fvGeometry.bindElement(element);
84 for (
auto&& scv : scvs(fvGeometry))
86 auto dofIdxGlobal = scv.dofIndex();
89 const auto& spatialParams = this->
assembler().problem().spatialParams();
90 const auto elemSol =
elementSolution(element, uCurrentIter, gridGeometry);
91 const auto& materialLawParams = spatialParams.materialLawParams(element, scv, elemSol);
92 const Scalar pcMin = MaterialLaw::pc(materialLawParams, 1.0);
93 const Scalar pw = uLastIter[dofIdxGlobal][pressureIdx];
95 const Scalar pn = max(this->
assembler().problem().nonWettingReferencePressure(), pw + pcMin);
96 const Scalar pcOld = pn - pw;
97 const Scalar SwOld = max(0.0, MaterialLaw::sw(materialLawParams, pcOld));
101 const Scalar pwMin = pn - MaterialLaw::pc(materialLawParams, SwOld - 0.2);
102 const Scalar pwMax = pn - MaterialLaw::pc(materialLawParams, SwOld + 0.2);
105 using std::min;
using std::max;
106 uCurrentIter[dofIdxGlobal][pressureIdx] = max(pwMin, min(uCurrentIter[dofIdxGlobal][pressureIdx], pwMax));
119 this->
assembler().updateGridVariables(uCurrentIter);
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
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
A high-level interface for a PDESolver.
Definition: common/pdesolver.hh:46
const Assembler & assembler() const
Access the assembler.
Definition: common/pdesolver.hh:83
An implementation of a Newton solver.
Definition: nonlinear/newtonsolver.hh:90
int numSteps_
actual number of steps done so far
Definition: nonlinear/newtonsolver.hh:795
bool enableResidualCriterion() const
Definition: nonlinear/newtonsolver.hh:733
void computeResidualReduction_(const SolutionVector &uCurrentIter)
Definition: nonlinear/newtonsolver.hh:726
A Richards model specific Newton solver.
Definition: porousmediumflow/richards/newtonsolver.hh:45
Declares all properties used in Dumux.
Reference implementation of the Newton solver.