mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fixed: sanity check rock compaction table indices
This commit is contained in:
parent
2529eec715
commit
8e02cea9a1
@ -34,6 +34,7 @@
|
||||
#include <opm/material/common/Tabulated1DFunction.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -332,7 +333,8 @@ protected:
|
||||
Scalar timeStepSize,
|
||||
Scalar endTime);
|
||||
|
||||
void readRockParameters_(const std::vector<Scalar>& cellCenterDepths);
|
||||
void readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
|
||||
std::function<std::array<int,3>(const unsigned)> ijkIndex);
|
||||
void readRockCompactionParameters_();
|
||||
|
||||
void readBlackoilExtentionsInitialConditions_(size_t numDof,
|
||||
|
@ -37,6 +37,9 @@
|
||||
|
||||
#include <boost/date_time.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
@ -148,7 +151,8 @@ briefDescription()
|
||||
|
||||
template<class GridView, class FluidSystem, class Scalar>
|
||||
void EclGenericProblem<GridView,FluidSystem,Scalar>::
|
||||
readRockParameters_(const std::vector<Scalar>& cellCenterDepths)
|
||||
readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
|
||||
std::function<std::array<int,3>(const unsigned)> ijkIndex)
|
||||
{
|
||||
const auto& rock_config = eclState_.getSimulationConfig().rock_config();
|
||||
|
||||
@ -169,6 +173,24 @@ readRockParameters_(const std::vector<Scalar>& cellCenterDepths)
|
||||
const auto& num = eclState_.fieldProps().get_int(rock_config.rocknum_property());
|
||||
for (size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) {
|
||||
rockTableIdx_[elemIdx] = num[elemIdx] - 1;
|
||||
auto fmtError =
|
||||
[&num,elemIdx,&ijkIndex,&rock_config](const char* type, std::size_t size)
|
||||
{
|
||||
return fmt::format("{} table index {} for elem {} read from {}"
|
||||
" is is out of bounds for number of tables {}",
|
||||
type, num[elemIdx], ijkIndex(elemIdx),
|
||||
rock_config.rocknum_property(), size);
|
||||
};
|
||||
if (!rockCompPoroMult_.empty() &&
|
||||
rockTableIdx_[elemIdx] >= rockCompPoroMult_.size()) {
|
||||
throw std::runtime_error(fmtError("Rock compaction",
|
||||
rockCompPoroMult_.size()));
|
||||
}
|
||||
if (!rockCompPoroMultWc_.empty() &&
|
||||
rockTableIdx_[elemIdx] >= rockCompPoroMultWc_.size()) {
|
||||
throw std::runtime_error(fmtError("Rock water compaction",
|
||||
rockCompPoroMultWc_.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,16 @@ public:
|
||||
// deal with DRSDT
|
||||
this->initDRSDT_(this->model().numGridDof(), this->episodeIndex());
|
||||
|
||||
this->readRockParameters_(simulator.vanguard().cellCenterDepths());
|
||||
this->readRockParameters_(simulator.vanguard().cellCenterDepths(),
|
||||
[&simulator](const unsigned idx)
|
||||
{
|
||||
std::array<int,dim> coords;
|
||||
simulator.vanguard().cartesianCoordinate(idx, coords);
|
||||
for (auto& c : coords) {
|
||||
++c;
|
||||
}
|
||||
return coords;
|
||||
});
|
||||
readMaterialParameters_();
|
||||
readThermalParameters_();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user