mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2254 from GitPaean/clang-format-aquifer
re-formatting aquifer files with clang-format
This commit is contained in:
commit
b64116a70c
@ -37,15 +37,15 @@ namespace Opm
|
||||
public:
|
||||
typedef AquiferInterface<TypeTag> Base;
|
||||
|
||||
using typename Base::Simulator;
|
||||
using typename Base::ElementContext;
|
||||
using typename Base::FluidSystem;
|
||||
using typename Base::BlackoilIndices;
|
||||
using typename Base::RateVector;
|
||||
using typename Base::IntensiveQuantities;
|
||||
using typename Base::ElementContext;
|
||||
using typename Base::Eval;
|
||||
using typename Base::Scalar;
|
||||
using typename Base::FluidState;
|
||||
using typename Base::FluidSystem;
|
||||
using typename Base::IntensiveQuantities;
|
||||
using typename Base::RateVector;
|
||||
using typename Base::Scalar;
|
||||
using typename Base::Simulator;
|
||||
|
||||
using Base::waterCompIdx;
|
||||
using Base::waterPhaseIdx;
|
||||
@ -55,7 +55,8 @@ namespace Opm
|
||||
const AquiferCT::AQUCT_data& aquct_data)
|
||||
: Base(connection, cartesian_to_compressed, ebosSimulator)
|
||||
, aquct_data_(aquct_data)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void endTimeStep() override
|
||||
{
|
||||
@ -100,39 +101,43 @@ namespace Opm
|
||||
// denom_face_areas is the sum of the areas connected to an aquifer
|
||||
Scalar denom_face_areas = 0.;
|
||||
Base::cellToConnectionIdx_.resize(Base::ebos_simulator_.gridView().size(/*codim=*/0), -1);
|
||||
for (size_t idx = 0; idx < Base::cell_idx_.size(); ++idx)
|
||||
{
|
||||
for (size_t idx = 0; idx < Base::cell_idx_.size(); ++idx) {
|
||||
const int cell_index = Base::cartesian_to_compressed_.at(Base::cell_idx_[idx]);
|
||||
Base::cellToConnectionIdx_[cell_index] = idx;
|
||||
|
||||
const auto cellFacesRange = cell2Faces[cell_index];
|
||||
for(auto cellFaceIter = cellFacesRange.begin(); cellFaceIter != cellFacesRange.end(); ++cellFaceIter)
|
||||
{
|
||||
for (auto cellFaceIter = cellFacesRange.begin(); cellFaceIter != cellFacesRange.end(); ++cellFaceIter) {
|
||||
// The index of the face in the compressed grid
|
||||
const int faceIdx = *cellFaceIter;
|
||||
|
||||
// the logically-Cartesian direction of the face
|
||||
const int faceTag = Opm::UgGridHelpers::faceTag(ugrid, cellFaceIter);
|
||||
|
||||
switch(faceTag)
|
||||
{
|
||||
case 0: faceDirection = Opm::FaceDir::XMinus;
|
||||
switch (faceTag) {
|
||||
case 0:
|
||||
faceDirection = Opm::FaceDir::XMinus;
|
||||
break;
|
||||
case 1: faceDirection = Opm::FaceDir::XPlus;
|
||||
case 1:
|
||||
faceDirection = Opm::FaceDir::XPlus;
|
||||
break;
|
||||
case 2: faceDirection = Opm::FaceDir::YMinus;
|
||||
case 2:
|
||||
faceDirection = Opm::FaceDir::YMinus;
|
||||
break;
|
||||
case 3: faceDirection = Opm::FaceDir::YPlus;
|
||||
case 3:
|
||||
faceDirection = Opm::FaceDir::YPlus;
|
||||
break;
|
||||
case 4: faceDirection = Opm::FaceDir::ZMinus;
|
||||
case 4:
|
||||
faceDirection = Opm::FaceDir::ZMinus;
|
||||
break;
|
||||
case 5: faceDirection = Opm::FaceDir::ZPlus;
|
||||
case 5:
|
||||
faceDirection = Opm::FaceDir::ZPlus;
|
||||
break;
|
||||
default: OPM_THROW(Opm::NumericalIssue,"Initialization of Aquifer Carter Tracy problem. Make sure faceTag is correctly defined");
|
||||
default:
|
||||
OPM_THROW(Opm::NumericalIssue,
|
||||
"Initialization of Aquifer Carter Tracy problem. Make sure faceTag is correctly defined");
|
||||
}
|
||||
|
||||
if (faceDirection == connection.reservoir_face_dir.at(idx))
|
||||
{
|
||||
if (faceDirection == connection.reservoir_face_dir.at(idx)) {
|
||||
Base::faceArea_connected_.at(idx) = Base::getFaceArea(faceCells, ugrid, faceIdx, idx, connection);
|
||||
denom_face_areas += (connection.influx_multiplier.at(idx) * Base::faceArea_connected_.at(idx));
|
||||
}
|
||||
@ -142,9 +147,9 @@ namespace Opm
|
||||
}
|
||||
|
||||
const double eps_sqrt = std::sqrt(std::numeric_limits<double>::epsilon());
|
||||
for (size_t idx = 0; idx < Base::cell_idx_.size(); ++idx)
|
||||
{
|
||||
Base::alphai_.at(idx) = (denom_face_areas < eps_sqrt)? // Prevent no connection NaNs due to division by zero
|
||||
for (size_t idx = 0; idx < Base::cell_idx_.size(); ++idx) {
|
||||
Base::alphai_.at(idx) = (denom_face_areas < eps_sqrt)
|
||||
? // Prevent no connection NaNs due to division by zero
|
||||
0.
|
||||
: (connection.influx_multiplier.at(idx) * Base::faceArea_connected_.at(idx)) / denom_face_areas;
|
||||
}
|
||||
@ -152,10 +157,8 @@ namespace Opm
|
||||
|
||||
void assignRestartData(const data::AquiferData& /* xaq */) override
|
||||
{
|
||||
throw std::runtime_error {
|
||||
"Restart-based initialization not currently supported "
|
||||
"for Carter-Tracey analytic aquifers"
|
||||
};
|
||||
throw std::runtime_error {"Restart-based initialization not currently supported "
|
||||
"for Carter-Tracey analytic aquifers"};
|
||||
}
|
||||
|
||||
inline void getInfluenceTableValues(Scalar& pitd, Scalar& pitd_prime, const Scalar& td)
|
||||
@ -167,7 +170,9 @@ namespace Opm
|
||||
|
||||
inline Scalar dpai(int idx)
|
||||
{
|
||||
Scalar dp = Base::pa0_ + Base::rhow_.at(idx).value()*Base::gravity_()*(Base::cell_depth_.at(idx) - aquct_data_.d0) - Base::pressure_previous_.at(idx);
|
||||
Scalar dp = Base::pa0_
|
||||
+ Base::rhow_.at(idx).value() * Base::gravity_() * (Base::cell_depth_.at(idx) - aquct_data_.d0)
|
||||
- Base::pressure_previous_.at(idx);
|
||||
return dp;
|
||||
}
|
||||
|
||||
@ -188,20 +193,17 @@ namespace Opm
|
||||
{
|
||||
Scalar a, b;
|
||||
calculateEqnConstants(a, b, idx, simulator);
|
||||
Base::Qai_.at(idx) = Base::alphai_.at(idx)*( a - b * ( Base::pressure_current_.at(idx) - Base::pressure_previous_.at(idx) ) );
|
||||
Base::Qai_.at(idx)
|
||||
= Base::alphai_.at(idx) * (a - b * (Base::pressure_current_.at(idx) - Base::pressure_previous_.at(idx)));
|
||||
}
|
||||
|
||||
inline void calculateAquiferConstants() override
|
||||
{
|
||||
// We calculate the influx constant
|
||||
beta_ = aquct_data_.c2 * aquct_data_.h
|
||||
* aquct_data_.theta * aquct_data_.phi_aq
|
||||
* aquct_data_.C_t
|
||||
beta_ = aquct_data_.c2 * aquct_data_.h * aquct_data_.theta * aquct_data_.phi_aq * aquct_data_.C_t
|
||||
* aquct_data_.r_o * aquct_data_.r_o;
|
||||
// We calculate the time constant
|
||||
Base::Tc_ = mu_w_ * aquct_data_.phi_aq
|
||||
* aquct_data_.C_t
|
||||
* aquct_data_.r_o * aquct_data_.r_o
|
||||
Base::Tc_ = mu_w_ * aquct_data_.phi_aq * aquct_data_.C_t * aquct_data_.r_o * aquct_data_.r_o
|
||||
/ (aquct_data_.k_a * aquct_data_.c1);
|
||||
}
|
||||
|
||||
@ -210,12 +212,9 @@ namespace Opm
|
||||
|
||||
int pvttableIdx = aquct_data_.pvttableID - 1;
|
||||
Base::rhow_.resize(Base::cell_idx_.size(), 0.);
|
||||
if (!aquct_data_.p0)
|
||||
{
|
||||
if (!aquct_data_.p0) {
|
||||
Base::pa0_ = calculateReservoirEquilibrium();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Base::pa0_ = *(aquct_data_.p0);
|
||||
}
|
||||
|
||||
@ -236,7 +235,6 @@ namespace Opm
|
||||
pa0_mean = Base::pa0_;
|
||||
Eval mu_w_aquifer = FluidSystem::waterPvt().viscosity(pvttableIdx, temperature_aq, pa0_mean);
|
||||
mu_w_ = mu_w_aquifer.value();
|
||||
|
||||
}
|
||||
|
||||
// This function is for calculating the aquifer properties from equilibrium state with the reservoir
|
||||
@ -266,7 +264,10 @@ namespace Opm
|
||||
|
||||
water_pressure_reservoir = fs.pressure(waterPhaseIdx).value();
|
||||
Base::rhow_[idx] = fs.density(waterPhaseIdx);
|
||||
pw_aquifer.push_back( (water_pressure_reservoir - Base::rhow_[idx].value()*Base::gravity_()*(Base::cell_depth_[idx] - aquct_data_.d0))*Base::alphai_[idx] );
|
||||
pw_aquifer.push_back(
|
||||
(water_pressure_reservoir
|
||||
- Base::rhow_[idx].value() * Base::gravity_() * (Base::cell_depth_[idx] - aquct_data_.d0))
|
||||
* Base::alphai_[idx]);
|
||||
}
|
||||
|
||||
// We take the average of the calculated equilibrium pressures.
|
||||
|
@ -38,15 +38,15 @@ namespace Opm
|
||||
public:
|
||||
typedef AquiferInterface<TypeTag> Base;
|
||||
|
||||
using typename Base::Simulator;
|
||||
using typename Base::ElementContext;
|
||||
using typename Base::FluidSystem;
|
||||
using typename Base::BlackoilIndices;
|
||||
using typename Base::RateVector;
|
||||
using typename Base::IntensiveQuantities;
|
||||
using typename Base::ElementContext;
|
||||
using typename Base::Eval;
|
||||
using typename Base::Scalar;
|
||||
using typename Base::FluidState;
|
||||
using typename Base::FluidSystem;
|
||||
using typename Base::IntensiveQuantities;
|
||||
using typename Base::RateVector;
|
||||
using typename Base::Scalar;
|
||||
using typename Base::Simulator;
|
||||
|
||||
using Base::waterCompIdx;
|
||||
using Base::waterPhaseIdx;
|
||||
@ -57,7 +57,8 @@ namespace Opm
|
||||
const Aquifetp::AQUFETP_data& aqufetp_data)
|
||||
: Base(connection, cartesian_to_compressed, ebosSimulator)
|
||||
, aqufetp_data_(aqufetp_data)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void endTimeStep() override
|
||||
{
|
||||
@ -101,39 +102,43 @@ namespace Opm
|
||||
// denom_face_areas is the sum of the areas connected to an aquifer
|
||||
Scalar denom_face_areas = 0.;
|
||||
Base::cellToConnectionIdx_.resize(Base::ebos_simulator_.gridView().size(/*codim=*/0), -1);
|
||||
for (size_t idx = 0; idx < Base::cell_idx_.size(); ++idx)
|
||||
{
|
||||
for (size_t idx = 0; idx < Base::cell_idx_.size(); ++idx) {
|
||||
const int cell_index = Base::cartesian_to_compressed_.at(Base::cell_idx_[idx]);
|
||||
Base::cellToConnectionIdx_[cell_index] = idx;
|
||||
|
||||
const auto cellFacesRange = cell2Faces[cell_index];
|
||||
for(auto cellFaceIter = cellFacesRange.begin(); cellFaceIter != cellFacesRange.end(); ++cellFaceIter)
|
||||
{
|
||||
for (auto cellFaceIter = cellFacesRange.begin(); cellFaceIter != cellFacesRange.end(); ++cellFaceIter) {
|
||||
// The index of the face in the compressed grid
|
||||
const int faceIdx = *cellFaceIter;
|
||||
|
||||
// the logically-Cartesian direction of the face
|
||||
const int faceTag = Opm::UgGridHelpers::faceTag(ugrid, cellFaceIter);
|
||||
|
||||
switch(faceTag)
|
||||
{
|
||||
case 0: faceDirection = Opm::FaceDir::XMinus;
|
||||
switch (faceTag) {
|
||||
case 0:
|
||||
faceDirection = Opm::FaceDir::XMinus;
|
||||
break;
|
||||
case 1: faceDirection = Opm::FaceDir::XPlus;
|
||||
case 1:
|
||||
faceDirection = Opm::FaceDir::XPlus;
|
||||
break;
|
||||
case 2: faceDirection = Opm::FaceDir::YMinus;
|
||||
case 2:
|
||||
faceDirection = Opm::FaceDir::YMinus;
|
||||
break;
|
||||
case 3: faceDirection = Opm::FaceDir::YPlus;
|
||||
case 3:
|
||||
faceDirection = Opm::FaceDir::YPlus;
|
||||
break;
|
||||
case 4: faceDirection = Opm::FaceDir::ZMinus;
|
||||
case 4:
|
||||
faceDirection = Opm::FaceDir::ZMinus;
|
||||
break;
|
||||
case 5: faceDirection = Opm::FaceDir::ZPlus;
|
||||
case 5:
|
||||
faceDirection = Opm::FaceDir::ZPlus;
|
||||
break;
|
||||
default: OPM_THROW(Opm::NumericalIssue,"Initialization of Aquifer problem. Make sure faceTag is correctly defined");
|
||||
default:
|
||||
OPM_THROW(Opm::NumericalIssue,
|
||||
"Initialization of Aquifer problem. Make sure faceTag is correctly defined");
|
||||
}
|
||||
|
||||
if (faceDirection == connection.reservoir_face_dir.at(idx))
|
||||
{
|
||||
if (faceDirection == connection.reservoir_face_dir.at(idx)) {
|
||||
Base::faceArea_connected_.at(idx) = Base::getFaceArea(faceCells, ugrid, faceIdx, idx, connection);
|
||||
denom_face_areas += (connection.influx_multiplier.at(idx) * Base::faceArea_connected_.at(idx));
|
||||
}
|
||||
@ -143,9 +148,9 @@ namespace Opm
|
||||
}
|
||||
|
||||
const double eps_sqrt = std::sqrt(std::numeric_limits<double>::epsilon());
|
||||
for (size_t idx = 0; idx < Base::cell_idx_.size(); ++idx)
|
||||
{
|
||||
Base::alphai_.at(idx) = (denom_face_areas < eps_sqrt)? // Prevent no connection NaNs due to division by zero
|
||||
for (size_t idx = 0; idx < Base::cell_idx_.size(); ++idx) {
|
||||
Base::alphai_.at(idx) = (denom_face_areas < eps_sqrt)
|
||||
? // Prevent no connection NaNs due to division by zero
|
||||
0.
|
||||
: (connection.influx_multiplier.at(idx) * Base::faceArea_connected_.at(idx)) / denom_face_areas;
|
||||
}
|
||||
@ -153,12 +158,9 @@ 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"
|
||||
};
|
||||
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;
|
||||
@ -199,12 +201,9 @@ namespace Opm
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aqufetp_data_.p0)
|
||||
{
|
||||
if (!aqufetp_data_.p0) {
|
||||
Base::pa0_ = calculateReservoirEquilibrium();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Base::pa0_ = *(aqufetp_data_.p0);
|
||||
}
|
||||
aquifer_pressure_ = Base::pa0_;
|
||||
@ -234,7 +233,10 @@ namespace Opm
|
||||
|
||||
water_pressure_reservoir = fs.pressure(waterPhaseIdx).value();
|
||||
Base::rhow_[idx] = fs.density(waterPhaseIdx);
|
||||
pw_aquifer.push_back( (water_pressure_reservoir - Base::rhow_[idx].value()*Base::gravity_()*(Base::cell_depth_[idx] - aqufetp_data_.d0))*Base::alphai_[idx] );
|
||||
pw_aquifer.push_back(
|
||||
(water_pressure_reservoir
|
||||
- Base::rhow_[idx].value() * Base::gravity_() * (Base::cell_depth_[idx] - aqufetp_data_.d0))
|
||||
* Base::alphai_[idx]);
|
||||
}
|
||||
|
||||
// We take the average of the calculated equilibrium pressures.
|
||||
|
@ -22,21 +22,21 @@
|
||||
#ifndef OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
||||
#define OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
||||
|
||||
#include <opm/common/utility/numeric/linearInterpolation.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/AquiferCT.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Aquifetp.hpp>
|
||||
#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>
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
#include <opm/material/fluidstates/BlackOilFluidState.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
@ -59,7 +59,13 @@ namespace Opm
|
||||
|
||||
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
|
||||
|
||||
typedef Opm::BlackOilFluidState<Eval, FluidSystem, enableTemperature, enableEnergy, BlackoilIndices::gasEnabled, BlackoilIndices::numPhases> FluidState;
|
||||
typedef Opm::BlackOilFluidState<Eval,
|
||||
FluidSystem,
|
||||
enableTemperature,
|
||||
enableEnergy,
|
||||
BlackoilIndices::gasEnabled,
|
||||
BlackoilIndices::numPhases>
|
||||
FluidState;
|
||||
|
||||
static const auto waterCompIdx = FluidSystem::waterCompIdx;
|
||||
static const auto waterPhaseIdx = FluidSystem::waterPhaseIdx;
|
||||
@ -71,16 +77,18 @@ namespace Opm
|
||||
: connection_(connection)
|
||||
, ebos_simulator_(ebosSimulator)
|
||||
, cartesian_to_compressed_(cartesian_to_compressed)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
// Deconstructor
|
||||
virtual ~AquiferInterface() {}
|
||||
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
|
||||
{
|
||||
auto xaqPos
|
||||
= std::find_if(aquiferSoln.begin(), aquiferSoln.end(), [this](const data::AquiferData& xaq) -> bool {
|
||||
return xaq.aquiferID == this->connection_.aquiferID;
|
||||
});
|
||||
|
||||
@ -131,15 +139,15 @@ namespace Opm
|
||||
if (idx < 0)
|
||||
return;
|
||||
|
||||
// We are dereferencing the value of IntensiveQuantities because cachedIntensiveQuantities return a const pointer to
|
||||
// IntensiveQuantities of that particular cell_id
|
||||
// We are dereferencing the value of IntensiveQuantities because cachedIntensiveQuantities return a const
|
||||
// pointer to IntensiveQuantities of that particular cell_id
|
||||
const IntensiveQuantities intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
|
||||
// This is the pressure at td + dt
|
||||
updateCellPressure(pressure_current_, idx, intQuants);
|
||||
updateCellDensity(idx, intQuants);
|
||||
calculateInflowRate(idx, context.simulator());
|
||||
rates[BlackoilIndices::conti0EqIdx + FluidSystem::waterCompIdx] +=
|
||||
Qai_[idx]/context.dofVolume(spaceIdx, timeIdx);
|
||||
rates[BlackoilIndices::conti0EqIdx + FluidSystem::waterCompIdx]
|
||||
+= Qai_[idx] / context.dofVolume(spaceIdx, timeIdx);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -151,12 +159,12 @@ namespace Opm
|
||||
inline void initQuantities(const Aquancon::AquanconOutput& connection)
|
||||
{
|
||||
// We reset the cumulative flux at the start of any simulation, so, W_flux = 0
|
||||
if (!this->solution_set_from_restart_)
|
||||
{
|
||||
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
|
||||
// We next get our connections to the aquifer and initialize these quantities using the initialize_connections
|
||||
// function
|
||||
initializeConnections(connection);
|
||||
calculateAquiferCondition();
|
||||
calculateAquiferConstants();
|
||||
@ -166,13 +174,15 @@ namespace Opm
|
||||
Qai_.resize(cell_idx_.size(), 0.0);
|
||||
}
|
||||
|
||||
inline void updateCellPressure(std::vector<Eval>& pressure_water, const int idx, const IntensiveQuantities& intQuants)
|
||||
inline void
|
||||
updateCellPressure(std::vector<Eval>& pressure_water, const int idx, const IntensiveQuantities& intQuants)
|
||||
{
|
||||
const auto& fs = intQuants.fluidState();
|
||||
pressure_water.at(idx) = fs.pressure(waterPhaseIdx);
|
||||
}
|
||||
|
||||
inline void updateCellPressure(std::vector<Scalar>& pressure_water, const int idx, const IntensiveQuantities& intQuants)
|
||||
inline void
|
||||
updateCellPressure(std::vector<Scalar>& pressure_water, const int idx, const IntensiveQuantities& intQuants)
|
||||
{
|
||||
const auto& fs = intQuants.fluidState();
|
||||
pressure_water.at(idx) = fs.pressure(waterPhaseIdx).value();
|
||||
@ -185,25 +195,26 @@ namespace Opm
|
||||
}
|
||||
|
||||
template <class faceCellType, class ugridType>
|
||||
inline double getFaceArea(const faceCellType& faceCells, const ugridType& ugrid,
|
||||
const int faceIdx, const int idx,
|
||||
inline double getFaceArea(const faceCellType& faceCells,
|
||||
const ugridType& ugrid,
|
||||
const int faceIdx,
|
||||
const int idx,
|
||||
const Aquancon::AquanconOutput& connection) const
|
||||
{
|
||||
// Check now if the face is outside of the reservoir, or if it adjoins an inactive cell
|
||||
// Do not make the connection if the product of the two cellIdx > 0. This is because the
|
||||
// face is within the reservoir/not connected to boundary. (We still have yet to check for inactive cell adjoining)
|
||||
// face is within the reservoir/not connected to boundary. (We still have yet to check for inactive cell
|
||||
// adjoining)
|
||||
double faceArea = 0.;
|
||||
const auto cellNeighbour0 = faceCells(faceIdx, 0);
|
||||
const auto cellNeighbour1 = faceCells(faceIdx, 1);
|
||||
const auto defaultFaceArea = Opm::UgGridHelpers::faceArea(ugrid, faceIdx);
|
||||
const auto calculatedFaceArea = (!connection.influx_coeff.at(idx))?
|
||||
defaultFaceArea :
|
||||
*(connection.influx_coeff.at(idx));
|
||||
const auto calculatedFaceArea
|
||||
= (!connection.influx_coeff.at(idx)) ? defaultFaceArea : *(connection.influx_coeff.at(idx));
|
||||
faceArea = (cellNeighbour0 * cellNeighbour1 > 0) ? 0. : calculatedFaceArea;
|
||||
if (cellNeighbour1 == 0) {
|
||||
faceArea = (cellNeighbour0 < 0) ? faceArea : 0.;
|
||||
}
|
||||
else if (cellNeighbour0 == 0){
|
||||
} else if (cellNeighbour0 == 0) {
|
||||
faceArea = (cellNeighbour1 < 0) ? faceArea : 0.;
|
||||
}
|
||||
return faceArea;
|
||||
|
@ -26,9 +26,9 @@
|
||||
|
||||
#include <ebos/eclbaseaquifermodel.hh>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/AquiferCT.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Aquifetp.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
|
||||
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
|
||||
@ -39,7 +39,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
/// Class for handling the blackoil well model.
|
||||
template <typename TypeTag>
|
||||
@ -59,10 +60,7 @@ namespace Opm {
|
||||
void beginIteration();
|
||||
// add the water rate due to aquifers to the source term.
|
||||
template <class Context>
|
||||
void addToSource(RateVector& rates,
|
||||
const Context& context,
|
||||
unsigned spaceIdx,
|
||||
unsigned timeIdx) const;
|
||||
void addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx) const;
|
||||
void endIteration();
|
||||
void endTimeStep();
|
||||
void endEpisode();
|
||||
@ -93,7 +91,6 @@ namespace Opm {
|
||||
bool aquiferActive() const;
|
||||
bool aquiferCarterTracyActive() const;
|
||||
bool aquiferFetkovichActive() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <opm/grid/utility/cartesianToCompressed.hpp>
|
||||
namespace Opm {
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
template <typename TypeTag>
|
||||
BlackoilAquiferModel<TypeTag>::
|
||||
BlackoilAquiferModel(Simulator& simulator)
|
||||
BlackoilAquiferModel<TypeTag>::BlackoilAquiferModel(Simulator& simulator)
|
||||
: simulator_(simulator)
|
||||
{
|
||||
init();
|
||||
@ -13,18 +13,14 @@ namespace Opm {
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::initialSolutionApplied()
|
||||
{
|
||||
if(aquiferCarterTracyActive())
|
||||
{
|
||||
for (auto aquifer = aquifers_CarterTracy.begin(); aquifer != aquifers_CarterTracy.end(); ++aquifer)
|
||||
{
|
||||
aquifer->initialSolutionApplied();
|
||||
if (aquiferCarterTracyActive()) {
|
||||
for (auto& aquifer : aquifers_CarterTracy) {
|
||||
aquifer.initialSolutionApplied();
|
||||
}
|
||||
}
|
||||
if(aquiferFetkovichActive())
|
||||
{
|
||||
for (auto aquifer = aquifers_Fetkovich.begin(); aquifer != aquifers_Fetkovich.end(); ++aquifer)
|
||||
{
|
||||
aquifer->initialSolutionApplied();
|
||||
if (aquiferFetkovichActive()) {
|
||||
for (auto& aquifer : aquifers_Fetkovich) {
|
||||
aquifer.initialSolutionApplied();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -33,17 +29,13 @@ namespace Opm {
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::initFromRestart(const std::vector<data::AquiferData>& aquiferSoln)
|
||||
{
|
||||
if(aquiferCarterTracyActive())
|
||||
{
|
||||
for (auto& aquifer : aquifers_CarterTracy)
|
||||
{
|
||||
if (aquiferCarterTracyActive()) {
|
||||
for (auto& aquifer : aquifers_CarterTracy) {
|
||||
aquifer.initFromRestart(aquiferSoln);
|
||||
}
|
||||
}
|
||||
if(aquiferFetkovichActive())
|
||||
{
|
||||
for (auto& aquifer : aquifers_Fetkovich)
|
||||
{
|
||||
if (aquiferFetkovichActive()) {
|
||||
for (auto& aquifer : aquifers_Fetkovich) {
|
||||
aquifer.initFromRestart(aquiferSoln);
|
||||
}
|
||||
}
|
||||
@ -52,47 +44,46 @@ namespace Opm {
|
||||
template <typename TypeTag>
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::beginEpisode()
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
template <typename TypeTag>
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::beginIteration()
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
template <typename TypeTag>
|
||||
void BlackoilAquiferModel<TypeTag>:: beginTimeStep()
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::beginTimeStep()
|
||||
{
|
||||
if(aquiferCarterTracyActive())
|
||||
{
|
||||
for (auto aquifer = aquifers_CarterTracy.begin(); aquifer != aquifers_CarterTracy.end(); ++aquifer)
|
||||
{
|
||||
aquifer->beginTimeStep();
|
||||
if (aquiferCarterTracyActive()) {
|
||||
for (auto& aquifer : aquifers_CarterTracy) {
|
||||
aquifer.beginTimeStep();
|
||||
}
|
||||
}
|
||||
if(aquiferFetkovichActive())
|
||||
{
|
||||
for (auto aquifer = aquifers_Fetkovich.begin(); aquifer != aquifers_Fetkovich.end(); ++aquifer)
|
||||
{
|
||||
aquifer->beginTimeStep();
|
||||
if (aquiferFetkovichActive()) {
|
||||
for (auto& aquifer : aquifers_Fetkovich) {
|
||||
aquifer.beginTimeStep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename TypeTag>
|
||||
template <class Context>
|
||||
void BlackoilAquiferModel<TypeTag>:: addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx) const
|
||||
{
|
||||
if(aquiferCarterTracyActive())
|
||||
{
|
||||
for (auto& aquifer : aquifers_CarterTracy)
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::addToSource(RateVector& rates,
|
||||
const Context& context,
|
||||
unsigned spaceIdx,
|
||||
unsigned timeIdx) const
|
||||
{
|
||||
if (aquiferCarterTracyActive()) {
|
||||
for (auto& aquifer : aquifers_CarterTracy) {
|
||||
aquifer.addToSource(rates, context, spaceIdx, timeIdx);
|
||||
}
|
||||
}
|
||||
if(aquiferFetkovichActive())
|
||||
{
|
||||
for (auto& aquifer : aquifers_Fetkovich)
|
||||
{
|
||||
if (aquiferFetkovichActive()) {
|
||||
for (auto& aquifer : aquifers_Fetkovich) {
|
||||
aquifer.addToSource(rates, context, spaceIdx, timeIdx);
|
||||
}
|
||||
}
|
||||
@ -101,30 +92,29 @@ namespace Opm {
|
||||
template <typename TypeTag>
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::endIteration()
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
template <typename TypeTag>
|
||||
void BlackoilAquiferModel<TypeTag>:: endTimeStep()
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::endTimeStep()
|
||||
{
|
||||
if(aquiferCarterTracyActive())
|
||||
{
|
||||
for (auto aquifer = aquifers_CarterTracy.begin(); aquifer != aquifers_CarterTracy.end(); ++aquifer)
|
||||
{
|
||||
aquifer->endTimeStep();
|
||||
if (aquiferCarterTracyActive()) {
|
||||
for (auto& aquifer : aquifers_CarterTracy) {
|
||||
aquifer.endTimeStep();
|
||||
}
|
||||
}
|
||||
if(aquiferFetkovichActive())
|
||||
{
|
||||
for (auto aquifer = aquifers_Fetkovich.begin(); aquifer != aquifers_Fetkovich.end(); ++aquifer)
|
||||
{
|
||||
aquifer->endTimeStep();
|
||||
if (aquiferFetkovichActive()) {
|
||||
for (auto& aquifer : aquifers_Fetkovich) {
|
||||
aquifer.endTimeStep();
|
||||
}
|
||||
}
|
||||
}
|
||||
template <typename TypeTag>
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::endEpisode()
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
template <typename TypeTag>
|
||||
template <class Restarter>
|
||||
@ -166,18 +156,14 @@ namespace Opm {
|
||||
const auto& gridView = simulator_.gridView();
|
||||
const int number_of_cells = gridView.size(0);
|
||||
|
||||
cartesian_to_compressed_ = cartesianToCompressed(number_of_cells,
|
||||
Opm::UgGridHelpers::globalCell(ugrid));
|
||||
cartesian_to_compressed_ = cartesianToCompressed(number_of_cells, Opm::UgGridHelpers::globalCell(ugrid));
|
||||
|
||||
for (size_t i = 0; i < aquifersData.size(); ++i)
|
||||
{
|
||||
aquifers_CarterTracy.push_back(
|
||||
AquiferCarterTracy<TypeTag> (aquifer_connection.at(i), cartesian_to_compressed_, this->simulator_ , aquifersData.at(i))
|
||||
);
|
||||
for (size_t i = 0; i < aquifersData.size(); ++i) {
|
||||
aquifers_CarterTracy.push_back(AquiferCarterTracy<TypeTag>(
|
||||
aquifer_connection.at(i), cartesian_to_compressed_, this->simulator_, aquifersData.at(i)));
|
||||
}
|
||||
}
|
||||
if(deck.hasKeyword("AQUFETP"))
|
||||
{
|
||||
if (deck.hasKeyword("AQUFETP")) {
|
||||
// updateConnectionIntensiveQuantities();
|
||||
const auto& eclState = this->simulator_.vanguard().eclState();
|
||||
|
||||
@ -193,14 +179,11 @@ namespace Opm {
|
||||
const auto& gridView = simulator_.gridView();
|
||||
const int number_of_cells = gridView.size(0);
|
||||
|
||||
cartesian_to_compressed_ = cartesianToCompressed(number_of_cells,
|
||||
Opm::UgGridHelpers::globalCell(ugrid));
|
||||
cartesian_to_compressed_ = cartesianToCompressed(number_of_cells, Opm::UgGridHelpers::globalCell(ugrid));
|
||||
|
||||
for (size_t i = 0; i < aquifersData.size(); ++i)
|
||||
{
|
||||
aquifers_Fetkovich.push_back(
|
||||
AquiferFetkovich<TypeTag> (aquifer_connection.at(i), cartesian_to_compressed_, this->simulator_ , aquifersData.at(i))
|
||||
);
|
||||
for (size_t i = 0; i < aquifersData.size(); ++i) {
|
||||
aquifers_Fetkovich.push_back(AquiferFetkovich<TypeTag>(
|
||||
aquifer_connection.at(i), cartesian_to_compressed_, this->simulator_, aquifersData.at(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user