mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use &ref not shared_pointer to MaterialLawManager
This commit is contained in:
parent
51f48fcd13
commit
0ef82665f5
@ -148,8 +148,8 @@ try
|
||||
/*gasPhaseIdx=*/Opm::BlackoilPhases::Vapour> MaterialTraits;
|
||||
typedef Opm::EclMaterialLawManager<MaterialTraits> MaterialLawManager;
|
||||
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManager = MaterialLawManager();
|
||||
materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
// Initialisation.
|
||||
//initBlackoilSurfvolUsingRSorRV(UgGridHelpers::numCells(grid), props, state);
|
||||
|
@ -568,7 +568,7 @@ namespace Opm
|
||||
template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
|
||||
struct PcEq
|
||||
{
|
||||
PcEq(std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
PcEq(const MaterialLawManager& materialLawManager,
|
||||
const int phase,
|
||||
const int cell,
|
||||
const double target_pc)
|
||||
@ -587,7 +587,7 @@ namespace Opm
|
||||
|
||||
double operator()(double s) const
|
||||
{
|
||||
const auto& matParams = materialLawManager_->materialLawParams(cell_);
|
||||
const auto& matParams = materialLawManager_.materialLawParams(cell_);
|
||||
fluidState_.setSaturation(phase_, s);
|
||||
MaterialLaw::capillaryPressures(pc_, matParams, fluidState_);
|
||||
double sign = (phase_ == FluidSystem::waterPhaseIdx)? -1.0 : 1.0;
|
||||
@ -596,7 +596,7 @@ namespace Opm
|
||||
}
|
||||
private:
|
||||
|
||||
std::shared_ptr<MaterialLawManager> materialLawManager_;
|
||||
const MaterialLawManager& materialLawManager_;
|
||||
const int phase_;
|
||||
const int cell_;
|
||||
const double target_pc_;
|
||||
@ -605,9 +605,9 @@ namespace Opm
|
||||
};
|
||||
|
||||
template <class FluidSystem, class MaterialLawManager>
|
||||
double minSaturations(std::shared_ptr<MaterialLawManager> materialLawManager, const int phase, const int cell) {
|
||||
double minSaturations(const MaterialLawManager& materialLawManager, const int phase, const int cell) {
|
||||
const auto& scaledDrainageInfo =
|
||||
materialLawManager->oilWaterScaledEpsInfoDrainage(cell);
|
||||
materialLawManager.oilWaterScaledEpsInfoDrainage(cell);
|
||||
|
||||
// Find minimum and maximum saturations.
|
||||
switch(phase) {
|
||||
@ -632,9 +632,9 @@ namespace Opm
|
||||
}
|
||||
|
||||
template <class FluidSystem, class MaterialLawManager>
|
||||
double maxSaturations(std::shared_ptr<MaterialLawManager> materialLawManager, const int phase, const int cell) {
|
||||
double maxSaturations(const MaterialLawManager& materialLawManager, const int phase, const int cell) {
|
||||
const auto& scaledDrainageInfo =
|
||||
materialLawManager->oilWaterScaledEpsInfoDrainage(cell);
|
||||
materialLawManager.oilWaterScaledEpsInfoDrainage(cell);
|
||||
|
||||
// Find minimum and maximum saturations.
|
||||
switch(phase) {
|
||||
@ -664,7 +664,7 @@ namespace Opm
|
||||
/// Compute saturation of some phase corresponding to a given
|
||||
/// capillary pressure.
|
||||
template <class FluidSystem, class MaterialLaw, class MaterialLawManager >
|
||||
inline double satFromPc(std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
inline double satFromPc(const MaterialLawManager& materialLawManager,
|
||||
const int phase,
|
||||
const int cell,
|
||||
const double target_pc,
|
||||
@ -700,7 +700,7 @@ namespace Opm
|
||||
template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
|
||||
struct PcEqSum
|
||||
{
|
||||
PcEqSum(std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
PcEqSum(const MaterialLawManager& materialLawManager,
|
||||
const int phase1,
|
||||
const int phase2,
|
||||
const int cell,
|
||||
@ -718,7 +718,7 @@ namespace Opm
|
||||
}
|
||||
double operator()(double s) const
|
||||
{
|
||||
const auto& matParams = materialLawManager_->materialLawParams(cell_);
|
||||
const auto& matParams = materialLawManager_.materialLawParams(cell_);
|
||||
fluidState_.setSaturation(phase1_, s);
|
||||
fluidState_.setSaturation(phase2_, 1.0 - s);
|
||||
|
||||
@ -731,7 +731,7 @@ namespace Opm
|
||||
return pc1 + pc2 - target_pc_;
|
||||
}
|
||||
private:
|
||||
std::shared_ptr<MaterialLawManager> materialLawManager_;
|
||||
const MaterialLawManager& materialLawManager_;
|
||||
const int phase1_;
|
||||
const int phase2_;
|
||||
const int cell_;
|
||||
@ -748,7 +748,7 @@ namespace Opm
|
||||
/// is given as a sum of two other functions.
|
||||
|
||||
template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
|
||||
inline double satFromSumOfPcs(std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
inline double satFromSumOfPcs(const MaterialLawManager& materialLawManager,
|
||||
const int phase1,
|
||||
const int phase2,
|
||||
const int cell,
|
||||
@ -778,7 +778,7 @@ namespace Opm
|
||||
|
||||
/// Compute saturation from depth. Used for constant capillary pressure function
|
||||
template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
|
||||
inline double satFromDepth(std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
inline double satFromDepth(const MaterialLawManager& materialLawManager,
|
||||
const double cellDepth,
|
||||
const double contactDepth,
|
||||
const int phase,
|
||||
@ -798,7 +798,7 @@ namespace Opm
|
||||
|
||||
/// Return true if capillary pressure function is constant
|
||||
template <class FluidSystem, class MaterialLaw, class MaterialLawManager>
|
||||
inline bool isConstPc(std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
inline bool isConstPc(const MaterialLawManager& materialLawManager,
|
||||
const int phase,
|
||||
const int cell)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ namespace Opm
|
||||
phaseSaturations(const Grid& grid,
|
||||
const Region& reg,
|
||||
const CellRange& cells,
|
||||
std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
MaterialLawManager& materialLawManager,
|
||||
const std::vector<double> swat_init,
|
||||
std::vector< std::vector<double> >& phase_pressures);
|
||||
|
||||
@ -226,7 +226,7 @@ namespace Opm
|
||||
class InitialStateComputer {
|
||||
public:
|
||||
template<class MaterialLawManager, class Grid>
|
||||
InitialStateComputer(std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
InitialStateComputer(MaterialLawManager& materialLawManager,
|
||||
const Opm::EclipseState& eclipseState,
|
||||
const Grid& G ,
|
||||
const double grav = unit::gravity,
|
||||
@ -386,7 +386,7 @@ namespace Opm
|
||||
void
|
||||
calcPressSatRsRv(const RMap& reg ,
|
||||
const std::vector< EquilRecord >& rec ,
|
||||
std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
MaterialLawManager& materialLawManager,
|
||||
const Grid& G ,
|
||||
const double grav)
|
||||
{
|
||||
|
@ -597,7 +597,7 @@ namespace Opm
|
||||
phaseSaturations(const Grid& G,
|
||||
const Region& reg,
|
||||
const CellRange& cells,
|
||||
std::shared_ptr<MaterialLawManager> materialLawManager,
|
||||
MaterialLawManager& materialLawManager,
|
||||
const std::vector<double> swat_init,
|
||||
std::vector< std::vector<double> >& phase_pressures)
|
||||
{
|
||||
@ -633,8 +633,8 @@ namespace Opm
|
||||
for (typename CellRange::const_iterator ci = cells.begin(); ci != cells.end(); ++ci, ++local_index) {
|
||||
const int cell = *ci;
|
||||
const auto& scaledDrainageInfo =
|
||||
materialLawManager->oilWaterScaledEpsInfoDrainage(cell);
|
||||
const auto& matParams = materialLawManager->materialLawParams(cell);
|
||||
materialLawManager.oilWaterScaledEpsInfoDrainage(cell);
|
||||
const auto& matParams = materialLawManager.materialLawParams(cell);
|
||||
|
||||
// Find saturations from pressure differences by
|
||||
// inverting capillary pressure functions.
|
||||
@ -653,7 +653,7 @@ namespace Opm
|
||||
phase_saturations[waterpos][local_index] = sw;
|
||||
} else { // Scale Pc to reflect imposed sw
|
||||
sw = swat_init[cell];
|
||||
sw = materialLawManager->applySwatinit(cell, pcov, sw);
|
||||
sw = materialLawManager.applySwatinit(cell, pcov, sw);
|
||||
phase_saturations[waterpos][local_index] = sw;
|
||||
}
|
||||
}
|
||||
@ -684,7 +684,7 @@ namespace Opm
|
||||
// Re-scale Pc to reflect imposed sw for vanishing oil phase.
|
||||
// This seems consistent with ecl, and fails to honour
|
||||
// swat_init in case of non-trivial gas-oil cap pressure.
|
||||
sw = materialLawManager->applySwatinit(cell, pcgw, sw);
|
||||
sw = materialLawManager.applySwatinit(cell, pcgw, sw);
|
||||
}
|
||||
sw = satFromSumOfPcs<FluidSystem, MaterialLaw, MaterialLawManager>(materialLawManager, waterpos, gaspos, cell, pcgw);
|
||||
sg = 1.0 - sw;
|
||||
|
@ -410,8 +410,8 @@ BOOST_AUTO_TEST_CASE (DeckAllDead)
|
||||
|
||||
std::vector<int> compressedToCartesianIdx
|
||||
= Opm::compressedToCartesian(grid->number_of_cells, grid->global_cell);
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManager = MaterialLawManager();
|
||||
materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
typedef Opm::FluidSystems::BlackOil<double> FluidSystem;
|
||||
|
||||
@ -449,8 +449,8 @@ BOOST_AUTO_TEST_CASE (CapillaryInversion)
|
||||
// Create material law manager.
|
||||
std::vector<int> compressedToCartesianIdx
|
||||
= Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManager = MaterialLawManager();
|
||||
materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
typedef Opm::FluidSystems::BlackOil<double> FluidSystem;
|
||||
typedef MaterialLawManager::MaterialLaw MaterialLaw;
|
||||
@ -515,8 +515,8 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillary)
|
||||
// Create material law manager.
|
||||
std::vector<int> compressedToCartesianIdx
|
||||
= Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManager = MaterialLawManager();
|
||||
materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
typedef Opm::FluidSystems::BlackOil<double> FluidSystem;
|
||||
|
||||
@ -566,8 +566,8 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillaryOverlap)
|
||||
// Create material law manager.
|
||||
std::vector<int> compressedToCartesianIdx
|
||||
= Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManager = MaterialLawManager();
|
||||
materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
typedef Opm::FluidSystems::BlackOil<double> FluidSystem;
|
||||
|
||||
@ -639,8 +639,8 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveOil)
|
||||
// Create material law manager.
|
||||
std::vector<int> compressedToCartesianIdx
|
||||
= Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManager = MaterialLawManager();
|
||||
materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
typedef Opm::FluidSystems::BlackOil<double> FluidSystem;
|
||||
|
||||
@ -727,8 +727,8 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveGas)
|
||||
// Create material law manager.
|
||||
std::vector<int> compressedToCartesianIdx
|
||||
= Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManager = MaterialLawManager();
|
||||
materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
typedef Opm::FluidSystems::BlackOil<double> FluidSystem;
|
||||
|
||||
@ -818,8 +818,8 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
|
||||
// Create material law manager.
|
||||
std::vector<int> compressedToCartesianIdx
|
||||
= Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManager = MaterialLawManager();
|
||||
materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
typedef Opm::FluidSystems::BlackOil<double> FluidSystem;
|
||||
|
||||
@ -930,11 +930,11 @@ BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
|
||||
// Create material law manager.
|
||||
std::vector<int> compressedToCartesianIdx
|
||||
= Opm::compressedToCartesian(grid.number_of_cells, grid.global_cell);
|
||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManager = MaterialLawManager();
|
||||
materialLawManager.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
auto materialLawManagerScaled = std::make_shared<MaterialLawManager>();
|
||||
materialLawManagerScaled->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
MaterialLawManager materialLawManagerScaled = MaterialLawManager();
|
||||
materialLawManagerScaled.initFromDeck(deck, eclipseState, compressedToCartesianIdx);
|
||||
|
||||
// reference saturations
|
||||
const std::vector<double> s[3]{
|
||||
@ -981,7 +981,7 @@ BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
|
||||
fluidState.setSaturation(FluidSystem::waterPhaseIdx, sw);
|
||||
fluidState.setSaturation(FluidSystem::oilPhaseIdx, so);
|
||||
fluidState.setSaturation(FluidSystem::gasPhaseIdx, sg);
|
||||
const auto& matParams = materialLawManager->materialLawParams(c);
|
||||
const auto& matParams = materialLawManager.materialLawParams(c);
|
||||
MaterialLaw::capillaryPressures(pc, matParams, fluidState);
|
||||
pc_original[3*c + 0] = pc[FluidSystem::oilPhaseIdx] - pc[FluidSystem::waterPhaseIdx];
|
||||
pc_original[3*c + 1] = 0.0;
|
||||
@ -1022,7 +1022,7 @@ BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
|
||||
fluidState.setSaturation(FluidSystem::waterPhaseIdx, sw);
|
||||
fluidState.setSaturation(FluidSystem::oilPhaseIdx, so);
|
||||
fluidState.setSaturation(FluidSystem::gasPhaseIdx, sg);
|
||||
const auto& matParams = materialLawManagerScaled->materialLawParams(c);
|
||||
const auto& matParams = materialLawManagerScaled.materialLawParams(c);
|
||||
MaterialLaw::capillaryPressures(pc, matParams, fluidState);
|
||||
pc_scaled[3*c + 0] = pc[FluidSystem::oilPhaseIdx] - pc[FluidSystem::waterPhaseIdx];
|
||||
pc_scaled[3*c + 1] = 0.0;
|
||||
@ -1039,7 +1039,7 @@ BOOST_AUTO_TEST_CASE (DeckWithSwatinit)
|
||||
fluidState.setSaturation(FluidSystem::oilPhaseIdx, so);
|
||||
fluidState.setSaturation(FluidSystem::gasPhaseIdx, sg);
|
||||
|
||||
const auto& matParams = materialLawManager->materialLawParams(c);
|
||||
const auto& matParams = materialLawManager.materialLawParams(c);
|
||||
MaterialLaw::capillaryPressures(pc, matParams, fluidState);
|
||||
pc_unscaled[3*c + 0] = pc[FluidSystem::oilPhaseIdx] - pc[FluidSystem::waterPhaseIdx];
|
||||
pc_unscaled[3*c + 1] = 0.0;
|
||||
|
Loading…
Reference in New Issue
Block a user