Fix 2phase celldata output

This commit is contained in:
Tor Harald Sandve 2016-11-15 12:48:25 +01:00
parent f8bf7c392c
commit b04f79b15f

View File

@ -286,6 +286,11 @@ namespace Opm
const auto& ebosModel = model.ebosSimulator().model();
//Get shorthands for water, oil, gas
const int aqua_active = phaseUsage.phase_used[Opm::PhaseUsage::Aqua];
const int liquid_active = phaseUsage.phase_used[Opm::PhaseUsage::Liquid];
const int vapour_active = phaseUsage.phase_used[Opm::PhaseUsage::Vapour];
// extract everything which can possibly be written to disk
int numCells = ebosModel.numGridDof();
@ -324,36 +329,36 @@ namespace Opm
temperature[cellIdx] = fs.temperature(FluidSystem::oilPhaseIdx).value();
satWater[cellIdx] = fs.saturation(FluidSystem::waterPhaseIdx).value();
satGas[cellIdx] = fs.saturation(FluidSystem::gasPhaseIdx).value();
if (aqua_active) {
satWater[cellIdx] = fs.saturation(FluidSystem::waterPhaseIdx).value();
bWater[cellIdx] = fs.invB(FluidSystem::waterPhaseIdx).value();
rhoWater[cellIdx] = fs.density(FluidSystem::waterPhaseIdx).value();
muWater[cellIdx] = fs.viscosity(FluidSystem::waterPhaseIdx).value();
krWater[cellIdx] = intQuants.relativePermeability(FluidSystem::waterPhaseIdx).value();
}
if (vapour_active) {
satGas[cellIdx] = fs.saturation(FluidSystem::gasPhaseIdx).value();
bGas[cellIdx] = fs.invB(FluidSystem::gasPhaseIdx).value();
rhoGas[cellIdx] = fs.density(FluidSystem::gasPhaseIdx).value();
muGas[cellIdx] = fs.viscosity(FluidSystem::gasPhaseIdx).value();
krGas[cellIdx] = intQuants.relativePermeability(FluidSystem::gasPhaseIdx).value();
Rs[cellIdx] = fs.Rs().value();
Rv[cellIdx] = fs.Rv().value();
RsSat[cellIdx] = FluidSystem::saturatedDissolutionFactor(fs,
FluidSystem::oilPhaseIdx,
intQuants.pvtRegionIndex(),
/*maxOilSaturation=*/1.0).value();
RvSat[cellIdx] = FluidSystem::saturatedDissolutionFactor(fs,
FluidSystem::gasPhaseIdx,
intQuants.pvtRegionIndex(),
/*maxOilSaturation=*/1.0).value();
}
bWater[cellIdx] = fs.invB(FluidSystem::waterPhaseIdx).value();
bOil[cellIdx] = fs.invB(FluidSystem::oilPhaseIdx).value();
bGas[cellIdx] = fs.invB(FluidSystem::gasPhaseIdx).value();
Rs[cellIdx] = fs.Rs().value();
Rs[cellIdx] = fs.Rv().value();
rhoWater[cellIdx] = fs.density(FluidSystem::waterPhaseIdx).value();
rhoOil[cellIdx] = fs.density(FluidSystem::oilPhaseIdx).value();
rhoGas[cellIdx] = fs.density(FluidSystem::gasPhaseIdx).value();
muWater[cellIdx] = fs.viscosity(FluidSystem::waterPhaseIdx).value();
// oil is always active
bOil[cellIdx] = fs.invB(FluidSystem::oilPhaseIdx).value();
rhoOil[cellIdx] = fs.density(FluidSystem::oilPhaseIdx).value();
muOil[cellIdx] = fs.viscosity(FluidSystem::oilPhaseIdx).value();
muGas[cellIdx] = fs.viscosity(FluidSystem::gasPhaseIdx).value();
krWater[cellIdx] = intQuants.relativePermeability(FluidSystem::waterPhaseIdx).value();
krOil[cellIdx] = intQuants.relativePermeability(FluidSystem::oilPhaseIdx).value();
krGas[cellIdx] = intQuants.relativePermeability(FluidSystem::gasPhaseIdx).value();
RsSat[cellIdx] = FluidSystem::saturatedDissolutionFactor(fs,
FluidSystem::oilPhaseIdx,
intQuants.pvtRegionIndex(),
/*maxOilSaturation=*/1.0).value();
RvSat[cellIdx] = FluidSystem::saturatedDissolutionFactor(fs,
FluidSystem::gasPhaseIdx,
intQuants.pvtRegionIndex(),
/*maxOilSaturation=*/1.0).value();
}
/**
@ -405,21 +410,22 @@ namespace Opm
/**
* Formation volume factors for water, oil, gas
*/
if (outKeywords["BW"] > 0) {
if (aqua_active && outKeywords["BW"] > 0) {
outKeywords["BW"] = 0;
output.insert("BW",
Opm::UnitSystem::measure::water_inverse_formation_volume_factor,
std::move(bWater),
data::TargetType::RESTART_AUXILLARY);
Opm::UnitSystem::measure::water_inverse_formation_volume_factor,
std::move(bWater),
data::TargetType::RESTART_AUXILLARY);
}
if (outKeywords["BO"] > 0) {
if (liquid_active && outKeywords["BO"] > 0) {
outKeywords["BO"] = 0;
output.insert("BO",
Opm::UnitSystem::measure::oil_inverse_formation_volume_factor,
std::move(bOil),
data::TargetType::RESTART_AUXILLARY);
}
if (outKeywords["BG"] > 0) {
if (vapour_active && outKeywords["BG"] > 0) {
outKeywords["BG"] = 0;
output.insert("BG",
Opm::UnitSystem::measure::gas_inverse_formation_volume_factor,
@ -432,19 +438,24 @@ namespace Opm
*/
if (outKeywords["DEN"] > 0) {
outKeywords["DEN"] = 0;
output.insert("WAT_DEN",
Opm::UnitSystem::measure::density,
std::move(rhoWater),
data::TargetType::RESTART_AUXILLARY);
output.insert("OIL_DEN",
Opm::UnitSystem::measure::density,
std::move(rhoOil),
data::TargetType::RESTART_AUXILLARY);
if (aqua_active) {
output.insert("WAT_DEN",
Opm::UnitSystem::measure::density,
std::move(rhoWater),
data::TargetType::RESTART_AUXILLARY);
}
if (liquid_active) {
output.insert("OIL_DEN",
Opm::UnitSystem::measure::density,
std::move(rhoOil),
data::TargetType::RESTART_AUXILLARY);
}
if (vapour_active) {
output.insert("GAS_DEN",
Opm::UnitSystem::measure::density,
std::move(rhoGas),
data::TargetType::RESTART_AUXILLARY);
}
}
/**
@ -452,41 +463,47 @@ namespace Opm
*/
if (outKeywords["VISC"] > 0) {
outKeywords["VISC"] = 0;
if (aqua_active) {
output.insert("WAT_VISC",
Opm::UnitSystem::measure::viscosity,
std::move(muWater),
data::TargetType::RESTART_AUXILLARY);
}
if (liquid_active) {
output.insert("OIL_VISC",
Opm::UnitSystem::measure::viscosity,
std::move(muOil),
data::TargetType::RESTART_AUXILLARY);
}
if (vapour_active) {
output.insert("GAS_VISC",
Opm::UnitSystem::measure::viscosity,
std::move(muGas),
data::TargetType::RESTART_AUXILLARY);
}
}
/**
* Relative permeabilities for water, oil, gas
*/
if (outKeywords["KRW"] > 0) {
if (aqua_active && outKeywords["KRW"] > 0) {
outKeywords["KRW"] = 0;
output.insert("WATKR",
Opm::UnitSystem::measure::identity,
Opm::UnitSystem::measure::permeability,
std::move(krWater),
data::TargetType::RESTART_AUXILLARY);
}
if (outKeywords["KRO"] > 0) {
if (liquid_active && outKeywords["KRO"] > 0) {
outKeywords["KRO"] = 0;
output.insert("OILKR",
Opm::UnitSystem::measure::identity,
Opm::UnitSystem::measure::permeability,
std::move(krOil),
data::TargetType::RESTART_AUXILLARY);
}
if (outKeywords["KRG"] > 0) {
if (vapour_active && outKeywords["KRG"] > 0) {
outKeywords["KRG"] = 0;
output.insert("GASKR",
Opm::UnitSystem::measure::identity,
Opm::UnitSystem::measure::permeability,
std::move(krGas),
data::TargetType::RESTART_AUXILLARY);
}
@ -494,14 +511,14 @@ namespace Opm
/**
* Vaporized and dissolved gas/oil ratio
*/
if (outKeywords["RSSAT"] > 0) {
if (vapour_active && liquid_active && outKeywords["RSSAT"] > 0) {
outKeywords["RSSAT"] = 0;
output.insert("RSSAT",
Opm::UnitSystem::measure::gas_oil_ratio,
std::move(RsSat),
data::TargetType::RESTART_AUXILLARY);
}
if (outKeywords["RVSAT"] > 0) {
if (vapour_active && liquid_active && outKeywords["RVSAT"] > 0) {
outKeywords["RVSAT"] = 0;
output.insert("RVSAT",
Opm::UnitSystem::measure::oil_gas_ratio,
@ -513,19 +530,22 @@ namespace Opm
/**
* Bubble point and dew point pressures
*/
if (outKeywords["PBPD"] > 0) {
if (log && vapour_active &&
liquid_active && outKeywords["PBPD"] > 0) {
Opm::OpmLog::warning("Bubble/dew point pressure output unsupported",
"Writing bubble points and dew points (PBPD) to file is unsupported, "
"as the simulator does not use these internally.");
}
//Warn for any unhandled keyword
for (auto& keyValue : outKeywords) {
if (keyValue.second > 0) {
std::string logstring = "Keyword '";
logstring.append(keyValue.first);
logstring.append("' is unhandled for output to file.");
Opm::OpmLog::warning("Unhandled output keyword", logstring);
if (log) {
for (auto& keyValue : outKeywords) {
if (keyValue.second > 0) {
std::string logstring = "Keyword '";
logstring.append(keyValue.first);
logstring.append("' is unhandled for output to file.");
Opm::OpmLog::warning("Unhandled output keyword", logstring);
}
}
}