change according to comments in pullrequest

This commit is contained in:
hnil
2019-05-23 09:13:45 +02:00
committed by Atgeirr Flø Rasmussen
parent 3a56213ed8
commit ee482e87a6
4 changed files with 17 additions and 25 deletions

View File

@@ -376,7 +376,6 @@ public:
// and the thermal condictivity coefficients // and the thermal condictivity coefficients
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
if (!FluidSystem::phaseIsActive(phaseIdx)) { if (!FluidSystem::phaseIsActive(phaseIdx)) {
//fs.setEnthalpy(phaseIdx, 0.0);
continue; continue;
} }

View File

@@ -140,6 +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::px) )
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,7 +207,6 @@ public:
asImp_().solventPostSatFuncUpdate_(elemCtx, dofIdx, timeIdx); asImp_().solventPostSatFuncUpdate_(elemCtx, dofIdx, timeIdx);
Evaluation SoMax=0; Evaluation SoMax=0;
//const Evaluation&
if(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)){ if(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)){
SoMax = SoMax =
Opm::max(fluidState_.saturation(oilPhaseIdx), Opm::max(fluidState_.saturation(oilPhaseIdx),
@@ -266,8 +266,6 @@ public:
fluidState_.setRv(0.0); fluidState_.setRv(0.0);
} }
else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) { else if (priVars.primaryVarsMeaning() == PrimaryVariables::Sw_pg_Rv) {
//assert(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);
@@ -282,10 +280,10 @@ public:
SoMax); SoMax);
fluidState_.setRs(Opm::min(RsMax, RsSat)); fluidState_.setRs(Opm::min(RsMax, RsSat));
} } else {
else
fluidState_.setRs(0.0); fluidState_.setRs(0.0);
}else{ }
} else {
assert(priVars.primaryVarsMeaning() == PrimaryVariables::px); assert(priVars.primaryVarsMeaning() == PrimaryVariables::px);
} }
@@ -353,12 +351,10 @@ public:
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) ){
x = rockCompressibility*(fluidState_.pressure(waterPhaseIdx) - rockRefPressure);
}else{ }else{
if(FluidSystem::phaseIsActive(waterPhaseIdx)){ x = rockCompressibility*(fluidState_.pressure(gasPhaseIdx) - rockRefPressure);
x = rockCompressibility*(fluidState_.pressure(waterPhaseIdx) - rockRefPressure);
}else{
x = rockCompressibility*(fluidState_.pressure(gasPhaseIdx) - rockRefPressure);
}
} }
porosity_ *= 1.0 + x + 0.5*x*x; porosity_ *= 1.0 + x + 0.5*x*x;
} }

View File

@@ -37,13 +37,13 @@ namespace Ewoms {
* *
* \brief The primary variable and equation indices for the black-oil model. * \brief The primary variable and equation indices for the black-oil model.
*/ */
template <unsigned numSolventsV, unsigned numPolymersV, unsigned numEnergyV, unsigned PVOffset, unsigned enableCanonicalCompIdx> template <unsigned numSolventsV, unsigned numPolymersV, unsigned numEnergyV, unsigned PVOffset, unsigned canonicalCompIdx>
struct BlackOilOnePhaseIndices struct BlackOilOnePhaseIndices
{ {
//! Is phase enabled or not //! Is phase enabled or not
static const bool oilEnabled = (enableCanonicalCompIdx == 0); static const bool oilEnabled = (canonicalCompIdx == 0);
static const bool waterEnabled = (enableCanonicalCompIdx == 1); static const bool waterEnabled = (canonicalCompIdx == 1);
static const bool gasEnabled = (enableCanonicalCompIdx == 2); static const bool gasEnabled = (canonicalCompIdx == 2);
//! Are solvents involved? //! Are solvents involved?
static const bool enableSolvent = numSolventsV > 0; static const bool enableSolvent = numSolventsV > 0;
@@ -116,7 +116,7 @@ struct BlackOilOnePhaseIndices
static unsigned activeToCanonicalComponentIndex(unsigned compIdx) static unsigned activeToCanonicalComponentIndex(unsigned compIdx)
{ {
// assumes canonical oil = 0, water = 1, gas = 2; // assumes canonical oil = 0, water = 1, gas = 2;
assert(compIdx < 2); assert(compIdx == 0);
if(gasEnabled) { if(gasEnabled) {
return 2; return 2;
} else if (waterEnabled) { } else if (waterEnabled) {

View File

@@ -401,10 +401,7 @@ public:
*/ */
void setTimeStepSize(Scalar value) void setTimeStepSize(Scalar value)
{ {
if( not(value>0)){ timeStepSize_ = value;
std::cout << "Time step set to zero" << std::endl;
}
timeStepSize_ = value;
} }
/*! /*!
@@ -448,7 +445,7 @@ public:
*/ */
bool finished() const bool finished() const
{ {
assert(timeStepSize_ > 0.0); assert(timeStepSize_ >= 0.0);
Scalar eps = Scalar eps =
std::max(Scalar(std::abs(this->time())), timeStepSize()) std::max(Scalar(std::abs(this->time())), timeStepSize())
*std::numeric_limits<Scalar>::epsilon()*1e3; *std::numeric_limits<Scalar>::epsilon()*1e3;
@@ -765,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);
setTimeStepSize(dt); setTimeStepSize(dt);
} }
prePostProcessTimer_.stop(); prePostProcessTimer_.stop();