creating AquiferHelpers
to make function neighborCellInsideReservoirAndActive more reusable.
This commit is contained in:
parent
de0615e251
commit
13c38b7eb9
@ -59,6 +59,7 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/Aquifer/AquiferCT.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Aquifer/Aquifetp.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Aquifer/Aquancon.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Aquifer/AquiferHelpers.cpp
|
||||
src/opm/parser/eclipse/EclipseState/checkDeck.cpp
|
||||
src/opm/parser/eclipse/EclipseState/EclipseConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/EclipseState.cpp
|
||||
|
@ -97,10 +97,6 @@ namespace Opm {
|
||||
}
|
||||
|
||||
private:
|
||||
static bool cellInsideReservoirAndActive(const EclipseGrid& grid, int i, int j, int k);
|
||||
static bool neighborCellInsideReservoirAndActive(const EclipseGrid& grid, int i, int j, int k, FaceDir::DirEnum faceDir);
|
||||
|
||||
|
||||
std::unordered_map<int, std::vector<Aquancon::AquancCell>> cells;
|
||||
};
|
||||
}
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <iterator>
|
||||
#include <iostream>
|
||||
|
||||
#include "AquiferHelpers.hpp"
|
||||
|
||||
namespace Opm {
|
||||
|
||||
namespace{
|
||||
@ -84,7 +86,7 @@ namespace Opm {
|
||||
for (int i = i1; i <= i2; i++) {
|
||||
if (grid.cellActive(i, j, k)) { // the cell itself needs to be active
|
||||
if (allow_aquifer_inside_reservoir
|
||||
|| !neighborCellInsideReservoirAndActive(grid, i, j, k, faceDir)) {
|
||||
|| !AquiferHelpers::neighborCellInsideReservoirAndActive(grid, i, j, k, faceDir)) {
|
||||
std::pair<bool, double> influx_coeff = std::make_pair(false, 0);
|
||||
auto global_index = grid.getGlobalIndex(i, j, k);
|
||||
if (aquanconRecord.getItem("INFLUX_COEFF").hasValue(0))
|
||||
@ -122,42 +124,6 @@ namespace Opm {
|
||||
return this->cells.at( aquiferID );
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Aquancon::cellInsideReservoirAndActive(const Opm::EclipseGrid& grid, const int i, const int j, const int k)
|
||||
{
|
||||
if ( i < 0 || j < 0 || k < 0
|
||||
|| size_t(i) > grid.getNX() - 1
|
||||
|| size_t(j) > grid.getNY() - 1
|
||||
|| size_t(k) > grid.getNZ() - 1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return grid.cellActive(i, j, k );
|
||||
}
|
||||
|
||||
bool Aquancon::neighborCellInsideReservoirAndActive(const Opm::EclipseGrid& grid,
|
||||
const int i, const int j, const int k, const Opm::FaceDir::DirEnum faceDir)
|
||||
{
|
||||
switch(faceDir) {
|
||||
case FaceDir::XMinus:
|
||||
return cellInsideReservoirAndActive(grid, i - 1, j, k);
|
||||
case FaceDir::XPlus:
|
||||
return cellInsideReservoirAndActive(grid, i + 1, j, k);
|
||||
case FaceDir::YMinus:
|
||||
return cellInsideReservoirAndActive(grid, i, j - 1, k);
|
||||
case FaceDir::YPlus:
|
||||
return cellInsideReservoirAndActive(grid, i, j + 1, k);
|
||||
case FaceDir::ZMinus:
|
||||
return cellInsideReservoirAndActive(grid, i, j, k - 1);
|
||||
case FaceDir::ZPlus:
|
||||
return cellInsideReservoirAndActive(grid, i, j, k + 1);
|
||||
default:
|
||||
throw std::runtime_error("Unknown FaceDir enum " + std::to_string(faceDir));
|
||||
}
|
||||
}
|
||||
|
||||
Aquancon::Aquancon(const std::unordered_map<int, std::vector<Aquancon::AquancCell>>& data) :
|
||||
cells(data)
|
||||
{}
|
||||
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright (C) 2020 SINTEF Digital
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include "AquiferHelpers.hpp"
|
||||
|
||||
namespace Opm::AquiferHelpers {
|
||||
bool cellInsideReservoirAndActive(const Opm::EclipseGrid& grid, const int i, const int j, const int k)
|
||||
{
|
||||
if ( i < 0 || j < 0 || k < 0
|
||||
|| size_t(i) > grid.getNX() - 1
|
||||
|| size_t(j) > grid.getNY() - 1
|
||||
|| size_t(k) > grid.getNZ() - 1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return grid.cellActive(i, j, k );
|
||||
}
|
||||
|
||||
bool neighborCellInsideReservoirAndActive(const Opm::EclipseGrid& grid,
|
||||
const int i, const int j, const int k,
|
||||
const FaceDir::DirEnum faceDir)
|
||||
{
|
||||
switch(faceDir) {
|
||||
case FaceDir::XMinus:
|
||||
return cellInsideReservoirAndActive(grid, i - 1, j, k);
|
||||
case FaceDir::XPlus:
|
||||
return cellInsideReservoirAndActive(grid, i + 1, j, k);
|
||||
case FaceDir::YMinus:
|
||||
return cellInsideReservoirAndActive(grid, i, j - 1, k);
|
||||
case FaceDir::YPlus:
|
||||
return cellInsideReservoirAndActive(grid, i, j + 1, k);
|
||||
case FaceDir::ZMinus:
|
||||
return cellInsideReservoirAndActive(grid, i, j, k - 1);
|
||||
case FaceDir::ZPlus:
|
||||
return cellInsideReservoirAndActive(grid, i, j, k + 1);
|
||||
default:
|
||||
throw std::runtime_error("Unknown FaceDir enum " + std::to_string(faceDir));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright (C) 2020 SINTEF Digital
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef OPM_AQUIFERHELPERS_HPP
|
||||
#define OPM_AQUIFERHELPERS_HPP
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class EclipseGrid;
|
||||
namespace AquiferHelpers {
|
||||
bool neighborCellInsideReservoirAndActive(const EclipseGrid &grid, int i, int j, int k, FaceDir::DirEnum faceDir);
|
||||
}
|
||||
}
|
||||
|
||||
#endif //OPM_AQUIFERHELPERS_HPP
|
Loading…
Reference in New Issue
Block a user