28#ifndef EWOMS_RICHARDS_NEWTON_METHOD_HH
29#define EWOMS_RICHARDS_NEWTON_METHOD_HH
33#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
35#include <dune/common/fvector.hh>
44template <
class TypeTag>
59 enum { pressureWIdx = Indices::pressureWIdx };
60 enum { numPhases = FluidSystem::numPhases };
61 enum { liquidPhaseIdx = getPropValue<TypeTag, Properties::LiquidPhaseIndex>() };
62 enum { gasPhaseIdx = getPropValue<TypeTag, Properties::GasPhaseIndex>() };
64 using PhaseVector = Dune::FieldVector<Scalar, numPhases>;
78 PrimaryVariables& nextValue,
79 const PrimaryVariables& currentValue,
80 const EqVector& update,
84 nextValue = currentValue;
88 if (this->numIterations_ > 4)
91 const auto& problem = this->simulator_.problem();
94 const MaterialLawParams& matParams =
95 problem.materialLawParams(globalDofIdx, 0);
97 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
100 Scalar T = problem.temperature(globalDofIdx, 0);
101 fs.setTemperature(T);
109 fs.setSaturation(liquidPhaseIdx, 1.0);
110 fs.setSaturation(gasPhaseIdx, 0.0);
112 MaterialLaw::capillaryPressures(pC, matParams, fs);
117 Scalar pWOld = currentValue[pressureWIdx];
119 std::max(problem.referencePressure(globalDofIdx, 0),
120 pWOld + (pC[gasPhaseIdx] - pC[liquidPhaseIdx]));
125 fs.setPressure(liquidPhaseIdx, pWOld);
126 fs.setPressure(gasPhaseIdx, pNOld);
129 MaterialLaw::saturations(satOld, matParams, fs);
130 satOld[liquidPhaseIdx] = std::max<Scalar>(0.0, satOld[liquidPhaseIdx]);
137 fs.setSaturation(liquidPhaseIdx, satOld[liquidPhaseIdx] - 0.2);
138 fs.setSaturation(gasPhaseIdx, 1.0 - (satOld[liquidPhaseIdx] - 0.2));
139 MaterialLaw::capillaryPressures(pC, matParams, fs);
140 Scalar pwMin = pNOld - (pC[gasPhaseIdx] - pC[liquidPhaseIdx]);
142 fs.setSaturation(liquidPhaseIdx, satOld[liquidPhaseIdx] + 0.2);
143 fs.setSaturation(gasPhaseIdx, 1.0 - (satOld[liquidPhaseIdx] + 0.2));
144 MaterialLaw::capillaryPressures(pC, matParams, fs);
145 Scalar pwMax = pNOld - (pC[gasPhaseIdx] - pC[liquidPhaseIdx]);
151 Scalar pW = nextValue[pressureWIdx];
152 pW = std::max(pwMin, std::min(pW, pwMax));
153 nextValue[pressureWIdx] = pW;
The multi-dimensional Newton method.
Definition: newtonmethod.hh:92
A Richards model specific Newton method.
Definition: richardsnewtonmethod.hh:46
RichardsNewtonMethod(Simulator &simulator)
Definition: richardsnewtonmethod.hh:67
void updatePrimaryVariables_(unsigned globalDofIdx, PrimaryVariables &nextValue, const PrimaryVariables ¤tValue, const EqVector &update, const EqVector &)
Update a single primary variables object.
Definition: richardsnewtonmethod.hh:77
friend ParentType
Definition: richardsnewtonmethod.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
Contains the property declarations for the Richards model.