2019-10-19 13:53:35 -05:00
|
|
|
/*
|
|
|
|
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
|
|
|
Copyright 2017 Statoil ASA.
|
|
|
|
Copyright 2017 IRIS
|
|
|
|
|
|
|
|
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 OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
|
|
|
#define OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
|
|
|
|
2019-12-20 07:30:13 -06:00
|
|
|
#include <opm/common/utility/numeric/linearInterpolation.hpp>
|
2021-01-08 16:18:41 -06:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Aquifer/Aquancon.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Aquifer/AquiferCT.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Aquifer/Aquifetp.hpp>
|
2019-10-19 13:53:35 -05:00
|
|
|
|
2019-11-28 10:26:58 -06:00
|
|
|
#include <opm/output/data/Aquifer.hpp>
|
|
|
|
|
2019-10-19 13:53:35 -05:00
|
|
|
#include <opm/material/common/MathToolbox.hpp>
|
|
|
|
#include <opm/material/densead/Evaluation.hpp>
|
2019-12-20 07:30:13 -06:00
|
|
|
#include <opm/material/densead/Math.hpp>
|
2019-10-19 13:53:35 -05:00
|
|
|
#include <opm/material/fluidstates/BlackOilFluidState.hpp>
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <unordered_map>
|
2019-12-20 07:30:13 -06:00
|
|
|
#include <vector>
|
2019-10-19 13:53:35 -05:00
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
{
|
2019-12-20 07:30:13 -06:00
|
|
|
template <typename TypeTag>
|
|
|
|
class AquiferInterface
|
|
|
|
{
|
|
|
|
public:
|
2020-08-26 03:49:52 -05:00
|
|
|
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
|
|
|
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
|
|
|
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
|
|
|
|
using BlackoilIndices = GetPropType<TypeTag, Properties::Indices>;
|
|
|
|
using RateVector = GetPropType<TypeTag, Properties::RateVector>;
|
|
|
|
using IntensiveQuantities = GetPropType<TypeTag, Properties::IntensiveQuantities>;
|
2020-11-24 07:58:15 -06:00
|
|
|
using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>;
|
2019-10-19 13:53:35 -05:00
|
|
|
|
2020-08-27 02:13:30 -05:00
|
|
|
enum { enableTemperature = getPropValue<TypeTag, Properties::EnableTemperature>() };
|
|
|
|
enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
|
|
|
|
enum { enableBrine = getPropValue<TypeTag, Properties::EnableBrine>() };
|
2019-10-19 13:53:35 -05:00
|
|
|
|
|
|
|
static const int numEq = BlackoilIndices::numEq;
|
|
|
|
typedef double Scalar;
|
|
|
|
|
|
|
|
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
|
|
|
|
|
2021-05-05 04:22:44 -05:00
|
|
|
typedef BlackOilFluidState<Eval,
|
|
|
|
FluidSystem,
|
|
|
|
enableTemperature,
|
|
|
|
enableEnergy,
|
|
|
|
BlackoilIndices::gasEnabled,
|
|
|
|
enableBrine,
|
|
|
|
BlackoilIndices::numPhases>
|
2019-12-20 07:30:13 -06:00
|
|
|
FluidState;
|
2019-10-19 13:53:35 -05:00
|
|
|
|
|
|
|
static const auto waterCompIdx = FluidSystem::waterCompIdx;
|
|
|
|
static const auto waterPhaseIdx = FluidSystem::waterPhaseIdx;
|
|
|
|
|
|
|
|
// Constructor
|
2020-02-10 10:39:04 -06:00
|
|
|
AquiferInterface(int aqID,
|
|
|
|
const std::vector<Aquancon::AquancCell>& connections,
|
2019-12-20 07:30:13 -06:00
|
|
|
const Simulator& ebosSimulator)
|
2021-05-12 05:16:20 -05:00
|
|
|
: aquiferID_(aqID)
|
2020-02-10 10:39:04 -06:00
|
|
|
, connections_(connections)
|
2019-12-20 07:30:13 -06:00
|
|
|
, ebos_simulator_(ebosSimulator)
|
|
|
|
{
|
|
|
|
}
|
2019-10-19 13:53:35 -05:00
|
|
|
|
2021-05-12 05:16:20 -05:00
|
|
|
// Destructor
|
2019-12-20 07:30:13 -06:00
|
|
|
virtual ~AquiferInterface()
|
|
|
|
{
|
|
|
|
}
|
2019-10-19 13:53:35 -05:00
|
|
|
|
2021-05-12 10:12:03 -05:00
|
|
|
void initFromRestart(const data::Aquifers& aquiferSoln)
|
2019-11-28 10:26:58 -06:00
|
|
|
{
|
2021-05-12 10:12:03 -05:00
|
|
|
auto xaqPos = aquiferSoln.find(this->aquiferID());
|
2020-02-10 10:39:04 -06:00
|
|
|
if (xaqPos == aquiferSoln.end())
|
2019-12-20 07:30:13 -06:00
|
|
|
return;
|
|
|
|
|
2021-05-12 10:12:03 -05:00
|
|
|
this->assignRestartData(xaqPos->second);
|
|
|
|
|
|
|
|
this->W_flux_ = xaqPos->second.volume;
|
|
|
|
this->pa0_ = xaqPos->second.initPressure;
|
2019-12-20 07:30:13 -06:00
|
|
|
this->solution_set_from_restart_ = true;
|
2019-11-28 10:26:58 -06:00
|
|
|
}
|
|
|
|
|
2019-10-19 13:53:35 -05:00
|
|
|
void initialSolutionApplied()
|
|
|
|
{
|
2020-02-09 00:43:43 -06:00
|
|
|
initQuantities();
|
2019-10-19 13:53:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void beginTimeStep()
|
|
|
|
{
|
2019-12-20 07:30:13 -06:00
|
|
|
ElementContext elemCtx(ebos_simulator_);
|
|
|
|
auto elemIt = ebos_simulator_.gridView().template begin<0>();
|
|
|
|
const auto& elemEndIt = ebos_simulator_.gridView().template end<0>();
|
|
|
|
for (; elemIt != elemEndIt; ++elemIt) {
|
|
|
|
const auto& elem = *elemIt;
|
|
|
|
|
|
|
|
elemCtx.updatePrimaryStencil(elem);
|
|
|
|
|
2021-05-12 05:16:20 -05:00
|
|
|
const int cellIdx = elemCtx.globalSpaceIndex(0, 0);
|
|
|
|
const int idx = cellToConnectionIdx_[cellIdx];
|
2019-12-20 07:30:13 -06:00
|
|
|
if (idx < 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
elemCtx.updateIntensiveQuantities(0);
|
|
|
|
const auto& iq = elemCtx.intensiveQuantities(0, 0);
|
2021-05-05 04:22:44 -05:00
|
|
|
pressure_previous_[idx] = getValue(iq.fluidState().pressure(waterPhaseIdx));
|
2019-12-20 07:30:13 -06:00
|
|
|
}
|
2019-10-19 13:53:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class Context>
|
2021-05-12 05:16:20 -05:00
|
|
|
void addToSource(RateVector& rates,
|
|
|
|
const Context& context,
|
|
|
|
const unsigned spaceIdx,
|
|
|
|
const unsigned timeIdx)
|
2019-10-19 13:53:35 -05:00
|
|
|
{
|
2021-05-12 05:16:20 -05:00
|
|
|
const unsigned cellIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
2019-12-20 07:30:13 -06:00
|
|
|
|
2021-05-12 05:16:20 -05:00
|
|
|
const int idx = this->cellToConnectionIdx_[cellIdx];
|
2019-12-20 07:30:13 -06:00
|
|
|
if (idx < 0)
|
|
|
|
return;
|
|
|
|
|
2021-05-12 05:16:20 -05:00
|
|
|
// We are dereferencing the value of IntensiveQuantities because
|
|
|
|
// cachedIntensiveQuantities return a const pointer to
|
|
|
|
// IntensiveQuantities of that particular cell_id
|
|
|
|
const auto& intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
|
|
|
|
|
2019-12-20 07:30:13 -06:00
|
|
|
// This is the pressure at td + dt
|
2021-05-12 05:16:20 -05:00
|
|
|
this->updateCellPressure(this->pressure_current_, idx, intQuants);
|
|
|
|
this->updateCellDensity(idx, intQuants);
|
|
|
|
this->calculateInflowRate(idx, context.simulator());
|
|
|
|
|
2019-12-20 07:30:13 -06:00
|
|
|
rates[BlackoilIndices::conti0EqIdx + FluidSystem::waterCompIdx]
|
2021-05-12 05:16:20 -05:00
|
|
|
+= this->Qai_[idx] / context.dofVolume(spaceIdx, timeIdx);
|
2019-10-19 13:53:35 -05:00
|
|
|
}
|
|
|
|
|
2020-02-10 10:39:04 -06:00
|
|
|
std::size_t size() const {
|
|
|
|
return this->connections_.size();
|
|
|
|
}
|
|
|
|
|
2021-05-12 05:16:20 -05:00
|
|
|
int aquiferID() const { return this->aquiferID_; }
|
2020-02-10 10:39:04 -06:00
|
|
|
|
2019-12-20 07:30:13 -06:00
|
|
|
protected:
|
2019-10-19 13:53:35 -05:00
|
|
|
inline Scalar gravity_() const
|
|
|
|
{
|
2019-12-20 07:30:13 -06:00
|
|
|
return ebos_simulator_.problem().gravity()[2];
|
2019-10-19 13:53:35 -05:00
|
|
|
}
|
|
|
|
|
2020-02-09 00:43:43 -06:00
|
|
|
inline void initQuantities()
|
2019-10-19 13:53:35 -05:00
|
|
|
{
|
2019-12-20 07:30:13 -06:00
|
|
|
// We reset the cumulative flux at the start of any simulation, so, 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
|
2020-02-09 00:43:43 -06:00
|
|
|
initializeConnections();
|
2019-12-20 07:30:13 -06:00
|
|
|
calculateAquiferCondition();
|
|
|
|
calculateAquiferConstants();
|
|
|
|
|
2020-02-10 10:39:04 -06:00
|
|
|
pressure_previous_.resize(this->connections_.size(), 0.);
|
|
|
|
pressure_current_.resize(this->connections_.size(), 0.);
|
|
|
|
Qai_.resize(this->connections_.size(), 0.0);
|
2019-10-19 13:53:35 -05:00
|
|
|
}
|
|
|
|
|
2019-12-20 07:30:13 -06:00
|
|
|
inline void
|
|
|
|
updateCellPressure(std::vector<Eval>& pressure_water, const int idx, const IntensiveQuantities& intQuants)
|
2019-10-19 13:53:35 -05:00
|
|
|
{
|
2019-12-20 07:30:13 -06:00
|
|
|
const auto& fs = intQuants.fluidState();
|
|
|
|
pressure_water.at(idx) = fs.pressure(waterPhaseIdx);
|
2019-10-19 13:53:35 -05:00
|
|
|
}
|
|
|
|
|
2019-12-20 07:30:13 -06:00
|
|
|
inline void
|
|
|
|
updateCellPressure(std::vector<Scalar>& pressure_water, const int idx, const IntensiveQuantities& intQuants)
|
2019-10-19 13:53:35 -05:00
|
|
|
{
|
2019-12-20 07:30:13 -06:00
|
|
|
const auto& fs = intQuants.fluidState();
|
|
|
|
pressure_water.at(idx) = fs.pressure(waterPhaseIdx).value();
|
2019-10-19 13:53:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void updateCellDensity(const int idx, const IntensiveQuantities& intQuants)
|
|
|
|
{
|
2019-12-20 07:30:13 -06:00
|
|
|
const auto& fs = intQuants.fluidState();
|
|
|
|
rhow_.at(idx) = fs.density(waterPhaseIdx);
|
2019-10-19 13:53:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
virtual void endTimeStep() = 0;
|
|
|
|
|
2021-05-12 05:16:20 -05:00
|
|
|
const int aquiferID_{};
|
2020-02-10 10:39:04 -06:00
|
|
|
const std::vector<Aquancon::AquancCell> connections_;
|
2019-10-19 13:53:35 -05:00
|
|
|
const Simulator& ebos_simulator_;
|
|
|
|
|
|
|
|
// Grid variables
|
|
|
|
std::vector<Scalar> faceArea_connected_;
|
|
|
|
std::vector<int> cellToConnectionIdx_;
|
2021-05-12 05:16:20 -05:00
|
|
|
|
2019-10-19 13:53:35 -05:00
|
|
|
// Quantities at each grid id
|
|
|
|
std::vector<Scalar> cell_depth_;
|
|
|
|
std::vector<Scalar> pressure_previous_;
|
|
|
|
std::vector<Eval> pressure_current_;
|
|
|
|
std::vector<Eval> Qai_;
|
|
|
|
std::vector<Eval> rhow_;
|
|
|
|
std::vector<Scalar> alphai_;
|
|
|
|
|
2021-05-12 05:16:20 -05:00
|
|
|
Scalar Tc_{}; // Time constant
|
|
|
|
Scalar pa0_{}; // initial aquifer pressure
|
2019-10-19 13:53:35 -05:00
|
|
|
|
|
|
|
Eval W_flux_;
|
|
|
|
|
2019-12-20 07:30:13 -06:00
|
|
|
bool solution_set_from_restart_ {false};
|
2019-11-28 10:26:58 -06:00
|
|
|
|
2020-12-15 02:43:43 -06:00
|
|
|
void initializeConnections()
|
|
|
|
{
|
|
|
|
this->cell_depth_.resize(this->size(), this->aquiferDepth());
|
|
|
|
this->alphai_.resize(this->size(), 1.0);
|
|
|
|
this->faceArea_connected_.resize(this->size(), 0.0);
|
|
|
|
|
|
|
|
// Translate the C face tag into the enum used by opm-parser's TransMult class
|
2021-05-05 04:22:44 -05:00
|
|
|
FaceDir::DirEnum faceDirection;
|
2020-12-15 02:43:43 -06:00
|
|
|
|
|
|
|
// denom_face_areas is the sum of the areas connected to an aquifer
|
|
|
|
Scalar denom_face_areas = 0.;
|
|
|
|
this->cellToConnectionIdx_.resize(this->ebos_simulator_.gridView().size(/*codim=*/0), -1);
|
2020-12-17 06:19:18 -06:00
|
|
|
const auto& gridView = this->ebos_simulator_.vanguard().gridView();
|
2020-12-15 02:43:43 -06:00
|
|
|
for (size_t idx = 0; idx < this->size(); ++idx) {
|
|
|
|
const auto global_index = this->connections_[idx].global_index;
|
|
|
|
const int cell_index = this->ebos_simulator_.vanguard().compressedIndex(global_index);
|
2020-12-17 06:19:18 -06:00
|
|
|
auto elemIt = gridView.template begin</*codim=*/ 0>();
|
|
|
|
if (cell_index > 0)
|
|
|
|
std::advance(elemIt, cell_index);
|
|
|
|
|
|
|
|
//the global_index is not part of this grid
|
|
|
|
if ( cell_index < 0 || elemIt->partitionType() != Dune::InteriorEntity)
|
2020-12-15 02:43:43 -06:00
|
|
|
continue;
|
|
|
|
|
|
|
|
this->cellToConnectionIdx_[cell_index] = idx;
|
|
|
|
this->cell_depth_.at(idx) = this->ebos_simulator_.vanguard().cellCenterDepth(cell_index);
|
|
|
|
}
|
|
|
|
// get areas for all connections
|
|
|
|
ElementMapper elemMapper(gridView, Dune::mcmgElementLayout());
|
|
|
|
auto elemIt = gridView.template begin</*codim=*/ 0>();
|
|
|
|
const auto& elemEndIt = gridView.template end</*codim=*/ 0>();
|
|
|
|
for (; elemIt != elemEndIt; ++elemIt) {
|
|
|
|
const auto& elem = *elemIt;
|
|
|
|
unsigned cell_index = elemMapper.index(elem);
|
|
|
|
int idx = this->cellToConnectionIdx_[cell_index];
|
|
|
|
|
|
|
|
// only deal with connections given by the aquifer
|
|
|
|
if( idx < 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
auto isIt = gridView.ibegin(elem);
|
|
|
|
const auto& isEndIt = gridView.iend(elem);
|
|
|
|
for (; isIt != isEndIt; ++ isIt) {
|
|
|
|
// store intersection, this might be costly
|
|
|
|
const auto& intersection = *isIt;
|
|
|
|
|
|
|
|
// only deal with grid boundaries
|
|
|
|
if (!intersection.boundary())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
int insideFaceIdx = intersection.indexInInside();
|
|
|
|
switch (insideFaceIdx) {
|
|
|
|
case 0:
|
2021-05-05 04:22:44 -05:00
|
|
|
faceDirection = FaceDir::XMinus;
|
2020-12-15 02:43:43 -06:00
|
|
|
break;
|
|
|
|
case 1:
|
2021-05-05 04:22:44 -05:00
|
|
|
faceDirection = FaceDir::XPlus;
|
2020-12-15 02:43:43 -06:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-05-05 04:22:44 -05:00
|
|
|
faceDirection = FaceDir::YMinus;
|
2020-12-15 02:43:43 -06:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-05-05 04:22:44 -05:00
|
|
|
faceDirection = FaceDir::YPlus;
|
2020-12-15 02:43:43 -06:00
|
|
|
break;
|
|
|
|
case 4:
|
2021-05-05 04:22:44 -05:00
|
|
|
faceDirection = FaceDir::ZMinus;
|
2020-12-15 02:43:43 -06:00
|
|
|
break;
|
|
|
|
case 5:
|
2021-05-05 04:22:44 -05:00
|
|
|
faceDirection = FaceDir::ZPlus;
|
2020-12-15 02:43:43 -06:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OPM_THROW(std::logic_error,
|
|
|
|
"Internal error in initialization of aquifer.");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (faceDirection == this->connections_[idx].face_dir) {
|
2021-02-14 13:47:22 -06:00
|
|
|
this->faceArea_connected_[idx] = this->connections_[idx].influx_coeff;
|
2020-12-15 02:43:43 -06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-02-16 03:02:36 -06:00
|
|
|
denom_face_areas += this->faceArea_connected_.at(idx);
|
2020-12-15 02:43:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
const auto& comm = this->ebos_simulator_.vanguard().grid().comm();
|
|
|
|
comm.sum(&denom_face_areas, 1);
|
|
|
|
const double eps_sqrt = std::sqrt(std::numeric_limits<double>::epsilon());
|
|
|
|
for (size_t idx = 0; idx < this->size(); ++idx) {
|
|
|
|
this->alphai_.at(idx) = (denom_face_areas < eps_sqrt)
|
|
|
|
? // Prevent no connection NaNs due to division by zero
|
|
|
|
0.
|
2021-02-16 03:02:36 -06:00
|
|
|
: this->faceArea_connected_.at(idx) / denom_face_areas;
|
2020-12-15 02:43:43 -06:00
|
|
|
}
|
|
|
|
}
|
2019-10-19 13:53:35 -05:00
|
|
|
|
2019-11-28 10:26:58 -06:00
|
|
|
virtual void assignRestartData(const data::AquiferData& xaq) = 0;
|
|
|
|
|
2019-10-19 13:53:35 -05:00
|
|
|
virtual void calculateInflowRate(int idx, const Simulator& simulator) = 0;
|
|
|
|
|
|
|
|
virtual void calculateAquiferCondition() = 0;
|
|
|
|
|
|
|
|
virtual void calculateAquiferConstants() = 0;
|
|
|
|
|
2020-09-24 09:09:56 -05:00
|
|
|
virtual Scalar aquiferDepth() const = 0;
|
|
|
|
|
|
|
|
// This function is for calculating the aquifer properties from equilibrium state with the reservoir
|
|
|
|
virtual Scalar calculateReservoirEquilibrium()
|
|
|
|
{
|
|
|
|
// Since the global_indices are the reservoir index, we just need to extract the fluidstate at those indices
|
|
|
|
std::vector<Scalar> pw_aquifer;
|
|
|
|
Scalar water_pressure_reservoir;
|
|
|
|
|
|
|
|
ElementContext elemCtx(this->ebos_simulator_);
|
|
|
|
const auto& gridView = this->ebos_simulator_.gridView();
|
|
|
|
auto elemIt = gridView.template begin</*codim=*/0>();
|
|
|
|
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
|
|
|
for (; elemIt != elemEndIt; ++elemIt) {
|
|
|
|
const auto& elem = *elemIt;
|
|
|
|
elemCtx.updatePrimaryStencil(elem);
|
|
|
|
|
2021-05-12 05:16:20 -05:00
|
|
|
const auto cellIdx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0);
|
|
|
|
const auto idx = this->cellToConnectionIdx_[cellIdx];
|
2020-09-24 09:09:56 -05:00
|
|
|
if (idx < 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
|
|
|
const auto& iq0 = elemCtx.intensiveQuantities(/*spaceIdx=*/0, /*timeIdx=*/0);
|
|
|
|
const auto& fs = iq0.fluidState();
|
|
|
|
|
|
|
|
water_pressure_reservoir = fs.pressure(waterPhaseIdx).value();
|
|
|
|
this->rhow_[idx] = fs.density(waterPhaseIdx);
|
|
|
|
pw_aquifer.push_back(
|
|
|
|
(water_pressure_reservoir
|
|
|
|
- this->rhow_[idx].value() * this->gravity_() * (this->cell_depth_[idx] - this->aquiferDepth()))
|
|
|
|
* this->alphai_[idx]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// We take the average of the calculated equilibrium pressures.
|
2020-12-15 02:01:03 -06:00
|
|
|
const auto& comm = ebos_simulator_.vanguard().grid().comm();
|
2021-05-12 05:16:20 -05:00
|
|
|
|
2020-12-15 02:01:03 -06:00
|
|
|
Scalar vals[2];
|
2021-05-12 05:16:20 -05:00
|
|
|
vals[0] = std::accumulate(this->alphai_.begin(), this->alphai_.end(), 0.0);
|
|
|
|
vals[1] = std::accumulate(pw_aquifer.begin(), pw_aquifer.end(), 0.0);
|
|
|
|
|
2020-12-15 02:01:03 -06:00
|
|
|
comm.sum(vals, 2);
|
2021-05-12 05:16:20 -05:00
|
|
|
|
2020-12-15 02:01:03 -06:00
|
|
|
return vals[1] / vals[0];
|
2020-09-24 09:09:56 -05:00
|
|
|
}
|
|
|
|
|
2019-12-20 07:30:13 -06:00
|
|
|
// This function is used to initialize and calculate the alpha_i for each grid connection to the aquifer
|
|
|
|
};
|
2019-10-19 13:53:35 -05:00
|
|
|
} // namespace Opm
|
|
|
|
#endif
|