Merge pull request #997 from andlaus/use_fluidsystem_in_blackoilpropsadfromdeck

Use fluidsystem in blackoilpropsadfromdeck
This commit is contained in:
Atgeirr Flø Rasmussen authored and GitHub committed 2017-01-06 22:14:33 +01:00
commit 9ba40520b8
45 files changed
+166 -526

No files matched your search

-2
View File
@@ -26,7 +26,6 @@
# originally generated with the command:
# find opm -name '*.c*' -printf '\t%p\n' | sort
list (APPEND MAIN_SOURCE_FILES
opm/autodiff/BlackoilPropsAdInterface.cpp
opm/autodiff/ExtractParallelGridInformationToISTL.cpp
opm/autodiff/NewtonIterationBlackoilCPR.cpp
opm/autodiff/NewtonIterationBlackoilInterleaved.cpp
@@ -156,7 +155,6 @@ list (APPEND PUBLIC_HEADER_FILES
opm/autodiff/BlackoilPressureModel.hpp
opm/autodiff/BlackoilPropsAdFromDeck.hpp
opm/autodiff/SolventPropsAdFromDeck.hpp
opm/autodiff/BlackoilPropsAdInterface.hpp
opm/autodiff/Compat.hpp
opm/autodiff/CPRPreconditioner.hpp
opm/autodiff/createGlobalCellArray.hpp
+2 -2
View File
@@ -44,7 +44,7 @@
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/SimulatorFullyImplicitBlackoil.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
@@ -211,7 +211,7 @@ void initOPMTrans(TransGraph& opmTrans, const Deck& deck, const EclipseState& ec
std::shared_ptr<GridManager> grid = std::make_shared<GridManager>( eclipseState.getInputGrid(),
eclipseState.get3DProperties().getDoubleGridProperty( "PORV" ).getData() );
const struct UnstructuredGrid * cGrid = grid->c_grid();
std::shared_ptr<BlackoilPropsAdInterface> props;
std::shared_ptr<BlackoilPropsAdFromDeck> props;
props.reset(new BlackoilPropsAdFromDeck(deck, eclipseState, *grid->c_grid()));
DerivedGeology geology(*grid->c_grid() , *props, eclipseState, false);
+2 -2
View File
@@ -57,7 +57,7 @@
#include <opm/polymer/PolymerState.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/GridHelpers.hpp>
@@ -113,7 +113,7 @@ try
}
std::shared_ptr<GridManager> grid;
std::shared_ptr<BlackoilPropertiesInterface> props;
std::shared_ptr<BlackoilPropsAdInterface> new_props;
std::shared_ptr<BlackoilPropsAdFromDeck> new_props;
std::shared_ptr<RockCompressibility> rock_comp;
std::unique_ptr<PolymerBlackoilState> state;
// bool check_well_controls = false;
+1 -1
View File
@@ -62,7 +62,7 @@ namespace Opm {
/// \param[in] terminal_output request output to cout/cerr
BlackoilModel(const typename Base::ModelParameters& param,
const Grid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo,
const RockCompressibility* rock_comp_props,
const StandardWells& std_wells,
+4 -4
View File
@@ -27,7 +27,7 @@
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/LinearisedBlackoilResidual.hpp>
#include <opm/autodiff/NewtonIterationBlackoilInterface.hpp>
#include <opm/autodiff/BlackoilModelEnums.hpp>
@@ -117,7 +117,7 @@ namespace Opm {
// For the conversion between the surface volume rate and resrevoir voidage rate
using RateConverterType = RateConverter::
SurfaceToReservoirVoidage<BlackoilPropsAdInterface, std::vector<int> >;
SurfaceToReservoirVoidage<BlackoilPropsAdFromDeck::FluidSystem, std::vector<int> >;
// --------- Public methods ---------
@@ -138,7 +138,7 @@ namespace Opm {
/// \param[in] terminal_output request output to cout/cerr
BlackoilModelBase(const ModelParameters& param,
const Grid& grid ,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo ,
const RockCompressibility* rock_comp_props,
const WellModel& well_model,
@@ -297,7 +297,7 @@ namespace Opm {
// --------- Data members ---------
const Grid& grid_;
const BlackoilPropsAdInterface& fluid_;
const BlackoilPropsAdFromDeck& fluid_;
const DerivedGeology& geo_;
const RockCompressibility* rock_comp_props_;
VFPProperties vfp_properties_;
+3 -3
View File
@@ -32,7 +32,7 @@
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/GridHelpers.hpp>
#include <opm/autodiff/WellHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/WellDensitySegmented.hpp>
#include <opm/autodiff/VFPProperties.hpp>
@@ -101,7 +101,7 @@ typedef Eigen::Array<double,
BlackoilModelBase<Grid, WellModel, Implementation>::
BlackoilModelBase(const ModelParameters& param,
const Grid& grid ,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo ,
const RockCompressibility* rock_comp_props,
const WellModel& well_model,
@@ -144,7 +144,7 @@ typedef Eigen::Array<double,
// the field will be calculated.
// TODO: more delicate implementation will be required if we want to handle different
// FIP regions specified from the well specifications.
, rate_converter_(fluid_, std::vector<int>(AutoDiffGrid::numCells(grid_),0))
, rate_converter_(fluid_.phaseUsage(), fluid_.cellPvtRegionIndex(), AutoDiffGrid::numCells(grid_), std::vector<int>(AutoDiffGrid::numCells(grid_),0))
{
if (active_[Water]) {
material_name_.push_back("Water");
+3 -3
View File
@@ -33,7 +33,7 @@
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/GridHelpers.hpp>
#include <opm/autodiff/WellHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/WellDensitySegmented.hpp>
#include <opm/autodiff/VFPProperties.hpp>
@@ -169,7 +169,7 @@ namespace Opm {
/// \param[in] terminal_output request output to cout/cerr
BlackoilModelEbos(Simulator& ebosSimulator,
const ModelParameters& param,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo ,
const StandardWellsDense<FluidSystem, BlackoilIndices>& well_model,
const NewtonIterationBlackoilInterface& linsolver,
@@ -1209,7 +1209,7 @@ namespace Opm {
Simulator& ebosSimulator_;
const Grid& grid_;
const ISTLSolverType* istlSolver_;
const BlackoilPropsAdInterface& fluid_;
const BlackoilPropsAdFromDeck& fluid_;
const DerivedGeology& geo_;
VFPProperties vfp_properties_;
// For each canonical phase -> true if active
+1 -1
View File
@@ -83,7 +83,7 @@ namespace Opm {
/// \param[in] wells_multisegment a vector of multisegment wells
BlackoilMultiSegmentModel(const typename Base::ModelParameters& param,
const Grid& grid ,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo ,
const RockCompressibility* rock_comp_props,
const MultisegmentWells& well_model,
@@ -25,7 +25,7 @@
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/GridHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/WellDensitySegmented.hpp>
#include <opm/autodiff/VFPProperties.hpp>
@@ -59,7 +59,7 @@ namespace Opm {
BlackoilMultiSegmentModel<Grid>::
BlackoilMultiSegmentModel(const typename Base::ModelParameters& param,
const Grid& grid ,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo ,
const RockCompressibility* rock_comp_props,
const MultisegmentWells& well_model,
+1 -1
View File
@@ -66,7 +66,7 @@ namespace Opm {
/// \param[in] terminal_output request output to cout/cerr
BlackoilPressureModel(const typename Base::ModelParameters& param,
const Grid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo,
const RockCompressibility* rock_comp_props,
const StandardWells& std_wells,
+16 -45
View File
@@ -127,11 +127,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
materialLawManager_ = materialLawManager;
// Copy properties that do not depend on the postion within the grid.
oilPvt_ = props.oilPvt_;
gasPvt_ = props.gasPvt_;
waterPvt_ = props.waterPvt_;
phase_usage_ = props.phase_usage_;
surfaceDensity_ = props.surfaceDensity_;
vap1_ = props.vap1_;
vap2_ = props.vap2_;
vap_satmax_guard_ = props.vap_satmax_guard_;
@@ -162,33 +158,9 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
phase_usage_ = phaseUsageFromDeck(deck);
gasPvt_ = std::make_shared<GasPvt>();
oilPvt_ = std::make_shared<OilPvt>();
waterPvt_ = std::make_shared<WaterPvt>();
gasPvt_->initFromDeck(deck, eclState);
oilPvt_->initFromDeck(deck, eclState);
waterPvt_->initFromDeck(deck, eclState);
// Surface densities. Accounting for different orders in eclipse and our code.
const auto& densityKeyword = deck.getKeyword("DENSITY");
int numRegions = densityKeyword.size();
auto tables = eclState.getTableManager();
surfaceDensity_.resize(numRegions);
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
if (phase_usage_.phase_used[Oil]) {
surfaceDensity_[regionIdx][phase_usage_.phase_pos[Oil]]
= densityKeyword.getRecord(regionIdx).getItem("OIL").getSIDouble(0);
}
if (phase_usage_.phase_used[Water]) {
surfaceDensity_[regionIdx][phase_usage_.phase_pos[Water]]
= densityKeyword.getRecord(regionIdx).getItem("WATER").getSIDouble(0);
}
if (phase_usage_.phase_used[Gas]) {
surfaceDensity_[regionIdx][phase_usage_.phase_pos[Gas]]
= densityKeyword.getRecord(regionIdx).getItem("GAS").getSIDouble(0);
}
if (! (&FluidSystem::oilPvt()) ) {
// make sure that we don't initialize the fluid system twice
FluidSystem::initFromDeck(deck, eclState);
}
// Oil vaporization controls (kw VAPPARS)
@@ -274,8 +246,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
V rhos = V::Zero(n);
for (int cellIdx = 0; cellIdx < n; ++cellIdx) {
int pvtRegionIdx = cellPvtRegionIdx_[cellIdx];
const auto* rho = &surfaceDensity_[pvtRegionIdx][0];
rhos[cellIdx] = rho[phaseIdx];
rhos[cellIdx] = FluidSystem::referenceDensity(phaseIdx, pvtRegionIdx);
}
return rhos;
}
@@ -314,7 +285,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
pEval.setValue(pw.value()[i]);
TEval.setValue(T.value()[i]);
const Eval& muEval = waterPvt_->viscosity(pvtRegionIdx, TEval, pEval);
const Eval& muEval = FluidSystem::waterPvt().viscosity(pvtRegionIdx, TEval, pEval);
mu[i] = muEval.value();
dmudp[i] = muEval.derivative(0);
@@ -371,13 +342,13 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
TEval.setValue(T.value()[i]);
if (cond[i].hasFreeGas()) {
muEval = oilPvt_->saturatedViscosity(pvtRegionIdx, TEval, pEval);
muEval = FluidSystem::oilPvt().saturatedViscosity(pvtRegionIdx, TEval, pEval);
}
else {
if (phase_usage_.phase_used[Gas]) {
RsEval.setValue(rs.value()[i]);
}
muEval = oilPvt_->viscosity(pvtRegionIdx, TEval, pEval, RsEval);
muEval = FluidSystem::oilPvt().viscosity(pvtRegionIdx, TEval, pEval, RsEval);
}
mu[i] = muEval.value();
@@ -438,11 +409,11 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
TEval.setValue(T.value()[i]);
if (cond[i].hasFreeOil()) {
muEval = gasPvt_->saturatedViscosity(pvtRegionIdx, TEval, pEval);
muEval = FluidSystem::gasPvt().saturatedViscosity(pvtRegionIdx, TEval, pEval);
}
else {
RvEval.setValue(rv.value()[i]);
muEval = gasPvt_->viscosity(pvtRegionIdx, TEval, pEval, RvEval);
muEval = FluidSystem::gasPvt().viscosity(pvtRegionIdx, TEval, pEval, RvEval);
}
mu[i] = muEval.value();
@@ -497,7 +468,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
pEval.setValue(pw.value()[i]);
TEval.setValue(T.value()[i]);
const Eval& bEval = waterPvt_->inverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval);
const Eval& bEval = FluidSystem::waterPvt().inverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval);
b[i] = bEval.value();
dbdp[i] = bEval.derivative(0);
@@ -552,7 +523,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
//RS/RV only makes sense when gas phase is active
if (cond[i].hasFreeGas()) {
bEval = oilPvt_->saturatedInverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval);
bEval = FluidSystem::oilPvt().saturatedInverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval);
}
else {
if (rs.size() == 0) {
@@ -561,7 +532,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
else {
RsEval.setValue(rs.value()[i]);
}
bEval = oilPvt_->inverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval, RsEval);
bEval = FluidSystem::oilPvt().inverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval, RsEval);
}
b[i] = bEval.value();
@@ -624,11 +595,11 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
TEval.setValue(T.value()[i]);
if (cond[i].hasFreeOil()) {
bEval = gasPvt_->saturatedInverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval);
bEval = FluidSystem::gasPvt().saturatedInverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval);
}
else {
RvEval.setValue(rv.value()[i]);
bEval = gasPvt_->inverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval, RvEval);
bEval = FluidSystem::gasPvt().inverseFormationVolumeFactor(pvtRegionIdx, TEval, pEval, RvEval);
}
b[i] = bEval.value();
@@ -679,7 +650,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
unsigned pvtRegionIdx = cellPvtRegionIdx_[cells[i]];
pEval.setValue(po.value()[i]);
const Eval& RsEval = oilPvt_->saturatedGasDissolutionFactor(pvtRegionIdx, TEval, pEval);
const Eval& RsEval = FluidSystem::oilPvt().saturatedGasDissolutionFactor(pvtRegionIdx, TEval, pEval);
rbub[i] = RsEval.value();
drbubdp[i] = RsEval.derivative(0);
@@ -736,7 +707,7 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
unsigned pvtRegionIdx = cellPvtRegionIdx_[cells[i]];
pEval.setValue(pg.value()[i]);
const Eval& RvEval = gasPvt_->saturatedOilVaporizationFactor(pvtRegionIdx, TEval, pEval);
const Eval& RvEval = FluidSystem::gasPvt().saturatedOilVaporizationFactor(pvtRegionIdx, TEval, pEval);
rv[i] = RvEval.value();
drvdp[i] = RvEval.derivative(0);
+3 -12
View File
@@ -22,16 +22,13 @@
#ifndef OPM_BLACKOILPROPSADFROMDECK_HEADER_INCLUDED
#define OPM_BLACKOILPROPSADFROMDECK_HEADER_INCLUDED
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/BlackoilModelEnums.hpp>
#include <opm/core/props/satfunc/SaturationPropsFromDeck.hpp>
#include <opm/core/props/rock/RockFromDeck.hpp>
#include <opm/material/fluidsystems/blackoilpvt/GasPvtMultiplexer.hpp>
#include <opm/material/fluidsystems/blackoilpvt/OilPvtMultiplexer.hpp>
#include <opm/material/fluidsystems/blackoilpvt/WaterPvtMultiplexer.hpp>
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
#include <opm/material/densead/Math.hpp>
#include <opm/material/densead/Evaluation.hpp>
@@ -61,10 +58,11 @@ namespace Opm
/// taking an AD type and returning the same. Derivatives are not
/// returned separately by any method, only implicitly with the AD
/// version of the methods.
class BlackoilPropsAdFromDeck : public BlackoilPropsAdInterface
class BlackoilPropsAdFromDeck
{
friend class BlackoilPropsDataHandle;
public:
typedef FluidSystems::BlackOil<double> FluidSystem;
typedef Opm::GasPvtMultiplexer<double> GasPvt;
typedef Opm::OilPvtMultiplexer<double> OilPvt;
typedef Opm::WaterPvtMultiplexer<double> WaterPvt;
@@ -416,18 +414,11 @@ namespace Opm
// The PVT region which is to be used for each cell
std::vector<int> cellPvtRegionIdx_;
// Densities, one std::array per PVT region.
std::vector<std::array<double, BlackoilPhases::MaxNumPhases> > surfaceDensity_;
// VAPPARS
double vap1_;
double vap2_;
std::vector<double> satOilMax_;
double vap_satmax_guard_; //Threshold value to promote stability
std::shared_ptr<GasPvt> gasPvt_;
std::shared_ptr<OilPvt> oilPvt_;
std::shared_ptr<WaterPvt> waterPvt_;
};
} // namespace Opm
-26
View File
@@ -1,26 +0,0 @@
/*
Copyright 2013 SINTEF ICT, Applied Mathematics.
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/>.
*/
#include "config.h"
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
Opm::BlackoilPropsAdInterface::~BlackoilPropsAdInterface()
{
}
-263
View File
@@ -1,263 +0,0 @@
/*
Copyright 2013 SINTEF ICT, Applied Mathematics.
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_BLACKOILPROPSADINTERFACE_HEADER_INCLUDED
#define OPM_BLACKOILPROPSADINTERFACE_HEADER_INCLUDED
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/BlackoilModelEnums.hpp>
namespace Opm
{
/// This class is intended to present a fluid interface for
/// three-phase black-oil that is easy to use with the AD-using
/// simulators.
///
/// Most methods are available in two overloaded versions, one
/// taking a constant vector and returning the same, and one
/// taking an AD type and returning the same. Derivatives are not
/// returned separately by any method, only implicitly with the AD
/// version of the methods.
class BlackoilPropsAdInterface
{
public:
/// Virtual destructor for inheritance.
virtual ~BlackoilPropsAdInterface();
////////////////////////////
// Rock interface //
////////////////////////////
/// \return D, the number of spatial dimensions.
virtual int numDimensions() const = 0;
/// \return N, the number of cells.
virtual int numCells() const = 0;
/// \return Array of N porosity values.
virtual const double* porosity() const = 0;
/// \return Array of ND^2 permeability values.
/// The D^2 permeability values for a cell are organized as a matrix,
/// which is symmetric (so ordering does not matter).
virtual const double* permeability() const = 0;
////////////////////////////
// Fluid interface //
////////////////////////////
typedef AutoDiffBlock<double> ADB;
typedef ADB::V V;
typedef ADB::M M;
typedef std::vector<int> Cells;
/// \return Number of active phases (also the number of components).
virtual int numPhases() const = 0;
/// \return Object describing the active phases.
virtual PhaseUsage phaseUsage() const = 0;
// ------ Density ------
/// Densities of stock components at surface conditions.
/// \param[in] phaseIdx
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n density values for phase given by phaseIdx.
virtual V surfaceDensity(const int PhaseIdx, const Cells& cells) const = 0;
// ------ Viscosity ------
/// Water viscosity.
/// \param[in] pw Array of n water pressure values.
/// \param[in] T Array of n temperature values.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n viscosity values.
virtual
ADB muWat(const ADB& pw,
const ADB& T,
const Cells& cells) const = 0;
/// Oil viscosity.
/// \param[in] po Array of n oil pressure values.
/// \param[in] T Array of n temperature values.
/// \param[in] rs Array of n gas solution factor values.
/// \param[in] cond Array of n objects, each specifying which phases are present with non-zero saturation in a cell.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n viscosity values.
virtual
ADB muOil(const ADB& po,
const ADB& T,
const ADB& rs,
const std::vector<PhasePresence>& cond,
const Cells& cells) const = 0;
/// Gas viscosity.
/// \param[in] pg Array of n gas pressure values.
/// \param[in] T Array of n temperature values.
/// \param[in] rv Array of n vapor oil/gas ratios.
/// \param[in] cond Array of n objects, each specifying which phases are present with non-zero saturation in a cell.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n viscosity values.
virtual
ADB muGas(const ADB& pg,
const ADB& T,
const ADB& rv,
const std::vector<PhasePresence>& cond,
const Cells& cells) const = 0;
// ------ Formation volume factor (b) ------
/// Water formation volume factor.
/// \param[in] pw Array of n water pressure values.
/// \param[in] T Array of n temperature values.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n formation volume factor values.
virtual
ADB bWat(const ADB& pw,
const ADB& T,
const Cells& cells) const = 0;
/// Oil formation volume factor.
/// \param[in] po Array of n oil pressure values.
/// \param[in] T Array of n temperature values.
/// \param[in] rs Array of n gas solution factor values.
/// \param[in] cond Array of n objects, each specifying which phases are present with non-zero saturation in a cell.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n formation volume factor values.
virtual
ADB bOil(const ADB& po,
const ADB& T,
const ADB& rs,
const std::vector<PhasePresence>& cond,
const Cells& cells) const = 0;
/// Gas formation volume factor.
/// \param[in] pg Array of n gas pressure values.
/// \param[in] T Array of n temperature values.
/// \param[in] rv Array of n vapor oil/gas ratios.
/// \param[in] cond Array of n objects, each specifying which phases are present with non-zero saturation in a cell.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n formation volume factor values.
virtual
ADB bGas(const ADB& pg,
const ADB& T,
const ADB& rv,
const std::vector<PhasePresence>& cond,
const Cells& cells) const = 0;
// ------ Rs bubble point curve ------
/// Bubble point curve for Rs as function of oil pressure.
/// \param[in] po Array of n oil pressure values.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n bubble point values for Rs.
virtual
ADB rsSat(const ADB& po,
const Cells& cells) const = 0;
/// Bubble point curve for Rs as function of oil pressure.
/// \param[in] po Array of n oil pressure values.
/// \param[in] so Array of n oil saturation values.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n bubble point values for Rs.
virtual
ADB rsSat(const ADB& po,
const ADB& so,
const Cells& cells) const = 0;
// ------ Rv condensation curve ------
/// Condensation curve for Rv as function of oil pressure.
/// \param[in] po Array of n oil pressure values.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n condensation point values for Rv.
virtual
ADB rvSat(const ADB& po,
const Cells& cells) const = 0;
/// Condensation curve for Rv as function of oil pressure.
/// \param[in] po Array of n oil pressure values.
/// \param[in] so Array of n oil saturation values.
/// \param[in] cells Array of n cell indices to be associated with the pressure values.
/// \return Array of n condensation point values for Rv.
virtual
ADB rvSat(const ADB& po,
const ADB& so,
const Cells& cells) const = 0;
// ------ Relative permeability ------
/// Relative permeabilities for all phases.
/// \param[in] sw Array of n water saturation values.
/// \param[in] so Array of n oil saturation values.
/// \param[in] sg Array of n gas saturation values.
/// \param[in] cells Array of n cell indices to be associated with the saturation values.
/// \return An std::vector with 3 elements, each an array of n relperm values,
/// containing krw, kro, krg. Use PhaseIndex for indexing into the result.
virtual
std::vector<ADB> relperm(const ADB& sw,
const ADB& so,
const ADB& sg,
const Cells& cells) const = 0;
/// Capillary pressure for all phases.
/// \param[in] sw Array of n water saturation values.
/// \param[in] so Array of n oil saturation values.
/// \param[in] sg Array of n gas saturation values.
/// \param[in] cells Array of n cell indices to be associated with the saturation values.
/// \return An std::vector with 3 elements, each an array of n capillary pressure values,
/// containing the offsets for each p_g, p_o, p_w. The capillary pressure between
/// two arbitrary phases alpha and beta is then given as p_alpha - p_beta.
virtual
std::vector<ADB> capPress(const ADB& sw,
const ADB& so,
const ADB& sg,
const Cells& cells) const = 0;
/// Saturation update for hysteresis behavior.
/// \param[in] cells Array of n cell indices to be associated with the saturation values.
virtual
void updateSatHyst(const std::vector<double>& saturation,
const std::vector<int>& cells) = 0;
/// Update for max oil saturation.
virtual
void updateSatOilMax(const std::vector<double>& saturation) = 0;
/// Obtain the scaled critical oil in gas saturation values.
/// \param[in] cells Array of cell indices.
/// \return Array of critical oil in gas saturaion values.
virtual
V scaledCriticalOilinGasSaturations(const Cells& cells) const = 0;
/// Obtain the scaled critical gas saturation values.
/// \param[in] cells Array of cell indices.
/// \return Array of scaled critical gas saturaion values.
virtual
V scaledCriticalGasSaturations(const Cells& cells) const = 0;
};
} // namespace Opm
#endif // OPM_BLACKOILPROPSADINTERFACE_HEADER_INCLUDED
+1 -1
View File
@@ -74,7 +74,7 @@ namespace Opm {
/// \param[in] terminal_output request output to cout/cerr
BlackoilSequentialModel(const ModelParameters& param,
const Grid& grid ,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo ,
const RockCompressibility* rock_comp_props,
const WellModel well_model,
+1 -1
View File
@@ -67,7 +67,7 @@ namespace Opm {
/// \param[in] is_miscible turn on miscible feature
BlackoilSolventModel(const typename Base::ModelParameters& param,
const Grid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo,
const RockCompressibility* rock_comp_props,
const SolventPropsAdFromDeck& solvent_props,
+2 -2
View File
@@ -25,7 +25,7 @@
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/GridHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/WellDensitySegmented.hpp>
@@ -72,7 +72,7 @@ namespace Opm {
template <class Grid>
BlackoilSolventModel<Grid>::BlackoilSolventModel(const typename Base::ModelParameters& param,
const Grid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo,
const RockCompressibility* rock_comp_props,
const SolventPropsAdFromDeck& solvent_props,
+1 -1
View File
@@ -59,7 +59,7 @@ namespace Opm {
/// \param[in] terminal_output request output to cout/cerr
BlackoilTransportModel(const typename Base::ModelParameters& param,
const Grid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo,
const RockCompressibility* rock_comp_props,
const StandardWells& std_wells,
-1
View File
@@ -30,7 +30,6 @@
#include <opm/autodiff/NewtonIterationBlackoilCPR.hpp>
#include <opm/autodiff/NewtonIterationBlackoilInterleaved.hpp>
#include <opm/autodiff/MissingFeatures.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/moduleVersion.hpp>
#include <opm/autodiff/ExtractParallelGridInformationToISTL.hpp>
+1 -1
View File
@@ -144,7 +144,7 @@ namespace {
ImpesTPFAAD::ImpesTPFAAD(const UnstructuredGrid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo,
const Wells& wells,
const LinearSolverInterface& linsolver)
+3 -3
View File
@@ -24,7 +24,7 @@
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/BlackoilModelEnums.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
struct UnstructuredGrid;
struct Wells;
@@ -46,7 +46,7 @@ namespace Opm {
public:
/// Construct impes solver.
ImpesTPFAAD(const UnstructuredGrid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo,
const Wells& wells,
const LinearSolverInterface& linsolver);
@@ -77,7 +77,7 @@ namespace Opm {
// Data
const UnstructuredGrid& grid_;
const BlackoilPropsAdInterface& fluid_;
const BlackoilPropsAdFromDeck& fluid_;
const DerivedGeology& geo_ ;
const Wells& wells_;
const LinearSolverInterface& linsolver_;
+1 -1
View File
@@ -223,7 +223,7 @@ namespace Opm {
void
MultisegmentWells::init(const BlackoilPropsAdInterface* fluid_arg,
MultisegmentWells::init(const BlackoilPropsAdFromDeck* fluid_arg,
const std::vector<bool>* active_arg,
const std::vector<PhasePresence>* pc_arg,
const VFPProperties* vfp_properties_arg,
+3 -3
View File
@@ -37,7 +37,7 @@
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/BlackoilModelEnums.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/LinearisedBlackoilResidual.hpp>
#include <opm/autodiff/WellHelpers.hpp>
#include <opm/autodiff/VFPProperties.hpp>
@@ -98,7 +98,7 @@ namespace Opm {
const std::vector< const Well* >& wells_ecl,
const int time_step);
void init(const BlackoilPropsAdInterface* fluid_arg,
void init(const BlackoilPropsAdFromDeck* fluid_arg,
const std::vector<bool>* active_arg,
const std::vector<PhasePresence>* pc_arg,
const VFPProperties* vfp_properties_arg,
@@ -261,7 +261,7 @@ namespace Opm {
// TODO: they should be split eventually.
const Wells* wells_;
const BlackoilPropsAdInterface* fluid_;
const BlackoilPropsAdFromDeck* fluid_;
const std::vector<bool>* active_;
const std::vector<PhasePresence>* phase_condition_;
const VFPProperties* vfp_properties_;
+54 -91
View File
@@ -21,15 +21,13 @@
#ifndef OPM_RATECONVERTER_HPP_HEADER_INCLUDED
#define OPM_RATECONVERTER_HPP_HEADER_INCLUDED
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/core/props/BlackoilPhases.hpp>
#include <opm/core/simulator/BlackoilState.hpp>
#include <opm/core/utility/RegionMapping.hpp>
#include <opm/core/linalg/ParallelIstlInformation.hpp>
#include <Eigen/Core>
#include <algorithm>
#include <cmath>
#include <memory>
@@ -385,9 +383,7 @@ namespace Opm {
* The conversion uses fluid properties evaluated at average
* hydrocarbon pressure in regions or field.
*
* \tparam Property Fluid property object. Expected to
* feature the formation volume factor functions of the
* BlackoilPropsAdInterface.
* \tparam FluidSystem Fluid system class. Expected to be a BlackOilFluidSystem
*
* \tparam Region Type of a forward region mapping. Expected
* to provide indexed access through \code operator[]()
@@ -395,24 +391,29 @@ namespace Opm {
* size_type, and \c const_iterator. Typically \code
* std::vector<int> \endcode.
*/
template <class Property, class Region>
template <class FluidSystem, class Region>
class SurfaceToReservoirVoidage {
public:
/**
* Constructor.
*
* \param[in] props Fluid property object.
*
* \param[in] region Forward region mapping. Often
* corresponds to the "FIPNUM" mapping of an ECLIPSE input
* deck.
*/
SurfaceToReservoirVoidage(const Property& props,
SurfaceToReservoirVoidage(const PhaseUsage& phaseUsage,
const int* cellPvtRegionIdx,
const int numCells,
const Region& region)
: props_(props)
: phaseUsage_(phaseUsage)
, rmap_ (region)
, attr_ (rmap_, Attributes(props_.numPhases()))
{}
, attr_ (rmap_, Attributes(phaseUsage_.num_phases))
{
cellPvtIdx_.resize(numCells, 0);
if (cellPvtRegionIdx) {
std::copy_n(cellPvtRegionIdx, numCells, cellPvtIdx_.begin());
}
}
/**
* Compute average hydrocarbon pressure and maximum
@@ -484,59 +485,58 @@ namespace Opm {
void
calcCoeff(const Input& in, const RegionId r, Coeff& coeff) const
{
using V = typename Property::V;
const auto& pu = props_.phaseUsage();
const auto& pu = phaseUsage_;
const auto& ra = attr_.attributes(r);
const auto p = this->constant(ra.pressure);
const auto T = this->constant(ra.temperature);
const auto c = this->getRegCell(r);
const double p = ra.pressure;
const double T = ra.temperature;
const int cellIdx = attr_.cell(r);
const int pvtRegionIdx = cellPvtIdx_[cellIdx];
const int iw = Details::PhasePos::water(pu);
const int io = Details::PhasePos::oil (pu);
const int ig = Details::PhasePos::gas (pu);
std::fill(& coeff[0], & coeff[0] + props_.numPhases(), 0.0);
std::fill(& coeff[0], & coeff[0] + phaseUsage_.num_phases, 0.0);
if (Details::PhaseUsed::water(pu)) {
// q[w]_r = q[w]_s / bw
const V bw = props_.bWat(p, T, c).value();
const double bw = FluidSystem::waterPvt().inverseFormationVolumeFactor(pvtRegionIdx, T, p);
coeff[iw] = 1.0 / bw(0);
coeff[iw] = 1.0 / bw;
}
const Miscibility& m = calcMiscibility(in, r);
// Determinant of 'R' matrix
const double detR = 1.0 - (m.rs(0) * m.rv(0));
const double detR = 1.0 - (m.rs * m.rv);
if (Details::PhaseUsed::oil(pu)) {
// q[o]_r = 1/(bo * (1 - rs*rv)) * (q[o]_s - rv*q[g]_s)
const auto rs = this->constant(m.rs);
const V bo = props_.bOil(p, T, rs, m.cond, c).value();
const double den = bo(0) * detR;
const double Rs = m.rs;
const double bo = FluidSystem::oilPvt().inverseFormationVolumeFactor(pvtRegionIdx, T, p, Rs);
const double den = bo * detR;
coeff[io] += 1.0 / den;
if (Details::PhaseUsed::gas(pu)) {
coeff[ig] -= m.rv(0) / den;
coeff[ig] -= m.rv / den;
}
}
if (Details::PhaseUsed::gas(pu)) {
// q[g]_r = 1/(bg * (1 - rs*rv)) * (q[g]_s - rs*q[o]_s)
const auto rv = this->constant(m.rv);
const V bg = props_.bGas(p, T, rv, m.cond, c).value();
const double den = bg(0) * detR;
const double Rv = m.rv;
const double bg = FluidSystem::gasPvt().inverseFormationVolumeFactor(pvtRegionIdx, T, p, Rv);
const double den = bg * detR;
coeff[ig] += 1.0 / den;
if (Details::PhaseUsed::oil(pu)) {
coeff[io] -= m.rs(0) / den;
coeff[io] -= m.rs / den;
}
}
}
@@ -545,7 +545,8 @@ namespace Opm {
/**
* Fluid property object.
*/
const Property& props_;
const PhaseUsage phaseUsage_;
std::vector<int> cellPvtIdx_;
/**
* "Fluid-in-place" region mapping (forward and reverse).
@@ -559,12 +560,12 @@ namespace Opm {
Attributes(const int np)
: pressure (0.0)
, temperature(0.0)
, Rmax (Eigen::ArrayXd::Zero(np, 1))
, Rmax(np, 0.0)
{}
double pressure;
double temperature;
Eigen::ArrayXd Rmax;
std::vector<double> Rmax;
};
Details::RegionAttributes<RegionId, Attributes> attr_;
@@ -580,8 +581,8 @@ namespace Opm {
, rv (1)
, cond(1)
{
rs << 0.0;
rv << 0.0;
rs = 0.0;
rv = 0.0;
}
/**
@@ -591,7 +592,7 @@ namespace Opm {
* Limited by "RSmax" at average hydrocarbon pressure
* in region.
*/
typename Property::V rs;
double rs;
/**
* Evaporated oil-gas ratio at particular component oil
@@ -600,7 +601,7 @@ namespace Opm {
* Limited by "RVmax" at average hydrocarbon pressure
* in region.
*/
typename Property::V rv;
double rv;
/**
* Fluid condition in representative region cell.
@@ -674,14 +675,13 @@ namespace Opm {
void
calcRmax()
{
const PhaseUsage& pu = props_.phaseUsage();
const PhaseUsage& pu = phaseUsage_;
if (Details::PhaseUsed::oil(pu) &&
Details::PhaseUsed::gas(pu))
{
const Eigen::ArrayXd::Index
io = Details::PhasePos::oil(pu),
ig = Details::PhasePos::gas(pu);
const int io = Details::PhasePos::oil(pu);
const int ig = Details::PhasePos::gas(pu);
// Note: Intentionally does not take capillary
// pressure into account. This facility uses the
@@ -691,13 +691,14 @@ namespace Opm {
for (const auto& reg : rmap_.activeRegions()) {
auto& ra = attr_.attributes(reg);
const auto c = this->getRegCell(reg);
const auto p = this->constant(ra.pressure);
const auto T = this->constant(ra.temperature);
const double T = ra.temperature;
const double p = ra.pressure;
const int cellIdx = attr_.cell(reg);
const int pvtRegionIdx = cellPvtIdx_[cellIdx];
auto& Rmax = ra.Rmax;
Rmax.row(io) = props_.rsSat(p, T, c).value();
Rmax.row(ig) = props_.rvSat(p, T, c).value();
std::vector<double>& Rmax = ra.Rmax;
Rmax[io] = FluidSystem::oilPvt().saturatedGasDissolutionFactor(pvtRegionIdx, T, p);
Rmax[ig] = FluidSystem::gasPvt().saturatedOilVaporizationFactor(pvtRegionIdx, T, p);
}
}
}
@@ -723,7 +724,7 @@ namespace Opm {
Miscibility
calcMiscibility(const Input& in, const RegionId r) const
{
const auto& pu = props_.phaseUsage();
const auto& pu = phaseUsage_;
const auto& attr = attr_.attributes(r);
const int io = Details::PhasePos::oil(pu);
@@ -740,7 +741,7 @@ namespace Opm {
cond.setFreeOil();
if (Details::PhaseUsed::gas(pu)) {
const double rsmax = attr.Rmax(io);
const double rsmax = attr.Rmax[io];
const double rs =
(0.0 < std::abs(in[io]))
? in[ig] / in[io]
@@ -750,7 +751,7 @@ namespace Opm {
cond.setFreeGas();
}
m.rs(0) = std::min(rs, rsmax);
m.rs = std::min(rs, rsmax);
}
}
@@ -761,56 +762,18 @@ namespace Opm {
}
if (Details::PhaseUsed::oil(pu)) {
const double rvmax = attr.Rmax(ig);
const double rvmax = attr.Rmax[ig];
const double rv =
(0.0 < std::abs(in[ig]))
? (in[io] / in[ig])
: (0.0 < std::abs(in[io])) ? rvmax : 0.0;
m.rv(0) = std::min(rv, rvmax);
m.rv = std::min(rv, rvmax);
}
}
return m;
}
/**
* Conversion from \code Property::V \endcode to (constant)
* \code Property::ADB \endcode (zero derivatives).
*/
typename Property::ADB
constant(const typename Property::V& x) const
{
return Property::ADB::constant(x);
}
/**
* Conversion from \c double to (constant) \code Property::ADB
* \endcode (zero derivatives).
*/
typename Property::ADB
constant(const double x) const
{
typename Property::V y(1);
y << x;
return this->constant(y);
}
/**
* Retrieve representative cell of region
*
* \param[in] r Particular region.
*
* \return Representative cell of region \c r.
*/
typename Property::Cells
getRegCell(const RegionId r) const
{
typename Property::Cells c(1, this->attr_.cell(r));
return c;
}
};
} // namespace RateConverter
} // namespace Opm
+4 -4
View File
@@ -30,7 +30,7 @@
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/BlackoilModel.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
#include <opm/autodiff/RateConverter.hpp>
@@ -124,7 +124,7 @@ namespace Opm
SimulatorBase(const parameter::ParameterGroup& param,
const Grid& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity,
@@ -189,7 +189,7 @@ namespace Opm
// Data.
typedef RateConverter::
SurfaceToReservoirVoidage< BlackoilPropsAdInterface,
SurfaceToReservoirVoidage< BlackoilPropsAdFromDeck::FluidSystem,
std::vector<int> > RateConverterType;
typedef typename Traits::Model Model;
typedef typename Model::ModelParameters ModelParameters;
@@ -201,7 +201,7 @@ namespace Opm
// Observed objects.
const Grid& grid_;
BlackoilPropsAdInterface& props_;
BlackoilPropsAdFromDeck& props_;
const RockCompressibility* rock_comp_props_;
const double* gravity_;
// Solvers
+2 -2
View File
@@ -36,7 +36,7 @@ namespace Opm
SimulatorBase<Implementation>::SimulatorBase(const parameter::ParameterGroup& param,
const Grid& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity,
@@ -60,7 +60,7 @@ namespace Opm
terminal_output_(param.getDefault("output_terminal", true)),
eclipse_state_(eclipse_state),
output_writer_(output_writer),
rateConverter_(props_, std::vector<int>(AutoDiffGrid::numCells(grid_), 0)),
rateConverter_(props_.phaseUsage(), props.cellPvtRegionIndex(), AutoDiffGrid::numCells(grid_), std::vector<int>(AutoDiffGrid::numCells(grid_), 0)),
threshold_pressures_by_face_(threshold_pressures_by_face),
is_parallel_run_( false ),
defunct_well_names_(defunct_well_names)
@@ -54,7 +54,7 @@ public:
SimulatorFullyImplicitBlackoil(const parameter::ParameterGroup& param,
const typename Base::Grid& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity,
@@ -94,7 +94,7 @@ public:
SimulatorFullyImplicitBlackoilEbos(Simulator& ebosSimulator,
const parameter::ParameterGroup& param,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity,
const bool has_disgas,
@@ -117,15 +117,11 @@ public:
defunct_well_names_( defunct_well_names ),
is_parallel_run_( false )
{
DUNE_UNUSED_PARAMETER(eclState);
// Misc init.
const int num_cells = AutoDiffGrid::numCells(grid());
allcells_.resize(num_cells);
for (int cell = 0; cell < num_cells; ++cell) {
allcells_[cell] = cell;
}
rateConverter_.reset(new RateConverterType(props_, std::vector<int>(AutoDiffGrid::numCells(grid()), 0)));
extractLegacyCellPvtRegionIndex_();
rateConverter_.reset(new RateConverterType(props.phaseUsage(),
legacyCellPvtRegionIdx_.data(),
AutoDiffGrid::numCells(grid()),
std::vector<int>(AutoDiffGrid::numCells(grid()), 0)));
#if HAVE_MPI
if ( solver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
@@ -708,15 +704,24 @@ protected:
const EclipseState& eclState() const
{ return ebosSimulator_.gridManager().eclState(); }
EclipseState& eclState()
{ return ebosSimulator_.gridManager().eclState(); }
void extractLegacyCellPvtRegionIndex_()
{
const auto& grid = ebosSimulator_.gridManager().grid();
const auto& eclProblem = ebosSimulator_.problem();
const unsigned numCells = grid.size(/*codim=*/0);
legacyCellPvtRegionIdx_.resize(numCells);
for (unsigned cellIdx = 0; cellIdx < numCells; ++cellIdx) {
legacyCellPvtRegionIdx_[cellIdx] =
eclProblem.pvtRegionIndex(cellIdx);
}
}
// Data.
Simulator& ebosSimulator_;
typedef RateConverter::
SurfaceToReservoirVoidage< BlackoilPropsAdInterface,
std::vector<int> > RateConverterType;
std::vector<int> legacyCellPvtRegionIdx_;
typedef RateConverter::SurfaceToReservoirVoidage<FluidSystem, std::vector<int> > RateConverterType;
typedef typename Solver::SolverParameters SolverParameters;
const parameter::ParameterGroup param_;
@@ -724,7 +729,7 @@ protected:
SolverParameters solver_param_;
// Observed objects.
BlackoilPropsAdInterface& props_;
BlackoilPropsAdFromDeck& props_;
const double* gravity_;
// Solvers
DerivedGeology& geo_;
@@ -65,7 +65,7 @@ public:
SimulatorFullyImplicitBlackoilMultiSegment(const parameter::ParameterGroup& param,
const GridT& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity,
@@ -29,7 +29,7 @@
#include <opm/common/ErrorMacros.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/SolventPropsAdFromDeck.hpp>
#include <opm/autodiff/RateConverter.hpp>
#include <opm/autodiff/NonlinearSolver.hpp>
@@ -111,7 +111,7 @@ namespace Opm
SimulatorFullyImplicitBlackoilSolvent(const parameter::ParameterGroup& param,
const GridT& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const SolventPropsAdFromDeck& solvent_props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
@@ -27,7 +27,7 @@ namespace Opm
SimulatorFullyImplicitBlackoilSolvent(const parameter::ParameterGroup& param,
const GridT& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const SolventPropsAdFromDeck& solvent_props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
+1 -1
View File
@@ -55,7 +55,7 @@ public:
SimulatorSequentialBlackoil(const parameter::ParameterGroup& param,
const typename Base::Grid& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity,
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef SOLVENTPROPSADFROMDECK_HPP
#define SOLVENTPROPSADFROMDECK_HPP
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/core/utility/NonuniformTableLinear.hpp>
+3 -3
View File
@@ -41,7 +41,7 @@
#include <opm/core/wells/WellCollection.hpp>
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/simulators/WellSwitchingLogger.hpp>
namespace Opm {
@@ -73,7 +73,7 @@ namespace Opm {
// --------- Public methods ---------
StandardWells(const Wells* wells_arg, WellCollection* well_collection);
void init(const BlackoilPropsAdInterface* fluid_arg,
void init(const BlackoilPropsAdFromDeck* fluid_arg,
const std::vector<bool>* active_arg,
const std::vector<PhasePresence>* pc_arg,
const VFPProperties* vfp_properties_arg,
@@ -210,7 +210,7 @@ namespace Opm {
// By default, they should all be one.
Vector well_perforation_efficiency_factors_;
const BlackoilPropsAdInterface* fluid_;
const BlackoilPropsAdFromDeck* fluid_;
const std::vector<bool>* active_;
const std::vector<PhasePresence>* phase_condition_;
const VFPProperties* vfp_properties_;
+3 -3
View File
@@ -36,12 +36,12 @@
#include <opm/core/wells.h>
#include <opm/core/wells/DynamicListEconLimited.hpp>
#include <opm/autodiff/VFPProperties.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/VFPInjProperties.hpp>
#include <opm/autodiff/VFPProdProperties.hpp>
#include <opm/autodiff/WellHelpers.hpp>
#include <opm/autodiff/BlackoilModelEnums.hpp>
#include <opm/autodiff/WellDensitySegmented.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/BlackoilDetails.hpp>
#include <opm/autodiff/BlackoilModelParameters.hpp>
#include <opm/autodiff/LinearisedBlackoilResidual.hpp>
@@ -104,7 +104,7 @@ enum WellVariablePositions {
}
}
void init(const BlackoilPropsAdInterface* fluid_arg,
void init(const BlackoilPropsAdFromDeck* fluid_arg,
const std::vector<bool>* active_arg,
const VFPProperties* vfp_properties_arg,
const double gravity_arg,
@@ -1483,7 +1483,7 @@ enum WellVariablePositions {
ModelParameters param_;
bool terminal_output_;
const BlackoilPropsAdInterface* fluid_;
const BlackoilPropsAdFromDeck* fluid_;
const std::vector<bool>* active_;
const VFPProperties* vfp_properties_;
double gravity_;
+1 -1
View File
@@ -92,7 +92,7 @@ namespace Opm
void
StandardWells::init(const BlackoilPropsAdInterface* fluid_arg,
StandardWells::init(const BlackoilPropsAdFromDeck* fluid_arg,
const std::vector<bool>* active_arg,
const std::vector<PhasePresence>* pc_arg,
const VFPProperties* vfp_properties_arg,
@@ -76,7 +76,7 @@ namespace Opm {
/// \param[in] terminal_output request output to cout/cerr
BlackoilPolymerModel(const typename Base::ModelParameters& param,
const Grid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo,
const RockCompressibility* rock_comp_props,
const PolymerPropsAd& polymer_props_ad,
@@ -29,7 +29,7 @@
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/GridHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/WellDensitySegmented.hpp>
@@ -76,7 +76,7 @@ namespace Opm {
template <class Grid>
BlackoilPolymerModel<Grid>::BlackoilPolymerModel(const typename Base::ModelParameters& param,
const Grid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo,
const RockCompressibility* rock_comp_props,
const PolymerPropsAd& polymer_props_ad,
@@ -25,7 +25,7 @@
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
@@ -167,7 +167,7 @@ namespace {
FullyImplicitCompressiblePolymerSolver::
FullyImplicitCompressiblePolymerSolver(const UnstructuredGrid& grid,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo ,
const RockCompressibility* rock_comp_props,
const PolymerPropsAd& polymer_props_ad,
@@ -111,7 +111,7 @@ namespace Opm {
/// \param[in] wells well structure
/// \param[in] linsolver linear solver
FullyImplicitCompressiblePolymerSolver(const UnstructuredGrid& grid ,
const BlackoilPropsAdInterface& fluid,
const BlackoilPropsAdFromDeck& fluid,
const DerivedGeology& geo ,
const RockCompressibility* rock_comp_props,
const PolymerPropsAd& polymer_props_ad,
@@ -185,7 +185,7 @@ namespace Opm {
// Member data
const UnstructuredGrid& grid_;
const BlackoilPropsAdInterface& fluid_;
const BlackoilPropsAdFromDeck& fluid_;
const DerivedGeology& geo_;
const RockCompressibility* rock_comp_props_;
const PolymerPropsAd& polymer_props_ad_;
@@ -32,7 +32,7 @@
#include <opm/common/ErrorMacros.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/RateConverter.hpp>
#include <opm/autodiff/NonlinearSolver.hpp>
@@ -111,7 +111,7 @@ namespace Opm
SimulatorFullyImplicitBlackoilPolymer(const parameter::ParameterGroup& param,
const GridT& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const PolymerPropsAd& polymer_props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
@@ -26,7 +26,7 @@ namespace Opm
SimulatorFullyImplicitBlackoilPolymer(const parameter::ParameterGroup& param,
const GridT& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const PolymerPropsAd& polymer_props,
const RockCompressibility* rock_comp_props,
NewtonIterationBlackoilInterface& linsolver,
@@ -25,7 +25,7 @@
#include <opm/common/ErrorMacros.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
#include <opm/autodiff/SimulatorBase.hpp>
@@ -103,7 +103,7 @@ namespace Opm
SimulatorFullyImplicitCompressiblePolymer(const parameter::ParameterGroup& param,
const GridT& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const PolymerPropsAd& polymer_props,
const RockCompressibility* rock_comp_props,
std::shared_ptr<EclipseState> eclipse_state,
@@ -29,7 +29,7 @@ SimulatorFullyImplicitCompressiblePolymer<GridT>::
SimulatorFullyImplicitCompressiblePolymer(const parameter::ParameterGroup& param,
const GridT& grid,
DerivedGeology& geo,
BlackoilPropsAdInterface& props,
BlackoilPropsAdFromDeck& props,
const PolymerPropsAd& polymer_props,
const RockCompressibility* rock_comp_props,
std::shared_ptr<EclipseState> eclipse_state,
+7 -5
View File
@@ -87,10 +87,11 @@ BOOST_FIXTURE_TEST_CASE(Construction, TestFixture<SetupSimple>)
typedef std::vector<int> Region;
typedef Opm::BlackoilPropsAdFromDeck Props;
typedef Opm::RateConverter::
SurfaceToReservoirVoidage<Props, Region> RCvrt;
SurfaceToReservoirVoidage<Props::FluidSystem, Region> RCvrt;
Region reg{ 0 };
RCvrt cvrt(ad_props, reg);
int numCells = Opm::UgGridHelpers::numCells(*grid.c_grid());
RCvrt cvrt(ad_props.phaseUsage(), ad_props.cellPvtRegionIndex(), numCells, reg);
}
@@ -100,12 +101,13 @@ BOOST_FIXTURE_TEST_CASE(ThreePhase, TestFixture<SetupSimple>)
typedef std::vector<int> Region;
typedef Opm::BlackoilPropsAdFromDeck Props;
typedef Opm::RateConverter::
SurfaceToReservoirVoidage<Props, Region> RCvrt;
SurfaceToReservoirVoidage<Props::FluidSystem, Region> RCvrt;
Region reg{ 0 };
RCvrt cvrt(ad_props, reg);
int numCells = Opm::UgGridHelpers::numCells(*grid.c_grid());
RCvrt cvrt(ad_props.phaseUsage(), ad_props.cellPvtRegionIndex(), numCells, reg);
Opm::BlackoilState x( Opm::UgGridHelpers::numCells( *grid.c_grid()) , Opm::UgGridHelpers::numFaces( *grid.c_grid()) , 3);
Opm::BlackoilState x(numCells, Opm::UgGridHelpers::numFaces( *grid.c_grid()) , 3);
cvrt.defineState(x);