mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use cellCentroids lookup function exported from vanguard.
That will take care of doing the right thing in parallel.
This commit is contained in:
@@ -45,6 +45,8 @@
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <functional>
|
||||
#include <array>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -53,11 +55,13 @@ EclGenericTracerModel<Grid,GridView,DofMapper,Stencil,Scalar>::
|
||||
EclGenericTracerModel(const GridView& gridView,
|
||||
const EclipseState& eclState,
|
||||
const CartesianIndexMapper& cartMapper,
|
||||
const DofMapper& dofMapper)
|
||||
const DofMapper& dofMapper,
|
||||
const std::function<std::array<double,dimWorld>(int)> centroids)
|
||||
: gridView_(gridView)
|
||||
, eclState_(eclState)
|
||||
, cartMapper_(cartMapper)
|
||||
, dofMapper_(dofMapper)
|
||||
, centroids_(centroids)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -137,12 +141,10 @@ doInit(bool enabled, size_t numGridDof,
|
||||
}
|
||||
//TVDPF keyword
|
||||
else {
|
||||
const auto& eclGrid = eclState_.getInputGrid();
|
||||
|
||||
for (size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx){
|
||||
int cartDofIdx = cartMapper_.cartesianIndex(globalDofIdx);
|
||||
const auto& center = eclGrid.getCellCenter(cartDofIdx);
|
||||
tracerConcentration_[tracerIdx][globalDofIdx] = tracer.free_tvdp.evaluate("TRACER_CONCENTRATION", center[2]);
|
||||
tracerConcentration_[tracerIdx][globalDofIdx] =
|
||||
tracer.free_tvdp.evaluate("TRACER_CONCENTRATION",
|
||||
centroids_(globalDofIdx)[2]);
|
||||
}
|
||||
}
|
||||
++tracerIdx;
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
using TracerMatrix = Dune::BCRSMatrix<Dune::FieldMatrix<Scalar, 1, 1>>;
|
||||
using TracerVector = Dune::BlockVector<Dune::FieldVector<Scalar,1>>;
|
||||
using CartesianIndexMapper = Dune::CartesianIndexMapper<Grid>;
|
||||
|
||||
static const int dimWorld = Grid::dimensionworld;
|
||||
/*!
|
||||
* \brief Return the number of tracers considered by the tracerModel.
|
||||
*/
|
||||
@@ -78,7 +78,8 @@ protected:
|
||||
EclGenericTracerModel(const GridView& gridView,
|
||||
const EclipseState& eclState,
|
||||
const CartesianIndexMapper& cartMapper,
|
||||
const DofMapper& dofMapper);
|
||||
const DofMapper& dofMapper,
|
||||
const std::function<std::array<double,dimWorld>(int)> centroids);
|
||||
|
||||
/*!
|
||||
* \brief Initialize all internal data structures needed by the tracer module
|
||||
@@ -109,7 +110,8 @@ protected:
|
||||
|
||||
// <wellName, tracerIdx> -> wellRate
|
||||
std::map<std::pair<std::string, std::string>, double> wellTracerRate_;
|
||||
|
||||
/// \brief Function returning the cell centers
|
||||
std::function<std::array<double,dimWorld>(int)> centroids_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
@@ -90,7 +90,8 @@ public:
|
||||
: BaseType(simulator.vanguard().gridView(),
|
||||
simulator.vanguard().eclState(),
|
||||
simulator.vanguard().cartesianIndexMapper(),
|
||||
simulator.model().dofMapper())
|
||||
simulator.model().dofMapper(),
|
||||
simulator.vanguard().cellCentroids())
|
||||
, simulator_(simulator)
|
||||
, wat_(TracerBatch<TracerVector>(waterPhaseIdx))
|
||||
, oil_(TracerBatch<TracerVector>(oilPhaseIdx))
|
||||
|
||||
Reference in New Issue
Block a user