mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2076 from GitPaean/converting_aquifier_unix
converting the aquifer files to be unix format
This commit is contained in:
commit
501122ca0d
@ -1,225 +1,225 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
|
||||||
Copyright 2017 Statoil ASA.
|
Copyright 2017 Statoil ASA.
|
||||||
Copyright 2017 IRIS
|
Copyright 2017 IRIS
|
||||||
|
|
||||||
This file is part of the Open Porous Media project (OPM).
|
This file is part of the Open Porous Media project (OPM).
|
||||||
|
|
||||||
OPM is free software: you can redistribute it and/or modify
|
OPM is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
OPM is distributed in the hope that it will be useful,
|
OPM is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
#ifndef OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
||||||
#define OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
#define OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
||||||
|
|
||||||
#include <opm/parser/eclipse/EclipseState/AquiferCT.hpp>
|
#include <opm/parser/eclipse/EclipseState/AquiferCT.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Aquifetp.hpp>
|
#include <opm/parser/eclipse/EclipseState/Aquifetp.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
|
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
|
||||||
#include <opm/common/utility/numeric/linearInterpolation.hpp>
|
#include <opm/common/utility/numeric/linearInterpolation.hpp>
|
||||||
|
|
||||||
#include <opm/material/common/MathToolbox.hpp>
|
#include <opm/material/common/MathToolbox.hpp>
|
||||||
#include <opm/material/densead/Math.hpp>
|
#include <opm/material/densead/Math.hpp>
|
||||||
#include <opm/material/densead/Evaluation.hpp>
|
#include <opm/material/densead/Evaluation.hpp>
|
||||||
#include <opm/material/fluidstates/BlackOilFluidState.hpp>
|
#include <opm/material/fluidstates/BlackOilFluidState.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
class AquiferInterface
|
class AquiferInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
|
typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
|
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
|
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, Indices) BlackoilIndices;
|
typedef typename GET_PROP_TYPE(TypeTag, Indices) BlackoilIndices;
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
|
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
|
||||||
typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
|
typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
|
||||||
|
|
||||||
enum { enableTemperature = GET_PROP_VALUE(TypeTag, EnableTemperature) };
|
enum { enableTemperature = GET_PROP_VALUE(TypeTag, EnableTemperature) };
|
||||||
enum { enableEnergy = GET_PROP_VALUE(TypeTag, EnableEnergy) };
|
enum { enableEnergy = GET_PROP_VALUE(TypeTag, EnableEnergy) };
|
||||||
|
|
||||||
static const int numEq = BlackoilIndices::numEq;
|
static const int numEq = BlackoilIndices::numEq;
|
||||||
typedef double Scalar;
|
typedef double Scalar;
|
||||||
|
|
||||||
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
|
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 waterCompIdx = FluidSystem::waterCompIdx;
|
||||||
static const auto waterPhaseIdx = FluidSystem::waterPhaseIdx;
|
static const auto waterPhaseIdx = FluidSystem::waterPhaseIdx;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
AquiferInterface( const Aquancon::AquanconOutput& connection,
|
AquiferInterface( const Aquancon::AquanconOutput& connection,
|
||||||
const std::unordered_map<int, int>& cartesian_to_compressed,
|
const std::unordered_map<int, int>& cartesian_to_compressed,
|
||||||
const Simulator& ebosSimulator)
|
const Simulator& ebosSimulator)
|
||||||
: connection_(connection)
|
: connection_(connection)
|
||||||
, ebos_simulator_(ebosSimulator)
|
, ebos_simulator_(ebosSimulator)
|
||||||
, cartesian_to_compressed_(cartesian_to_compressed)
|
, cartesian_to_compressed_(cartesian_to_compressed)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// Deconstructor
|
// Deconstructor
|
||||||
virtual ~AquiferInterface() {}
|
virtual ~AquiferInterface() {}
|
||||||
|
|
||||||
void initialSolutionApplied()
|
void initialSolutionApplied()
|
||||||
{
|
{
|
||||||
initQuantities(connection_);
|
initQuantities(connection_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void beginTimeStep()
|
void beginTimeStep()
|
||||||
{
|
{
|
||||||
ElementContext elemCtx(ebos_simulator_);
|
ElementContext elemCtx(ebos_simulator_);
|
||||||
auto elemIt = ebos_simulator_.gridView().template begin<0>();
|
auto elemIt = ebos_simulator_.gridView().template begin<0>();
|
||||||
const auto& elemEndIt = ebos_simulator_.gridView().template end<0>();
|
const auto& elemEndIt = ebos_simulator_.gridView().template end<0>();
|
||||||
for (; elemIt != elemEndIt; ++elemIt) {
|
for (; elemIt != elemEndIt; ++elemIt) {
|
||||||
const auto& elem = *elemIt;
|
const auto& elem = *elemIt;
|
||||||
|
|
||||||
elemCtx.updatePrimaryStencil(elem);
|
elemCtx.updatePrimaryStencil(elem);
|
||||||
|
|
||||||
int cellIdx = elemCtx.globalSpaceIndex(0, 0);
|
int cellIdx = elemCtx.globalSpaceIndex(0, 0);
|
||||||
int idx = cellToConnectionIdx_[cellIdx];
|
int idx = cellToConnectionIdx_[cellIdx];
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
elemCtx.updateIntensiveQuantities(0);
|
elemCtx.updateIntensiveQuantities(0);
|
||||||
const auto& iq = elemCtx.intensiveQuantities(0, 0);
|
const auto& iq = elemCtx.intensiveQuantities(0, 0);
|
||||||
pressure_previous_[idx] = Opm::getValue(iq.fluidState().pressure(waterPhaseIdx));
|
pressure_previous_[idx] = Opm::getValue(iq.fluidState().pressure(waterPhaseIdx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Context>
|
template <class Context>
|
||||||
void addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx)
|
void addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx)
|
||||||
{
|
{
|
||||||
unsigned cellIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
unsigned cellIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
||||||
|
|
||||||
int idx = cellToConnectionIdx_[cellIdx];
|
int idx = cellToConnectionIdx_[cellIdx];
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We are dereferencing the value of IntensiveQuantities because cachedIntensiveQuantities return a const pointer to
|
// We are dereferencing the value of IntensiveQuantities because cachedIntensiveQuantities return a const pointer to
|
||||||
// IntensiveQuantities of that particular cell_id
|
// IntensiveQuantities of that particular cell_id
|
||||||
const IntensiveQuantities intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
|
const IntensiveQuantities intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
|
||||||
// This is the pressure at td + dt
|
// This is the pressure at td + dt
|
||||||
updateCellPressure(pressure_current_,idx,intQuants);
|
updateCellPressure(pressure_current_,idx,intQuants);
|
||||||
updateCellDensity(idx,intQuants);
|
updateCellDensity(idx,intQuants);
|
||||||
calculateInflowRate(idx, context.simulator());
|
calculateInflowRate(idx, context.simulator());
|
||||||
rates[BlackoilIndices::conti0EqIdx + FluidSystem::waterCompIdx] +=
|
rates[BlackoilIndices::conti0EqIdx + FluidSystem::waterCompIdx] +=
|
||||||
Qai_[idx]/context.dofVolume(spaceIdx, timeIdx);
|
Qai_[idx]/context.dofVolume(spaceIdx, timeIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline Scalar gravity_() const
|
inline Scalar gravity_() const
|
||||||
{
|
{
|
||||||
return ebos_simulator_.problem().gravity()[2];
|
return ebos_simulator_.problem().gravity()[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void initQuantities(const Aquancon::AquanconOutput& connection)
|
inline void initQuantities(const Aquancon::AquanconOutput& connection)
|
||||||
{
|
{
|
||||||
// We reset the cumulative flux at the start of any simulation, so, W_flux = 0
|
// We reset the cumulative flux at the start of any simulation, so, W_flux = 0
|
||||||
W_flux_ = 0.;
|
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);
|
initializeConnections(connection);
|
||||||
calculateAquiferCondition();
|
calculateAquiferCondition();
|
||||||
calculateAquiferConstants();
|
calculateAquiferConstants();
|
||||||
|
|
||||||
pressure_previous_.resize(cell_idx_.size(), 0.);
|
pressure_previous_.resize(cell_idx_.size(), 0.);
|
||||||
pressure_current_.resize(cell_idx_.size(), 0.);
|
pressure_current_.resize(cell_idx_.size(), 0.);
|
||||||
Qai_.resize(cell_idx_.size(), 0.0);
|
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();
|
const auto& fs = intQuants.fluidState();
|
||||||
pressure_water.at(idx) = fs.pressure(waterPhaseIdx);
|
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();
|
const auto& fs = intQuants.fluidState();
|
||||||
pressure_water.at(idx) = fs.pressure(waterPhaseIdx).value();
|
pressure_water.at(idx) = fs.pressure(waterPhaseIdx).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void updateCellDensity(const int idx, const IntensiveQuantities& intQuants)
|
inline void updateCellDensity(const int idx, const IntensiveQuantities& intQuants)
|
||||||
{
|
{
|
||||||
const auto& fs = intQuants.fluidState();
|
const auto& fs = intQuants.fluidState();
|
||||||
rhow_.at(idx) = fs.density(waterPhaseIdx);
|
rhow_.at(idx) = fs.density(waterPhaseIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class faceCellType, class ugridType>
|
template<class faceCellType, class ugridType>
|
||||||
inline double getFaceArea(const faceCellType& faceCells, const ugridType& ugrid,
|
inline double getFaceArea(const faceCellType& faceCells, const ugridType& ugrid,
|
||||||
const int faceIdx, const int idx,
|
const int faceIdx, const int idx,
|
||||||
const Aquancon::AquanconOutput& connection) const
|
const Aquancon::AquanconOutput& connection) const
|
||||||
{
|
{
|
||||||
// Check now if the face is outside of the reservoir, or if it adjoins an inactive cell
|
// 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
|
// 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.;
|
double faceArea = 0.;
|
||||||
const auto cellNeighbour0 = faceCells(faceIdx,0);
|
const auto cellNeighbour0 = faceCells(faceIdx,0);
|
||||||
const auto cellNeighbour1 = faceCells(faceIdx,1);
|
const auto cellNeighbour1 = faceCells(faceIdx,1);
|
||||||
const auto defaultFaceArea = Opm::UgGridHelpers::faceArea(ugrid, faceIdx);
|
const auto defaultFaceArea = Opm::UgGridHelpers::faceArea(ugrid, faceIdx);
|
||||||
const auto calculatedFaceArea = (!connection.influx_coeff.at(idx))?
|
const auto calculatedFaceArea = (!connection.influx_coeff.at(idx))?
|
||||||
defaultFaceArea :
|
defaultFaceArea :
|
||||||
*(connection.influx_coeff.at(idx));
|
*(connection.influx_coeff.at(idx));
|
||||||
faceArea = (cellNeighbour0 * cellNeighbour1 > 0)? 0. : calculatedFaceArea;
|
faceArea = (cellNeighbour0 * cellNeighbour1 > 0)? 0. : calculatedFaceArea;
|
||||||
if (cellNeighbour1 == 0){
|
if (cellNeighbour1 == 0){
|
||||||
faceArea = (cellNeighbour0 < 0)? faceArea : 0.;
|
faceArea = (cellNeighbour0 < 0)? faceArea : 0.;
|
||||||
}
|
}
|
||||||
else if (cellNeighbour0 == 0){
|
else if (cellNeighbour0 == 0){
|
||||||
faceArea = (cellNeighbour1 < 0)? faceArea : 0.;
|
faceArea = (cellNeighbour1 < 0)? faceArea : 0.;
|
||||||
}
|
}
|
||||||
return faceArea;
|
return faceArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void endTimeStep() = 0;
|
virtual void endTimeStep() = 0;
|
||||||
|
|
||||||
const Aquancon::AquanconOutput connection_;
|
const Aquancon::AquanconOutput connection_;
|
||||||
const Simulator& ebos_simulator_;
|
const Simulator& ebos_simulator_;
|
||||||
const std::unordered_map<int, int> cartesian_to_compressed_;
|
const std::unordered_map<int, int> cartesian_to_compressed_;
|
||||||
|
|
||||||
// Grid variables
|
// Grid variables
|
||||||
std::vector<size_t> cell_idx_;
|
std::vector<size_t> cell_idx_;
|
||||||
std::vector<Scalar> faceArea_connected_;
|
std::vector<Scalar> faceArea_connected_;
|
||||||
std::vector<int> cellToConnectionIdx_;
|
std::vector<int> cellToConnectionIdx_;
|
||||||
// Quantities at each grid id
|
// Quantities at each grid id
|
||||||
std::vector<Scalar> cell_depth_;
|
std::vector<Scalar> cell_depth_;
|
||||||
std::vector<Scalar> pressure_previous_;
|
std::vector<Scalar> pressure_previous_;
|
||||||
std::vector<Eval> pressure_current_;
|
std::vector<Eval> pressure_current_;
|
||||||
std::vector<Eval> Qai_;
|
std::vector<Eval> Qai_;
|
||||||
std::vector<Eval> rhow_;
|
std::vector<Eval> rhow_;
|
||||||
std::vector<Scalar> alphai_;
|
std::vector<Scalar> alphai_;
|
||||||
|
|
||||||
Scalar mu_w_; //water viscosity
|
Scalar mu_w_; //water viscosity
|
||||||
Scalar Tc_; // Time constant
|
Scalar Tc_; // Time constant
|
||||||
Scalar pa0_; // initial aquifer pressure
|
Scalar pa0_; // initial aquifer pressure
|
||||||
|
|
||||||
Eval W_flux_;
|
Eval W_flux_;
|
||||||
|
|
||||||
virtual void initializeConnections(const Aquancon::AquanconOutput& connection) =0;
|
virtual void initializeConnections(const Aquancon::AquanconOutput& connection) =0;
|
||||||
|
|
||||||
virtual Scalar dpai(int idx) = 0;
|
virtual Scalar dpai(int idx) = 0;
|
||||||
|
|
||||||
virtual void calculateInflowRate(int idx, const Simulator& simulator) = 0;
|
virtual void calculateInflowRate(int idx, const Simulator& simulator) = 0;
|
||||||
|
|
||||||
virtual void calculateAquiferCondition() = 0;
|
virtual void calculateAquiferCondition() = 0;
|
||||||
|
|
||||||
virtual void calculateAquiferConstants() = 0;
|
virtual void calculateAquiferConstants() = 0;
|
||||||
|
|
||||||
virtual Scalar calculateReservoirEquilibrium() =0;
|
virtual Scalar calculateReservoirEquilibrium() =0;
|
||||||
// This function is used to initialize and calculate the alpha_i for each grid connection to the aquifer
|
// This function is used to initialize and calculate the alpha_i for each grid connection to the aquifer
|
||||||
};
|
};
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,173 +1,146 @@
|
|||||||
#include <opm/grid/utility/cartesianToCompressed.hpp>
|
#include <opm/grid/utility/cartesianToCompressed.hpp>
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
BlackoilAquiferModel<TypeTag>::
|
|
||||||
BlackoilAquiferModel(Simulator& simulator)
|
|
||||||
: simulator_(simulator)
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
void
|
|
||||||
BlackoilAquiferModel<TypeTag>::initialSolutionApplied()
|
|
||||||
{
|
|
||||||
if(aquiferCarterTracyActive())
|
|
||||||
{
|
|
||||||
for (auto aquifer = aquifers_CarterTracy.begin(); aquifer != aquifers_CarterTracy.end(); ++aquifer)
|
|
||||||
{
|
|
||||||
aquifer->initialSolutionApplied();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(aquiferFetkovichActive())
|
|
||||||
{
|
|
||||||
for (auto aquifer = aquifers_Fetkovich.begin(); aquifer != aquifers_Fetkovich.end(); ++aquifer)
|
|
||||||
{
|
|
||||||
aquifer->initialSolutionApplied();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
void
|
|
||||||
BlackoilAquiferModel<TypeTag>::beginEpisode()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
void
|
|
||||||
BlackoilAquiferModel<TypeTag>::beginIteration()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void BlackoilAquiferModel<TypeTag>:: beginTimeStep()
|
BlackoilAquiferModel<TypeTag>::
|
||||||
|
BlackoilAquiferModel(Simulator& simulator)
|
||||||
|
: simulator_(simulator)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename TypeTag>
|
||||||
|
void
|
||||||
|
BlackoilAquiferModel<TypeTag>::initialSolutionApplied()
|
||||||
{
|
{
|
||||||
if(aquiferCarterTracyActive())
|
if(aquiferCarterTracyActive())
|
||||||
{
|
{
|
||||||
for (auto aquifer = aquifers_CarterTracy.begin(); aquifer != aquifers_CarterTracy.end(); ++aquifer)
|
for (auto aquifer = aquifers_CarterTracy.begin(); aquifer != aquifers_CarterTracy.end(); ++aquifer)
|
||||||
{
|
{
|
||||||
aquifer->beginTimeStep();
|
aquifer->initialSolutionApplied();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(aquiferFetkovichActive())
|
if(aquiferFetkovichActive())
|
||||||
{
|
{
|
||||||
for (auto aquifer = aquifers_Fetkovich.begin(); aquifer != aquifers_Fetkovich.end(); ++aquifer)
|
for (auto aquifer = aquifers_Fetkovich.begin(); aquifer != aquifers_Fetkovich.end(); ++aquifer)
|
||||||
{
|
{
|
||||||
aquifer->beginTimeStep();
|
aquifer->initialSolutionApplied();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
template<class Context>
|
void
|
||||||
void BlackoilAquiferModel<TypeTag>:: addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx) const
|
BlackoilAquiferModel<TypeTag>::beginEpisode()
|
||||||
{
|
{ }
|
||||||
if(aquiferCarterTracyActive())
|
|
||||||
{
|
template<typename TypeTag>
|
||||||
for (auto& aquifer : aquifers_CarterTracy)
|
void
|
||||||
{
|
BlackoilAquiferModel<TypeTag>::beginIteration()
|
||||||
aquifer.addToSource(rates, context, spaceIdx, timeIdx);
|
{ }
|
||||||
}
|
|
||||||
}
|
template<typename TypeTag>
|
||||||
if(aquiferFetkovichActive())
|
void BlackoilAquiferModel<TypeTag>:: beginTimeStep()
|
||||||
{
|
|
||||||
for (auto& aquifer : aquifers_Fetkovich)
|
|
||||||
{
|
|
||||||
aquifer.addToSource(rates, context, spaceIdx, timeIdx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
void
|
|
||||||
BlackoilAquiferModel<TypeTag>::endIteration()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
void BlackoilAquiferModel<TypeTag>:: endTimeStep()
|
|
||||||
{
|
|
||||||
if(aquiferCarterTracyActive())
|
|
||||||
{
|
|
||||||
for (auto aquifer = aquifers_CarterTracy.begin(); aquifer != aquifers_CarterTracy.end(); ++aquifer)
|
|
||||||
{
|
|
||||||
aquifer->endTimeStep();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(aquiferFetkovichActive())
|
|
||||||
{
|
|
||||||
for (auto aquifer = aquifers_Fetkovich.begin(); aquifer != aquifers_Fetkovich.end(); ++aquifer)
|
|
||||||
{
|
|
||||||
aquifer->endTimeStep();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<typename TypeTag>
|
|
||||||
void
|
|
||||||
BlackoilAquiferModel<TypeTag>::endEpisode()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
template <typename TypeTag>
|
|
||||||
template <class Restarter>
|
|
||||||
void
|
|
||||||
BlackoilAquiferModel<TypeTag>::serialize(Restarter& /* res */)
|
|
||||||
{
|
|
||||||
// TODO (?)
|
|
||||||
throw std::logic_error("BlackoilAquiferModel::serialize() is not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
template <class Restarter>
|
|
||||||
void
|
|
||||||
BlackoilAquiferModel<TypeTag>::deserialize(Restarter& /* res */)
|
|
||||||
{
|
|
||||||
// TODO (?)
|
|
||||||
throw std::logic_error("BlackoilAquiferModel::deserialize() is not yet implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the aquifers in the deck
|
|
||||||
template<typename TypeTag>
|
|
||||||
void
|
|
||||||
BlackoilAquiferModel<TypeTag>:: init()
|
|
||||||
{
|
{
|
||||||
const auto& deck = this->simulator_.vanguard().deck();
|
if(aquiferCarterTracyActive())
|
||||||
|
{
|
||||||
|
for (auto aquifer = aquifers_CarterTracy.begin(); aquifer != aquifers_CarterTracy.end(); ++aquifer)
|
||||||
|
{
|
||||||
|
aquifer->beginTimeStep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(aquiferFetkovichActive())
|
||||||
|
{
|
||||||
|
for (auto aquifer = aquifers_Fetkovich.begin(); aquifer != aquifers_Fetkovich.end(); ++aquifer)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
aquifer.addToSource(rates, context, spaceIdx, timeIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(aquiferFetkovichActive())
|
||||||
|
{
|
||||||
|
for (auto& aquifer : aquifers_Fetkovich)
|
||||||
|
{
|
||||||
|
aquifer.addToSource(rates, context, spaceIdx, timeIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename TypeTag>
|
||||||
|
void
|
||||||
|
BlackoilAquiferModel<TypeTag>::endIteration()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
template<typename TypeTag>
|
||||||
|
void BlackoilAquiferModel<TypeTag>:: endTimeStep()
|
||||||
|
{
|
||||||
|
if(aquiferCarterTracyActive())
|
||||||
|
{
|
||||||
|
for (auto aquifer = aquifers_CarterTracy.begin(); aquifer != aquifers_CarterTracy.end(); ++aquifer)
|
||||||
|
{
|
||||||
|
aquifer->endTimeStep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(aquiferFetkovichActive())
|
||||||
|
{
|
||||||
|
for (auto aquifer = aquifers_Fetkovich.begin(); aquifer != aquifers_Fetkovich.end(); ++aquifer)
|
||||||
|
{
|
||||||
|
aquifer->endTimeStep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template<typename TypeTag>
|
||||||
|
void
|
||||||
|
BlackoilAquiferModel<TypeTag>::endEpisode()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
template <typename TypeTag>
|
||||||
|
template <class Restarter>
|
||||||
|
void
|
||||||
|
BlackoilAquiferModel<TypeTag>::serialize(Restarter& /* res */)
|
||||||
|
{
|
||||||
|
// TODO (?)
|
||||||
|
throw std::logic_error("BlackoilAquiferModel::serialize() is not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename TypeTag>
|
||||||
|
template <class Restarter>
|
||||||
|
void
|
||||||
|
BlackoilAquiferModel<TypeTag>::deserialize(Restarter& /* res */)
|
||||||
|
{
|
||||||
|
// TODO (?)
|
||||||
|
throw std::logic_error("BlackoilAquiferModel::deserialize() is not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize the aquifers in the deck
|
||||||
|
template<typename TypeTag>
|
||||||
|
void
|
||||||
|
BlackoilAquiferModel<TypeTag>:: init()
|
||||||
|
{
|
||||||
|
const auto& deck = this->simulator_.vanguard().deck();
|
||||||
if (deck.hasKeyword("AQUCT")) {
|
if (deck.hasKeyword("AQUCT")) {
|
||||||
//updateConnectionIntensiveQuantities();
|
//updateConnectionIntensiveQuantities();
|
||||||
const auto& eclState = this->simulator_.vanguard().eclState();
|
const auto& eclState = this->simulator_.vanguard().eclState();
|
||||||
|
|
||||||
// Get all the carter tracy aquifer properties data and put it in aquifers vector
|
// Get all the carter tracy aquifer properties data and put it in aquifers vector
|
||||||
const AquiferCT aquiferct = AquiferCT(eclState,deck);
|
const AquiferCT aquiferct = AquiferCT(eclState,deck);
|
||||||
const Aquancon aquifer_connect = Aquancon(eclState.getInputGrid(), deck);
|
const Aquancon aquifer_connect = Aquancon(eclState.getInputGrid(), deck);
|
||||||
|
|
||||||
std::vector<AquiferCT::AQUCT_data> aquifersData = aquiferct.getAquifers();
|
std::vector<AquiferCT::AQUCT_data> aquifersData = aquiferct.getAquifers();
|
||||||
std::vector<Aquancon::AquanconOutput> aquifer_connection = aquifer_connect.getAquOutput();
|
std::vector<Aquancon::AquanconOutput> aquifer_connection = aquifer_connect.getAquOutput();
|
||||||
|
|
||||||
assert( aquifersData.size() == aquifer_connection.size() );
|
|
||||||
const auto& ugrid = simulator_.vanguard().grid();
|
|
||||||
const auto& gridView = simulator_.gridView();
|
|
||||||
const int number_of_cells = gridView.size(0);
|
|
||||||
|
|
||||||
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))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(deck.hasKeyword("AQUFETP"))
|
|
||||||
{
|
|
||||||
//updateConnectionIntensiveQuantities();
|
|
||||||
const auto& eclState = this->simulator_.vanguard().eclState();
|
|
||||||
|
|
||||||
// Get all the carter tracy aquifer properties data and put it in aquifers vector
|
|
||||||
const Aquifetp aquifetp = Aquifetp(deck);
|
|
||||||
const Aquancon aquifer_connect = Aquancon(eclState.getInputGrid(), deck);
|
|
||||||
|
|
||||||
std::vector<Aquifetp::AQUFETP_data> aquifersData = aquifetp.getAquifers();
|
|
||||||
std::vector<Aquancon::AquanconOutput> aquifer_connection = aquifer_connect.getAquOutput();
|
|
||||||
|
|
||||||
assert( aquifersData.size() == aquifer_connection.size() );
|
assert( aquifersData.size() == aquifer_connection.size() );
|
||||||
const auto& ugrid = simulator_.vanguard().grid();
|
const auto& ugrid = simulator_.vanguard().grid();
|
||||||
const auto& gridView = simulator_.gridView();
|
const auto& gridView = simulator_.gridView();
|
||||||
@ -176,30 +149,57 @@ namespace Opm {
|
|||||||
cartesian_to_compressed_ = cartesianToCompressed(number_of_cells,
|
cartesian_to_compressed_ = cartesianToCompressed(number_of_cells,
|
||||||
Opm::UgGridHelpers::globalCell(ugrid));
|
Opm::UgGridHelpers::globalCell(ugrid));
|
||||||
|
|
||||||
for (size_t i = 0; i < aquifersData.size(); ++i)
|
for (size_t i = 0; i < aquifersData.size(); ++i)
|
||||||
{
|
{
|
||||||
aquifers_Fetkovich.push_back(
|
aquifers_CarterTracy.push_back(
|
||||||
AquiferFetkovich<TypeTag> (aquifer_connection.at(i), cartesian_to_compressed_, this->simulator_ , aquifersData.at(i))
|
AquiferCarterTracy<TypeTag> (aquifer_connection.at(i), cartesian_to_compressed_, this->simulator_ , aquifersData.at(i))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if(deck.hasKeyword("AQUFETP"))
|
||||||
template<typename TypeTag>
|
{
|
||||||
bool
|
//updateConnectionIntensiveQuantities();
|
||||||
BlackoilAquiferModel<TypeTag>:: aquiferActive() const
|
const auto& eclState = this->simulator_.vanguard().eclState();
|
||||||
|
|
||||||
|
// Get all the carter tracy aquifer properties data and put it in aquifers vector
|
||||||
|
const Aquifetp aquifetp = Aquifetp(deck);
|
||||||
|
const Aquancon aquifer_connect = Aquancon(eclState.getInputGrid(), deck);
|
||||||
|
|
||||||
|
std::vector<Aquifetp::AQUFETP_data> aquifersData = aquifetp.getAquifers();
|
||||||
|
std::vector<Aquancon::AquanconOutput> aquifer_connection = aquifer_connect.getAquOutput();
|
||||||
|
|
||||||
|
assert( aquifersData.size() == aquifer_connection.size() );
|
||||||
|
const auto& ugrid = simulator_.vanguard().grid();
|
||||||
|
const auto& gridView = simulator_.gridView();
|
||||||
|
const int number_of_cells = gridView.size(0);
|
||||||
|
|
||||||
|
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))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template<typename TypeTag>
|
||||||
|
bool
|
||||||
|
BlackoilAquiferModel<TypeTag>:: aquiferActive() const
|
||||||
{
|
{
|
||||||
return (aquiferCarterTracyActive() || aquiferFetkovichActive());
|
return (aquiferCarterTracyActive() || aquiferFetkovichActive());
|
||||||
}
|
}
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
bool
|
bool
|
||||||
BlackoilAquiferModel<TypeTag>:: aquiferCarterTracyActive() const
|
BlackoilAquiferModel<TypeTag>:: aquiferCarterTracyActive() const
|
||||||
{
|
{
|
||||||
return !aquifers_CarterTracy.empty();
|
return !aquifers_CarterTracy.empty();
|
||||||
}
|
}
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
bool
|
bool
|
||||||
BlackoilAquiferModel<TypeTag>:: aquiferFetkovichActive() const
|
BlackoilAquiferModel<TypeTag>:: aquiferFetkovichActive() const
|
||||||
{
|
{
|
||||||
return !aquifers_Fetkovich.empty();
|
return !aquifers_Fetkovich.empty();
|
||||||
}
|
}
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
Loading…
Reference in New Issue
Block a user