Make polymer inflow specification by cell.

Before, it was a single number for the whole domain. It could vary
with time, though.

Simulator behaviour should be identical before and after this commit.

This touches the classes TransportModel*Polymer, Simulator*Polymer,
and the computeInjectedProduced() functions. The PolymerInflow class
and its usage has been replaced with PolymerInflowInterface, and
a subclass PolymerInflowBasic has been created which provides the
old behaviour (using parameters poly_start_days, poly_end_days and
poly_amount).
This commit is contained in:
Atgeirr Flø Rasmussen
2012-10-04 13:38:22 +02:00
parent f5eb116410
commit 6033e5ca69
9 changed files with 91 additions and 71 deletions

View File

@@ -126,7 +126,7 @@ namespace Opm
std::vector< std::vector<int> > columns_;
// Misc. data
std::vector<int> allcells_;
PolymerInflow poly_inflow_;
boost::scoped_ptr<PolymerInflowInterface> poly_inflow_;
};
@@ -187,10 +187,7 @@ namespace Opm
gravity, wells, src, bcs),
tsolver_(grid, props, poly_props, TransportModelPolymer::Bracketing,
param.getDefault("nl_tolerance", 1e-9),
param.getDefault("nl_maxiter", 30)),
poly_inflow_(param.getDefault("poly_start_days", 300.0)*Opm::unit::day,
param.getDefault("poly_end_days", 800.0)*Opm::unit::day,
param.getDefault("poly_amount", poly_props.cMax()))
param.getDefault("nl_maxiter", 30))
{
// For output.
output_ = param.getDefault("output", true);
@@ -226,6 +223,11 @@ namespace Opm
extractColumn(grid_, columns_);
}
// Polymer inflow control.
poly_inflow_.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day,
param.getDefault("poly_end_days", 800.0)*Opm::unit::day,
param.getDefault("poly_amount", poly_props.cMax())));
// Misc init.
const int num_cells = grid.number_of_cells;
allcells_.resize(num_cells);
@@ -240,7 +242,8 @@ namespace Opm
PolymerState& state,
WellState& well_state)
{
std::vector<double> transport_src;
std::vector<double> transport_src(grid_.number_of_cells);
std::vector<double> polymer_inflow_c(grid_.number_of_cells);
// Initialisation.
std::vector<double> porevol;
@@ -316,12 +319,7 @@ namespace Opm
// Find inflow rate.
const double current_time = timer.currentTime();
double stepsize = timer.currentStepLength();
const double inflowc0 = poly_inflow_(current_time + 1e-5*stepsize);
const double inflowc1 = poly_inflow_(current_time + (1.0 - 1e-5)*stepsize);
if (inflowc0 != inflowc1) {
std::cout << "**** Warning: polymer inflow rate changes during timestep. Using rate near start of step.";
}
const double inflow_c = inflowc0;
poly_inflow_->getInflowValues(current_time, current_time + stepsize, polymer_inflow_c);
// Solve transport.
transport_timer.start();
@@ -335,11 +333,11 @@ namespace Opm
double substep_polyprod = 0.0;
injected[0] = injected[1] = produced[0] = produced[1] = polyinj = polyprod = 0.0;
for (int tr_substep = 0; tr_substep < num_transport_substeps_; ++tr_substep) {
tsolver_.solve(&state.faceflux()[0], &porevol[0], &transport_src[0], stepsize, inflow_c,
tsolver_.solve(&state.faceflux()[0], &porevol[0], &transport_src[0], &polymer_inflow_c[0], stepsize,
state.saturation(), state.concentration(), state.maxconcentration());
Opm::computeInjectedProduced(props_, poly_props_,
state.saturation(), state.concentration(), state.maxconcentration(),
transport_src, stepsize, inflow_c,
transport_src, polymer_inflow_c, stepsize,
substep_injected, substep_produced, substep_polyinj, substep_polyprod);
injected[0] += substep_injected[0];
injected[1] += substep_injected[1];