mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Cleanup SaturationPropsFromDeck interface.
Unused methods and arguments have been removed, and we avoid including the EclMaterialLawManager in the header. Clients IncompPropertiesFromDeck and BlackoilPropertiesFromDeck have been updated.
This commit is contained in:
parent
530df90a42
commit
d0285c3eb1
@ -19,24 +19,40 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||||
|
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
||||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
|
#include <vector>
|
||||||
|
#include <numeric>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// Construct explicit mapping from active/compressed to logical cartesian
|
||||||
|
// indices, either as given in global_cell or as { 0, 1, 2, ....} if null.
|
||||||
|
std::vector<int> compressedToCartesian(const int num_cells,
|
||||||
|
const int* global_cell)
|
||||||
|
{
|
||||||
|
std::vector<int> retval;
|
||||||
|
if (global_cell) {
|
||||||
|
retval.assign(global_cell, global_cell + num_cells);
|
||||||
|
} else {
|
||||||
|
retval.resize(num_cells);
|
||||||
|
std::iota(retval.begin(), retval.end(), 0);
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
|
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
|
||||||
Opm::EclipseStateConstPtr eclState,
|
Opm::EclipseStateConstPtr eclState,
|
||||||
const UnstructuredGrid& grid,
|
const UnstructuredGrid& grid,
|
||||||
bool init_rock)
|
bool init_rock)
|
||||||
{
|
{
|
||||||
std::vector<int> compressedToCartesianIdx(grid.number_of_cells);
|
std::vector<int> compressedToCartesianIdx
|
||||||
for (int cellIdx = 0; cellIdx < grid.number_of_cells; ++cellIdx) {
|
= compressedToCartesian(grid.number_of_cells, grid.global_cell);
|
||||||
if (grid.global_cell) {
|
|
||||||
compressedToCartesianIdx[cellIdx] = grid.global_cell[cellIdx];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
compressedToCartesianIdx[cellIdx] = cellIdx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||||
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
||||||
@ -51,15 +67,8 @@ namespace Opm
|
|||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
bool init_rock)
|
bool init_rock)
|
||||||
{
|
{
|
||||||
std::vector<int> compressedToCartesianIdx(grid.number_of_cells);
|
std::vector<int> compressedToCartesianIdx
|
||||||
for (int cellIdx = 0; cellIdx < grid.number_of_cells; ++cellIdx) {
|
= compressedToCartesian(grid.number_of_cells, grid.global_cell);
|
||||||
if (grid.global_cell) {
|
|
||||||
compressedToCartesianIdx[cellIdx] = grid.global_cell[cellIdx];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
compressedToCartesianIdx[cellIdx] = cellIdx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||||
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
||||||
@ -74,15 +83,9 @@ namespace Opm
|
|||||||
const int* cart_dims,
|
const int* cart_dims,
|
||||||
bool init_rock)
|
bool init_rock)
|
||||||
{
|
{
|
||||||
std::vector<int> compressedToCartesianIdx(number_of_cells);
|
std::vector<int> compressedToCartesianIdx
|
||||||
for (int cellIdx = 0; cellIdx < number_of_cells; ++cellIdx) {
|
= compressedToCartesian(number_of_cells, global_cell);
|
||||||
if (global_cell) {
|
|
||||||
compressedToCartesianIdx[cellIdx] = global_cell[cellIdx];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
compressedToCartesianIdx[cellIdx] = cellIdx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||||
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
||||||
|
|
||||||
@ -98,15 +101,9 @@ namespace Opm
|
|||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
bool init_rock)
|
bool init_rock)
|
||||||
{
|
{
|
||||||
std::vector<int> compressedToCartesianIdx(number_of_cells);
|
std::vector<int> compressedToCartesianIdx
|
||||||
for (int cellIdx = 0; cellIdx < number_of_cells; ++cellIdx) {
|
= compressedToCartesian(number_of_cells, global_cell);
|
||||||
if (global_cell) {
|
|
||||||
compressedToCartesianIdx[cellIdx] = global_cell[cellIdx];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
compressedToCartesianIdx[cellIdx] = cellIdx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
auto materialLawManager = std::make_shared<MaterialLawManager>();
|
||||||
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
||||||
|
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
#include <opm/core/props/satfunc/SaturationPropsFromDeck.hpp>
|
#include <opm/core/props/satfunc/SaturationPropsFromDeck.hpp>
|
||||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
|
|
||||||
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
|
||||||
|
|
||||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <opm/core/props/IncompPropertiesFromDeck.hpp>
|
#include <opm/core/props/IncompPropertiesFromDeck.hpp>
|
||||||
|
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
||||||
#include <opm/core/utility/Units.hpp>
|
#include <opm/core/utility/Units.hpp>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -45,7 +46,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
|
||||||
|
|
||||||
satprops_.init(deck, eclState, materialLawManager, grid);
|
satprops_.init(deck, materialLawManager);
|
||||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
if (pvt_.numPhases() != satprops_.numPhases()) {
|
||||||
OPM_THROW(std::runtime_error, "IncompPropertiesFromDeck::IncompPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
OPM_THROW(std::runtime_error, "IncompPropertiesFromDeck::IncompPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <opm/core/props/satfunc/SaturationPropsFromDeck.hpp>
|
||||||
|
|
||||||
|
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
||||||
|
|
||||||
#include <opm/core/utility/UniformTableLinear.hpp>
|
#include <opm/core/utility/UniformTableLinear.hpp>
|
||||||
#include <opm/core/utility/NonuniformTableLinear.hpp>
|
#include <opm/core/utility/NonuniformTableLinear.hpp>
|
||||||
#include <opm/core/grid/GridHelpers.hpp>
|
#include <opm/core/grid/GridHelpers.hpp>
|
||||||
@ -30,11 +34,10 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "SaturationPropsFromDeck.hpp"
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
typedef SaturationPropsFromDeck::MaterialLawManager::MaterialLaw MaterialLaw;
|
||||||
|
|
||||||
// ----------- Methods of SaturationPropsFromDeck ---------
|
// ----------- Methods of SaturationPropsFromDeck ---------
|
||||||
|
|
||||||
@ -44,17 +47,6 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize from deck.
|
|
||||||
void SaturationPropsFromDeck::init(Opm::DeckConstPtr deck,
|
|
||||||
Opm::EclipseStateConstPtr eclipseState,
|
|
||||||
std::shared_ptr<MaterialLawManager> materialLawManager,
|
|
||||||
const UnstructuredGrid& grid)
|
|
||||||
{
|
|
||||||
this->init(deck, eclipseState, materialLawManager, grid.number_of_cells,
|
|
||||||
grid.global_cell, grid.cell_centroids,
|
|
||||||
grid.dimensions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Initialize from deck.
|
/// Initialize from deck.
|
||||||
void SaturationPropsFromDeck::init(const PhaseUsage &phaseUsage,
|
void SaturationPropsFromDeck::init(const PhaseUsage &phaseUsage,
|
||||||
std::shared_ptr<MaterialLawManager> materialLawManager)
|
std::shared_ptr<MaterialLawManager> materialLawManager)
|
||||||
|
@ -29,14 +29,20 @@
|
|||||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||||
|
|
||||||
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct UnstructuredGrid;
|
struct UnstructuredGrid;
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declaring the EclMaterialLawManager template.
|
||||||
|
template <class ScalarT, int wettingPhaseIdxV, int nonWettingasPhaseIdxV, int gasPhaseIdxV>
|
||||||
|
class ThreePhaseMaterialTraits;
|
||||||
|
template <class Traits>
|
||||||
|
class EclMaterialLawManager;
|
||||||
|
|
||||||
|
|
||||||
/// Interface to saturation functions from deck.
|
/// Interface to saturation functions from deck.
|
||||||
class SaturationPropsFromDeck : public SaturationPropsInterface
|
class SaturationPropsFromDeck : public SaturationPropsInterface
|
||||||
{
|
{
|
||||||
@ -46,47 +52,22 @@ namespace Opm
|
|||||||
/*nonWettingPhaseIdx=*/BlackoilPhases::Liquid,
|
/*nonWettingPhaseIdx=*/BlackoilPhases::Liquid,
|
||||||
/*gasPhaseIdx=*/BlackoilPhases::Vapour> MaterialTraits;
|
/*gasPhaseIdx=*/BlackoilPhases::Vapour> MaterialTraits;
|
||||||
typedef Opm::EclMaterialLawManager<MaterialTraits> MaterialLawManager;
|
typedef Opm::EclMaterialLawManager<MaterialTraits> MaterialLawManager;
|
||||||
typedef MaterialLawManager::MaterialLaw MaterialLaw;
|
|
||||||
typedef MaterialLawManager::MaterialLawParams MaterialLawParams;
|
|
||||||
|
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
SaturationPropsFromDeck();
|
SaturationPropsFromDeck();
|
||||||
|
|
||||||
/// Initialize from a MaterialLawManager object and a compressed to cartesian cell index map.
|
/// Initialize from a MaterialLawManager object.
|
||||||
|
/// \param[in] phaseUsage Phase configuration
|
||||||
/// \param[in] materialLawManager An initialized MaterialLawManager object
|
/// \param[in] materialLawManager An initialized MaterialLawManager object
|
||||||
void init(const PhaseUsage& phaseUsage,
|
void init(const PhaseUsage& phaseUsage,
|
||||||
std::shared_ptr<MaterialLawManager> materialLawManager);
|
std::shared_ptr<MaterialLawManager> materialLawManager);
|
||||||
|
|
||||||
|
|
||||||
/// Initialize from deck and grid.
|
/// Initialize from deck and MaterialLawManager.
|
||||||
/// \param[in] deck Deck input parser
|
/// \param[in] deck Input deck
|
||||||
/// \param[in] grid Grid to which property object applies, needed for the
|
/// \param[in] materialLawManager An initialized MaterialLawManager object
|
||||||
/// mapping from cell indices (typically from a processed grid)
|
|
||||||
/// to logical cartesian indices consistent with the deck.
|
|
||||||
void init(Opm::DeckConstPtr deck,
|
void init(Opm::DeckConstPtr deck,
|
||||||
Opm::EclipseStateConstPtr eclipseState,
|
std::shared_ptr<MaterialLawManager> materialLawManager)
|
||||||
std::shared_ptr<MaterialLawManager> materialLawManager,
|
|
||||||
const UnstructuredGrid& grid);
|
|
||||||
|
|
||||||
/// Initialize from deck and grid.
|
|
||||||
/// \param[in] deck Deck input parser
|
|
||||||
/// \param[in] number_of_cells The number of cells of the grid to which property
|
|
||||||
/// object applies, needed for the
|
|
||||||
/// mapping from cell indices (typically from a processed
|
|
||||||
/// grid) to logical cartesian indices consistent with the
|
|
||||||
/// deck.
|
|
||||||
/// \param[in] global_cell The mapping from local cell indices of the grid to
|
|
||||||
/// global cell indices used in the deck.
|
|
||||||
/// \param[in] begin_cell_centroids Pointer to the first cell_centroid of the grid.
|
|
||||||
/// \param[in] dimensions The dimensions of the grid.
|
|
||||||
template<class T>
|
|
||||||
void init(Opm::DeckConstPtr deck,
|
|
||||||
Opm::EclipseStateConstPtr eclipseState,
|
|
||||||
std::shared_ptr<MaterialLawManager> materialLawManager,
|
|
||||||
int number_of_cells,
|
|
||||||
const int* global_cell,
|
|
||||||
const T& begin_cell_centroids,
|
|
||||||
int dimensions)
|
|
||||||
{
|
{
|
||||||
init(Opm::phaseUsageFromDeck(deck), materialLawManager);
|
init(Opm::phaseUsageFromDeck(deck), materialLawManager);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user