mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #4726 from blattms/increase-supported-equil-regions
Increase supported equil regions from 255 to 65525
This commit is contained in:
commit
8c428caa80
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <limits>
|
||||
#include <ebos/eclgenericthresholdpressure.hh>
|
||||
|
||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||
@ -98,8 +99,8 @@ thresholdPressure(int elem1Idx, int elem2Idx) const
|
||||
}
|
||||
|
||||
// threshold pressure accross EQUIL regions
|
||||
unsigned short equilRegion1Idx = elemEquilRegion_[elem1Idx];
|
||||
unsigned short equilRegion2Idx = elemEquilRegion_[elem2Idx];
|
||||
auto equilRegion1Idx = elemEquilRegion_[elem1Idx];
|
||||
auto equilRegion2Idx = elemEquilRegion_[elem2Idx];
|
||||
|
||||
if (equilRegion1Idx == equilRegion2Idx)
|
||||
return 0.0;
|
||||
@ -120,10 +121,25 @@ finishInit()
|
||||
return;
|
||||
|
||||
numEquilRegions_ = eclState_.getTableManager().getEqldims().getNumEquilRegions();
|
||||
if (numEquilRegions_ > 0xff) {
|
||||
// make sure that the index of an equilibration region can be stored in a
|
||||
// single byte
|
||||
throw std::runtime_error("The maximum number of supported equilibration regions is 255!");
|
||||
const decltype(numEquilRegions_) maxRegions =
|
||||
std::numeric_limits<std::decay_t<decltype(elemEquilRegion_[0])>>::max();
|
||||
|
||||
if (numEquilRegions_ > maxRegions) {
|
||||
// make sure that the index of an equilibration region can be stored
|
||||
// in the vector
|
||||
OPM_THROW(std::invalid_argument,
|
||||
(fmt::format("The maximum number of supported "
|
||||
"equilibration regions by OPM flow is {}, but "
|
||||
"{} are used!",
|
||||
maxRegions, numEquilRegions_)));
|
||||
}
|
||||
|
||||
if (numEquilRegions_ > 2048) {
|
||||
// warn about performance
|
||||
OpmLog::warning(fmt::format("Number of equilibration regions is {}, which is "
|
||||
"rather large. Note, that this might "
|
||||
"have a negative impact on performance "
|
||||
"and memory consumption.", numEquilRegions_));
|
||||
}
|
||||
|
||||
// internalize the data specified using the EQLNUM keyword
|
||||
@ -169,8 +185,8 @@ applyExplicitThresholdPressures_()
|
||||
unsigned insideElemIdx = elementMapper_.index(inside);
|
||||
unsigned outsideElemIdx = elementMapper_.index(outside);
|
||||
|
||||
unsigned equilRegionInside = elemEquilRegion_[insideElemIdx];
|
||||
unsigned equilRegionOutside = elemEquilRegion_[outsideElemIdx];
|
||||
auto equilRegionInside = elemEquilRegion_[insideElemIdx];
|
||||
auto equilRegionOutside = elemEquilRegion_[outsideElemIdx];
|
||||
if (thpres.hasRegionBarrier(equilRegionInside + 1, equilRegionOutside + 1)) {
|
||||
Scalar pth = 0.0;
|
||||
if (thpres.hasThresholdPressure(equilRegionInside + 1, equilRegionOutside + 1)) {
|
||||
|
@ -97,7 +97,7 @@ protected:
|
||||
std::vector<Scalar> thpresDefault_;
|
||||
std::vector<Scalar> thpres_;
|
||||
unsigned numEquilRegions_{};
|
||||
std::vector<unsigned char> elemEquilRegion_;
|
||||
std::vector<unsigned short> elemEquilRegion_;
|
||||
|
||||
// threshold pressure accross faults. EXPERIMENTAL!
|
||||
std::vector<Scalar> thpresftValues_;
|
||||
|
Loading…
Reference in New Issue
Block a user