28#ifndef EWOMS_NCP_NEWTON_METHOD_HH
29#define EWOMS_NCP_NEWTON_METHOD_HH
31#include <opm/common/Exceptions.hpp>
40namespace Opm::Properties {
42template <
class TypeTag,
class MyTypeTag>
43struct DiscNewtonMethod;
54template <
class TypeTag>
70 enum { fugacity0Idx = Indices::fugacity0Idx };
71 enum { saturation0Idx = Indices::saturation0Idx };
72 enum { pressure0Idx = Indices::pressure0Idx };
73 enum { ncp0EqIdx = Indices::ncp0EqIdx };
86 void preSolve_(
const SolutionVector&,
89 const auto& constraintsMap = this->model().linearizer().constraintsMap();
90 this->lastError_ = this->error_;
97 if (dofIdx >= this->model().numGridDof() || this->model().dofTotalVolume(dofIdx) <= 0.0) {
102 if (this->enableConstraints_()) {
103 if (constraintsMap.count(dofIdx) > 0) {
110 if (ncp0EqIdx <=
eqIdx &&
eqIdx < Indices::ncp0EqIdx + numPhases) {
114 std::max(std::abs(
r[
eqIdx] * this->model().eqWeight(dofIdx,
eqIdx)),
120 this->error_ = this->comm_.max(this->error_);
124 if (this->error_ > Parameters::Get<Parameters::NewtonMaxError<Scalar>>()) {
126 " is larger than maximum allowed error of " +
127 std::to_string(Parameters::Get<Parameters::NewtonMaxError<Scalar>>()));
137 const EqVector& update,
163 alpha * update[saturation0Idx +
phaseIdx];
181 std::max(this->problem().model().minActivityCoeff(globalDofIdx,
compIdx),
195 if (this->numIterations_ < 3) {
200 const Scalar
minPhi = this->problem().model().minActivityCoeff(globalDofIdx,
compIdx);
A Newton solver specific to the NCP model.
Definition ncpnewtonmethod.hh:56
NcpNewtonMethod(Simulator &simulator)
Definition ncpnewtonmethod.hh:79
void updatePrimaryVariables_(unsigned globalDofIdx, PrimaryVariables &nextValue, const PrimaryVariables ¤tValue, const EqVector &update, const EqVector &)
Update a single primary variables object.
Definition ncpnewtonmethod.hh:134
The multi-dimensional Newton method.
Definition newtonmethod.hh:100
Defines the common properties required by the porous medium multi-phase models.
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:233
The multi-dimensional Newton method.