mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #921 from totto82/frankenstein_output_fixes
Frankenstein output fixes
This commit is contained in:
commit
89f2636b2e
@ -264,8 +264,9 @@ public:
|
|||||||
elemCtx.updateAll(*elemIt);
|
elemCtx.updateAll(*elemIt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:: fiz seg_fault
|
// No per cell data is written for initial step, but will be
|
||||||
//output_writer_.writeTimeStep( timer, state, well_state, solver->model() );
|
// for subsequent steps, when we have started simulating
|
||||||
|
output_writer_.writeTimeStepWithoutCellProperties( timer, state, well_state );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute orignal FIP;
|
// Compute orignal FIP;
|
||||||
|
@ -244,7 +244,14 @@ namespace Opm
|
|||||||
Opm::UgGridHelpers::cell2Faces(grid),
|
Opm::UgGridHelpers::cell2Faces(grid),
|
||||||
Opm::UgGridHelpers::beginFaceCentroids(grid),
|
Opm::UgGridHelpers::beginFaceCentroids(grid),
|
||||||
permeability,
|
permeability,
|
||||||
dummy_list_econ_limited);
|
dummy_list_econ_limited
|
||||||
|
// We need to pass the optionaly arguments
|
||||||
|
// as we get the following error otherwise
|
||||||
|
// with c++ (Debian 4.9.2-10) 4.9.2 and -std=c++11
|
||||||
|
// converting to ‘const std::unordered_set<std::basic_string<char> >’ from initializer list would use explicit constructo
|
||||||
|
, false,
|
||||||
|
std::vector<double>(),
|
||||||
|
std::unordered_set<std::string>());
|
||||||
|
|
||||||
const Wells* wells = wellsmanager.c_wells();
|
const Wells* wells = wellsmanager.c_wells();
|
||||||
wellstate.resize(wells, simulatorstate); //Resize for restart step
|
wellstate.resize(wells, simulatorstate); //Resize for restart step
|
||||||
@ -262,16 +269,15 @@ namespace Opm
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<class Model>
|
template<class Model>
|
||||||
Opm::data::Solution getOutputDataEbos(
|
void getOutputDataEbos(data::Solution& output,
|
||||||
const Opm::PhaseUsage& phaseUsage,
|
const Opm::PhaseUsage& phaseUsage,
|
||||||
const Model& model,
|
const Model& model,
|
||||||
const RestartConfig& restartConfig,
|
const RestartConfig& restartConfig,
|
||||||
const int reportStepNum)
|
const int reportStepNum,
|
||||||
{
|
const bool log)
|
||||||
|
{
|
||||||
typedef typename Model::FluidSystem FluidSystem;
|
typedef typename Model::FluidSystem FluidSystem;
|
||||||
|
|
||||||
Opm::data::Solution sol;
|
|
||||||
|
|
||||||
//Get the value of each of the keys
|
//Get the value of each of the keys
|
||||||
std::map<std::string, int> outKeywords = restartConfig.getRestartKeywords(reportStepNum);
|
std::map<std::string, int> outKeywords = restartConfig.getRestartKeywords(reportStepNum);
|
||||||
for (auto& keyValue : outKeywords) {
|
for (auto& keyValue : outKeywords) {
|
||||||
@ -280,6 +286,11 @@ namespace Opm
|
|||||||
|
|
||||||
const auto& ebosModel = model.ebosSimulator().model();
|
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
|
// extract everything which can possibly be written to disk
|
||||||
int numCells = ebosModel.numGridDof();
|
int numCells = ebosModel.numGridDof();
|
||||||
|
|
||||||
@ -318,43 +329,43 @@ namespace Opm
|
|||||||
|
|
||||||
temperature[cellIdx] = fs.temperature(FluidSystem::oilPhaseIdx).value();
|
temperature[cellIdx] = fs.temperature(FluidSystem::oilPhaseIdx).value();
|
||||||
|
|
||||||
satWater[cellIdx] = fs.saturation(FluidSystem::waterPhaseIdx).value();
|
if (aqua_active) {
|
||||||
satGas[cellIdx] = fs.saturation(FluidSystem::gasPhaseIdx).value();
|
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();
|
// oil is always active
|
||||||
bOil[cellIdx] = fs.invB(FluidSystem::oilPhaseIdx).value();
|
bOil[cellIdx] = fs.invB(FluidSystem::oilPhaseIdx).value();
|
||||||
bGas[cellIdx] = fs.invB(FluidSystem::gasPhaseIdx).value();
|
rhoOil[cellIdx] = fs.density(FluidSystem::oilPhaseIdx).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();
|
|
||||||
muOil[cellIdx] = fs.viscosity(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();
|
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Oil Pressures
|
* Oil Pressures
|
||||||
*/
|
*/
|
||||||
outKeywords["PRESSURE"] = 0;
|
outKeywords["PRESSURE"] = 0;
|
||||||
sol.insert("PRESSURE",
|
output.insert("PRESSURE",
|
||||||
UnitSystem::measure::pressure,
|
UnitSystem::measure::pressure,
|
||||||
std::move(pressureOil),
|
std::move(pressureOil),
|
||||||
data::TargetType::RESTART_SOLUTION);
|
data::TargetType::RESTART_SOLUTION);
|
||||||
@ -363,7 +374,7 @@ namespace Opm
|
|||||||
* Temperatures
|
* Temperatures
|
||||||
*/
|
*/
|
||||||
outKeywords["TEMP"] = 0;
|
outKeywords["TEMP"] = 0;
|
||||||
sol.insert("TEMP",
|
output.insert("TEMP",
|
||||||
UnitSystem::measure::temperature,
|
UnitSystem::measure::temperature,
|
||||||
std::move(temperature),
|
std::move(temperature),
|
||||||
data::TargetType::RESTART_SOLUTION);
|
data::TargetType::RESTART_SOLUTION);
|
||||||
@ -373,11 +384,11 @@ namespace Opm
|
|||||||
*/
|
*/
|
||||||
outKeywords["SWAT"] = 0;
|
outKeywords["SWAT"] = 0;
|
||||||
outKeywords["SGAS"] = 0;
|
outKeywords["SGAS"] = 0;
|
||||||
sol.insert("SWAT",
|
output.insert("SWAT",
|
||||||
UnitSystem::measure::identity,
|
UnitSystem::measure::identity,
|
||||||
std::move(satWater),
|
std::move(satWater),
|
||||||
data::TargetType::RESTART_SOLUTION);
|
data::TargetType::RESTART_SOLUTION);
|
||||||
sol.insert("SGAS",
|
output.insert("SGAS",
|
||||||
UnitSystem::measure::identity,
|
UnitSystem::measure::identity,
|
||||||
std::move(satGas),
|
std::move(satGas),
|
||||||
data::TargetType::RESTART_SOLUTION);
|
data::TargetType::RESTART_SOLUTION);
|
||||||
@ -387,11 +398,11 @@ namespace Opm
|
|||||||
*/
|
*/
|
||||||
outKeywords["RS"] = 0;
|
outKeywords["RS"] = 0;
|
||||||
outKeywords["RV"] = 0;
|
outKeywords["RV"] = 0;
|
||||||
sol.insert("RS",
|
output.insert("RS",
|
||||||
UnitSystem::measure::gas_oil_ratio,
|
UnitSystem::measure::gas_oil_ratio,
|
||||||
std::move(Rs),
|
std::move(Rs),
|
||||||
data::TargetType::RESTART_SOLUTION);
|
data::TargetType::RESTART_SOLUTION);
|
||||||
sol.insert("RV",
|
output.insert("RV",
|
||||||
UnitSystem::measure::oil_gas_ratio,
|
UnitSystem::measure::oil_gas_ratio,
|
||||||
std::move(Rv),
|
std::move(Rv),
|
||||||
data::TargetType::RESTART_SOLUTION);
|
data::TargetType::RESTART_SOLUTION);
|
||||||
@ -399,23 +410,24 @@ namespace Opm
|
|||||||
/**
|
/**
|
||||||
* Formation volume factors for water, oil, gas
|
* Formation volume factors for water, oil, gas
|
||||||
*/
|
*/
|
||||||
if (outKeywords["BW"] > 0) {
|
if (aqua_active && outKeywords["BW"] > 0) {
|
||||||
outKeywords["BW"] = 0;
|
outKeywords["BW"] = 0;
|
||||||
sol.insert("BW",
|
output.insert("BW",
|
||||||
Opm::UnitSystem::measure::water_inverse_formation_volume_factor,
|
Opm::UnitSystem::measure::water_inverse_formation_volume_factor,
|
||||||
std::move(bWater),
|
std::move(bWater),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (outKeywords["BO"] > 0) {
|
if (liquid_active && outKeywords["BO"] > 0) {
|
||||||
outKeywords["BO"] = 0;
|
outKeywords["BO"] = 0;
|
||||||
sol.insert("BO",
|
output.insert("BO",
|
||||||
Opm::UnitSystem::measure::oil_inverse_formation_volume_factor,
|
Opm::UnitSystem::measure::oil_inverse_formation_volume_factor,
|
||||||
std::move(bOil),
|
std::move(bOil),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
}
|
}
|
||||||
if (outKeywords["BG"] > 0) {
|
if (vapour_active && outKeywords["BG"] > 0) {
|
||||||
outKeywords["BG"] = 0;
|
outKeywords["BG"] = 0;
|
||||||
sol.insert("BG",
|
output.insert("BG",
|
||||||
Opm::UnitSystem::measure::gas_inverse_formation_volume_factor,
|
Opm::UnitSystem::measure::gas_inverse_formation_volume_factor,
|
||||||
std::move(bGas),
|
std::move(bGas),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
@ -426,19 +438,24 @@ namespace Opm
|
|||||||
*/
|
*/
|
||||||
if (outKeywords["DEN"] > 0) {
|
if (outKeywords["DEN"] > 0) {
|
||||||
outKeywords["DEN"] = 0;
|
outKeywords["DEN"] = 0;
|
||||||
|
if (aqua_active) {
|
||||||
sol.insert("WAT_DEN",
|
output.insert("WAT_DEN",
|
||||||
Opm::UnitSystem::measure::density,
|
Opm::UnitSystem::measure::density,
|
||||||
std::move(rhoWater),
|
std::move(rhoWater),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
sol.insert("OIL_DEN",
|
}
|
||||||
Opm::UnitSystem::measure::density,
|
if (liquid_active) {
|
||||||
std::move(rhoOil),
|
output.insert("OIL_DEN",
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
Opm::UnitSystem::measure::density,
|
||||||
sol.insert("GAS_DEN",
|
std::move(rhoOil),
|
||||||
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
|
}
|
||||||
|
if (vapour_active) {
|
||||||
|
output.insert("GAS_DEN",
|
||||||
Opm::UnitSystem::measure::density,
|
Opm::UnitSystem::measure::density,
|
||||||
std::move(rhoGas),
|
std::move(rhoGas),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -446,41 +463,47 @@ namespace Opm
|
|||||||
*/
|
*/
|
||||||
if (outKeywords["VISC"] > 0) {
|
if (outKeywords["VISC"] > 0) {
|
||||||
outKeywords["VISC"] = 0;
|
outKeywords["VISC"] = 0;
|
||||||
sol.insert("WAT_VISC",
|
if (aqua_active) {
|
||||||
|
output.insert("WAT_VISC",
|
||||||
Opm::UnitSystem::measure::viscosity,
|
Opm::UnitSystem::measure::viscosity,
|
||||||
std::move(muWater),
|
std::move(muWater),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
sol.insert("OIL_VISC",
|
}
|
||||||
|
if (liquid_active) {
|
||||||
|
output.insert("OIL_VISC",
|
||||||
Opm::UnitSystem::measure::viscosity,
|
Opm::UnitSystem::measure::viscosity,
|
||||||
std::move(muOil),
|
std::move(muOil),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
sol.insert("GAS_VISC",
|
}
|
||||||
|
if (vapour_active) {
|
||||||
|
output.insert("GAS_VISC",
|
||||||
Opm::UnitSystem::measure::viscosity,
|
Opm::UnitSystem::measure::viscosity,
|
||||||
std::move(muGas),
|
std::move(muGas),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relative permeabilities for water, oil, gas
|
* Relative permeabilities for water, oil, gas
|
||||||
*/
|
*/
|
||||||
if (outKeywords["KRW"] > 0) {
|
if (aqua_active && outKeywords["KRW"] > 0) {
|
||||||
outKeywords["KRW"] = 0;
|
outKeywords["KRW"] = 0;
|
||||||
sol.insert("WATKR",
|
output.insert("WATKR",
|
||||||
Opm::UnitSystem::measure::identity,
|
Opm::UnitSystem::measure::permeability,
|
||||||
std::move(krWater),
|
std::move(krWater),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
}
|
}
|
||||||
if (outKeywords["KRO"] > 0) {
|
if (liquid_active && outKeywords["KRO"] > 0) {
|
||||||
outKeywords["KRO"] = 0;
|
outKeywords["KRO"] = 0;
|
||||||
sol.insert("OILKR",
|
output.insert("OILKR",
|
||||||
Opm::UnitSystem::measure::identity,
|
Opm::UnitSystem::measure::permeability,
|
||||||
std::move(krOil),
|
std::move(krOil),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
}
|
}
|
||||||
if (outKeywords["KRG"] > 0) {
|
if (vapour_active && outKeywords["KRG"] > 0) {
|
||||||
outKeywords["KRG"] = 0;
|
outKeywords["KRG"] = 0;
|
||||||
sol.insert("GASKR",
|
output.insert("GASKR",
|
||||||
Opm::UnitSystem::measure::identity,
|
Opm::UnitSystem::measure::permeability,
|
||||||
std::move(krGas),
|
std::move(krGas),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
}
|
}
|
||||||
@ -488,16 +511,16 @@ namespace Opm
|
|||||||
/**
|
/**
|
||||||
* Vaporized and dissolved gas/oil ratio
|
* Vaporized and dissolved gas/oil ratio
|
||||||
*/
|
*/
|
||||||
if (outKeywords["RSSAT"] > 0) {
|
if (vapour_active && liquid_active && outKeywords["RSSAT"] > 0) {
|
||||||
outKeywords["RSSAT"] = 0;
|
outKeywords["RSSAT"] = 0;
|
||||||
sol.insert("RSSAT",
|
output.insert("RSSAT",
|
||||||
Opm::UnitSystem::measure::gas_oil_ratio,
|
Opm::UnitSystem::measure::gas_oil_ratio,
|
||||||
std::move(RsSat),
|
std::move(RsSat),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
}
|
}
|
||||||
if (outKeywords["RVSAT"] > 0) {
|
if (vapour_active && liquid_active && outKeywords["RVSAT"] > 0) {
|
||||||
outKeywords["RVSAT"] = 0;
|
outKeywords["RVSAT"] = 0;
|
||||||
sol.insert("RVSAT",
|
output.insert("RVSAT",
|
||||||
Opm::UnitSystem::measure::oil_gas_ratio,
|
Opm::UnitSystem::measure::oil_gas_ratio,
|
||||||
std::move(RvSat),
|
std::move(RvSat),
|
||||||
data::TargetType::RESTART_AUXILLARY);
|
data::TargetType::RESTART_AUXILLARY);
|
||||||
@ -507,23 +530,25 @@ namespace Opm
|
|||||||
/**
|
/**
|
||||||
* Bubble point and dew point pressures
|
* 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",
|
Opm::OpmLog::warning("Bubble/dew point pressure output unsupported",
|
||||||
"Writing bubble points and dew points (PBPD) to file is unsupported, "
|
"Writing bubble points and dew points (PBPD) to file is unsupported, "
|
||||||
"as the simulator does not use these internally.");
|
"as the simulator does not use these internally.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Warn for any unhandled keyword
|
//Warn for any unhandled keyword
|
||||||
for (auto& keyValue : outKeywords) {
|
if (log) {
|
||||||
if (keyValue.second > 0) {
|
for (auto& keyValue : outKeywords) {
|
||||||
std::string logstring = "Keyword '";
|
if (keyValue.second > 0) {
|
||||||
logstring.append(keyValue.first);
|
std::string logstring = "Keyword '";
|
||||||
logstring.append("' is unhandled for output to file.");
|
logstring.append(keyValue.first);
|
||||||
Opm::OpmLog::warning("Unhandled output keyword", logstring);
|
logstring.append("' is unhandled for output to file.");
|
||||||
|
Opm::OpmLog::warning("Unhandled output keyword", logstring);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sol;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -671,8 +696,9 @@ namespace Opm
|
|||||||
|
|
||||||
if( output_ && !parallelOutput_->isParallel() )
|
if( output_ && !parallelOutput_->isParallel() )
|
||||||
{
|
{
|
||||||
//detail::getRestartData( cellData, phaseUsage_, physicalModel,
|
|
||||||
// restartConfig, reportStepNum, logMessages );
|
detail::getOutputDataEbos( cellData, phaseUsage_, physicalModel,
|
||||||
|
restartConfig, reportStepNum, logMessages );
|
||||||
detail::getSummaryData( cellData, phaseUsage_, physicalModel, summaryConfig );
|
detail::getSummaryData( cellData, phaseUsage_, physicalModel, summaryConfig );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user