some changes, mostly of them are API changes from opm-autodiff and opm-parser.

This commit is contained in:
Liu Ming 2014-09-26 14:06:01 +08:00
parent 1cb1e8475a
commit ca70d67d83
3 changed files with 16 additions and 13 deletions

View File

@ -569,15 +569,16 @@ namespace {
}
ADB cell_rho_total = ADB::constant(V::Zero(nc), state.pressure.blockPattern());
std::vector<ADB> press = computePressures(state);
const std::vector<PhasePresence> cond = phaseCondition();
for (int phase = 0; phase < 2; ++phase) {
const ADB cell_rho = fluidDensity(phase, press[phase], cells_);
const ADB cell_rho = fluidDensity(phase, press[phase], cond, cells_);
cell_rho_total += state.saturation[phase] * cell_rho;
}
ADB inj_rho_total = ADB::constant(V::Zero(nperf), state.pressure.blockPattern());
assert(np == wells_.number_of_phases);
const DataBlock compi = Eigen::Map<const DataBlock>(wells_.comp_frac, nw, np);
for (int phase = 0; phase < 2; ++phase) {
const ADB cell_rho = fluidDensity(phase, press[phase], cells_);
const ADB cell_rho = fluidDensity(phase, press[phase], cond, cells_);
const V fraction = compi.col(phase);
inj_rho_total += (wops_.w2p * fraction.matrix()).array() * subset(cell_rho, well_cells);
}
@ -938,7 +939,7 @@ namespace {
ADB
FullyImplicitCompressiblePolymerSolver::fluidReciprocFVF(const int phase,
const ADB& p ,
const std::vector<PhasePresence>& cond
const std::vector<PhasePresence>& cond,
const std::vector<int>& cells) const
{
const ADB null = ADB::constant(V::Zero(grid_.number_of_cells, 1), p.blockPattern());
@ -960,7 +961,7 @@ namespace {
ADB
FullyImplicitCompressiblePolymerSolver::fluidDensity(const int phase,
const ADB& p ,
const std::vector<PhasePresence>& cond
const std::vector<PhasePresence>& cond,
const std::vector<int>& cells) const
{
const double* rhos = fluid_.surfaceDensity();
@ -1039,12 +1040,12 @@ namespace {
void
FullyImplicitCompressiblePolymerSolver::classifyCondition(const PolymerBlackoilState& state)
{
const nc = grid_.number_of_cells;
const int nc = grid_.number_of_cells;
const DataBlock s = Eigen::Map<const DataBlock>(& state.saturation()[0], nc, 2);
const V so = s.col(1);
for (V::Index c = 0; e = so.size(); c != e; ++c) {
phaseConditon_[c].setFreeWater();
for (V::Index c = 0, e = so.size(); c != e; ++c) {
phaseCondition_[c].setFreeWater();
if (so[c] > 0) {
phaseCondition_[c].setFreeOil();
}

View File

@ -135,8 +135,8 @@ namespace Opm {
const WellOps wops_;
const M grav_;
V cmax_;
std::vector<ReservoirResidualQuant> rq_;
std::vector<PhasePresence> phaseCondition_;
std::vector<ReservoirResidualQuant> rq_;
// The mass_balance vector has one element for each active phase,
// each of which has size equal to the number of cells.
// The well_eq has size equal to the number of wells.
@ -225,7 +225,7 @@ namespace Opm {
ADB
fluidReciprocFVF(const int phase,
const ADB& p ,
const std::vector<PhasePresence>& cond
const std::vector<PhasePresence>& cond,
const std::vector<int>& cells) const;
ADB
@ -241,7 +241,7 @@ namespace Opm {
transMult(const ADB& p) const;
const std::vector<PhasePresence>
phaseCondition() const { return phaseConditon_; }
phaseCondition() const { return phaseCondition_; }
void
classifyCondition(const PolymerBlackoilState& state);

View File

@ -86,6 +86,7 @@ namespace Opm
public:
Impl(const parameter::ParameterGroup& param,
const UnstructuredGrid& grid,
const DerivedGeology& geo,
const BlackoilPropsAdInterface& props,
const PolymerPropsAd& polymer_props,
const RockCompressibility* rock_comp_props,
@ -131,6 +132,7 @@ namespace Opm
SimulatorFullyImplicitCompressiblePolymer::
SimulatorFullyImplicitCompressiblePolymer(const parameter::ParameterGroup& param,
const UnstructuredGrid& grid,
const DerivedGeology& geo,
const BlackoilPropsAdInterface& props,
const PolymerPropsAd& polymer_props,
const RockCompressibility* rock_comp_props,
@ -140,7 +142,7 @@ namespace Opm
const double* gravity)
{
pimpl_.reset(new Impl(param, grid, props, polymer_props, rock_comp_props, wells_manager, polymer_inflow, linsolver, gravity));
pimpl_.reset(new Impl(param, grid, geo, props, polymer_props, rock_comp_props, wells_manager, polymer_inflow, linsolver, gravity));
}
@ -293,7 +295,7 @@ namespace Opm
// Process transport sources (to include bdy terms and well flows).
// Opm::computeTransportSource(props_, wells_, well_state, transport_src);
// Run solver.
const double current_time = timer.currentTimeElapsed();
const double current_time = timer.simulationTimeElapsed();
double stepsize = timer.currentStepLength();
polymer_inflow_.getInflowValues(current_time, current_time + stepsize, polymer_inflow_c);
solver_timer.start();
@ -347,7 +349,7 @@ namespace Opm
tot_injected[1] += injected[1];
tot_produced[0] += produced[0];
tot_produced[1] += produced[1];
watercut.push(timer.currentTimeElapsed() + timer.currentStepLength(),
watercut.push(timer.simulationTimeElapsed() + timer.currentStepLength(),
produced[0]/(produced[0] + produced[1]),
tot_produced[0]/tot_porevol_init);
std::cout.precision(5);