mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move assignment of free tracer concentration into TracerContainer
This commit is contained in:
parent
7386655b65
commit
00fe560720
@ -645,15 +645,11 @@ public:
|
||||
|
||||
// tracers
|
||||
const auto& tracerModel = simulator_.problem().tracerModel();
|
||||
if (! this->tracerC_.freeConcentrations_.empty()) {
|
||||
for (int tracerIdx = 0; tracerIdx < tracerModel.numTracers(); ++tracerIdx) {
|
||||
if (this->tracerC_.freeConcentrations_[tracerIdx].empty()) {
|
||||
continue;
|
||||
}
|
||||
this->tracerC_.freeConcentrations_[tracerIdx][globalDofIdx] =
|
||||
tracerModel.freeTracerConcentration(tracerIdx, globalDofIdx);
|
||||
}
|
||||
}
|
||||
this->tracerC_.assignFreeConcentrations(globalDofIdx,
|
||||
[globalDofIdx, &tracerModel](const unsigned tracerIdx)
|
||||
{ return tracerModel.freeTracerConcentration(tracerIdx,
|
||||
globalDofIdx); });
|
||||
|
||||
if (! this->tracerC_.solConcentrations_.empty()) {
|
||||
for (int tracerIdx = 0; tracerIdx < tracerModel.numTracers(); ++tracerIdx) {
|
||||
if (this->tracerC_.solConcentrations_[tracerIdx].empty()) {
|
||||
|
@ -61,6 +61,21 @@ allocate(const unsigned bufferSize)
|
||||
}
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
void TracerContainer<FluidSystem>::
|
||||
assignFreeConcentrations(const unsigned globalDofIdx,
|
||||
const AssignFunction& concentration)
|
||||
{
|
||||
std::for_each(freeConcentrations_.begin(), freeConcentrations_.end(),
|
||||
[globalDofIdx, idx = 0, &concentration](auto& tracer) mutable
|
||||
{
|
||||
if (!tracer.empty()) {
|
||||
tracer[globalDofIdx] = concentration(idx);
|
||||
}
|
||||
++idx;
|
||||
});
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
void TracerContainer<FluidSystem>::
|
||||
outputRestart(data::Solution& sol)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#ifndef OPM_TRACER_CONTAINER_HPP
|
||||
#define OPM_TRACER_CONTAINER_HPP
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
@ -46,6 +47,11 @@ public:
|
||||
|
||||
void allocate(const unsigned bufferSize);
|
||||
|
||||
using AssignFunction = std::function<Scalar(const unsigned)>;
|
||||
|
||||
void assignFreeConcentrations(const unsigned globalDofIdx,
|
||||
const AssignFunction& concentration);
|
||||
|
||||
void outputRestart(data::Solution& sol);
|
||||
|
||||
const EclipseState& eclState_;
|
||||
|
Loading…
Reference in New Issue
Block a user