mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-28 20:13:49 -06:00
Add Means of Initializing Analytic Aquifers From Restart Data
This commit adds a new member function, AquiferInterface::initFromRestart() that consumes a vector<data::AquiferData> constructed from information in the restart file's SAAQ and XAAQ vectors. At the moment, we use the initial aquifer pressure, the total produced liquid volume and the current aquifer pressure at restart. We implement the interface's member function in terms of the virtual function AquiferInterface::assignRestartData() that must be overridden in derived classes. Implement a trivial such function for Carter-Tracy aquifers, and a function that only stores the current aquifer pressure for the Fetkovich aquifer model. Additionally, record whether or not the aquifer object was initialised from a previous solution. If so, don't reset total produce liquid volumes or aquifer pressures to their base values from the model input file.
This commit is contained in:
parent
92cbdf3c63
commit
df86d01486
@ -23,6 +23,8 @@
|
||||
|
||||
#include <opm/simulators/aquifers/AquiferInterface.hpp>
|
||||
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
@ -145,6 +147,9 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
void assignRestartData(const data::AquiferData& /* xaq */) override
|
||||
{}
|
||||
|
||||
inline void getInfluenceTableValues(Scalar& pitd, Scalar& pitd_prime, const Scalar& td)
|
||||
{
|
||||
// We use the opm-common numeric linear interpolator
|
||||
|
@ -23,6 +23,11 @@ along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <opm/simulators/aquifers/AquiferInterface.hpp>
|
||||
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
@ -146,6 +151,19 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
void assignRestartData(const data::AquiferData& xaq) override
|
||||
{
|
||||
if (xaq.type != data::AquiferType::Fetkovich)
|
||||
{
|
||||
throw std::invalid_argument {
|
||||
"Analytic aquifer data for unexpected aquifer type "
|
||||
"passed to Fetkovich aquifer"
|
||||
};
|
||||
}
|
||||
|
||||
this->aquifer_pressure_ = xaq.pressure;
|
||||
}
|
||||
|
||||
inline Eval dpai(int idx)
|
||||
{
|
||||
const Eval dp = aquifer_pressure_ - Base::pressure_current_.at(idx)
|
||||
@ -176,6 +194,11 @@ namespace Opm
|
||||
inline void calculateAquiferCondition()
|
||||
{
|
||||
Base::rhow_.resize(Base::cell_idx_.size(),0.);
|
||||
|
||||
if (this->solution_set_from_restart_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aqufetp_data_.p0)
|
||||
{
|
||||
Base::pa0_ = calculateReservoirEquilibrium();
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
|
||||
#include <opm/common/utility/numeric/linearInterpolation.hpp>
|
||||
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
|
||||
#include <opm/material/common/MathToolbox.hpp>
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
#include <opm/material/densead/Evaluation.hpp>
|
||||
@ -74,6 +76,26 @@ namespace Opm
|
||||
// Deconstructor
|
||||
virtual ~AquiferInterface() {}
|
||||
|
||||
void initFromRestart(const std::vector<data::AquiferData>& aquiferSoln)
|
||||
{
|
||||
auto xaqPos = std::find_if(aquiferSoln.begin(), aquiferSoln.end(),
|
||||
[this](const data::AquiferData& xaq) -> bool
|
||||
{
|
||||
return xaq.aquiferID == this->connection_.aquiferID;
|
||||
});
|
||||
|
||||
if (xaqPos == aquiferSoln.end()) {
|
||||
// No restart value applies to this aquifer. Nothing to do.
|
||||
return;
|
||||
}
|
||||
|
||||
this->assignRestartData(*xaqPos);
|
||||
|
||||
this->W_flux_ = xaqPos->volume;
|
||||
this->pa0_ = xaqPos->initPressure;
|
||||
this->solution_set_from_restart_ = true;
|
||||
}
|
||||
|
||||
void initialSolutionApplied()
|
||||
{
|
||||
initQuantities(connection_);
|
||||
@ -129,7 +151,10 @@ namespace Opm
|
||||
inline void initQuantities(const Aquancon::AquanconOutput& connection)
|
||||
{
|
||||
// We reset the cumulative flux at the start of any simulation, so, W_flux = 0
|
||||
W_flux_ = 0.;
|
||||
if (!this->solution_set_from_restart_)
|
||||
{
|
||||
W_flux_ = 0.;
|
||||
}
|
||||
|
||||
// We next get our connections to the aquifer and initialize these quantities using the initialize_connections function
|
||||
initializeConnections(connection);
|
||||
@ -207,8 +232,12 @@ namespace Opm
|
||||
|
||||
Eval W_flux_;
|
||||
|
||||
bool solution_set_from_restart_{false};
|
||||
|
||||
virtual void initializeConnections(const Aquancon::AquanconOutput& connection) =0;
|
||||
|
||||
virtual void assignRestartData(const data::AquiferData& xaq) = 0;
|
||||
|
||||
virtual void calculateInflowRate(int idx, const Simulator& simulator) = 0;
|
||||
|
||||
virtual void calculateAquiferCondition() = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user