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);
|
||||
}
|
||||
|
||||
// TODO:: fiz seg_fault
|
||||
//output_writer_.writeTimeStep( timer, state, well_state, solver->model() );
|
||||
// No per cell data is written for initial step, but will be
|
||||
// for subsequent steps, when we have started simulating
|
||||
output_writer_.writeTimeStepWithoutCellProperties( timer, state, well_state );
|
||||
}
|
||||
|
||||
// Compute orignal FIP;
|
||||
|
@ -244,7 +244,14 @@ namespace Opm
|
||||
Opm::UgGridHelpers::cell2Faces(grid),
|
||||
Opm::UgGridHelpers::beginFaceCentroids(grid),
|
||||
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();
|
||||
wellstate.resize(wells, simulatorstate); //Resize for restart step
|
||||
@ -262,16 +269,15 @@ namespace Opm
|
||||
|
||||
namespace detail {
|
||||
template<class Model>
|
||||
Opm::data::Solution getOutputDataEbos(
|
||||
const Opm::PhaseUsage& phaseUsage,
|
||||
const Model& model,
|
||||
const RestartConfig& restartConfig,
|
||||
const int reportStepNum)
|
||||
{
|
||||
void getOutputDataEbos(data::Solution& output,
|
||||
const Opm::PhaseUsage& phaseUsage,
|
||||
const Model& model,
|
||||
const RestartConfig& restartConfig,
|
||||
const int reportStepNum,
|
||||
const bool log)
|
||||
{
|
||||
typedef typename Model::FluidSystem FluidSystem;
|
||||
|
||||
Opm::data::Solution sol;
|
||||
|
||||
//Get the value of each of the keys
|
||||
std::map<std::string, int> outKeywords = restartConfig.getRestartKeywords(reportStepNum);
|
||||
for (auto& keyValue : outKeywords) {
|
||||
@ -280,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();
|
||||
|
||||
@ -318,43 +329,43 @@ 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Oil Pressures
|
||||
*/
|
||||
outKeywords["PRESSURE"] = 0;
|
||||
sol.insert("PRESSURE",
|
||||
output.insert("PRESSURE",
|
||||
UnitSystem::measure::pressure,
|
||||
std::move(pressureOil),
|
||||
data::TargetType::RESTART_SOLUTION);
|
||||
@ -363,7 +374,7 @@ namespace Opm
|
||||
* Temperatures
|
||||
*/
|
||||
outKeywords["TEMP"] = 0;
|
||||
sol.insert("TEMP",
|
||||
output.insert("TEMP",
|
||||
UnitSystem::measure::temperature,
|
||||
std::move(temperature),
|
||||
data::TargetType::RESTART_SOLUTION);
|
||||
@ -373,11 +384,11 @@ namespace Opm
|
||||
*/
|
||||
outKeywords["SWAT"] = 0;
|
||||
outKeywords["SGAS"] = 0;
|
||||
sol.insert("SWAT",
|
||||
output.insert("SWAT",
|
||||
UnitSystem::measure::identity,
|
||||
std::move(satWater),
|
||||
data::TargetType::RESTART_SOLUTION);
|
||||
sol.insert("SGAS",
|
||||
output.insert("SGAS",
|
||||
UnitSystem::measure::identity,
|
||||
std::move(satGas),
|
||||
data::TargetType::RESTART_SOLUTION);
|
||||
@ -387,11 +398,11 @@ namespace Opm
|
||||
*/
|
||||
outKeywords["RS"] = 0;
|
||||
outKeywords["RV"] = 0;
|
||||
sol.insert("RS",
|
||||
output.insert("RS",
|
||||
UnitSystem::measure::gas_oil_ratio,
|
||||
std::move(Rs),
|
||||
data::TargetType::RESTART_SOLUTION);
|
||||
sol.insert("RV",
|
||||
output.insert("RV",
|
||||
UnitSystem::measure::oil_gas_ratio,
|
||||
std::move(Rv),
|
||||
data::TargetType::RESTART_SOLUTION);
|
||||
@ -399,23 +410,24 @@ namespace Opm
|
||||
/**
|
||||
* Formation volume factors for water, oil, gas
|
||||
*/
|
||||
if (outKeywords["BW"] > 0) {
|
||||
if (aqua_active && outKeywords["BW"] > 0) {
|
||||
outKeywords["BW"] = 0;
|
||||
sol.insert("BW",
|
||||
Opm::UnitSystem::measure::water_inverse_formation_volume_factor,
|
||||
std::move(bWater),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
output.insert("BW",
|
||||
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;
|
||||
sol.insert("BO",
|
||||
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;
|
||||
sol.insert("BG",
|
||||
output.insert("BG",
|
||||
Opm::UnitSystem::measure::gas_inverse_formation_volume_factor,
|
||||
std::move(bGas),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
@ -426,19 +438,24 @@ namespace Opm
|
||||
*/
|
||||
if (outKeywords["DEN"] > 0) {
|
||||
outKeywords["DEN"] = 0;
|
||||
|
||||
sol.insert("WAT_DEN",
|
||||
Opm::UnitSystem::measure::density,
|
||||
std::move(rhoWater),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
sol.insert("OIL_DEN",
|
||||
Opm::UnitSystem::measure::density,
|
||||
std::move(rhoOil),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
sol.insert("GAS_DEN",
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -446,41 +463,47 @@ namespace Opm
|
||||
*/
|
||||
if (outKeywords["VISC"] > 0) {
|
||||
outKeywords["VISC"] = 0;
|
||||
sol.insert("WAT_VISC",
|
||||
if (aqua_active) {
|
||||
output.insert("WAT_VISC",
|
||||
Opm::UnitSystem::measure::viscosity,
|
||||
std::move(muWater),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
sol.insert("OIL_VISC",
|
||||
}
|
||||
if (liquid_active) {
|
||||
output.insert("OIL_VISC",
|
||||
Opm::UnitSystem::measure::viscosity,
|
||||
std::move(muOil),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
sol.insert("GAS_VISC",
|
||||
}
|
||||
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;
|
||||
sol.insert("WATKR",
|
||||
Opm::UnitSystem::measure::identity,
|
||||
output.insert("WATKR",
|
||||
Opm::UnitSystem::measure::permeability,
|
||||
std::move(krWater),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
}
|
||||
if (outKeywords["KRO"] > 0) {
|
||||
if (liquid_active && outKeywords["KRO"] > 0) {
|
||||
outKeywords["KRO"] = 0;
|
||||
sol.insert("OILKR",
|
||||
Opm::UnitSystem::measure::identity,
|
||||
output.insert("OILKR",
|
||||
Opm::UnitSystem::measure::permeability,
|
||||
std::move(krOil),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
}
|
||||
if (outKeywords["KRG"] > 0) {
|
||||
if (vapour_active && outKeywords["KRG"] > 0) {
|
||||
outKeywords["KRG"] = 0;
|
||||
sol.insert("GASKR",
|
||||
Opm::UnitSystem::measure::identity,
|
||||
output.insert("GASKR",
|
||||
Opm::UnitSystem::measure::permeability,
|
||||
std::move(krGas),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
}
|
||||
@ -488,16 +511,16 @@ namespace Opm
|
||||
/**
|
||||
* Vaporized and dissolved gas/oil ratio
|
||||
*/
|
||||
if (outKeywords["RSSAT"] > 0) {
|
||||
if (vapour_active && liquid_active && outKeywords["RSSAT"] > 0) {
|
||||
outKeywords["RSSAT"] = 0;
|
||||
sol.insert("RSSAT",
|
||||
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;
|
||||
sol.insert("RVSAT",
|
||||
output.insert("RVSAT",
|
||||
Opm::UnitSystem::measure::oil_gas_ratio,
|
||||
std::move(RvSat),
|
||||
data::TargetType::RESTART_AUXILLARY);
|
||||
@ -507,23 +530,25 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sol;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -671,8 +696,9 @@ namespace Opm
|
||||
|
||||
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 );
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user