tried to enable onephase with water as phase

This commit is contained in:
hnil 2019-05-19 20:42:41 +02:00 committed by Atgeirr Flø Rasmussen
parent 596cb21e20
commit 17e9a73f81
3 changed files with 37 additions and 13 deletions

View File

@ -128,9 +128,13 @@ public:
// extract the water and the gas saturations for convenience
Evaluation Sw = 0.0;
if (waterEnabled)
if (waterEnabled){
if(priVars.primaryVarsMeaning() == PrimaryVariables::px){
Sw = 1.0;
}else{
Sw = priVars.makeEvaluation(Indices::waterSaturationIdx, timeIdx);
}
}
Evaluation Sg = 0.0;
if (compositionSwitchEnabled)
{
@ -257,8 +261,8 @@ public:
else
fluidState_.setRv(0.0);
}
else {
assert(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);
fluidState_.setRv(Rv);
@ -277,6 +281,8 @@ public:
}
else
fluidState_.setRs(0.0);
}else{
assert(priVars.primaryVarsMeaning() == PrimaryVariables::px);
}
typename FluidSystem::template ParameterCache<Evaluation> paramCache;
@ -338,7 +344,12 @@ public:
Scalar rockCompressibility = problem.rockCompressibility(elemCtx, dofIdx, timeIdx);
if (rockCompressibility > 0.0) {
Scalar rockRefPressure = problem.rockReferencePressure(elemCtx, dofIdx, timeIdx);
Evaluation x = rockCompressibility*(fluidState_.pressure(oilPhaseIdx) - rockRefPressure);
Evaluation x;
if(FluidSystem::phaseIsActive(oilPhaseIdx)){
x = rockCompressibility*(fluidState_.pressure(oilPhaseIdx) - rockRefPressure);
}else{
x = rockCompressibility*(fluidState_.pressure(waterPhaseIdx) - rockRefPressure);
}
porosity_ *= 1.0 + x + 0.5*x*x;
}

View File

@ -112,6 +112,7 @@ public:
Sw_po_Sg, // threephase case
Sw_po_Rs, // water + oil case
Sw_pg_Rv, // water + gas case
px , // onephase case
};
BlackOilPrimaryVariables()
@ -264,10 +265,13 @@ public:
EnergyModule::assignPrimaryVars(*this, fluidState);
// determine the meaning of the primary variables
if ((gasPresent && oilPresent) || onlyWater)
if ( FluidSystem::numActivePhases() == 1 ){
primaryVarsMeaning_ = px;
}else if ((gasPresent && oilPresent) || (onlyWater && FluidSystem::phaseIsActive(oilPhaseIdx)) ){
// gas and oil: both hydrocarbon phases are in equilibrium (i.e., saturated
// with the "protagonist" component of the other phase.)
primaryVarsMeaning_ = Sw_po_Sg;
}
else if (oilPresent) {
// 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
@ -287,7 +291,16 @@ public:
}
// assign the actual primary variables
if (primaryVarsMeaning() == Sw_po_Sg) {
if (primaryVarsMeaning() == px ) {
if (waterEnabled){
(*this)[waterSaturationIdx] = FsToolbox::value(fluidState.saturation(waterPhaseIdx));
(*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(waterPhaseIdx));
}else{
throw std::logic_error("Only pure ware is presently allowed");
}
}
else if (primaryVarsMeaning() == Sw_po_Sg) {
if (waterEnabled)
(*this)[waterSaturationIdx] = FsToolbox::value(fluidState.saturation(waterPhaseIdx));
(*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(oilPhaseIdx));

View File

@ -83,16 +83,16 @@ public:
BlackOilRateVector(Scalar value) : ParentType(Toolbox::createConstant(value))
{}
template <class Eval = Evaluation>
BlackOilRateVector(const typename std::enable_if<std::is_same<Eval, Evaluation>::value, Evaluation>::type& value) : ParentType(value)
{}
// template <class Eval = Evaluation>
// BlackOilRateVector(const typename std::enable_if<std::is_same<Eval, Evaluation>::value, Evaluation>::type& value) : ParentType(value)
// {}
/*!
* \copydoc ImmiscibleRateVector::ImmiscibleRateVector(const
* ImmiscibleRateVector& )
*/
BlackOilRateVector(const BlackOilRateVector& value) : ParentType(value)
{}
// BlackOilRateVector(const BlackOilRateVector& value) : ParentType(value)
// {}
/*!
* \copydoc ImmiscibleRateVector::setMassRate