isolate numerical aquifer cells by setting permeability to zero

instead of editing transmissiblity directly.
This commit is contained in:
Kai Bao
2021-02-03 22:32:29 +01:00
parent fc8ca0566d
commit 8443b991c7
6 changed files with 10 additions and 88 deletions

View File

@@ -41,8 +41,6 @@ namespace Opm {
const std::unordered_map <size_t, SingleNumericalAquifer>& aquifers() const;
bool operator==(const NumericalAquifers& other) const;
std::array<std::set<size_t>, 3> transToRemove(const EclipseGrid& grid) const;
std::unordered_map<size_t, const NumericalAquiferCell*> allAquiferCells() const;
std::vector<NNCdata> aquiferNNCs(const EclipseGrid& grid, const FieldPropsManager& fp) const;
@@ -60,7 +58,6 @@ namespace Opm {
std::unordered_map <size_t, SingleNumericalAquifer> m_aquifers;
void addAquiferCell(const NumericalAquiferCell& aqu_cell);
void addAquiferConnections(const Deck &deck, const EclipseGrid &grid);
};
}

View File

@@ -55,14 +55,8 @@ namespace Opm {
size_t numConnections() const;
const NumericalAquiferCell* getCellPrt(size_t index) const;
// we remove the connection around the aquifer cells to isolate aquifer cells
// from the other part of the reservoir
// the removing of the connection is done by make transmissiblities to be zero
std::array<std::set<size_t>, 3> transToRemove(const EclipseGrid& grid) const;
std::unordered_map<size_t, AquiferCellProps> aquiferCellProps() const;
void appendNNC(const EclipseGrid& grid, const FieldPropsManager& fp, NNC& nnc) const;
std::vector<NNCdata> aquiferNNCs(const EclipseGrid& grid, const FieldPropsManager& fp) const;
bool operator==(const SingleNumericalAquifer& other) const;

View File

@@ -147,17 +147,6 @@ namespace Opm {
return cells;
}
std::array<std::set<size_t>, 3> NumericalAquifers::transToRemove(const EclipseGrid& grid) const {
std::array<std::set<size_t>, 3> trans;
for (const auto& [id, aquifer] : this->m_aquifers) {
auto trans_aquifer = aquifer.transToRemove(grid);
for (size_t i = 0; i < 3; ++i) {
trans[i].merge(trans_aquifer[i]);
}
}
return trans;
}
const std::unordered_map<size_t, SingleNumericalAquifer>& NumericalAquifers::aquifers() const {
return this->m_aquifers;
}

View File

@@ -58,34 +58,6 @@ namespace Opm {
return this->connections_.size();
}
std::array<std::set<size_t>, 3> SingleNumericalAquifer::transToRemove(const EclipseGrid& grid) const {
std::array<std::set<size_t>, 3> trans;
for (const auto& cell : this->cells_) {
const size_t i = cell.I;
const size_t j = cell.J;
const size_t k = cell.K;
if (AquiferHelpers::neighborCellInsideReservoirAndActive(grid, i, j, k, FaceDir::XPlus)) {
trans[0].insert(cell.global_index);
}
if (AquiferHelpers::neighborCellInsideReservoirAndActive(grid, i, j, k, FaceDir::XMinus)) {
trans[0].insert(grid.getGlobalIndex(i-1, j, k));
}
if (AquiferHelpers::neighborCellInsideReservoirAndActive(grid, i, j, k, FaceDir::YPlus)) {
trans[1].insert(cell.global_index);
}
if (AquiferHelpers::neighborCellInsideReservoirAndActive(grid, i, j, k, FaceDir::YMinus)) {
trans[1].insert(grid.getGlobalIndex(i, j-1, k));
}
if (AquiferHelpers::neighborCellInsideReservoirAndActive(grid, i, j, k, FaceDir::ZPlus)) {
trans[2].insert(cell.global_index);
}
if (AquiferHelpers::neighborCellInsideReservoirAndActive(grid, i, j, k, FaceDir::ZMinus)) {
trans[2].insert(grid.getGlobalIndex(i, j, k-1));
}
}
return trans;
}
size_t SingleNumericalAquifer::id() const {
return this->id_;
}

View File

@@ -1218,8 +1218,12 @@ bool FieldProps::tran_active(const std::string& keyword) const {
void FieldProps::apply_numerical_aquifers(const NumericalAquifers& numerical_aquifers) {
auto& porv_data = this->init_get<double>("PORV").data;
auto& poro_data = this->init_get<double>("PORO").data;
auto& satnum_data = this->int_data["SATNUM"].data;
auto& pvtnum_data = this->int_data["PVTNUM"].data;
auto& satnum_data = this->init_get<int>("SATNUM").data;
auto& pvtnum_data = this->init_get<int>("PVTNUM").data;
auto& permx_data = this->init_get<double>("PERMX").data;
auto& permy_data = this->init_get<double>("PERMY").data;
auto& permz_data = this->init_get<double>("PERMZ").data;
const auto& aqu_cell_props = numerical_aquifers.aquiferCellProps();
for (const auto& [global_index, cellprop] : aqu_cell_props) {
@@ -1230,42 +1234,11 @@ void FieldProps::apply_numerical_aquifers(const NumericalAquifers& numerical_aqu
this->cell_depth[active_index] = cellprop.depth;
satnum_data[active_index] = cellprop.satnum;
pvtnum_data[active_index] = cellprop.pvtnum;
}
this->updateTransWithNumericalAquifer(numerical_aquifers);
}
void FieldProps::updateTransWithNumericalAquifer(const NumericalAquifers& numerical_aquifers) {
const std::array<std::set<size_t>, 3> trans_to_remove = numerical_aquifers.transToRemove(*(this->grid_ptr));
std::array<std::vector<Box::cell_index>, 3> index_lists;
for (int i = 0; i < 3; ++i) {
size_t num = 0;
for (const auto& elem : trans_to_remove[i]) {
const size_t active_index = this->grid_ptr->activeIndex(elem);
index_lists[i].emplace_back(elem, active_index, num);
num++;
}
}
const std::array<std::string, 3> trans_string {"TRANX", "TRANY", "TRANZ"};
for (int i = 0; i < 3; ++i) {
const std::string& target_kw = trans_string[i];
const std::vector<Box::cell_index>& single_index_list = index_lists[i];
auto tran_iter = this->tran.find(target_kw);
if (tran_iter == this->tran.end()) {
const std::string msg = trans_string[i] + " TranCalculator could not be found when applying numerical aquifer";
throw std::logic_error(msg);
}
const std::string unique_name = tran_iter->second.next_name();
const auto operation = Fieldprops::ScalarOperation::EQUAL;
tran_iter->second.add_action(operation, unique_name);
const auto kw_info = tran_iter->second.make_kw_info(operation);
auto& field_data = this->init_get<double>(unique_name, kw_info);
// setting the transmissiblity to be zero to remove the connection between specific cells
FieldProps::apply(operation, field_data.data, field_data.value_status, 0.0, single_index_list);
// TODO: not sure when we need the following. If we need, we also need to make a global_index_list;
/* if (field_data.global_data)
FieldProps::apply(operation, *field_data.global_data, *field_data.global_value_status, scalar_value, box.global_index_list()); */
// isolate the numerical aquifer cells by setting permeability to be zero
permx_data[active_index] = 0.;
permy_data[active_index] = 0.;
permz_data[active_index] = 0.;
}
}

View File

@@ -362,9 +362,6 @@ public:
void reset_actnum(const std::vector<int>& actnum);
void apply_numerical_aquifers(const NumericalAquifers& numerical_aquifers);
// set the transmissiblities around the numerical aquifer cells to be zero, so we can isolate them
// from the other reservoir cells
void updateTransWithNumericalAquifer(const NumericalAquifers& numerical_aquifer);
const std::string& default_region() const;