diff --git a/opm/simulators/flow/FlowProblemBlackoil.hpp b/opm/simulators/flow/FlowProblemBlackoil.hpp index b1bf08d83..8e8ef8cca 100644 --- a/opm/simulators/flow/FlowProblemBlackoil.hpp +++ b/opm/simulators/flow/FlowProblemBlackoil.hpp @@ -1142,6 +1142,10 @@ protected: // Initialize mixing controls before trying to set any lastRx valuesx this->mixControls_.init(numElems, restart_step, eclState.runspec().tabdims().getNumPVTTables()); + if constexpr (enableMICP) { + this->micp_ = this->eclWriter_->outputModule().getMICP().getSolution(); + } + for (std::size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { auto& elemFluidState = this->initialFluidStates_[elemIdx]; elemFluidState.setPvtRegionIndex(pvtRegionIndex(elemIdx)); @@ -1179,13 +1183,6 @@ protected: if constexpr (enablePolymer) this->polymer_.concentration[elemIdx] = this->eclWriter_->outputModule().getPolymerConcentration(elemIdx); - if constexpr (enableMICP){ - this->micp_.microbialConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getMicrobialConcentration(elemIdx); - this->micp_.oxygenConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getOxygenConcentration(elemIdx); - this->micp_.ureaConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getUreaConcentration(elemIdx); - this->micp_.biofilmConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getBiofilmConcentration(elemIdx); - this->micp_.calciteConcentration[elemIdx] = this->eclWriter_->outputModule().getMICP().getCalciteConcentration(elemIdx); - } // if we need to restart for polymer molecular weight simulation, we need to add related here } diff --git a/opm/simulators/flow/MICPContainer.cpp b/opm/simulators/flow/MICPContainer.cpp index 6414bcfbb..4f851ce46 100644 --- a/opm/simulators/flow/MICPContainer.cpp +++ b/opm/simulators/flow/MICPContainer.cpp @@ -27,6 +27,8 @@ #include +#include + #include #include #include @@ -63,6 +65,20 @@ assign(const unsigned globalDofIdx, cCalcite_[globalDofIdx] = calciteConcentration; } +template +MICPSolutionContainer +MICPContainer:: +getSolution() const +{ + return { + cMicrobes_, + cOxygen_, + cUrea_, + cBiofilm_, + cCalcite_ + }; +} + template void MICPContainer:: outputRestart(data::Solution& sol) diff --git a/opm/simulators/flow/MICPContainer.hpp b/opm/simulators/flow/MICPContainer.hpp index 8ca6697ee..3e5e53d14 100644 --- a/opm/simulators/flow/MICPContainer.hpp +++ b/opm/simulators/flow/MICPContainer.hpp @@ -31,6 +31,7 @@ namespace Opm { namespace data { class Solution; } +template class MICPSolutionContainer; template class MICPContainer @@ -47,6 +48,8 @@ public: const Scalar biofilmConcentration, const Scalar calciteConcentration); + MICPSolutionContainer getSolution() const; + void outputRestart(data::Solution& sol); void readRestart(const unsigned globalDofIdx, @@ -56,46 +59,6 @@ public: bool allocated() const { return allocated_; } - Scalar getMicrobialConcentration(unsigned elemIdx) const - { - if (cMicrobes_.size() > elemIdx) - return cMicrobes_[elemIdx]; - - return 0; - } - - Scalar getOxygenConcentration(unsigned elemIdx) const - { - if (cOxygen_.size() > elemIdx) - return cOxygen_[elemIdx]; - - return 0; - } - - Scalar getUreaConcentration(unsigned elemIdx) const - { - if (cUrea_.size() > elemIdx) - return cUrea_[elemIdx]; - - return 0; - } - - Scalar getBiofilmConcentration(unsigned elemIdx) const - { - if (cBiofilm_.size() > elemIdx) - return cBiofilm_[elemIdx]; - - return 0; - } - - Scalar getCalciteConcentration(unsigned elemIdx) const - { - if (cCalcite_.size() > elemIdx) - return cCalcite_[elemIdx]; - - return 0; - } - bool allocated_ = false; ScalarBuffer cMicrobes_; ScalarBuffer cOxygen_;