mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
simplifying the constructor for AquiferNumerical
removing the unused global_cell and avoid the unnecessary construction of cartesianToCompressed
This commit is contained in:
parent
6afb386070
commit
d69c80b84a
@ -61,13 +61,10 @@ public:
|
|||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
AquiferNumerical(const SingleNumericalAquifer& aquifer,
|
AquiferNumerical(const SingleNumericalAquifer& aquifer,
|
||||||
const std::unordered_map<int, int>& cartesian_to_compressed,
|
const Simulator& ebos_simulator)
|
||||||
const Simulator& ebos_simulator,
|
|
||||||
const int* global_cell)
|
|
||||||
: AquiferInterface<TypeTag>(aquifer.id(), ebos_simulator)
|
: AquiferInterface<TypeTag>(aquifer.id(), ebos_simulator)
|
||||||
, flux_rate_ (0.0)
|
, flux_rate_ (0.0)
|
||||||
, cumulative_flux_(0.0)
|
, cumulative_flux_(0.0)
|
||||||
, global_cell_ (global_cell)
|
|
||||||
, init_pressure_ (aquifer.numCells(), 0.0)
|
, init_pressure_ (aquifer.numCells(), 0.0)
|
||||||
{
|
{
|
||||||
this->cell_to_aquifer_cell_idx_.resize(this->ebos_simulator_.gridView().size(/*codim=*/0), -1);
|
this->cell_to_aquifer_cell_idx_.resize(this->ebos_simulator_.gridView().size(/*codim=*/0), -1);
|
||||||
@ -77,9 +74,9 @@ public:
|
|||||||
const auto* cell = aquifer.getCellPrt(idx);
|
const auto* cell = aquifer.getCellPrt(idx);
|
||||||
|
|
||||||
// Due to parallelisation, the cell might not exist in the current process
|
// Due to parallelisation, the cell might not exist in the current process
|
||||||
auto search = cartesian_to_compressed.find(cell->global_index);
|
const int compressed_idx = ebos_simulator.vanguard().compressedIndexForInterior(cell->global_index);
|
||||||
if (search != cartesian_to_compressed.end()) {
|
if (compressed_idx >= 0) {
|
||||||
this->cell_to_aquifer_cell_idx_[search->second] = idx;
|
this->cell_to_aquifer_cell_idx_[compressed_idx] = idx;
|
||||||
aquifer_on_process = true;
|
aquifer_on_process = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,7 +298,6 @@ private:
|
|||||||
|
|
||||||
double flux_rate_; // aquifer influx rate
|
double flux_rate_; // aquifer influx rate
|
||||||
double cumulative_flux_; // cumulative aquifer influx
|
double cumulative_flux_; // cumulative aquifer influx
|
||||||
const int* global_cell_; // mapping to global index
|
|
||||||
std::vector<double> init_pressure_{};
|
std::vector<double> init_pressure_{};
|
||||||
double pressure_; // aquifer pressure
|
double pressure_; // aquifer pressure
|
||||||
bool solution_set_from_restart_ {false};
|
bool solution_set_from_restart_ {false};
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <opm/grid/utility/cartesianToCompressed.hpp>
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -157,15 +155,8 @@ BlackoilAquiferModel<TypeTag>::init()
|
|||||||
|
|
||||||
if (aquifer.hasNumericalAquifer()) {
|
if (aquifer.hasNumericalAquifer()) {
|
||||||
const auto& num_aquifers = aquifer.numericalAquifers().aquifers();
|
const auto& num_aquifers = aquifer.numericalAquifers().aquifers();
|
||||||
const int number_of_cells = simulator_.gridView().size(0);
|
|
||||||
const int* global_cell = this->simulator_.vanguard().globalCell().data();
|
|
||||||
const std::unordered_map<int, int> cartesian_to_compressed = cartesianToCompressed(number_of_cells,
|
|
||||||
global_cell);
|
|
||||||
for ([[maybe_unused]]const auto& [id, aqu] : num_aquifers) {
|
for ([[maybe_unused]]const auto& [id, aqu] : num_aquifers) {
|
||||||
auto aqf = std::make_unique<AquiferNumerical<TypeTag>>(aqu,
|
auto aqf = std::make_unique<AquiferNumerical<TypeTag>>(aqu, this->simulator_);
|
||||||
cartesian_to_compressed,
|
|
||||||
this->simulator_,
|
|
||||||
global_cell);
|
|
||||||
aquifers.push_back(std::move(aqf));
|
aquifers.push_back(std::move(aqf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user