updating the primary variables before calculating accumulation term

This commit is contained in:
Kai Bao 2019-02-27 10:46:10 +01:00
parent 79e51ab724
commit 1df65913d7

View File

@ -817,9 +817,11 @@ namespace Opm
void
MultisegmentWell<TypeTag>::
calculateExplicitQuantities(const Simulator& ebosSimulator,
const WellState& /* well_state */,
const WellState& well_state,
Opm::DeferredLogger& deferred_logger)
{
updatePrimaryVariables(well_state);
initPrimaryVariablesEvaluation();
computePerfCellPressDiffs(ebosSimulator);
computeInitialSegmentFluids(ebosSimulator);
}
@ -1024,8 +1026,7 @@ namespace Opm
if ( drawdown > 0.0) {
// Do nothing is crossflow is not allowed
if (!allow_cf && well_type_ == INJECTOR) {
// TODO: actaully, we did not have a case to test if it is the same case for injectors
drawdown = -mini_drawdown;
return;
}
// compute component volumetric rates at standard conditions
@ -1045,7 +1046,7 @@ namespace Opm
} else { // injecting perforations
// Do nothing if crossflow is not allowed
if (!allow_cf && well_type_ == PRODUCER) {
drawdown = mini_drawdown;
return;
}
// for injecting perforations, we use total mobility
@ -1836,8 +1837,9 @@ namespace Opm
const EvalWell segment_surface_volume = getSegmentSurfaceVolume(ebosSimulator, seg);
// for each component
for (int comp_idx = 0; comp_idx < num_components_; ++comp_idx) {
EvalWell accumulation_term = (segment_surface_volume * surfaceVolumeFraction(seg, comp_idx)
- segment_fluid_initial_[seg][comp_idx]) / dt + getSegmentRate(seg, comp_idx);
const EvalWell accumulation_term = (segment_fluid_initial_[seg][comp_idx]
- segment_surface_volume * surfaceVolumeFraction(seg, comp_idx) ) / dt
+ getSegmentRate(seg, comp_idx);
resWell_[seg][comp_idx] += accumulation_term.value();
for (int pv_idx = 0; pv_idx < numWellEq; ++pv_idx) {