diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 5259d65b4..b577f005e 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -160,6 +160,7 @@ list (APPEND PUBLIC_HEADER_FILES opm/simulators/aquifers/AquiferInterface.hpp opm/simulators/aquifers/AquiferCarterTracy.hpp opm/simulators/aquifers/AquiferFetkovich.hpp + opm/simulators/aquifers/AquiferNumerical.hpp opm/simulators/aquifers/BlackoilAquiferModel.hpp opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp opm/simulators/linalg/bda/BdaBridge.hpp diff --git a/opm/simulators/aquifers/AquiferNumerical.hpp b/opm/simulators/aquifers/AquiferNumerical.hpp new file mode 100644 index 000000000..354f26ccf --- /dev/null +++ b/opm/simulators/aquifers/AquiferNumerical.hpp @@ -0,0 +1,76 @@ +/* + Copyright (C) 2020 Equinor ASA + Copyright (C) 2020 SINTEF Digital + + 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 . +*/ + +#ifndef OPM_AQUIFERNUMERICAL_HEADER_INCLUDED +#define OPM_AQUIFERNUMERICAL_HEADER_INCLUDED + +#include + +#include + +namespace Opm +{ +template +class AquiferNumerical +{ +public: + // Constructor + AquiferNumerical(const SingleNumericalAquifer& aquifer) + : aquifer_(aquifer) + , init_pressure_(aquifer.initPressure()) + , pressure_(this->init_pressure_) + , flux_rate_(0.) + , cumulative_flux_(0.) + { + } + + void initFromRestart(const std::vector& aquiferSoln) + { + // NOT handling Restart for now + } + + void beginTimeStep() + { + } + + void endTimeStep() + { + } + + Opm::data::AquiferData aquiferData() const + { + data::AquiferData data; + data.aquiferID = this->aquifer_.id(); + data.initPressure = this->init_pressure_; + data.pressure = this->pressure_; + data.volume = this->cumulative_flux_; + data.type = Opm::data::AquiferType::Numerical; + return data; + } + +private: + const Opm::SingleNumericalAquifer& aquifer_; + double init_pressure_; + double pressure_; // aquifer pressure + double flux_rate_; // aquifer influx rate + double cumulative_flux_; // cumulative aquifer influx +}; +} // namespace Opm +#endif diff --git a/opm/simulators/aquifers/BlackoilAquiferModel.hpp b/opm/simulators/aquifers/BlackoilAquiferModel.hpp index 17a87f7c8..af80516e6 100644 --- a/opm/simulators/aquifers/BlackoilAquiferModel.hpp +++ b/opm/simulators/aquifers/BlackoilAquiferModel.hpp @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -120,6 +121,7 @@ protected: // they share the base class mutable std::vector aquifers_CarterTracy; mutable std::vector aquifers_Fetkovich; + std::vector> aquifers_numerical; // This initialization function is used to connect the parser objects with the ones needed by AquiferCarterTracy void init(); @@ -127,6 +129,7 @@ protected: bool aquiferActive() const; bool aquiferCarterTracyActive() const; bool aquiferFetkovichActive() const; + bool aquiferNumericalActive() const; }; diff --git a/opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp b/opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp index 847fe545e..eb4bf2a3c 100644 --- a/opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp +++ b/opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp @@ -18,6 +18,9 @@ along with OPM. If not, see . */ +#include +#include "BlackoilAquiferModel.hpp" + namespace Opm { @@ -179,6 +182,12 @@ BlackoilAquiferModel::init() aquifers_Fetkovich.emplace_back(connections[aq.aquiferID], this->simulator_, aq); } + + if (aquifer.hasNumericalAquifer()) { + for (const auto& elem : aquifer.numericalAquifers().aquifers()) { + this->aquifers_numerical.emplace_back(elem.second); + } + } } template bool @@ -199,6 +208,13 @@ BlackoilAquiferModel::aquiferFetkovichActive() const return !aquifers_Fetkovich.empty(); } +template +bool +BlackoilAquiferModel::aquiferNumericalActive() const +{ + return !(this->aquifers_numerical.empty()); +} + template Opm::data::Aquifers BlackoilAquiferModel::aquiferData() const { Opm::data::Aquifers data; @@ -215,6 +231,14 @@ Opm::data::Aquifers BlackoilAquiferModel::aquiferData() const { data[aqu_data.aquiferID] = aqu_data; } } + + if (this->aquiferNumericalActive()) { + for (const auto& aqu : this->aquifers_numerical) { + Opm::data::AquiferData aqu_data = aqu.aquiferData(); + data[aqu_data.aquiferID] = aqu_data; + } + } + return data; } } // namespace Opm