mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Exception added (restart not supported for LGRs), improved-cleaned code
This commit is contained in:
parent
93731c419d
commit
88e03e5e8d
@ -268,12 +268,6 @@ public:
|
||||
|
||||
int numPressurePointsEquil() const
|
||||
{ return numPressurePointsEquil_; }
|
||||
|
||||
auto getLookUpData(unsigned elemIdx) const
|
||||
{
|
||||
using GridType = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
|
||||
return lookUpData_.template getOriginIndex<GridType>(elemIdx);
|
||||
}
|
||||
|
||||
bool operator==(const EclGenericProblem& rhs) const;
|
||||
|
||||
@ -377,12 +371,18 @@ protected:
|
||||
|
||||
// equilibration parameters
|
||||
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_;
|
||||
|
||||
|
||||
auto getLookUpData(unsigned elemIdx) const
|
||||
{
|
||||
using GridType = std::remove_cv_t< typename std::remove_reference<decltype(gridView_.grid())>::type>;
|
||||
return lookUpData_.template getOriginIndex<GridType>(elemIdx);
|
||||
}
|
||||
|
||||
private:
|
||||
template<class T>
|
||||
void updateNum(const std::string& name, std::vector<T>& numbers, std::size_t num_regions);
|
||||
|
@ -169,14 +169,15 @@ readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
|
||||
rockTableIdx_.resize(numElem);
|
||||
const auto& num = eclState_.fieldProps().get_int(rock_config.rocknum_property());
|
||||
for (std::size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) {
|
||||
rockTableIdx_[elemIdx] = num[this->getLookUpData(elemIdx)] - 1;
|
||||
auto coarseElemIdx = this->getLookUpData(elemIdx);
|
||||
rockTableIdx_[elemIdx] = num[coarseElemIdx] - 1;
|
||||
auto fmtError =
|
||||
[&num,elemIdx,&ijkIndex,&rock_config, this](const char* type, std::size_t size)
|
||||
[&num,coarseElemIdx,&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[this-> getLookUpData(elemIdx)],
|
||||
ijkIndex(this-> getLookUpData(elemIdx)),
|
||||
type, num[coarseElemIdx],
|
||||
ijkIndex(coarseElemIdx),
|
||||
rock_config.rocknum_property(), size);
|
||||
};
|
||||
if (!rockCompPoroMult_.empty() &&
|
||||
@ -213,7 +214,7 @@ readRockParameters_(const std::vector<Scalar>& cellCenterDepths,
|
||||
tableIdx = rockTableIdx_[elemIdx];
|
||||
}
|
||||
overburdenPressure_[elemIdx] =
|
||||
overburdenTables[tableIdx].eval(cellCenterDepths[this->getLookUpData(elemIdx)], /*extrapolation=*/true);
|
||||
overburdenTables[tableIdx].eval(cellCenterDepths[elemIdx], /*extrapolation=*/true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -320,7 +321,7 @@ rockCompressibility(unsigned globalSpaceIdx) const
|
||||
|
||||
unsigned tableIdx = 0;
|
||||
if (!this->rockTableIdx_.empty()) {
|
||||
tableIdx = this->rockTableIdx_[globalSpaceIdx];
|
||||
tableIdx = this->rockTableIdx_[globalSpaceIdx];
|
||||
}
|
||||
return this->rockParams_[tableIdx].compressibility;
|
||||
}
|
||||
@ -334,7 +335,7 @@ rockReferencePressure(unsigned globalSpaceIdx) const
|
||||
|
||||
unsigned tableIdx = 0;
|
||||
if (!this->rockTableIdx_.empty()) {
|
||||
tableIdx = this->rockTableIdx_[globalSpaceIdx];
|
||||
tableIdx = this->rockTableIdx_[globalSpaceIdx];
|
||||
}
|
||||
return this->rockParams_[tableIdx].referencePressure;
|
||||
}
|
||||
@ -356,7 +357,7 @@ rockFraction(unsigned elementIdx, unsigned timeIdx) const
|
||||
// geometric volume of the element. Note that it can
|
||||
// be larger than 1.0 if porevolume multipliers are used
|
||||
// to for instance implement larger boundary cells
|
||||
Scalar porosity = poro[this->getLookUpData(elementIdx)];
|
||||
Scalar porosity = poro[this->getLookUpData(elementIdx)];
|
||||
return referencePorosity(elementIdx, timeIdx) / porosity * (1 - porosity);
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,6 @@ public:
|
||||
using EclGenericProblem<GridView,FluidSystem,Scalar>::rockCompressibility;
|
||||
using EclGenericProblem<GridView,FluidSystem,Scalar>::rockReferencePressure;
|
||||
using EclGenericProblem<GridView,FluidSystem,Scalar>::porosity;
|
||||
using EclGenericProblem<GridView,FluidSystem,Scalar>::getLookUpData;
|
||||
|
||||
/*!
|
||||
* \copydoc FvBaseProblem::registerParameters
|
||||
@ -2027,6 +2026,11 @@ protected:
|
||||
|
||||
void readEclRestartSolution_()
|
||||
{
|
||||
// Throw an exception if the grid has LGRs. Refined grid are not supported for restart.
|
||||
if(this->simulator().vanguard().grid().maxLevel() > 0) {
|
||||
throw std::invalid_argument("Refined grids are not yet supported for restart ");
|
||||
}
|
||||
|
||||
// Set the start time of the simulation
|
||||
auto& simulator = this->simulator();
|
||||
const auto& schedule = simulator.vanguard().schedule();
|
||||
@ -2092,19 +2096,13 @@ protected:
|
||||
this->mixControls_.updateLastValues(elemIdx, elemFluidState.Rs(), elemFluidState.Rv());
|
||||
|
||||
if constexpr (enablePolymer)
|
||||
this->polymer_.concentration[elemIdx] =
|
||||
eclWriter_->eclOutputModule().getPolymerConcentration(getLookUpData(elemIdx));
|
||||
this->polymer_.concentration[elemIdx] = eclWriter_->eclOutputModule().getPolymerConcentration(elemIdx);
|
||||
if constexpr (enableMICP){
|
||||
this->micp_.microbialConcentration[elemIdx] =
|
||||
eclWriter_->eclOutputModule().getMicrobialConcentration(getLookUpData(elemIdx));
|
||||
this->micp_.oxygenConcentration[elemIdx] =
|
||||
eclWriter_->eclOutputModule().getOxygenConcentration(getLookUpData(elemIdx));
|
||||
this->micp_.ureaConcentration[elemIdx] =
|
||||
eclWriter_->eclOutputModule().getUreaConcentration(getLookUpData(elemIdx));
|
||||
this->micp_.biofilmConcentration[elemIdx] =
|
||||
eclWriter_->eclOutputModule().getBiofilmConcentration(getLookUpData(elemIdx));
|
||||
this->micp_.calciteConcentration[elemIdx]
|
||||
= eclWriter_->eclOutputModule().getCalciteConcentration(getLookUpData(elemIdx));
|
||||
this->micp_.microbialConcentration[elemIdx] = eclWriter_->eclOutputModule().getMicrobialConcentration(elemIdx);
|
||||
this->micp_.oxygenConcentration[elemIdx] = eclWriter_->eclOutputModule().getOxygenConcentration(elemIdx);
|
||||
this->micp_.ureaConcentration[elemIdx] = eclWriter_->eclOutputModule().getUreaConcentration(elemIdx);
|
||||
this->micp_.biofilmConcentration[elemIdx] = eclWriter_->eclOutputModule().getBiofilmConcentration(elemIdx);
|
||||
this->micp_.calciteConcentration[elemIdx] = eclWriter_->eclOutputModule().getCalciteConcentration(elemIdx);
|
||||
}
|
||||
// if we need to restart for polymer molecular weight simulation, we need to add related here
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user