Skip to content
Snippets Groups Projects
Commit 86134405 authored by Kilian Weishaupt's avatar Kilian Weishaupt Committed by Ned Coltman
Browse files

[ricahrds] Clean up Newton solver

* use std::clamp
* clean up docu
* clean up includes
parent 36796f9c
No related branches found
No related tags found
1 merge request!2205[newtonsolver] Use virtual function to update the gridVars after an update of the solution
......@@ -25,7 +25,7 @@
#ifndef DUMUX_RICHARDS_NEWTON_SOLVER_HH
#define DUMUX_RICHARDS_NEWTON_SOLVER_HH
#include <dumux/common/properties.hh>
#include <algorithm>
#include <dumux/nonlinear/newtonsolver.hh>
#include <dumux/discretization/elementsolution.hh>
......@@ -37,8 +37,6 @@ namespace Dumux {
* This solver 'knows' what a 'physically meaningful' solution is
* and can thus do update smarter than the plain Newton solver.
*
* \todo make this typetag independent by extracting anything model specific from assembler
* or from possible ModelTraits.
*/
template <class Assembler, class LinearSolver>
class RichardsNewtonSolver : public NewtonSolver<Assembler, LinearSolver>
......@@ -96,14 +94,13 @@ private:
const Scalar pcOld = pn - pw;
const Scalar SwOld = max(0.0, MaterialLaw::sw(materialLawParams, pcOld));
// convert into minimum and maximum wetting phase
// pressures
// convert into minimum and maximum wetting phase pressures
const Scalar pwMin = pn - MaterialLaw::pc(materialLawParams, SwOld - 0.2);
const Scalar pwMax = pn - MaterialLaw::pc(materialLawParams, SwOld + 0.2);
// clamp the result
using std::min; using std::max;
uCurrentIter[dofIdxGlobal][pressureIdx] = max(pwMin, min(uCurrentIter[dofIdxGlobal][pressureIdx], pwMax));
using std::clamp;
uCurrentIter[dofIdxGlobal][pressureIdx] = clamp(uCurrentIter[dofIdxGlobal][pressureIdx], pwMin, pwMax);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment