Add WellConnections() overload which uses FieldPropsManager
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
namespace Opm {
|
||||
class EclipseGrid;
|
||||
class Eclipse3DProperties;
|
||||
class FieldPropsManager;
|
||||
class WellConnections {
|
||||
public:
|
||||
|
||||
@@ -48,6 +49,7 @@ namespace Opm {
|
||||
const double segDistEnd= 0.0,
|
||||
const bool defaultSatTabId = true);
|
||||
void loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties);
|
||||
void loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const FieldPropsManager& field_properties);
|
||||
|
||||
using const_iterator = std::vector< Connection >::const_iterator;
|
||||
|
||||
@@ -100,9 +102,9 @@ namespace Opm {
|
||||
void loadCOMPDAT(const DeckRecord& record,
|
||||
const EclipseGrid& grid,
|
||||
const std::vector<int>& satnum_data,
|
||||
const std::vector<double>& permx,
|
||||
const std::vector<double>& permy,
|
||||
const std::vector<double>& permz,
|
||||
const std::vector<double>* permx,
|
||||
const std::vector<double>* permy,
|
||||
const std::vector<double>* permz,
|
||||
const std::vector<double>& ntg);
|
||||
|
||||
size_t findClosestConnection(int oi, int oj, double oz, size_t start_pos);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/Units/Units.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
|
||||
@@ -191,6 +192,16 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction
|
||||
defaultSatTabId);
|
||||
}
|
||||
|
||||
void WellConnections::loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const FieldPropsManager& field_properties) {
|
||||
const auto permx = field_properties.try_get<double>("PERMX");
|
||||
const auto permy = field_properties.try_get<double>("PERMY");
|
||||
const auto permz = field_properties.try_get<double>("PERMZ");
|
||||
const auto& ntg = field_properties.get<double>("NTG");
|
||||
const auto& satnum_data = field_properties.get<int>("SATNUM");
|
||||
|
||||
this->loadCOMPDAT(record, grid, satnum_data, permx, permy, permz, ntg);
|
||||
}
|
||||
|
||||
void WellConnections::loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties) {
|
||||
const auto& permx = eclipseProperties.getDoubleGridProperty("PERMX").compressedCopy(grid);
|
||||
const auto& permy = eclipseProperties.getDoubleGridProperty("PERMY").compressedCopy(grid);
|
||||
@@ -198,15 +209,15 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction
|
||||
const auto& ntg = eclipseProperties.getDoubleGridProperty("NTG").compressedCopy(grid);
|
||||
const auto& satnum_data = eclipseProperties.getIntGridProperty("SATNUM").compressedCopy(grid);
|
||||
|
||||
this->loadCOMPDAT(record, grid, satnum_data, permx, permy, permz, ntg);
|
||||
this->loadCOMPDAT(record, grid, satnum_data, std::addressof(permx), std::addressof(permy), std::addressof(permz), ntg);
|
||||
}
|
||||
|
||||
void WellConnections::loadCOMPDAT(const DeckRecord& record,
|
||||
const EclipseGrid& grid,
|
||||
const std::vector<int>& satnum_data,
|
||||
const std::vector<double>& permx,
|
||||
const std::vector<double>& permy,
|
||||
const std::vector<double>& permz,
|
||||
const std::vector<double>* permx,
|
||||
const std::vector<double>* permy,
|
||||
const std::vector<double>* permz,
|
||||
const std::vector<double>& ntg) {
|
||||
|
||||
const auto& itemI = record.getItem( "I" );
|
||||
@@ -274,11 +285,13 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction
|
||||
goto CF_done;
|
||||
|
||||
/* We must calculate CF and Kh from the items in the COMPDAT record and cell properties. */
|
||||
{
|
||||
if (permx && permy && permz) {
|
||||
// Angle of completion exposed to flow. We assume centre
|
||||
// placement so there's complete exposure (= 2\pi).
|
||||
const double angle = 6.2831853071795864769252867665590057683943387987502116419498;
|
||||
std::array<double,3> cell_perm = {{ permx[active_index], permy[active_index], permz[active_index]}};
|
||||
std::array<double,3> cell_perm = {{ permx->operator[](active_index),
|
||||
permy->operator[](active_index),
|
||||
permz->operator[](active_index)}};
|
||||
std::array<double,3> cell_size = grid.getCellDims(I,J,k);
|
||||
const auto& K = permComponents(direction, cell_perm);
|
||||
const auto& D = effectiveExtent(direction, ntg[active_index], cell_size);
|
||||
@@ -300,7 +313,8 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction
|
||||
Kh = std::sqrt(K[0] * K[1]) * D[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
throw std::invalid_argument("Missing PERM values to calculate connection factors");
|
||||
|
||||
|
||||
CF_done:
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
@@ -148,12 +149,16 @@ Opm::WellConnections loadCOMPDAT(const std::string& compdat_keyword) {
|
||||
Opm::Parser parser;
|
||||
const auto deck = parser.parseString(compdat_keyword);
|
||||
Opm::Eclipse3DProperties props(deck, tables, grid );
|
||||
Opm::FieldPropsManager field_props(deck, grid);
|
||||
const auto& keyword = deck.getKeyword("COMPDAT", 0);
|
||||
Opm::WellConnections connections(10,10);
|
||||
for (const auto& rec : keyword)
|
||||
connections.loadCOMPDAT(rec, grid, props);
|
||||
|
||||
return connections;
|
||||
Opm::WellConnections connections1(10,10);
|
||||
Opm::WellConnections connections2(10,10);
|
||||
for (const auto& rec : keyword) {
|
||||
connections1.loadCOMPDAT(rec, grid, props);
|
||||
connections2.loadCOMPDAT(rec, grid, field_props);
|
||||
}
|
||||
BOOST_CHECK_EQUAL( connections1, connections2);
|
||||
return connections1;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(loadCOMPDATTEST) {
|
||||
|
||||
Reference in New Issue
Block a user