Load tracer solution from restart file

This commit is contained in:
Joakim Hove 2021-11-26 17:32:34 +01:00
parent 609bdbb92b
commit e9c45f4ca8

View File

@ -305,6 +305,12 @@ public:
std::vector<RestartKey> extraKeys = {{"OPMEXTRA", UnitSystem::measure::identity, false},
{"THRESHPR", UnitSystem::measure::pressure, inputThpres.active()}};
{
const auto& tracers = simulator_.vanguard().eclState().tracer();
for (const auto& tracer : tracers)
solutionKeys.emplace_back(tracer.fname(), UnitSystem::measure::identity, true);
}
// The episodeIndex is rewined one back before beginRestart is called
// and can not be used here.
// We just ask the initconfig directly to be sure that we use the correct
@ -326,6 +332,16 @@ public:
eclOutputModule_->setRestart(restartValues.solution, elemIdx, globalIdx);
}
auto& tracer_model = simulator_.problem().tracerModel();
for (int tracer_index = 0; tracer_index < tracer_model.numTracers(); tracer_index++) {
const auto& tracer_name = tracer_model.fname(tracer_index);
const auto& tracer_solution = restartValues.solution.data(tracer_name);
for (unsigned elemIdx = 0; elemIdx < numElements; ++elemIdx) {
unsigned globalIdx = this->collectToIORank_.localIdxToGlobalIdx(elemIdx);
tracer_model.setTracerConcentration(tracer_index, globalIdx, tracer_solution[globalIdx]);
}
}
if (inputThpres.active()) {
Simulator& mutableSimulator = const_cast<Simulator&>(simulator_);
auto& thpres = mutableSimulator.problem().thresholdPressure();