diff --git a/opm/core/io/eclipse/EclipseWriter.cpp b/opm/core/io/eclipse/EclipseWriter.cpp index ea4a1805..93f17ff5 100644 --- a/opm/core/io/eclipse/EclipseWriter.cpp +++ b/opm/core/io/eclipse/EclipseWriter.cpp @@ -547,14 +547,13 @@ protected: flatIdx_ = timeStepWellIdx_*phaseUses_.num_phases + phaseUses_.phase_pos[phaseIdx_]; } + // return m^3/s of injected or produced fluid double rate(const WellState& wellState) { - // convert m^3/s of injected fluid to m^3/d of produced fluid - const double convFactor = Opm::unit::day; double value = 0; if (wellState.wellRates().size() > 0) { assert(int(wellState.wellRates().size()) > flatIdx_); - value = sign_ * wellState.wellRates()[flatIdx_] * convFactor; + value = sign_ * wellState.wellRates()[flatIdx_]; } return value; } @@ -668,7 +667,9 @@ public: } // TODO: Why only positive rates? - return std::max(0., rate(wellState)); + using namespace Opm::unit; + return convert::to(std::max(0., rate(wellState)), + cubic(meter)/day); } }; @@ -711,10 +712,11 @@ public: return 0.0; } - // TODO: Is the rate average for the timestep, or is in - // instantaneous (in which case trapezoidal or Simpson integration - // would probably be better) + // due to using an Euler method as time integration scheme, the well rate is the + // average for the time step. For more complicated time stepping schemes, the + // integral of the rate is not simply multiplying two numbers... const double intg = timer.stepLengthTaken() * rate(wellState); + // add this timesteps production to the total total_ += intg; // report the new production total