mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1056 from babrodtk/pdpb_output
Added output of dew and bubble point pressures
This commit is contained in:
commit
d8aa0b7ddf
@ -1271,6 +1271,15 @@ namespace Opm {
|
|||||||
VectorType& RsSat = simData.getCellData( "RSSAT" );
|
VectorType& RsSat = simData.getCellData( "RSSAT" );
|
||||||
VectorType& RvSat = simData.getCellData( "RVSAT" );
|
VectorType& RvSat = simData.getCellData( "RVSAT" );
|
||||||
|
|
||||||
|
simData.registerCellData( "PBUB", 1 );
|
||||||
|
simData.registerCellData( "PDEW", 1 );
|
||||||
|
|
||||||
|
VectorType& Pb = simData.getCellData( "PBUB" );
|
||||||
|
VectorType& Pd = simData.getCellData( "PDEW" );
|
||||||
|
|
||||||
|
std::vector<int> failed_cells_pb;
|
||||||
|
std::vector<int> failed_cells_pd;
|
||||||
|
|
||||||
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
|
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
|
||||||
const auto& intQuants = *ebosModel.cachedIntensiveQuantities(cellIdx, /*timeIdx=*/0);
|
const auto& intQuants = *ebosModel.cachedIntensiveQuantities(cellIdx, /*timeIdx=*/0);
|
||||||
const auto& fs = intQuants.fluidState();
|
const auto& fs = intQuants.fluidState();
|
||||||
@ -1304,6 +1313,18 @@ namespace Opm {
|
|||||||
FluidSystem::gasPhaseIdx,
|
FluidSystem::gasPhaseIdx,
|
||||||
intQuants.pvtRegionIndex(),
|
intQuants.pvtRegionIndex(),
|
||||||
/*maxOilSaturation=*/1.0).value();
|
/*maxOilSaturation=*/1.0).value();
|
||||||
|
try {
|
||||||
|
Pb[cellIdx] = FluidSystem::bubblePointPressure(fs, intQuants.pvtRegionIndex()).value();
|
||||||
|
}
|
||||||
|
catch (const NumericalProblem& e) {
|
||||||
|
failed_cells_pb.push_back(cellIdx);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Pd[cellIdx] = FluidSystem::dewPointPressure(fs, intQuants.pvtRegionIndex()).value();
|
||||||
|
}
|
||||||
|
catch (const NumericalProblem& e) {
|
||||||
|
failed_cells_pd.push_back(cellIdx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( liquid_active )
|
if( liquid_active )
|
||||||
{
|
{
|
||||||
@ -1315,6 +1336,36 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t max_num_cells_faillog = 20;
|
||||||
|
if (failed_cells_pb.size() > 0) {
|
||||||
|
std::stringstream errlog;
|
||||||
|
errlog << "Finding the dew point pressure failed for " << failed_cells_pb.size() << " cells [";
|
||||||
|
errlog << failed_cells_pb[0];
|
||||||
|
const int max_elems = std::min(max_num_cells_faillog, failed_cells_pb.size());
|
||||||
|
for (size_t i = 1; i < max_elems; ++i) {
|
||||||
|
errlog << ", " << failed_cells_pb[i];
|
||||||
|
}
|
||||||
|
if (failed_cells_pb.size() > max_num_cells_faillog) {
|
||||||
|
errlog << ", ...";
|
||||||
|
}
|
||||||
|
errlog << "]";
|
||||||
|
OpmLog::problem("pb numerical problem", errlog.str());
|
||||||
|
}
|
||||||
|
if (failed_cells_pd.size() > 0) {
|
||||||
|
std::stringstream errlog;
|
||||||
|
errlog << "Finding the dew point pressure failed for " << failed_cells_pd.size() << " cells [";
|
||||||
|
errlog << failed_cells_pd[0];
|
||||||
|
const int max_elems = std::min(max_num_cells_faillog, failed_cells_pd.size());
|
||||||
|
for (size_t i = 1; i < max_elems; ++i) {
|
||||||
|
errlog << ", " << failed_cells_pd[i];
|
||||||
|
}
|
||||||
|
if (failed_cells_pd.size() > max_num_cells_faillog) {
|
||||||
|
errlog << ", ...";
|
||||||
|
}
|
||||||
|
errlog << "]";
|
||||||
|
OpmLog::problem("pd numerical problem", errlog.str());
|
||||||
|
}
|
||||||
|
|
||||||
return simData;
|
return simData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,9 +723,14 @@ namespace Opm
|
|||||||
if (log && vapour_active &&
|
if (log && vapour_active &&
|
||||||
liquid_active && rstKeywords["PBPD"] > 0) {
|
liquid_active && rstKeywords["PBPD"] > 0) {
|
||||||
rstKeywords["PBPD"] = 0;
|
rstKeywords["PBPD"] = 0;
|
||||||
Opm::OpmLog::warning("Bubble/dew point pressure output unsupported",
|
output.insert("PBUB",
|
||||||
"Writing bubble points and dew points (PBPD) to file is unsupported, "
|
Opm::UnitSystem::measure::pressure,
|
||||||
"as the simulator does not use these internally.");
|
std::move( sd.getCellData("PBUB") ),
|
||||||
|
data::TargetType::RESTART_AUXILIARY);
|
||||||
|
output.insert("PDEW",
|
||||||
|
Opm::UnitSystem::measure::pressure,
|
||||||
|
std::move( sd.getCellData("PDEW") ),
|
||||||
|
data::TargetType::RESTART_AUXILIARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Warn for any unhandled keyword
|
//Warn for any unhandled keyword
|
||||||
|
Loading…
Reference in New Issue
Block a user