diff --git a/ebos/eclbaseaquifermodel.hh b/ebos/eclbaseaquifermodel.hh index c2cc95deb..3e8aeba67 100644 --- a/ebos/eclbaseaquifermodel.hh +++ b/ebos/eclbaseaquifermodel.hh @@ -149,6 +149,11 @@ public: void deserialize(Restarter& res OPM_UNUSED) { } + + Opm::data::Aquifers aquiferData() const + { return Opm::data::Aquifers{}; } + + protected: Simulator& simulator_; }; diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index cad1935c5..8029daa60 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -273,6 +273,9 @@ public: const auto localGroupAndNetworkData = simulator_.problem().wellModel() .groupAndNetworkData(reportStepNum, simulator_.vanguard().schedule()); + + const auto localAquiferData = simulator_.problem().mutableAquiferModel().aquiferData(); + this->prepareLocalCellData(isSubStep, reportStepNum); if (collectToIORank_.isParallel()) @@ -308,6 +311,9 @@ public: ? this->collectToIORank_.globalGroupAndNetworkData() : localGroupAndNetworkData; + // Aquifer can not be parallel running yet + const auto& aquiferData = localAquiferData; + const auto& blockData = this->collectToIORank_.isParallel() ? this->collectToIORank_.globalBlockData() @@ -322,7 +328,8 @@ public: groupAndNetworkData, miscSummaryData, regionData, - blockData); + blockData, + aquiferData); const auto& udq_config = schedule().getUDQConfig(reportStepNum); udq_config.eval( reportStepNum, summaryState(), udqState() ); diff --git a/opm/simulators/aquifers/AquiferCarterTracy.hpp b/opm/simulators/aquifers/AquiferCarterTracy.hpp index 99c711eed..264fcd7c8 100644 --- a/opm/simulators/aquifers/AquiferCarterTracy.hpp +++ b/opm/simulators/aquifers/AquiferCarterTracy.hpp @@ -65,6 +65,22 @@ public: } } + Opm::data::AquiferData aquiferData() const + { + data::AquiferData data; + data.aquiferID = this->aquiferID; + // TODO: not sure how to get this pressure value yet + data.pressure = this->pa0_; + data.fluxRate = 0.; + for (const auto& q : this->Qai_) { + data.fluxRate += q.value(); + } + data.volume = this->W_flux_.value(); + data.initPressure = this->pa0_; + data.type = Opm::data::AquiferType::CarterTracey; + return data; + } + protected: // Variables constants const AquiferCT::AQUCT_data aquct_data_; diff --git a/opm/simulators/aquifers/AquiferFetkovich.hpp b/opm/simulators/aquifers/AquiferFetkovich.hpp index cb1b0d8be..469ac04e1 100644 --- a/opm/simulators/aquifers/AquiferFetkovich.hpp +++ b/opm/simulators/aquifers/AquiferFetkovich.hpp @@ -68,6 +68,24 @@ public: } } + Opm::data::AquiferData aquiferData() const + { + // TODO: how to unify the two functions? + data::AquiferData data; + data.aquiferID = this->aquiferID; + data.pressure = this->aquifer_pressure_; + data.fluxRate = 0.; + for (const auto& q : this->Qai_) { + data.fluxRate += q.value(); + } + data.volume = this->W_flux_.value(); + data.initPressure = this->pa0_; + data.type = Opm::data::AquiferType::Fetkovich; + // Not handling std::shared_ptr aquFet for now, + // because we do not need it yet + return data; + } + protected: // Aquifer Fetkovich Specific Variables // TODO: using const reference here will cause segmentation fault, which is very strange diff --git a/opm/simulators/aquifers/BlackoilAquiferModel.hpp b/opm/simulators/aquifers/BlackoilAquiferModel.hpp index 72804ba25..2b51e4d40 100644 --- a/opm/simulators/aquifers/BlackoilAquiferModel.hpp +++ b/opm/simulators/aquifers/BlackoilAquiferModel.hpp @@ -65,6 +65,8 @@ public: void endTimeStep(); void endEpisode(); + Opm::data::Aquifers aquiferData() const; + template void serialize(Restarter& res); @@ -82,6 +84,8 @@ protected: Simulator& simulator_; std::unordered_map cartesian_to_compressed_; + // TODO: probably we can use one variable to store both types of aquifers, because + // they share the base class mutable std::vector aquifers_CarterTracy; mutable std::vector aquifers_Fetkovich; diff --git a/opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp b/opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp index 55d964f2f..e01d6ebf5 100644 --- a/opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp +++ b/opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp @@ -205,4 +205,23 @@ BlackoilAquiferModel::aquiferFetkovichActive() const { return !aquifers_Fetkovich.empty(); } + +template +Opm::data::Aquifers BlackoilAquiferModel::aquiferData() const { + Opm::data::Aquifers data; + if (this->aquiferCarterTracyActive()) { + for (const auto& aqu : aquifers_CarterTracy) { + Opm::data::AquiferData aqu_data = aqu.aquiferData(); + data[aqu_data.aquiferID] = aqu_data; + } + } + + if (this->aquiferFetkovichActive()) { + for (const auto& aqu : aquifers_Fetkovich) { + Opm::data::AquiferData aqu_data = aqu.aquiferData(); + data[aqu_data.aquiferID] = aqu_data; + } + } + return data; +} } // namespace Opm