Whitespace fixes and style consistency.

This commit is contained in:
Atgeirr Flø Rasmussen 2019-08-08 11:38:50 +02:00
parent 544aeea40b
commit 8977d64bc6
4 changed files with 22 additions and 22 deletions

View File

@ -128,10 +128,10 @@ public:
// extract the water and the gas saturations for convenience // extract the water and the gas saturations for convenience
Evaluation Sw = 0.0; Evaluation Sw = 0.0;
if (waterEnabled){ if (waterEnabled) {
if(priVars.primaryVarsMeaning() == PrimaryVariables::OnePhase_p){ if (priVars.primaryVarsMeaning() == PrimaryVariables::OnePhase_p) {
Sw = 1.0; Sw = 1.0;
}else{ } else {
Sw = priVars.makeEvaluation(Indices::waterSaturationIdx, timeIdx); Sw = priVars.makeEvaluation(Indices::waterSaturationIdx, timeIdx);
} }
} }
@ -140,7 +140,7 @@ public:
{ {
if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_po_Sg) { if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_po_Sg) {
// -> threephase case // -> threephase case
assert( not(priVars.primaryVarsMeaning() == PrimaryVariables::OnePhase_p) ); assert( priVars.primaryVarsMeaning() != PrimaryVariables::OnePhase_p );
Sg = priVars.makeEvaluation(Indices::compositionSwitchIdx, timeIdx); Sg = priVars.makeEvaluation(Indices::compositionSwitchIdx, timeIdx);
} else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) { } else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) {
// -> gas-water case // -> gas-water case
@ -206,11 +206,10 @@ public:
// update the Saturation functions for the blackoil solvent module. // update the Saturation functions for the blackoil solvent module.
asImp_().solventPostSatFuncUpdate_(elemCtx, dofIdx, timeIdx); asImp_().solventPostSatFuncUpdate_(elemCtx, dofIdx, timeIdx);
Evaluation SoMax=0; Evaluation SoMax = 0.0;
if(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)){ if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
SoMax = SoMax = Opm::max(fluidState_.saturation(oilPhaseIdx),
Opm::max(fluidState_.saturation(oilPhaseIdx), elemCtx.problem().maxOilSaturation(globalSpaceIdx));
elemCtx.problem().maxOilSaturation(globalSpaceIdx));
} }
// take the meaning of the switiching primary variable into account for the gas // take the meaning of the switiching primary variable into account for the gas
@ -268,7 +267,7 @@ public:
else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) { else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) {
const auto& Rv = priVars.makeEvaluation(Indices::compositionSwitchIdx, timeIdx); const auto& Rv = priVars.makeEvaluation(Indices::compositionSwitchIdx, timeIdx);
fluidState_.setRv(Rv); fluidState_.setRv(Rv);
if (FluidSystem::enableDissolvedGas()) { if (FluidSystem::enableDissolvedGas()) {
// the oil phase is not present, but we need to compute its "composition" for // the oil phase is not present, but we need to compute its "composition" for
// the gravity correction anyway // the gravity correction anyway
@ -278,7 +277,7 @@ public:
oilPhaseIdx, oilPhaseIdx,
pvtRegionIdx, pvtRegionIdx,
SoMax); SoMax);
fluidState_.setRs(Opm::min(RsMax, RsSat)); fluidState_.setRs(Opm::min(RsMax, RsSat));
} else { } else {
fluidState_.setRs(0.0); fluidState_.setRs(0.0);
@ -349,11 +348,11 @@ public:
if (rockCompressibility > 0.0) { if (rockCompressibility > 0.0) {
Scalar rockRefPressure = problem.rockReferencePressure(elemCtx, dofIdx, timeIdx); Scalar rockRefPressure = problem.rockReferencePressure(elemCtx, dofIdx, timeIdx);
Evaluation x; Evaluation x;
if(FluidSystem::phaseIsActive(oilPhaseIdx)){ if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
x = rockCompressibility*(fluidState_.pressure(oilPhaseIdx) - rockRefPressure); x = rockCompressibility*(fluidState_.pressure(oilPhaseIdx) - rockRefPressure);
}else if( FluidSystem::phaseIsActive(waterPhaseIdx) ){ } else if (FluidSystem::phaseIsActive(waterPhaseIdx)){
x = rockCompressibility*(fluidState_.pressure(waterPhaseIdx) - rockRefPressure); x = rockCompressibility*(fluidState_.pressure(waterPhaseIdx) - rockRefPressure);
}else{ } else {
x = rockCompressibility*(fluidState_.pressure(gasPhaseIdx) - rockRefPressure); x = rockCompressibility*(fluidState_.pressure(gasPhaseIdx) - rockRefPressure);
} }
porosity_ *= 1.0 + x + 0.5*x*x; porosity_ *= 1.0 + x + 0.5*x*x;

View File

@ -265,13 +265,14 @@ public:
EnergyModule::assignPrimaryVars(*this, fluidState); EnergyModule::assignPrimaryVars(*this, fluidState);
// determine the meaning of the primary variables // determine the meaning of the primary variables
if ( FluidSystem::numActivePhases() == 1 ){ if (FluidSystem::numActivePhases() == 1) {
primaryVarsMeaning_ = OnePhase_p; primaryVarsMeaning_ = OnePhase_p;
}else if ((gasPresent && oilPresent) || (onlyWater && FluidSystem::phaseIsActive(oilPhaseIdx)) ){ }
else if ((gasPresent && oilPresent) || (onlyWater && FluidSystem::phaseIsActive(oilPhaseIdx))) {
// gas and oil: both hydrocarbon phases are in equilibrium (i.e., saturated // gas and oil: both hydrocarbon phases are in equilibrium (i.e., saturated
// with the "protagonist" component of the other phase.) // with the "protagonist" component of the other phase.)
primaryVarsMeaning_ = Sw_po_Sg; primaryVarsMeaning_ = Sw_po_Sg;
} }
else if (oilPresent) { else if (oilPresent) {
// only oil: if dissolved gas is enabled, we need to consider the oil phase // only oil: if dissolved gas is enabled, we need to consider the oil phase
// composition, if it is disabled, the gas component must stick to its phase // composition, if it is disabled, the gas component must stick to its phase
@ -292,10 +293,10 @@ public:
// assign the actual primary variables // assign the actual primary variables
if (primaryVarsMeaning() == OnePhase_p) { if (primaryVarsMeaning() == OnePhase_p) {
if (waterEnabled){ if (waterEnabled) {
(*this)[waterSaturationIdx] = FsToolbox::value(fluidState.saturation(waterPhaseIdx)); (*this)[waterSaturationIdx] = FsToolbox::value(fluidState.saturation(waterPhaseIdx));
(*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(waterPhaseIdx)); (*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(waterPhaseIdx));
}else{ } else {
throw std::logic_error("Only pure ware is presently allowed"); throw std::logic_error("Only pure ware is presently allowed");
} }

View File

@ -580,9 +580,9 @@ protected:
// Use the implicit Euler time discretization // Use the implicit Euler time discretization
for (unsigned eqIdx = 0; eqIdx < numEq; ++eqIdx) { for (unsigned eqIdx = 0; eqIdx < numEq; ++eqIdx) {
double dt = elemCtx.simulator().timeStepSize(); double dt = elemCtx.simulator().timeStepSize();
assert(dt>0); assert(dt > 0);
tmp[eqIdx] -= tmp2[eqIdx]; tmp[eqIdx] -= tmp2[eqIdx];
tmp[eqIdx] *= scvVolume / dt; tmp[eqIdx] *= scvVolume / dt;
residual[dofIdx][eqIdx] += tmp[eqIdx]; residual[dofIdx][eqIdx] += tmp[eqIdx];
} }

View File

@ -762,7 +762,7 @@ public:
else else
// ask the problem to provide the next time step size // ask the problem to provide the next time step size
dt = std::min(maxTimeStepSize(), problem_->nextTimeStepSize()); dt = std::min(maxTimeStepSize(), problem_->nextTimeStepSize());
assert(dt>0); assert(dt > 0);
setTimeStepSize(dt); setTimeStepSize(dt);
} }
prePostProcessTimer_.stop(); prePostProcessTimer_.stop();