28#ifndef EWOMS_PVS_NEWTON_METHOD_HH
29#define EWOMS_PVS_NEWTON_METHOD_HH
37template <
class TypeTag,
class MyTypeTag>
38struct DiscNewtonMethod;
50template <
class TypeTag>
62 enum { numPhases = FluidSystem::numPhases };
65 enum { pressure0Idx = Indices::pressure0Idx };
66 enum { switch0Idx = Indices::switch0Idx };
80 PrimaryVariables& nextValue,
81 const PrimaryVariables& currentValue,
82 const EqVector& update,
86 nextValue = currentValue;
93 Scalar sumSatDelta = 0.0;
94 Scalar maxSatDelta = 0.0;
95 for (
unsigned phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx) {
96 if (!currentValue.phaseIsPresent(phaseIdx))
99 maxSatDelta = std::max(std::abs(update[switch0Idx + phaseIdx]),
101 sumSatDelta += update[switch0Idx + phaseIdx];
103 maxSatDelta = std::max(std::abs(- sumSatDelta), maxSatDelta);
105 if (maxSatDelta > 0.2) {
106 Scalar alpha = 0.2/maxSatDelta;
107 for (
unsigned phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx) {
108 if (!currentValue.phaseIsPresent(phaseIdx))
111 nextValue[switch0Idx + phaseIdx] =
112 currentValue[switch0Idx + phaseIdx]
113 - alpha*update[switch0Idx + phaseIdx];
119 currentValue[pressure0Idx]*0.8,
120 currentValue[pressure0Idx]*1.2);
127 const SolutionVector& uLastIter)
129 ParentType::endIteration_(uCurrentIter, uLastIter);
130 this->problem().model().switchPrimaryVars_();
134 { val = std::max(minVal, std::min(val, maxVal)); }
The multi-dimensional Newton method.
Definition: newtonmethod.hh:92
A newton solver which is specific to the compositional multi-phase PVS model.
Definition: pvsnewtonmethod.hh:52
PvsNewtonMethod(Simulator &simulator)
Definition: pvsnewtonmethod.hh:69
void updatePrimaryVariables_(unsigned, PrimaryVariables &nextValue, const PrimaryVariables ¤tValue, const EqVector &update, const EqVector &)
Update a single primary variables object.
Definition: pvsnewtonmethod.hh:79
void clampValue_(Scalar &val, Scalar minVal, Scalar maxVal) const
Definition: pvsnewtonmethod.hh:133
void endIteration_(SolutionVector &uCurrentIter, const SolutionVector &uLastIter)
Indicates that one Newton iteration was finished.
Definition: pvsnewtonmethod.hh:126
friend ParentType
Definition: pvsnewtonmethod.hh:74
Definition: blackoilmodel.hh:72
Definition: blackoilboundaryratevector.hh:37
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:235
Declares the properties required for the compositional multi-phase primary variable switching model.