mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fixing grid_index for AquiferCarterTracy
adding the mapping from cartisian indices to the actual grid indices.
This commit is contained in:
parent
bec18a5d91
commit
3a55e4aac2
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@ -64,9 +65,11 @@ namespace Opm
|
|||||||
|
|
||||||
AquiferCarterTracy( const AquiferCT::AQUCT_data& aquct_data,
|
AquiferCarterTracy( const AquiferCT::AQUCT_data& aquct_data,
|
||||||
const Aquancon::AquanconOutput& connection,
|
const Aquancon::AquanconOutput& connection,
|
||||||
|
const std::unordered_map<int, int>& cartesian_to_compressed,
|
||||||
const Simulator& ebosSimulator)
|
const Simulator& ebosSimulator)
|
||||||
: ebos_simulator_ (ebosSimulator)
|
: ebos_simulator_ (ebosSimulator)
|
||||||
, aquct_data_ (aquct_data)
|
, aquct_data_ (aquct_data)
|
||||||
|
, cartesian_to_compressed_(cartesian_to_compressed)
|
||||||
, connection_(connection)
|
, connection_(connection)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -149,6 +152,7 @@ namespace Opm
|
|||||||
|
|
||||||
Eval W_flux_;
|
Eval W_flux_;
|
||||||
|
|
||||||
|
const std::unordered_map<int, int>& cartesian_to_compressed_;
|
||||||
|
|
||||||
Scalar gravity_() const
|
Scalar gravity_() const
|
||||||
{ return ebos_simulator_.problem().gravity()[2]; }
|
{ return ebos_simulator_.problem().gravity()[2]; }
|
||||||
@ -279,7 +283,6 @@ namespace Opm
|
|||||||
cell_depth_.resize(cell_idx_.size(), aquct_data_.d0);
|
cell_depth_.resize(cell_idx_.size(), aquct_data_.d0);
|
||||||
alphai_.resize(cell_idx_.size(), 1.0);
|
alphai_.resize(cell_idx_.size(), 1.0);
|
||||||
faceArea_connected_.resize(cell_idx_.size(),0.0);
|
faceArea_connected_.resize(cell_idx_.size(),0.0);
|
||||||
Scalar faceArea;
|
|
||||||
|
|
||||||
auto cell2Faces = Opm::UgGridHelpers::cell2Faces(ugrid);
|
auto cell2Faces = Opm::UgGridHelpers::cell2Faces(ugrid);
|
||||||
auto faceCells = Opm::UgGridHelpers::faceCells(ugrid);
|
auto faceCells = Opm::UgGridHelpers::faceCells(ugrid);
|
||||||
@ -294,7 +297,8 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
cellToConnectionIdx_[cell_idx_[idx]] = idx;
|
cellToConnectionIdx_[cell_idx_[idx]] = idx;
|
||||||
|
|
||||||
auto cellFacesRange = cell2Faces[cell_idx_.at(idx)];
|
const int cell_index = cartesian_to_compressed_.at(cell_idx_[idx]);
|
||||||
|
auto cellFacesRange = cell2Faces[cell_index];
|
||||||
for(auto cellFaceIter = cellFacesRange.begin(); cellFaceIter != cellFacesRange.end(); ++cellFaceIter)
|
for(auto cellFaceIter = cellFacesRange.begin(); cellFaceIter != cellFacesRange.end(); ++cellFaceIter)
|
||||||
{
|
{
|
||||||
// The index of the face in the compressed grid
|
// The index of the face in the compressed grid
|
||||||
|
@ -71,6 +71,9 @@ namespace Opm {
|
|||||||
|
|
||||||
Simulator& simulator_;
|
Simulator& simulator_;
|
||||||
|
|
||||||
|
// map from logically cartesian cell indices to compressed ones
|
||||||
|
std::unordered_map<int, int> cartesian_to_compressed_;
|
||||||
|
|
||||||
// This initialization function is used to connect the parser objects with the ones needed by AquiferCarterTracy
|
// This initialization function is used to connect the parser objects with the ones needed by AquiferCarterTracy
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <opm/grid/utility/cartesianToCompressed.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
|
|
||||||
@ -92,13 +94,23 @@ namespace Opm {
|
|||||||
|
|
||||||
assert( aquifersData.size() == aquifer_connection.size() );
|
assert( aquifersData.size() == aquifer_connection.size() );
|
||||||
|
|
||||||
|
// generate the mapping from Cartesian coordinates to the index in the actual grid
|
||||||
|
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)
|
for (size_t i = 0; i < aquifersData.size(); ++i)
|
||||||
{
|
{
|
||||||
aquifers_.push_back(
|
aquifers_.push_back(
|
||||||
AquiferCarterTracy<TypeTag> (aquifersData.at(i), aquifer_connection.at(i), this->simulator_)
|
AquiferCarterTracy<TypeTag> (aquifersData.at(i),
|
||||||
|
aquifer_connection.at(i), cartesian_to_compressed_, this->simulator_)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
|
Loading…
Reference in New Issue
Block a user