Merge pull request #4791 from svenn-t/aquifer_h2store

Enable aquifers with H2STORE
This commit is contained in:
Bård Skaflestad 2023-08-12 13:42:16 +02:00 committed by GitHub
commit 43acfb6142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 22 deletions

View File

@ -715,7 +715,7 @@ private:
void applyNumericalAquifers_(const GridView& gridView, void applyNumericalAquifers_(const GridView& gridView,
const NumericalAquifers& aquifer, const NumericalAquifers& aquifer,
const bool co2store); const bool co2store_or_h2store);
template<class RMap> template<class RMap>
void setRegionPvtIdx(const EclipseState& eclState, const RMap& reg); void setRegionPvtIdx(const EclipseState& eclState, const RMap& reg);

View File

@ -1507,7 +1507,7 @@ InitialStateComputer(MaterialLawManager& materialLawManager,
calcPressSatRsRv(eqlmap, rec, materialLawManager, comm, grav); calcPressSatRsRv(eqlmap, rec, materialLawManager, comm, grav);
// modify the pressure and saturation for numerical aquifer cells // modify the pressure and saturation for numerical aquifer cells
applyNumericalAquifers_(gridView, num_aquifers, eclipseState.runspec().co2Storage()); applyNumericalAquifers_(gridView, num_aquifers, eclipseState.runspec().co2Storage() || eclipseState.runspec().h2Storage());
// Modify oil pressure in no-oil regions so that the pressures of present phases can // Modify oil pressure in no-oil regions so that the pressures of present phases can
// be recovered from the oil pressure and capillary relations. // be recovered from the oil pressure and capillary relations.
@ -1654,14 +1654,23 @@ void InitialStateComputer<FluidSystem,
CartesianIndexMapper>:: CartesianIndexMapper>::
applyNumericalAquifers_(const GridView& gridView, applyNumericalAquifers_(const GridView& gridView,
const NumericalAquifers& aquifer, const NumericalAquifers& aquifer,
const bool co2store) const bool co2store_or_h2store)
{ {
const auto num_aqu_cells = aquifer.allAquiferCells(); const auto num_aqu_cells = aquifer.allAquiferCells();
if (num_aqu_cells.empty()) return; if (num_aqu_cells.empty()) return;
// Check if water phase is active, or in the case of CO2STORE and H2STORE, water is modelled as oil phase
bool oil_as_brine = co2store_or_h2store && FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx);
const auto watPos = oil_as_brine? FluidSystem::oilPhaseIdx : FluidSystem::waterPhaseIdx;
if (!FluidSystem::phaseIsActive(watPos)){
throw std::logic_error { "Water phase has to be active for numerical aquifer case" };
}
ElementMapper elemMapper(gridView, Dune::mcmgElementLayout()); ElementMapper elemMapper(gridView, Dune::mcmgElementLayout());
auto elemIt = gridView.template begin</*codim=*/0>(); auto elemIt = gridView.template begin</*codim=*/0>();
const auto& elemEndIt = gridView.template end</*codim=*/0>(); const auto& elemEndIt = gridView.template end</*codim=*/0>();
const auto oilPos = FluidSystem::oilPhaseIdx;
const auto gasPos = FluidSystem::gasPhaseIdx;
for (; elemIt != elemEndIt; ++elemIt) { for (; elemIt != elemEndIt; ++elemIt) {
const Element& element = *elemIt; const Element& element = *elemIt;
const unsigned int elemIdx = elemMapper.index(element); const unsigned int elemIdx = elemMapper.index(element);
@ -1669,21 +1678,12 @@ applyNumericalAquifers_(const GridView& gridView,
const auto search = num_aqu_cells.find(cartIx); const auto search = num_aqu_cells.find(cartIx);
if (search != num_aqu_cells.end()) { if (search != num_aqu_cells.end()) {
// numerical aquifer cells are filled with water initially // numerical aquifer cells are filled with water initially
// for co2store the oilphase may be used for the brine this->sat_[watPos][elemIdx] = 1.;
bool co2store_oil_as_brine = co2store && FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx);
const auto watPos = co2store_oil_as_brine? FluidSystem::oilPhaseIdx : FluidSystem::waterPhaseIdx;
if (FluidSystem::phaseIsActive(watPos)) {
this->sat_[watPos][elemIdx] = 1.;
} else {
throw std::logic_error { "Water phase has to be active for numerical aquifer case" };
}
const auto oilPos = FluidSystem::oilPhaseIdx; if (!co2store_or_h2store && FluidSystem::phaseIsActive(oilPos)) {
if (!co2store && FluidSystem::phaseIsActive(oilPos)) {
this->sat_[oilPos][elemIdx] = 0.; this->sat_[oilPos][elemIdx] = 0.;
} }
const auto gasPos = FluidSystem::gasPhaseIdx;
if (FluidSystem::phaseIsActive(gasPos)) { if (FluidSystem::phaseIsActive(gasPos)) {
this->sat_[gasPos][elemIdx] = 0.; this->sat_[gasPos][elemIdx] = 0.;
} }

View File

@ -246,7 +246,7 @@ protected:
int compIdx_() const int compIdx_() const
{ {
if (this->co2store_()) if (this->co2store_or_h2store_())
return FluidSystem::oilCompIdx; return FluidSystem::oilCompIdx;
return FluidSystem::waterCompIdx; return FluidSystem::waterCompIdx;

View File

@ -104,7 +104,7 @@ public:
aquCT->dimensionless_pressure = this->dimensionless_pressure_; aquCT->dimensionless_pressure = this->dimensionless_pressure_;
aquCT->influxConstant = this->aquct_data_.influxConstant(); aquCT->influxConstant = this->aquct_data_.influxConstant();
if (!this->co2store_()) { if (!this->co2store_or_h2store_()) {
aquCT->timeConstant = this->aquct_data_.timeConstant(); aquCT->timeConstant = this->aquct_data_.timeConstant();
aquCT->waterDensity = this->aquct_data_.waterDensity(); aquCT->waterDensity = this->aquct_data_.waterDensity();
aquCT->waterViscosity = this->aquct_data_.waterViscosity(); aquCT->waterViscosity = this->aquct_data_.waterViscosity();
@ -217,7 +217,7 @@ protected:
void calculateAquiferConstants() override void calculateAquiferConstants() override
{ {
this->Tc_ = this->co2store_() this->Tc_ = this->co2store_or_h2store_()
? this->timeConstantCO2Store() ? this->timeConstantCO2Store()
: this->aquct_data_.timeConstant(); : this->aquct_data_.timeConstant();
@ -245,7 +245,7 @@ protected:
this->Ta0_ = this->aquct_data_.initial_temperature.value(); this->Ta0_ = this->aquct_data_.initial_temperature.value();
} }
this->rhow_ = this->co2store_() this->rhow_ = this->co2store_or_h2store_()
? this->waterDensityCO2Store() ? this->waterDensityCO2Store()
: this->aquct_data_.waterDensity(); : this->aquct_data_.waterDensity();
} }

View File

@ -214,7 +214,7 @@ private:
// TODO: this is a function from AquiferAnalytical // TODO: this is a function from AquiferAnalytical
int compIdx_() const int compIdx_() const
{ {
if (this->co2store_()) if (this->co2store_or_h2store_())
return FluidSystem::oilCompIdx; return FluidSystem::oilCompIdx;
return FluidSystem::waterCompIdx; return FluidSystem::waterCompIdx;

View File

@ -78,15 +78,16 @@ public:
int aquiferID() const { return this->aquiferID_; } int aquiferID() const { return this->aquiferID_; }
protected: protected:
bool co2store_() const bool co2store_or_h2store_() const
{ {
return ebos_simulator_.vanguard().eclState().runspec().co2Storage(); const auto& rspec = ebos_simulator_.vanguard().eclState().runspec();
return rspec.co2Storage() || rspec.h2Storage();
} }
int phaseIdx_() const int phaseIdx_() const
{ {
// If OIL is used to model brine the aquifer should do the same // If OIL is used to model brine the aquifer should do the same
if (co2store_() && FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) if (co2store_or_h2store_() && FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx))
return FluidSystem::oilPhaseIdx; return FluidSystem::oilPhaseIdx;
return FluidSystem::waterPhaseIdx; return FluidSystem::waterPhaseIdx;