mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move output of tracer data into TracerContainer
This commit is contained in:
parent
7f4e3624f7
commit
7386655b65
@ -632,41 +632,7 @@ assignToSolution(data::Solution& sol)
|
||||
this->fipC_.outputRestart(sol);
|
||||
|
||||
// Tracers
|
||||
if (! this->tracerC_.freeConcentrations_.empty()) {
|
||||
const auto& tracers = this->eclState_.tracer();
|
||||
for (auto tracerIdx = 0*tracers.size();
|
||||
tracerIdx < tracers.size(); ++tracerIdx)
|
||||
{
|
||||
sol.insert(tracers[tracerIdx].fname(),
|
||||
UnitSystem::measure::identity,
|
||||
std::move(this->tracerC_.freeConcentrations_[tracerIdx]),
|
||||
data::TargetType::RESTART_TRACER_SOLUTION);
|
||||
}
|
||||
|
||||
// Put freeTracerConcentrations container into a valid state. Otherwise
|
||||
// we'll move from vectors that have already been moved from if we
|
||||
// get here and it's not a restart step.
|
||||
this->tracerC_.freeConcentrations_.clear();
|
||||
}
|
||||
if (! this->tracerC_.solConcentrations_.empty()) {
|
||||
const auto& tracers = this->eclState_.tracer();
|
||||
for (auto tracerIdx = 0*tracers.size();
|
||||
tracerIdx < tracers.size(); ++tracerIdx)
|
||||
{
|
||||
if (this->tracerC_.solConcentrations_[tracerIdx].empty())
|
||||
continue;
|
||||
|
||||
sol.insert(tracers[tracerIdx].sname(),
|
||||
UnitSystem::measure::identity,
|
||||
std::move(this->tracerC_.solConcentrations_[tracerIdx]),
|
||||
data::TargetType::RESTART_TRACER_SOLUTION);
|
||||
}
|
||||
|
||||
// Put solTracerConcentrations container into a valid state. Otherwise
|
||||
// we'll move from vectors that have already been moved from if we
|
||||
// get here and it's not a restart step.
|
||||
this->tracerC_.solConcentrations_.clear();
|
||||
}
|
||||
this->tracerC_.outputRestart(sol);
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
|
@ -29,7 +29,10 @@
|
||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||
#include <opm/material/fluidsystems/GenericOilGasWaterFluidSystem.hpp>
|
||||
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@ -58,6 +61,35 @@ allocate(const unsigned bufferSize)
|
||||
}
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
void TracerContainer<FluidSystem>::
|
||||
outputRestart(data::Solution& sol)
|
||||
{
|
||||
if (!this->allocated_) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& tracers = this->eclState_.tracer();
|
||||
std::for_each(tracers.begin(), tracers.end(),
|
||||
[idx = 0, &sol, this](const auto& tracer) mutable
|
||||
{
|
||||
sol.insert(tracer.fname(),
|
||||
UnitSystem::measure::identity,
|
||||
std::move(freeConcentrations_[idx]),
|
||||
data::TargetType::RESTART_TRACER_SOLUTION);
|
||||
|
||||
if (!solConcentrations_[idx].empty()) {
|
||||
sol.insert(tracer.sname(),
|
||||
UnitSystem::measure::identity,
|
||||
std::move(solConcentrations_[idx]),
|
||||
data::TargetType::RESTART_TRACER_SOLUTION);
|
||||
}
|
||||
++idx;
|
||||
});
|
||||
|
||||
this->allocated_ = false;
|
||||
}
|
||||
|
||||
template<class T> using FS = BlackOilFluidSystem<T,BlackOilDefaultIndexTraits>;
|
||||
|
||||
#define INSTANTIATE_TYPE(T) \
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
namespace data { class Solution; }
|
||||
class EclipseState;
|
||||
|
||||
template<class FluidSystem>
|
||||
@ -45,6 +46,8 @@ public:
|
||||
|
||||
void allocate(const unsigned bufferSize);
|
||||
|
||||
void outputRestart(data::Solution& sol);
|
||||
|
||||
const EclipseState& eclState_;
|
||||
|
||||
std::vector<ScalarBuffer> freeConcentrations_{};
|
||||
|
Loading…
Reference in New Issue
Block a user