Add asImpl() to some method calls.

This enables those methods (mostly well related) to be used polymorphically.
This commit is contained in:
Atgeirr Flø Rasmussen 2015-10-12 14:47:58 +02:00 committed by Kai Bao
parent ae512d5c83
commit 1c4f4c646d

View File

@ -899,12 +899,12 @@ namespace detail {
SolutionState state = asImpl().variableState(reservoir_state, well_state); SolutionState state = asImpl().variableState(reservoir_state, well_state);
SolutionState state0 = state; SolutionState state0 = state;
asImpl().makeConstantState(state0); asImpl().makeConstantState(state0);
computeWellConnectionPressures(state0, well_state); asImpl().computeWellConnectionPressures(state0, well_state);
} }
// Possibly switch well controls and updating well state to // Possibly switch well controls and updating well state to
// get reasonable initial conditions for the wells // get reasonable initial conditions for the wells
updateWellControls(well_state); asImpl().updateWellControls(well_state);
// Create the primary variables. // Create the primary variables.
SolutionState state = asImpl().variableState(reservoir_state, well_state); SolutionState state = asImpl().variableState(reservoir_state, well_state);
@ -916,7 +916,7 @@ namespace detail {
// Compute initial accumulation contributions // Compute initial accumulation contributions
// and well connection pressures. // and well connection pressures.
asImpl().computeAccum(state0, 0); asImpl().computeAccum(state0, 0);
computeWellConnectionPressures(state0, well_state); asImpl().computeWellConnectionPressures(state0, well_state);
} }
// OPM_AD_DISKVAL(state.pressure); // OPM_AD_DISKVAL(state.pressure);
@ -960,7 +960,7 @@ namespace detail {
asImpl().updatePerfPhaseRatesAndPressures(cq_s, state, well_state); asImpl().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
asImpl().addWellFluxEq(cq_s, state); asImpl().addWellFluxEq(cq_s, state);
asImpl().addWellContributionToMassBalanceEq(cq_s, state, well_state); asImpl().addWellContributionToMassBalanceEq(cq_s, state, well_state);
addWellControlEq(state, well_state, aliveWells); asImpl().addWellControlEq(state, well_state, aliveWells);
} }
@ -1594,15 +1594,15 @@ namespace detail {
// bhp and Q for the wells // bhp and Q for the wells
std::vector<V> vars0; std::vector<V> vars0;
vars0.reserve(2); vars0.reserve(2);
variableWellStateInitials(well_state, vars0); asImpl().variableWellStateInitials(well_state, vars0);
std::vector<ADB> vars = ADB::variables(vars0); std::vector<ADB> vars = ADB::variables(vars0);
SolutionState wellSolutionState = state0; SolutionState wellSolutionState = state0;
variableStateExtractWellsVars(indices, vars, wellSolutionState); asImpl().variableStateExtractWellsVars(indices, vars, wellSolutionState);
asImpl().computeWellFlux(wellSolutionState, mob_perfcells_const, b_perfcells_const, aliveWells, cq_s); asImpl().computeWellFlux(wellSolutionState, mob_perfcells_const, b_perfcells_const, aliveWells, cq_s);
asImpl().updatePerfPhaseRatesAndPressures(cq_s, wellSolutionState, well_state); asImpl().updatePerfPhaseRatesAndPressures(cq_s, wellSolutionState, well_state);
asImpl().addWellFluxEq(cq_s, wellSolutionState); asImpl().addWellFluxEq(cq_s, wellSolutionState);
addWellControlEq(wellSolutionState, well_state, aliveWells); asImpl().addWellControlEq(wellSolutionState, well_state, aliveWells);
converged = getWellConvergence(it); converged = getWellConvergence(it);
if (converged) { if (converged) {
@ -1625,8 +1625,8 @@ namespace detail {
ADB::V total_residual_v = total_residual.value(); ADB::V total_residual_v = total_residual.value();
const Eigen::VectorXd& dx = solver.solve(total_residual_v.matrix()); const Eigen::VectorXd& dx = solver.solve(total_residual_v.matrix());
assert(dx.size() == (well_state.numWells() * (well_state.numPhases()+1))); assert(dx.size() == (well_state.numWells() * (well_state.numPhases()+1)));
updateWellState(dx.array(), well_state); asImpl().updateWellState(dx.array(), well_state);
updateWellControls(well_state); asImpl().updateWellControls(well_state);
} }
} while (it < 15); } while (it < 15);
@ -2152,7 +2152,7 @@ namespace detail {
} }
updateWellState(dwells,well_state); asImpl().updateWellState(dwells,well_state);
// Update phase conditions used for property calculations. // Update phase conditions used for property calculations.
updatePhaseCondFromPrimalVariable(); updatePhaseCondFromPrimalVariable();