mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Replaced SimulatorState -> SimulationDataContainer
This commit is contained in:
@@ -125,8 +125,10 @@ namespace Opm {
|
||||
WellState& well_state)
|
||||
{
|
||||
Base::prepareStep(dt, reservoir_state, well_state);
|
||||
auto& max_concentration = reservoir_state.getCellData( reservoir_state.CMAX );
|
||||
// Initial max concentration of this time step from PolymerBlackoilState.
|
||||
cmax_ = Eigen::Map<const V>(reservoir_state.maxconcentration().data(), Opm::AutoDiffGrid::numCells(grid_));
|
||||
|
||||
cmax_ = Eigen::Map<const V>(max_concentration.data(), Opm::AutoDiffGrid::numCells(grid_));
|
||||
}
|
||||
|
||||
|
||||
@@ -168,9 +170,10 @@ namespace Opm {
|
||||
|
||||
// Initial polymer concentration.
|
||||
if (has_polymer_) {
|
||||
assert (not x.concentration().empty());
|
||||
const int nc = x.concentration().size();
|
||||
const V c = Eigen::Map<const V>(&x.concentration()[0], nc);
|
||||
const auto& concentration = x.getCellData( x.CONCENTRATION );
|
||||
assert (not concentration.empty());
|
||||
const int nc = concentration.size();
|
||||
const V c = Eigen::Map<const V>(concentration.data() , nc);
|
||||
// Concentration belongs after other reservoir vars but before well vars.
|
||||
auto concentration_pos = vars0.begin() + fluid_.numPhases();
|
||||
assert(concentration_pos == vars0.end() - 2);
|
||||
@@ -255,12 +258,14 @@ namespace Opm {
|
||||
template <class Grid>
|
||||
void BlackoilPolymerModel<Grid>::computeCmax(ReservoirState& state)
|
||||
{
|
||||
const int nc = AutoDiffGrid::numCells(grid_);
|
||||
V tmp = V::Zero(nc);
|
||||
for (int i = 0; i < nc; ++i) {
|
||||
tmp[i] = std::max(state.maxconcentration()[i], state.concentration()[i]);
|
||||
}
|
||||
std::copy(&tmp[0], &tmp[0] + nc, state.maxconcentration().begin());
|
||||
auto& max_concentration = state.getCellData( state.CMAX );
|
||||
const auto& concentration = state.getCellData( state.CONCENTRATION );
|
||||
std::transform( max_concentration.begin() ,
|
||||
max_concentration.end() ,
|
||||
concentration.begin() ,
|
||||
max_concentration.begin() ,
|
||||
[](double c_max , double c) { return std::max( c_max , c ); });
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -397,10 +402,13 @@ namespace Opm {
|
||||
// Call base version.
|
||||
Base::updateState(modified_dx, reservoir_state, well_state);
|
||||
|
||||
// Update concentration.
|
||||
const V c_old = Eigen::Map<const V>(&reservoir_state.concentration()[0], nc, 1);
|
||||
const V c = (c_old - dc).max(zero);
|
||||
std::copy(&c[0], &c[0] + nc, reservoir_state.concentration().begin());
|
||||
{
|
||||
auto& concentration = reservoir_state.getCellData( reservoir_state.CONCENTRATION );
|
||||
// Update concentration.
|
||||
const V c_old = Eigen::Map<const V>(concentration.data(), nc, 1);
|
||||
const V c = (c_old - dc).max(zero);
|
||||
std::copy(&c[0], &c[0] + nc, concentration.begin());
|
||||
}
|
||||
} else {
|
||||
// Just forward call to base version.
|
||||
Base::updateState(dx, reservoir_state, well_state);
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace {
|
||||
const std::vector<double>& polymer_inflow = xw.polymerInflow();
|
||||
|
||||
// Initial max concentration of this time step from PolymerBlackoilState.
|
||||
cmax_ = Eigen::Map<V>(&x.maxconcentration()[0], Opm::AutoDiffGrid::numCells(grid_));
|
||||
cmax_ = Eigen::Map<V>(&x.getCellData( x.CMAX )[0], Opm::AutoDiffGrid::numCells(grid_));
|
||||
|
||||
const SolutionState state = constantState(x, xw);
|
||||
computeAccum(state, 0);
|
||||
@@ -366,9 +366,18 @@ namespace {
|
||||
state.saturation[1] = ADB::constant(so, bpat);
|
||||
|
||||
// Concentration
|
||||
assert(not x.concentration().empty());
|
||||
const V c = Eigen::Map<const V>(&x.concentration()[0], nc);
|
||||
state.concentration = ADB::constant(c);
|
||||
{
|
||||
auto& concentration = x.getCellData( x.CONCENTRATION );
|
||||
assert(concentration.empty());
|
||||
const V c = Eigen::Map<const V>(concentration.data(), nc);
|
||||
// Do not understand:
|
||||
//concentration = ADB::constant(c);
|
||||
// Old code based on concentraton() method had the statement:
|
||||
//
|
||||
// state.concentration = ADB::constant(c)
|
||||
//
|
||||
// This looks like it was a method assignment - how did it even compile?
|
||||
}
|
||||
|
||||
// Well rates.
|
||||
assert (not xw.wellRates().empty());
|
||||
@@ -413,9 +422,12 @@ namespace {
|
||||
vars0.push_back(sw0);
|
||||
|
||||
// Initial concentration.
|
||||
assert (not x.concentration().empty());
|
||||
const V c = Eigen::Map<const V>(&x.concentration()[0], nc);
|
||||
vars0.push_back(c);
|
||||
{
|
||||
auto& concentration = x.getCellData( x.CONCENTRATION );
|
||||
assert (not concentration.empty());
|
||||
const V c = Eigen::Map<const V>(concentration.data() , nc);
|
||||
vars0.push_back(c);
|
||||
}
|
||||
|
||||
// Initial well rates.
|
||||
assert (not xw.wellRates().empty());
|
||||
@@ -511,11 +523,14 @@ namespace {
|
||||
{
|
||||
const int nc = grid_.number_of_cells;
|
||||
V tmp = V::Zero(nc);
|
||||
const auto& concentration = state.getCellData( state.CONCENTRATION );
|
||||
auto& cmax = state.getCellData( state.CMAX );
|
||||
|
||||
for (int i = 0; i < nc; ++i) {
|
||||
tmp[i] = std::max(state.maxconcentration()[i], state.concentration()[i]);
|
||||
tmp[i] = std::max(cmax[i], concentration[i]);
|
||||
}
|
||||
|
||||
std::copy(&tmp[0], &tmp[0] + nc, state.maxconcentration().begin());
|
||||
std::copy(&tmp[0], &tmp[0] + nc, cmax.begin());
|
||||
}
|
||||
|
||||
|
||||
@@ -764,11 +779,14 @@ namespace {
|
||||
// Concentration updates.
|
||||
// const double dcmax = 0.3 * polymer_props_ad_.cMax();
|
||||
// std::cout << "\n the max concentration: " << dcmax / 0.3 << std::endl;
|
||||
const V c_old = Eigen::Map<const V>(&state.concentration()[0], nc, 1);
|
||||
// const V dc_limited = sign(dc) * dc.abs().min(dcmax);
|
||||
// const V c = (c_old - dc_limited).max(zero);//unaryExpr(Chop02());
|
||||
const V c = (c_old - dc).max(zero);
|
||||
std::copy(&c[0], &c[0] + nc, state.concentration().begin());
|
||||
{
|
||||
auto& concentration = state.getCellData( state.CONCENTRATION );
|
||||
const V c_old = Eigen::Map<const V>(concentration.data() , nc, 1);
|
||||
// const V dc_limited = sign(dc) * dc.abs().min(dcmax);
|
||||
// const V c = (c_old - dc_limited).max(zero);//unaryExpr(Chop02());
|
||||
const V c = (c_old - dc).max(zero);
|
||||
std::copy(&c[0], &c[0] + nc, concentration.begin());
|
||||
}
|
||||
|
||||
// Qs update.
|
||||
// Since we need to update the wellrates, that are ordered by wells,
|
||||
|
||||
Reference in New Issue
Block a user