water-gas ratio input and output plus simulator for salt precipitation and water evaporation

This commit is contained in:
Paul Egberts 2022-03-01 17:54:22 +01:00
parent 131bb6585f
commit 797fdc278b
15 changed files with 238 additions and 13 deletions

View File

@ -388,7 +388,6 @@ add_dependencies(moduleVersion opmsimulators)
set(FLOW_MODELS blackoil brine energy extbo foam gasoil gaswater
oilwater oilwater_brine gaswater_brine oilwater_polymer
oilwater_polymer_injectivity micp polymer solvent
gasoil_energy brine_saltprecipitation)
set(FLOW_VARIANT_MODELS brine_energy onephase onephase_energy)
set(FLOW_TGTS)

View File

@ -134,6 +134,11 @@ public:
else if (Indices::gasEnabled)
fluidState.setRv(0.0);
if (FluidSystem::enableVaporizedWater())
fluidState.setRvw(initialState.rvw()[elemIdx]);
else if (Indices::gasEnabled)
fluidState.setRvw(0.0);
// set the temperature.
if (enableTemperature || enableEnergy)

View File

@ -681,6 +681,7 @@ assignToSolution(data::Solution& sol)
{"RSSAT", UnitSystem::measure::gas_oil_ratio, data::TargetType::RESTART_AUXILIARY, gasDissolutionFactor_},
{"RV", UnitSystem::measure::oil_gas_ratio, data::TargetType::RESTART_SOLUTION, rv_},
{"RVSAT", UnitSystem::measure::oil_gas_ratio, data::TargetType::RESTART_AUXILIARY, oilVaporizationFactor_},
{"RVW", UnitSystem::measure::oil_gas_ratio, data::TargetType::RESTART_AUXILIARY, rvw_}, //PJPE check units + add water vap factor
{"SALT", UnitSystem::measure::salinity, data::TargetType::RESTART_SOLUTION, cSalt_},
{"SALTP", UnitSystem::measure::identity, data::TargetType::RESTART_AUXILIARY, pSalt_},
{"PERMFACT", UnitSystem::measure::identity, data::TargetType::RESTART_AUXILIARY, permFact_},
@ -784,6 +785,8 @@ setRestart(const data::Solution& sol,
rs_[elemIdx] = sol.data("RS")[globalDofIndex];
if (!rv_.empty() && sol.has("RV"))
rv_[elemIdx] = sol.data("RV")[globalDofIndex];
if (!rvw_.empty() && sol.has("RVW"))
rvw_[elemIdx] = sol.data("RVW")[globalDofIndex];
if (!cPolymer_.empty() && sol.has("POLYMER"))
cPolymer_[elemIdx] = sol.data("POLYMER")[globalDofIndex];
if (!cFoam_.empty() && sol.has("FOAM"))
@ -978,7 +981,10 @@ doAllocBuffers(unsigned bufferSize,
rv_.resize(bufferSize, 0.0);
rstKeywords["RV"] = 0;
}
if (FluidSystem::enableVaporizedWater()) {
rvw_.resize(bufferSize, 0.0);
rstKeywords["RVW"] = 0;
}
if (enableSolvent_)
sSol_.resize(bufferSize, 0.0);
if (enablePolymer_)

View File

@ -415,6 +415,7 @@ protected:
ScalarBuffer temperature_;
ScalarBuffer rs_;
ScalarBuffer rv_;
ScalarBuffer rvw_;
ScalarBuffer overburdenPressure_;
ScalarBuffer oilSaturationPressure_;
ScalarBuffer sSol_;

View File

@ -282,6 +282,11 @@ public:
Valgrind::CheckDefined(this->rv_[globalDofIdx]);
}
if (!this->rvw_.empty()) {
this->rvw_[globalDofIdx] = getValue(fs.Rvw());
Valgrind::CheckDefined(this->rvw_[globalDofIdx]);
}
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
if (this->invB_[phaseIdx].empty())
continue;
@ -472,6 +477,9 @@ public:
if (!this->rs_.empty())
this->rs_[globalDofIdx] = fsInitial.Rs();
if (!this->rvw_.empty())
this->rvw_[globalDofIdx] = fsInitial.Rvw();
// re-compute the volume factors, viscosities and densities if asked for
if (!this->density_[oilPhaseIdx].empty())
this->density_[oilPhaseIdx][globalDofIdx] = FluidSystem::density(fsInitial,
@ -717,6 +725,8 @@ public:
fs.setRs(this->rs_[elemIdx]);
if (!this->rv_.empty())
fs.setRv(this->rv_[elemIdx]);
if (!this->rvw_.empty())
fs.setRvw(this->rvw_[elemIdx]);
}
void initHysteresisParams(Simulator& simulator, unsigned elemIdx) const

View File

@ -2572,6 +2572,7 @@ private:
bool has_sgas = fp.has_double("SGAS");
bool has_rs = fp.has_double("RS");
bool has_rv = fp.has_double("RV");
bool has_rvw = fp.has_double("RVW");
bool has_pressure = fp.has_double("PRESSURE");
bool has_salt = fp.has_double("SALT");
bool has_saltp = fp.has_double("SALTP");
@ -2594,6 +2595,9 @@ private:
if (FluidSystem::enableVaporizedOil() && !has_rv)
throw std::runtime_error("The ECL input file requires the RV keyword to be present if"
" vaporized oil is enabled");
if (FluidSystem::enableVaporizedWater() && !has_rvw)
throw std::runtime_error("The ECL input file requires the RVW keyword to be present if"
" vaporized water is enabled");
if (enableBrine && !has_salt)
throw std::runtime_error("The ECL input file requires the SALT keyword to be present if"
" brine is enabled and the model is initialized explicitly");
@ -2610,6 +2614,7 @@ private:
std::vector<double> pressureData;
std::vector<double> rsData;
std::vector<double> rvData;
std::vector<double> rvwData;
std::vector<double> tempiData;
std::vector<double> saltData;
std::vector<double> saltpData;
@ -2631,6 +2636,9 @@ private:
if (FluidSystem::enableVaporizedOil())
rvData = fp.get_double("RV");
if (FluidSystem::enableVaporizedWater())
rvwData = fp.get_double("RVW");
// initial reservoir temperature
tempiData = fp.get_double("TEMPI");
@ -2692,22 +2700,25 @@ private:
- gasSaturationData[dofIdx]);
//////
// set phase pressures
// set phase pressures
//////
Scalar oilPressure = pressureData[dofIdx];
Scalar pressure = pressureData[dofIdx]; // oil pressure or gas pressure if oil is not enabled
// this assumes that capillary pressures only depend on the phase saturations
// and possibly on temperature. (this is always the case for ECL problems.)
Dune::FieldVector<Scalar, numPhases> pc(0.0);
const auto& matParams = materialLawParams(dofIdx);
MaterialLaw::capillaryPressures(pc, matParams, dofFluidState);
Valgrind::CheckDefined(oilPressure);
Valgrind::CheckDefined(pressure);
Valgrind::CheckDefined(pc);
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
if (!FluidSystem::phaseIsActive(phaseIdx))
continue;
dofFluidState.setPressure(phaseIdx, oilPressure + (pc[phaseIdx] - pc[oilPhaseIdx]));
if (Indices::oilEnabled)
dofFluidState.setPressure(phaseIdx, pressure + (pc[phaseIdx] - pc[oilPhaseIdx]));
else if (Indices::gasEnabled)
dofFluidState.setPressure(phaseIdx, pressure + (pc[phaseIdx] - pc[gasPhaseIdx]));
}
if (FluidSystem::enableDissolvedGas())
@ -2720,6 +2731,11 @@ private:
else if (Indices::gasEnabled && Indices::oilEnabled)
dofFluidState.setRv(0.0);
if (FluidSystem::enableVaporizedWater())
dofFluidState.setRvw(rvwData[dofIdx]);
else if (Indices::gasEnabled && Indices::waterEnabled)
dofFluidState.setRvw(0.0);
//////
// set invB_
//////

View File

@ -344,6 +344,7 @@ public:
{"SSOLVENT" , UnitSystem::measure::identity, enableSolvent},
{"RS", UnitSystem::measure::gas_oil_ratio, FluidSystem::enableDissolvedGas()},
{"RV", UnitSystem::measure::oil_gas_ratio, FluidSystem::enableVaporizedOil()},
{"RVW", UnitSystem::measure::oil_gas_ratio, FluidSystem::enableVaporizedWater()},
{"SOMAX", UnitSystem::measure::identity, simulator_.problem().vapparsActive(simulator_.episodeIndex())},
{"PCSWM_OW", UnitSystem::measure::identity, enableHysteresis},
{"KRNSW_OW", UnitSystem::measure::identity, enableHysteresis},

View File

@ -1737,6 +1737,7 @@ public:
const PVec& saturation() const { return sat_; }
const Vec& rs() const { return rs_; }
const Vec& rv() const { return rv_; }
const Vec& rvw() const { return rvw_; }
private:
@ -1807,6 +1808,7 @@ private:
PVec sat_;
Vec rs_;
Vec rv_;
Vec rvw_;
const CartesianIndexMapper& cartesianIndexMapper_;
Vec swatInit_;
Vec cellCenterDepth_;

View File

@ -34,7 +34,6 @@ namespace TTag {
struct EclFlowGasWaterProblem {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
//! The indices required by the model
template<class TypeTag>

View File

@ -0,0 +1,109 @@
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <flow/flow_ebos_gaswater_saltprec_vapwat.hpp>
#include <opm/material/common/ResetLocale.hpp>
#include <opm/models/blackoil/blackoiltwophaseindices.hh>
#include <opm/grid/CpGrid.hpp>
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
#include <opm/simulators/flow/Main.hpp>
namespace Opm {
namespace Properties {
namespace TTag {
struct EclFlowGasWaterSaltprecVapwatProblem {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
template<class TypeTag>
struct EnableBrine<TypeTag, TTag::EclFlowGasWaterSaltprecVapwatProblem> {
static constexpr bool value = true;
};
template<class TypeTag>
struct EnableSaltPrecipitation<TypeTag, TTag::EclFlowGasWaterSaltprecVapwatProblem> {
static constexpr bool value = true;
};
template<class TypeTag>
struct EnableEvaporation<TypeTag, TTag::EclFlowGasWaterSaltprecVapwatProblem> {
static constexpr bool value = true;
};
//! The indices required by the model
template<class TypeTag>
struct Indices<TypeTag, TTag::EclFlowGasWaterSaltprecVapwatProblem>
{
private:
// it is unfortunately not possible to simply use 'TypeTag' here because this leads
// to cyclic definitions of some properties. if this happens the compiler error
// messages unfortunately are *really* confusing and not really helpful.
using BaseTypeTag = TTag::EclFlowProblem;
using FluidSystem = GetPropType<BaseTypeTag, Properties::FluidSystem>;
public:
typedef BlackOilTwoPhaseIndices<getPropValue<TypeTag, Properties::EnableSolvent>(),
getPropValue<TypeTag, Properties::EnableExtbo>(),
getPropValue<TypeTag, Properties::EnablePolymer>(),
getPropValue<TypeTag, Properties::EnableEnergy>(),
getPropValue<TypeTag, Properties::EnableFoam>(),
getPropValue<TypeTag, Properties::EnableBrine>(),
/*PVOffset=*/0,
/*disabledCompIdx=*/FluidSystem::oilCompIdx,
getPropValue<TypeTag, Properties::EnableMICP>()> type;
};
}}
namespace Opm {
void flowEbosGasWaterSaltprecVapwatSetDeck(double setupTime, std::shared_ptr<Deck> deck,
std::shared_ptr<EclipseState> eclState,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summaryConfig)
{
using TypeTag = Properties::TTag::EclFlowGasWaterSaltprecVapwatProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
}
// ----------------- Main program -----------------
int flowEbosGasWaterSaltprecVapwatMain(int argc, char** argv, bool outputCout, bool outputFiles)
{
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
resetLocale();
FlowMainEbos<Properties::TTag::EclFlowGasWaterSaltprecVapwatProblem>
mainfunc {argc, argv, outputCout, outputFiles};
return mainfunc.execute();
}
int flowEbosGasWaterSaltprecVapwatMainStandalone(int argc, char** argv)
{
using TypeTag = Properties::TTag::EclFlowGasWaterSaltprecVapwatProblem;
auto mainObject = Opm::Main(argc, argv);
return mainObject.runStatic<TypeTag>();
}
}

View File

@ -0,0 +1,42 @@
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FLOW_EBOS_GASWATERSALTPRECVAPWAT_BRINE_HPP
#define FLOW_EBOS_GASWATERSALTPRECVAPWAT_BRINE_HPP
#include <memory>
namespace Opm {
class Deck;
class EclipseState;
class Schedule;
class SummaryConfig;
void flowEbosGasWaterSaltprecVapwatSetDeck(double setupTime, std::shared_ptr<Deck> deck,
std::shared_ptr<EclipseState> eclState,
std::shared_ptr<Schedule> schedule,
std::shared_ptr<SummaryConfig> summaryConfig);
//! \brief Main function used in flow binary.
int flowEbosGasWaterSaltprecVapwatMain(int argc, char** argv, bool outputCout, bool outputFiles);
//! \brief Main function used in flow_gaswater_brine binary.
int flowEbosGasWaterSaltprecVapwatMainStandalone(int argc, char** argv);
}
#endif // FLOW_EBOS_GASWATERSALTPRECVAPWAT_HPP

View File

@ -0,0 +1,24 @@
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <flow/flow_ebos_gaswater_saltprec_vapwat.hpp>
int main(int argc, char** argv)
{
return Opm::flowEbosGasWaterSaltprecVapwatMainStandalone(argc, argv);
}

View File

@ -452,6 +452,7 @@ namespace Opm {
{
Scalar resultDelta = 0.0;
Scalar resultDenom = 0.0;
//return 0.0;
const auto& elemMapper = ebosSimulator_.model().elementMapper();
const auto& gridView = ebosSimulator_.gridView();

View File

@ -34,6 +34,7 @@
#include <flow/flow_ebos_foam.hpp>
#include <flow/flow_ebos_brine.hpp>
#include <flow/flow_ebos_brine_saltprecipitation.hpp>
#include <flow/flow_ebos_gaswater_saltprec_vapwat.hpp>
#include <flow/flow_ebos_oilwater_brine.hpp>
#include <flow/flow_ebos_gaswater_brine.hpp>
#include <flow/flow_ebos_energy.hpp>
@ -667,9 +668,18 @@ private:
return flowEbosOilWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
}
if (phases.active(Phase::GAS)){ // gas water brine case
flowEbosGasWaterBrineSetDeck(
setupTime_, deck_, eclipseState_, schedule_, summaryConfig_);
return flowEbosGasWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
if (eclipseState_->getSimulationConfig().hasPRECSALT() &&
eclipseState_->getSimulationConfig().hasVAPWAT()) {
//case with water vaporization into gas phase and salt precipitation
flowEbosGasWaterSaltprecVapwatSetDeck(
setupTime_, deck_, eclipseState_, schedule_, summaryConfig_);
return flowEbosGasWaterSaltprecVapwatMain(argc_, argv_, outputCout_, outputFiles_);
}
else {
flowEbosGasWaterBrineSetDeck(
setupTime_, deck_, eclipseState_, schedule_, summaryConfig_);
return flowEbosGasWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
}
}
}
else if (eclipseState_->getSimulationConfig().hasPRECSALT()) {

View File

@ -488,7 +488,7 @@ const KeywordValidation::UnsupportedKeywords& unsupportedKeywords()
{"PPCWMAX", {false, std::nullopt}},
{"PRORDER", {false, std::nullopt}},
{"PRVD", {false, std::nullopt}},
{"PVTGW", {false, std::nullopt}},
//{"PVTGW", {false, std::nullopt}},
{"PVTGWO", {false, std::nullopt}},
{"RAINFALL", {false, std::nullopt}},
{"RBEDCONT", {false, std::nullopt}},
@ -549,7 +549,7 @@ const KeywordValidation::UnsupportedKeywords& unsupportedKeywords()
{"RSCONSTT", {false, std::nullopt}},
{"RSSPEC", {false, std::nullopt}},
{"RTEMPA", {false, std::nullopt}},
{"RWGSALT", {false, std::nullopt}},
//{"RWGSALT", {false, std::nullopt}},
{"SAMG", {false, std::nullopt}},
{"SAVE", {false, std::nullopt}},
{"SKIP", {false, std::nullopt}},
@ -659,7 +659,7 @@ const KeywordValidation::UnsupportedKeywords& unsupportedKeywords()
{"USECUPL", {false, std::nullopt}},
{"USEFLUX", {false, std::nullopt}},
{"USENOFLO", {false, std::nullopt}},
{"VAPWAT", {false, std::nullopt}},
//{"VAPWAT", {false, std::nullopt}},
{"VDFLOW", {false, std::nullopt}},
{"VDFLOWR", {false, std::nullopt}},
{"VE", {false, std::nullopt}},