dont copy the well model in computeWellPotentials

This commit is contained in:
Tor Harald Sandve
2020-12-22 09:25:56 +01:00
parent 2cce4a1af5
commit 967f99500c

View File

@@ -812,28 +812,17 @@ namespace Opm
return; return;
} }
} */ } */
debug_cost_counter_ = 0;
// creating a copy of the well itself, to avoid messing up the explicit informations
// during this copy, the only information not copied properly is the well controls
MultisegmentWell<TypeTag> well(*this);
well.debug_cost_counter_ = 0;
well.updatePrimaryVariables(well_state, deferred_logger);
// initialize the primary variables in Evaluation, which is used in computePerfRate for computeWellPotentials
// TODO: for computeWellPotentials, no derivative is required actually
well.initPrimaryVariablesEvaluation();
// does the well have a THP related constraint? // does the well have a THP related constraint?
const auto& summaryState = ebosSimulator.vanguard().summaryState(); const auto& summaryState = ebosSimulator.vanguard().summaryState();
const Well::ProducerCMode& current_control = well_state.currentProductionControls()[this->index_of_well_]; const Well::ProducerCMode& current_control = well_state.currentProductionControls()[this->index_of_well_];
if ( !well.Base::wellHasTHPConstraints(summaryState) || current_control == Well::ProducerCMode::BHP) { if ( !Base::wellHasTHPConstraints(summaryState) || current_control == Well::ProducerCMode::BHP) {
well.computeWellRatesAtBhpLimit(ebosSimulator, B_avg, well_potentials, deferred_logger); computeWellRatesAtBhpLimit(ebosSimulator, B_avg, well_potentials, deferred_logger);
} else { } else {
well_potentials = well.computeWellPotentialWithTHP(ebosSimulator, B_avg, deferred_logger); well_potentials = computeWellPotentialWithTHP(ebosSimulator, B_avg, deferred_logger);
} }
deferred_logger.debug("Cost in iterations of finding well potential for well " deferred_logger.debug("Cost in iterations of finding well potential for well "
+ name() + ": " + std::to_string(well.debug_cost_counter_)); + name() + ": " + std::to_string(debug_cost_counter_));
} }