mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move output of MICP restart data into MICPContainer
This commit is contained in:
parent
3f94ace151
commit
4c261ba880
@ -514,11 +514,7 @@ assignToSolution(data::Solution& sol)
|
||||
addEntry(flowsSolutionVector, "FLRWATK-", UnitSystem::measure::rate, flores_[FaceDir::ToIntersectionIndex(Dir::ZMinus)][waterCompIdx], waterCompIdx);
|
||||
|
||||
auto extendedSolutionArrays = std::array {
|
||||
DataEntry{"BIOFILM", UnitSystem::measure::identity, micpC_.cBiofilm_},
|
||||
DataEntry{"CALCITE", UnitSystem::measure::identity, micpC_.cCalcite_},
|
||||
DataEntry{"DRSDTCON", UnitSystem::measure::gas_oil_ratio_rate, drsdtcon_},
|
||||
DataEntry{"MICROBES", UnitSystem::measure::density, micpC_.cMicrobes_},
|
||||
DataEntry{"OXYGEN", UnitSystem::measure::density, micpC_.cOxygen_},
|
||||
DataEntry{"PERMFACT", UnitSystem::measure::identity, permFact_},
|
||||
DataEntry{"PORV_RC", UnitSystem::measure::identity, rockCompPorvMultiplier_},
|
||||
DataEntry{"PRES_OVB", UnitSystem::measure::pressure, overburdenPressure_},
|
||||
@ -535,7 +531,6 @@ assignToSolution(data::Solution& sol)
|
||||
DataEntry{"STD_GAS", UnitSystem::measure::identity, mFracGas_},
|
||||
DataEntry{"STD_OIL", UnitSystem::measure::identity, mFracOil_},
|
||||
DataEntry{"TMULT_RC", UnitSystem::measure::identity, rockCompTransMultiplier_},
|
||||
DataEntry{"UREA", UnitSystem::measure::density, micpC_.cUrea_},
|
||||
};
|
||||
|
||||
// basically, for compositional, we can not use std::array for this. We need to generate the ZMF1, ZMF2, and so on
|
||||
@ -580,6 +575,10 @@ assignToSolution(data::Solution& sol)
|
||||
}
|
||||
}
|
||||
|
||||
if (this->micpC_.allocated()) {
|
||||
this->micpC_.outputRestart(sol);
|
||||
}
|
||||
|
||||
for (auto& array : extendedSolutionArrays) {
|
||||
doInsert(array, data::TargetType::RESTART_OPM_EXTENDED);
|
||||
}
|
||||
|
@ -23,6 +23,15 @@
|
||||
#include <config.h>
|
||||
#include <opm/simulators/flow/MICPContainer.hpp>
|
||||
|
||||
#include <opm/input/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template<class Scalar>
|
||||
@ -38,6 +47,39 @@ allocate(const unsigned bufferSize)
|
||||
allocated_ = true;
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
void MICPContainer<Scalar>::
|
||||
outputRestart(data::Solution& sol)
|
||||
{
|
||||
if (!this->allocated_) {
|
||||
return;
|
||||
}
|
||||
|
||||
using DataEntry =
|
||||
std::tuple<std::string, UnitSystem::measure, std::vector<Scalar>&>;
|
||||
|
||||
auto solutionVectors = std::array {
|
||||
DataEntry{"BIOFILM", UnitSystem::measure::identity, cBiofilm_},
|
||||
DataEntry{"CALCITE", UnitSystem::measure::identity, cCalcite_},
|
||||
DataEntry{"MICROBES", UnitSystem::measure::density, cMicrobes_},
|
||||
DataEntry{"OXYGEN", UnitSystem::measure::density, cOxygen_},
|
||||
DataEntry{"UREA", UnitSystem::measure::density, cUrea_},
|
||||
};
|
||||
|
||||
std::for_each(solutionVectors.begin(), solutionVectors.end(),
|
||||
[&sol](auto& entry)
|
||||
{
|
||||
if (!std::get<2>(entry).empty()) {
|
||||
sol.insert(std::get<std::string>(entry),
|
||||
std::get<UnitSystem::measure>(entry),
|
||||
std::move(std::get<2>(entry)),
|
||||
data::TargetType::RESTART_OPM_EXTENDED);
|
||||
}
|
||||
});
|
||||
|
||||
allocated_ = false;
|
||||
}
|
||||
|
||||
template class MICPContainer<double>;
|
||||
|
||||
#if FLOW_INSTANTIATE_FLOAT
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
namespace data { class Solution; }
|
||||
|
||||
template<class Scalar>
|
||||
class MICPContainer
|
||||
{
|
||||
@ -38,6 +40,8 @@ class MICPContainer
|
||||
public:
|
||||
void allocate(const unsigned bufferSize);
|
||||
|
||||
void outputRestart(data::Solution& sol);
|
||||
|
||||
bool allocated() const
|
||||
{ return allocated_; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user