93 void update(
const ElementContext& elemCtx,
unsigned dofIdx,
unsigned timeIdx)
95 ParentType::update(elemCtx, dofIdx, timeIdx);
96 EnergyIntensiveQuantities::updateTemperatures_(fluidState_, elemCtx, dofIdx, timeIdx);
99 const auto& problem = elemCtx.problem();
100 const typename MaterialLaw::Params& materialParams =
101 problem.materialLawParams(elemCtx, dofIdx, timeIdx);
102 const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx);
103 Opm::Valgrind::CheckDefined(priVars);
105 Evaluation sumSat = 0.0;
106 for (
unsigned phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx) {
107 const Evaluation& Salpha = priVars.makeEvaluation(saturation0Idx + phaseIdx, timeIdx);
108 fluidState_.setSaturation(phaseIdx, Salpha);
111 fluidState_.setSaturation(numPhases - 1, 1 - sumSat);
114 MaterialLaw::capillaryPressures(pC, materialParams, fluidState_);
115 Opm::Valgrind::CheckDefined(pC);
118 MaterialLaw::relativePermeabilities(relativePermeability_, materialParams, fluidState_);
119 Opm::Valgrind::CheckDefined(relativePermeability_);
121 const Evaluation& p0 = priVars.makeEvaluation(pressure0Idx, timeIdx);
122 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
123 fluidState_.setPressure(phaseIdx, p0 + (pC[phaseIdx] - pC[0]));
125 typename FluidSystem::template ParameterCache<Evaluation> paramCache;
126 paramCache.updateAll(fluidState_);
128 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
130 const Evaluation& mu = FluidSystem::viscosity(fluidState_, paramCache, phaseIdx);
131 fluidState_.setViscosity(phaseIdx, mu);
134 const Evaluation& rho = FluidSystem::density(fluidState_, paramCache, phaseIdx);
135 fluidState_.setDensity(phaseIdx, rho);
137 mobility_[phaseIdx] = relativePermeability_[phaseIdx]/mu;
141 porosity_ = problem.porosity(elemCtx, dofIdx, timeIdx);
144 intrinsicPerm_ = problem.intrinsicPermeability(elemCtx, dofIdx, timeIdx);
147 EnergyIntensiveQuantities::update_(fluidState_, paramCache, elemCtx, dofIdx, timeIdx);
150 FluxIntensiveQuantities::update_(elemCtx, dofIdx, timeIdx);