Adress PR review issues

This commit is contained in:
Tor Harald Sandve 2017-11-22 08:31:57 +01:00 committed by Andreas Lauser
parent d27c43bf61
commit 07c2cad36c

View File

@ -538,8 +538,7 @@ namespace Opm
/** /**
* Retrieve pvtIdx of the region. * Retrieve pvtIdx of the region.
*/ */
const int int pvtIdx() const { return this->pvtIdx_; }
pvtIdx() const { return this->pvtIdx_; }
private: private:
@ -566,27 +565,29 @@ namespace Opm
cell_(cell), cell_(cell),
target_pc_(target_pc) target_pc_(target_pc)
{ {
fluidState_.setSaturation(FluidSystem::waterPhaseIdx, 0.0);
fluidState_.setSaturation(FluidSystem::oilPhaseIdx, 0.0);
fluidState_.setSaturation(FluidSystem::gasPhaseIdx, 0.0);
std::fill(pc_, pc_ + FluidSystem::numPhases, 0.0);
} }
double operator()(double s) const double operator()(double s) const
{ {
const auto& matParams = materialLawManager_.materialLawParams(cell_); const auto& matParams = materialLawManager_.materialLawParams(cell_);
fluidState_.setSaturation(phase_, s); SatOnlyFluidState fluidState;
MaterialLaw::capillaryPressures(pc_, matParams, fluidState_); fluidState.setSaturation(FluidSystem::waterPhaseIdx, 0.0);
fluidState.setSaturation(FluidSystem::oilPhaseIdx, 0.0);
fluidState.setSaturation(FluidSystem::gasPhaseIdx, 0.0);
fluidState.setSaturation(phase_, s);
double pc[FluidSystem::numPhases];
std::fill(pc, pc + FluidSystem::numPhases, 0.0);
MaterialLaw::capillaryPressures(pc, matParams, fluidState);
double sign = (phase_ == FluidSystem::waterPhaseIdx)? -1.0 : 1.0; double sign = (phase_ == FluidSystem::waterPhaseIdx)? -1.0 : 1.0;
double pc = pc_[FluidSystem::oilPhaseIdx] + sign * pc_[phase_]; double pcPhase = pc[FluidSystem::oilPhaseIdx] + sign * pc[phase_];
return pc - target_pc_; return pcPhase - target_pc_;
} }
private: private:
const MaterialLawManager& materialLawManager_; const MaterialLawManager& materialLawManager_;
const int phase_; const int phase_;
const int cell_; const int cell_;
const double target_pc_; const double target_pc_;
mutable SatOnlyFluidState fluidState_;
mutable double pc_[FluidSystem::numPhases];
}; };
template <class FluidSystem, class MaterialLawManager> template <class FluidSystem, class MaterialLawManager>
@ -694,22 +695,25 @@ namespace Opm
cell_(cell), cell_(cell),
target_pc_(target_pc) target_pc_(target_pc)
{ {
fluidState_.setSaturation(FluidSystem::waterPhaseIdx, 0.0);
fluidState_.setSaturation(FluidSystem::oilPhaseIdx, 0.0);
fluidState_.setSaturation(FluidSystem::gasPhaseIdx, 0.0);
std::fill(pc_, pc_ + FluidSystem::numPhases, 0.0);
} }
double operator()(double s) const double operator()(double s) const
{ {
const auto& matParams = materialLawManager_.materialLawParams(cell_); const auto& matParams = materialLawManager_.materialLawParams(cell_);
fluidState_.setSaturation(phase1_, s); SatOnlyFluidState fluidState;
fluidState_.setSaturation(phase2_, 1.0 - s); fluidState.setSaturation(FluidSystem::waterPhaseIdx, 0.0);
fluidState.setSaturation(FluidSystem::oilPhaseIdx, 0.0);
fluidState.setSaturation(FluidSystem::gasPhaseIdx, 0.0);
fluidState.setSaturation(phase1_, s);
fluidState.setSaturation(phase2_, 1.0 - s);
MaterialLaw::capillaryPressures(pc_, matParams, fluidState_); double pc[FluidSystem::numPhases];
std::fill(pc, pc + FluidSystem::numPhases, 0.0);
MaterialLaw::capillaryPressures(pc, matParams, fluidState);
double sign1 = (phase1_ == FluidSystem::waterPhaseIdx)? -1.0 : 1.0; double sign1 = (phase1_ == FluidSystem::waterPhaseIdx)? -1.0 : 1.0;
double pc1 = pc_[FluidSystem::oilPhaseIdx] + sign1 * pc_[phase1_]; double pc1 = pc[FluidSystem::oilPhaseIdx] + sign1 * pc[phase1_];
double sign2 = (phase2_ == FluidSystem::waterPhaseIdx)? -1.0 : 1.0; double sign2 = (phase2_ == FluidSystem::waterPhaseIdx)? -1.0 : 1.0;
double pc2 = pc_[FluidSystem::oilPhaseIdx] + sign2 * pc_[phase2_]; double pc2 = pc[FluidSystem::oilPhaseIdx] + sign2 * pc[phase2_];
return pc1 + pc2 - target_pc_; return pc1 + pc2 - target_pc_;
} }
private: private:
@ -718,8 +722,6 @@ namespace Opm
const int phase2_; const int phase2_;
const int cell_; const int cell_;
const double target_pc_; const double target_pc_;
mutable SatOnlyFluidState fluidState_;
mutable double pc_[FluidSystem::numPhases];
}; };