mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1087 from babrodtk/somax_in_restart
Added somax to input/output to restart file
This commit is contained in:
commit
431abb0012
@ -103,6 +103,8 @@ namespace Opm {
|
|||||||
ADB rsSat; // Saturated gas-oil ratio
|
ADB rsSat; // Saturated gas-oil ratio
|
||||||
ADB rvSat; // Saturated oil-gas ratio
|
ADB rvSat; // Saturated oil-gas ratio
|
||||||
|
|
||||||
|
std::vector<double> soMax; // Maximum oil saturation
|
||||||
|
|
||||||
std::array<V, fipValues> fip;
|
std::array<V, fipValues> fip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -463,6 +463,7 @@ typedef Eigen::Array<double,
|
|||||||
: rq(num_phases)
|
: rq(num_phases)
|
||||||
, rsSat(ADB::null())
|
, rsSat(ADB::null())
|
||||||
, rvSat(ADB::null())
|
, rvSat(ADB::null())
|
||||||
|
, soMax()
|
||||||
, fip()
|
, fip()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -662,6 +663,7 @@ typedef Eigen::Array<double,
|
|||||||
} else {
|
} else {
|
||||||
state.rv = sd_.rvSat;
|
state.rv = sd_.rvSat;
|
||||||
}
|
}
|
||||||
|
sd_.soMax = fluid_.satOilMax();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1247,6 +1247,9 @@ namespace Opm {
|
|||||||
VectorType& Pb = simData.getCellData( "PBUB" );
|
VectorType& Pb = simData.getCellData( "PBUB" );
|
||||||
VectorType& Pd = simData.getCellData( "PDEW" );
|
VectorType& Pd = simData.getCellData( "PDEW" );
|
||||||
|
|
||||||
|
simData.registerCellData( "SOMAX", 1 );
|
||||||
|
VectorType& somax = simData.getCellData( "SOMAX" );
|
||||||
|
|
||||||
std::vector<int> failed_cells_pb;
|
std::vector<int> failed_cells_pb;
|
||||||
std::vector<int> failed_cells_pd;
|
std::vector<int> failed_cells_pd;
|
||||||
const auto& gridView = ebosSimulator().gridView();
|
const auto& gridView = ebosSimulator().gridView();
|
||||||
@ -1271,6 +1274,8 @@ namespace Opm {
|
|||||||
|
|
||||||
temperature[cellIdx] = fs.temperature(FluidSystem::oilPhaseIdx).value();
|
temperature[cellIdx] = fs.temperature(FluidSystem::oilPhaseIdx).value();
|
||||||
|
|
||||||
|
somax[cellIdx] = ebosSimulator().model().maxOilSaturation(cellIdx);
|
||||||
|
|
||||||
if (aqua_active) {
|
if (aqua_active) {
|
||||||
saturation[ satIdx + aqua_pos ] = fs.saturation(FluidSystem::waterPhaseIdx).value();
|
saturation[ satIdx + aqua_pos ] = fs.saturation(FluidSystem::waterPhaseIdx).value();
|
||||||
bWater[cellIdx] = fs.invB(FluidSystem::waterPhaseIdx).value();
|
bWater[cellIdx] = fs.invB(FluidSystem::waterPhaseIdx).value();
|
||||||
|
@ -168,10 +168,10 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
|
|||||||
if (deck.hasKeyword("VAPPARS") && deck.hasKeyword("VAPOIL") && deck.hasKeyword("DISGAS")) {
|
if (deck.hasKeyword("VAPPARS") && deck.hasKeyword("VAPOIL") && deck.hasKeyword("DISGAS")) {
|
||||||
vap1_ = deck.getKeyword("VAPPARS").getRecord(0).getItem(0).get< double >(0);
|
vap1_ = deck.getKeyword("VAPPARS").getRecord(0).getItem(0).get< double >(0);
|
||||||
vap2_ = deck.getKeyword("VAPPARS").getRecord(0).getItem(1).get< double >(0);
|
vap2_ = deck.getKeyword("VAPPARS").getRecord(0).getItem(1).get< double >(0);
|
||||||
satOilMax_.resize(number_of_cells, 0.0);
|
|
||||||
} else if (deck.hasKeyword("VAPPARS")) {
|
} else if (deck.hasKeyword("VAPPARS")) {
|
||||||
OPM_THROW(std::runtime_error, "Input has VAPPARS, but missing VAPOIL and/or DISGAS\n");
|
OPM_THROW(std::runtime_error, "Input has VAPPARS, but missing VAPOIL and/or DISGAS\n");
|
||||||
}
|
}
|
||||||
|
satOilMax_.resize(number_of_cells, 0.0);
|
||||||
|
|
||||||
SaturationPropsFromDeck* ptr
|
SaturationPropsFromDeck* ptr
|
||||||
= new SaturationPropsFromDeck();
|
= new SaturationPropsFromDeck();
|
||||||
@ -879,19 +879,22 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
|
|||||||
/// Update for max oil saturation.
|
/// Update for max oil saturation.
|
||||||
void BlackoilPropsAdFromDeck::updateSatOilMax(const std::vector<double>& saturation)
|
void BlackoilPropsAdFromDeck::updateSatOilMax(const std::vector<double>& saturation)
|
||||||
{
|
{
|
||||||
if (!satOilMax_.empty()) {
|
const int n = satOilMax_.size();
|
||||||
const int n = satOilMax_.size();
|
const int np = phase_usage_.num_phases;
|
||||||
const int np = phase_usage_.num_phases;
|
const int posOil = phase_usage_.phase_pos[Oil];
|
||||||
const int posOil = phase_usage_.phase_pos[Oil];
|
const double* s = saturation.data();
|
||||||
const double* s = saturation.data();
|
for (int i=0; i<n; ++i) {
|
||||||
for (int i=0; i<n; ++i) {
|
if (satOilMax_[i] < s[np*i+posOil]) {
|
||||||
if (satOilMax_[i] < s[np*i+posOil]) {
|
satOilMax_[i] = s[np*i+posOil];
|
||||||
satOilMax_[i] = s[np*i+posOil];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::vector<double>& BlackoilPropsAdFromDeck::satOilMax() const
|
||||||
|
{
|
||||||
|
return satOilMax_;
|
||||||
|
}
|
||||||
|
|
||||||
/// Set capillary pressure scaling according to pressure diff. and initial water saturation.
|
/// Set capillary pressure scaling according to pressure diff. and initial water saturation.
|
||||||
/// \param[in] saturation Array of n*numPhases saturation values.
|
/// \param[in] saturation Array of n*numPhases saturation values.
|
||||||
/// \param[in] pc Array of n*numPhases capillary pressure values.
|
/// \param[in] pc Array of n*numPhases capillary pressure values.
|
||||||
@ -918,7 +921,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
|
|||||||
const std::vector<int>& cells,
|
const std::vector<int>& cells,
|
||||||
const double vap) const
|
const double vap) const
|
||||||
{
|
{
|
||||||
if (!satOilMax_.empty() && vap > 0.0) {
|
if (vap > 0.0) {
|
||||||
const int n = cells.size();
|
const int n = cells.size();
|
||||||
V factor = V::Ones(n, 1);
|
V factor = V::Ones(n, 1);
|
||||||
const double eps_sqrt = std::sqrt(std::numeric_limits<double>::epsilon());
|
const double eps_sqrt = std::sqrt(std::numeric_limits<double>::epsilon());
|
||||||
@ -943,7 +946,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
|
|||||||
const std::vector<int>& cells,
|
const std::vector<int>& cells,
|
||||||
const double vap) const
|
const double vap) const
|
||||||
{
|
{
|
||||||
if (!satOilMax_.empty() && vap > 0.0) {
|
if (vap > 0.0) {
|
||||||
const int n = cells.size();
|
const int n = cells.size();
|
||||||
V factor = V::Ones(n, 1);
|
V factor = V::Ones(n, 1);
|
||||||
const double eps_sqrt = std::sqrt(std::numeric_limits<double>::epsilon());
|
const double eps_sqrt = std::sqrt(std::numeric_limits<double>::epsilon());
|
||||||
|
@ -362,6 +362,9 @@ namespace Opm
|
|||||||
/// Update for max oil saturation.
|
/// Update for max oil saturation.
|
||||||
void updateSatOilMax(const std::vector<double>& saturation);
|
void updateSatOilMax(const std::vector<double>& saturation);
|
||||||
|
|
||||||
|
/// Returns the max oil saturation
|
||||||
|
const std::vector<double>& satOilMax() const;
|
||||||
|
|
||||||
/// Set capillary pressure scaling according to pressure diff. and initial water saturation.
|
/// Set capillary pressure scaling according to pressure diff. and initial water saturation.
|
||||||
/// \param[in] saturation Array of n*numPhases saturation values.
|
/// \param[in] saturation Array of n*numPhases saturation values.
|
||||||
/// \param[in] pc Array of n*numPhases capillary pressure values.
|
/// \param[in] pc Array of n*numPhases capillary pressure values.
|
||||||
|
@ -174,6 +174,10 @@ void solutionToSim( const data::Solution& sol,
|
|||||||
state.getCellData("SSOL") = sol.data("SSOL");
|
state.getCellData("SSOL") = sol.data("SSOL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( sol.has( "SOMAX" ) ) {
|
||||||
|
state.registerCellData("SOMAX", 1);
|
||||||
|
state.getCellData("SOMAX") = sol.data("SOMAX");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,6 +149,17 @@ public:
|
|||||||
// This is a restart, populate WellState and ReservoirState state objects from restart file
|
// This is a restart, populate WellState and ReservoirState state objects from restart file
|
||||||
output_writer_.initFromRestartFile(props_.phaseUsage(), grid(), state, prev_well_state, extra);
|
output_writer_.initFromRestartFile(props_.phaseUsage(), grid(), state, prev_well_state, extra);
|
||||||
initHydroCarbonState(state, props_.phaseUsage(), Opm::UgGridHelpers::numCells(grid()), has_disgas_, has_vapoil_);
|
initHydroCarbonState(state, props_.phaseUsage(), Opm::UgGridHelpers::numCells(grid()), has_disgas_, has_vapoil_);
|
||||||
|
{
|
||||||
|
const int num_cells = Opm::UgGridHelpers::numCells(grid());
|
||||||
|
|
||||||
|
typedef std::vector<double> VectorType;
|
||||||
|
|
||||||
|
const VectorType& somax = state.getCellData( "SOMAX" );
|
||||||
|
|
||||||
|
for (int cellIdx = 0; cellIdx < num_cells; ++cellIdx) {
|
||||||
|
ebosSimulator_.model().setMaxOilSaturation(somax[cellIdx], cellIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create timers and file for writing timing info.
|
// Create timers and file for writing timing info.
|
||||||
|
@ -420,11 +420,12 @@ namespace Opm
|
|||||||
ExtraData& extra )
|
ExtraData& extra )
|
||||||
{
|
{
|
||||||
std::map<std::string, UnitSystem::measure> solution_keys {{"PRESSURE" , UnitSystem::measure::pressure},
|
std::map<std::string, UnitSystem::measure> solution_keys {{"PRESSURE" , UnitSystem::measure::pressure},
|
||||||
{"SWAT" , UnitSystem::measure::identity},
|
{"SWAT" , UnitSystem::measure::identity},
|
||||||
{"SGAS" , UnitSystem::measure::identity},
|
{"SGAS" , UnitSystem::measure::identity},
|
||||||
{"TEMP" , UnitSystem::measure::temperature},
|
{"TEMP" , UnitSystem::measure::temperature},
|
||||||
{"RS" , UnitSystem::measure::gas_oil_ratio},
|
{"RS" , UnitSystem::measure::gas_oil_ratio},
|
||||||
{"RV" , UnitSystem::measure::oil_gas_ratio}};
|
{"RV" , UnitSystem::measure::oil_gas_ratio},
|
||||||
|
{"SOMAX", UnitSystem::measure::identity}};
|
||||||
std::map<std::string, bool> extra_keys {{"OPMEXTRA" , false}};
|
std::map<std::string, bool> extra_keys {{"OPMEXTRA" , false}};
|
||||||
|
|
||||||
if (restart_double_si_) {
|
if (restart_double_si_) {
|
||||||
@ -550,6 +551,8 @@ namespace Opm
|
|||||||
addToSimData( simData, "RSSAT", sd.rsSat );
|
addToSimData( simData, "RSSAT", sd.rsSat );
|
||||||
addToSimData( simData, "RVSAT", sd.rvSat );
|
addToSimData( simData, "RVSAT", sd.rvSat );
|
||||||
|
|
||||||
|
addToSimData( simData, "SOMAX", sd.soMax );
|
||||||
|
|
||||||
return simData;
|
return simData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -774,6 +777,13 @@ namespace Opm
|
|||||||
data::TargetType::RESTART_AUXILIARY);
|
data::TargetType::RESTART_AUXILIARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sd.hasCellData("SOMAX")) {
|
||||||
|
output.insert("SOMAX",
|
||||||
|
Opm::UnitSystem::measure::identity,
|
||||||
|
std::move( sd.getCellData("SOMAX") ),
|
||||||
|
data::TargetType::RESTART_AUXILIARY);
|
||||||
|
}
|
||||||
|
|
||||||
//Warn for any unhandled keyword
|
//Warn for any unhandled keyword
|
||||||
if (log) {
|
if (log) {
|
||||||
for (auto& keyValue : rstKeywords) {
|
for (auto& keyValue : rstKeywords) {
|
||||||
|
@ -82,6 +82,7 @@ namespace Opm {
|
|||||||
: rq(num_phases)
|
: rq(num_phases)
|
||||||
, rsSat(ADB::null())
|
, rsSat(ADB::null())
|
||||||
, rvSat(ADB::null())
|
, rvSat(ADB::null())
|
||||||
|
, soMax()
|
||||||
, fip()
|
, fip()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -92,6 +93,7 @@ namespace Opm {
|
|||||||
std::vector<ReservoirResidualQuant> rq;
|
std::vector<ReservoirResidualQuant> rq;
|
||||||
ADB rsSat;
|
ADB rsSat;
|
||||||
ADB rvSat;
|
ADB rvSat;
|
||||||
|
std::vector<double> soMax;
|
||||||
std::array<V, fipValues> fip;
|
std::array<V, fipValues> fip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user