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];
118 clampValue_(nextValue[pressure0Idx],
119 currentValue[pressure0Idx]*0.8,
120 currentValue[pressure0Idx]*1.2);