mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
LookUp Indices in eclgenericproblem
This commit is contained in:
parent
b60eb25285
commit
17c7e2c91f
@ -29,6 +29,7 @@
|
|||||||
#include <dune/grid/common/gridview.hh>
|
#include <dune/grid/common/gridview.hh>
|
||||||
|
|
||||||
#include <opm/grid/CpGrid.hpp>
|
#include <opm/grid/CpGrid.hpp>
|
||||||
|
#include <opm/grid/LookUpData.hh>
|
||||||
|
|
||||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ namespace Opm {
|
|||||||
class Deck;
|
class Deck;
|
||||||
class EclipseState;
|
class EclipseState;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
|
template<typename Grid, typename GridView> class LookUpData;
|
||||||
|
|
||||||
int eclPositionalParameter(Dune::ParameterTree& tree,
|
int eclPositionalParameter(Dune::ParameterTree& tree,
|
||||||
std::set<std::string>& seenParams,
|
std::set<std::string>& seenParams,
|
||||||
@ -268,6 +269,9 @@ public:
|
|||||||
int numPressurePointsEquil() const
|
int numPressurePointsEquil() const
|
||||||
{ return numPressurePointsEquil_; }
|
{ return numPressurePointsEquil_; }
|
||||||
|
|
||||||
|
auto getLookUpData() const
|
||||||
|
{ return lookUpData_; }
|
||||||
|
|
||||||
bool operator==(const EclGenericProblem& rhs) const;
|
bool operator==(const EclGenericProblem& rhs) const;
|
||||||
|
|
||||||
template<class Serializer>
|
template<class Serializer>
|
||||||
@ -371,6 +375,11 @@ protected:
|
|||||||
// equilibration parameters
|
// equilibration parameters
|
||||||
int numPressurePointsEquil_;
|
int numPressurePointsEquil_;
|
||||||
|
|
||||||
|
// To lookup origin cell indices
|
||||||
|
using Grid = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
|
||||||
|
using LookUpData = Opm::LookUpData<Grid,GridView>;
|
||||||
|
const LookUpData lookUpData_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<class T>
|
template<class T>
|
||||||
void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
|
void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
|
||||||
|
@ -89,6 +89,7 @@ EclGenericProblem(const EclipseState& eclState,
|
|||||||
, schedule_(schedule)
|
, schedule_(schedule)
|
||||||
, gridView_(gridView)
|
, gridView_(gridView)
|
||||||
, mixControls_(schedule)
|
, mixControls_(schedule)
|
||||||
|
, lookUpData_(gridView)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,14 +169,15 @@ readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
|
|||||||
rockTableIdx_.resize(numElem);
|
rockTableIdx_.resize(numElem);
|
||||||
const auto& num = eclState_.fieldProps().get_int(rock_config.rocknum_property());
|
const auto& num = eclState_.fieldProps().get_int(rock_config.rocknum_property());
|
||||||
for (std::size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) {
|
for (std::size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) {
|
||||||
rockTableIdx_[elemIdx] = num[elemIdx] - 1;
|
rockTableIdx_[elemIdx] = num[this->lookUpData_.getOriginIndex(elemIdx)] - 1;
|
||||||
auto fmtError =
|
auto fmtError =
|
||||||
[&num,elemIdx,&ijkIndex,&rock_config](const char* type, std::size_t size)
|
[&num,elemIdx,&ijkIndex,&rock_config, this](const char* type, std::size_t size)
|
||||||
{
|
{
|
||||||
return fmt::format("{} table index {} for elem {} read from {}"
|
return fmt::format("{} table index {} for elem {} read from {}"
|
||||||
" is is out of bounds for number of tables {}",
|
" is is out of bounds for number of tables {}",
|
||||||
type, num[elemIdx], ijkIndex(elemIdx),
|
type, num[this->lookUpData_.getOriginIndex(elemIdx)],
|
||||||
rock_config.rocknum_property(), size);
|
ijkIndex(this-> lookUpData_.getOriginIndex(elemIdx)),
|
||||||
|
rock_config.rocknum_property(), size);
|
||||||
};
|
};
|
||||||
if (!rockCompPoroMult_.empty() &&
|
if (!rockCompPoroMult_.empty() &&
|
||||||
rockTableIdx_[elemIdx] >= rockCompPoroMult_.size()) {
|
rockTableIdx_[elemIdx] >= rockCompPoroMult_.size()) {
|
||||||
@ -210,7 +212,8 @@ readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
|
|||||||
if (!rockTableIdx_.empty()) {
|
if (!rockTableIdx_.empty()) {
|
||||||
tableIdx = rockTableIdx_[elemIdx];
|
tableIdx = rockTableIdx_[elemIdx];
|
||||||
}
|
}
|
||||||
overburdenPressure_[elemIdx] = overburdenTables[tableIdx].eval(cellCenterDepths[elemIdx], /*extrapolation=*/true);
|
overburdenPressure_[elemIdx] =
|
||||||
|
overburdenTables[tableIdx].eval(cellCenterDepths[this->lookUpData_.getOriginIndex(elemIdx)], /*extrapolation=*/true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,7 +356,7 @@ rockFraction(unsigned elementIdx, unsigned timeIdx) const
|
|||||||
// geometric volume of the element. Note that it can
|
// geometric volume of the element. Note that it can
|
||||||
// be larger than 1.0 if porevolume multipliers are used
|
// be larger than 1.0 if porevolume multipliers are used
|
||||||
// to for instance implement larger boundary cells
|
// to for instance implement larger boundary cells
|
||||||
Scalar porosity = poro[elementIdx];
|
Scalar porosity = poro[this->lookUpData_.getOriginIndex(elementIdx)];
|
||||||
return referencePorosity(elementIdx, timeIdx) / porosity * (1 - porosity);
|
return referencePorosity(elementIdx, timeIdx) / porosity * (1 - porosity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,10 +373,10 @@ updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regi
|
|||||||
unsigned numElems = gridView_.size(/*codim=*/0);
|
unsigned numElems = gridView_.size(/*codim=*/0);
|
||||||
numbers.resize(numElems);
|
numbers.resize(numElems);
|
||||||
for (unsigned elemIdx = 0; elemIdx < numElems; ++elemIdx) {
|
for (unsigned elemIdx = 0; elemIdx < numElems; ++elemIdx) {
|
||||||
if (numData[elemIdx] > (int)num_regions) {
|
if (numData[this->lookUpData_.getOriginIndex(elemIdx)] > (int)num_regions) {
|
||||||
throw std::runtime_error("Values larger than maximum number of regions " + std::to_string(num_regions) + " provided in " + name);
|
throw std::runtime_error("Values larger than maximum number of regions " + std::to_string(num_regions) + " provided in " + name);
|
||||||
} else if (numData[elemIdx] > 0) {
|
} else if (numData[this->lookUpData_.getOriginIndex(elemIdx)] > 0) {
|
||||||
numbers[elemIdx] = static_cast<T>(numData[elemIdx]) - 1;
|
numbers[elemIdx] = static_cast<T>(numData[this->lookUpData_.getOriginIndex(elemIdx)]) - 1;
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("zero or negative values provided for region array: " + name);
|
throw std::runtime_error("zero or negative values provided for region array: " + name);
|
||||||
}
|
}
|
||||||
|
@ -202,6 +202,7 @@ public:
|
|||||||
using EclGenericProblem<GridView,FluidSystem,Scalar>::rockCompressibility;
|
using EclGenericProblem<GridView,FluidSystem,Scalar>::rockCompressibility;
|
||||||
using EclGenericProblem<GridView,FluidSystem,Scalar>::rockReferencePressure;
|
using EclGenericProblem<GridView,FluidSystem,Scalar>::rockReferencePressure;
|
||||||
using EclGenericProblem<GridView,FluidSystem,Scalar>::porosity;
|
using EclGenericProblem<GridView,FluidSystem,Scalar>::porosity;
|
||||||
|
using EclGenericProblem<GridView,FluidSystem,Scalar>::getLookUpData;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \copydoc FvBaseProblem::registerParameters
|
* \copydoc FvBaseProblem::registerParameters
|
||||||
@ -2091,13 +2092,19 @@ protected:
|
|||||||
this->mixControls_.updateLastValues(elemIdx, elemFluidState.Rs(), elemFluidState.Rv());
|
this->mixControls_.updateLastValues(elemIdx, elemFluidState.Rs(), elemFluidState.Rv());
|
||||||
|
|
||||||
if constexpr (enablePolymer)
|
if constexpr (enablePolymer)
|
||||||
this->polymer_.concentration[elemIdx] = eclWriter_->eclOutputModule().getPolymerConcentration(elemIdx);
|
this->polymer_.concentration[elemIdx] =
|
||||||
|
eclWriter_->eclOutputModule().getPolymerConcentration(getLookUpData().getOriginIndex(elemIdx));
|
||||||
if constexpr (enableMICP){
|
if constexpr (enableMICP){
|
||||||
this->micp_.microbialConcentration[elemIdx] = eclWriter_->eclOutputModule().getMicrobialConcentration(elemIdx);
|
this->micp_.microbialConcentration[elemIdx] =
|
||||||
this->micp_.oxygenConcentration[elemIdx] = eclWriter_->eclOutputModule().getOxygenConcentration(elemIdx);
|
eclWriter_->eclOutputModule().getMicrobialConcentration(getLookUpData().getOriginIndex(elemIdx));
|
||||||
this->micp_.ureaConcentration[elemIdx] = eclWriter_->eclOutputModule().getUreaConcentration(elemIdx);
|
this->micp_.oxygenConcentration[elemIdx] =
|
||||||
this->micp_.biofilmConcentration[elemIdx] = eclWriter_->eclOutputModule().getBiofilmConcentration(elemIdx);
|
eclWriter_->eclOutputModule().getOxygenConcentration(getLookUpData().getOriginIndex(elemIdx));
|
||||||
this->micp_.calciteConcentration[elemIdx] = eclWriter_->eclOutputModule().getCalciteConcentration(elemIdx);
|
this->micp_.ureaConcentration[elemIdx] =
|
||||||
|
eclWriter_->eclOutputModule().getUreaConcentration(getLookUpData().getOriginIndex(elemIdx));
|
||||||
|
this->micp_.biofilmConcentration[elemIdx] =
|
||||||
|
eclWriter_->eclOutputModule().getBiofilmConcentration(getLookUpData().getOriginIndex(elemIdx));
|
||||||
|
this->micp_.calciteConcentration[elemIdx]
|
||||||
|
= eclWriter_->eclOutputModule().getCalciteConcentration(getLookUpData().getOriginIndex(elemIdx));
|
||||||
}
|
}
|
||||||
// if we need to restart for polymer molecular weight simulation, we need to add related here
|
// if we need to restart for polymer molecular weight simulation, we need to add related here
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user