From e77cad793b7cc5a9adaf645f9db2f8ab1bda4d6c Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 22 Sep 2015 13:20:42 +0200 Subject: [PATCH] re-order the attributes of EclPeacemanWell and init them in the ctor re-ordering the attributes avoids some padding for EclPeacemanWell objects and -- more importantly -- makes their ordering slightly more logical. initializing them avoids a valgrind complaint when writing the initial condition to the ECL summary file. --- applications/ebos/eclpeacemanwell.hh | 65 ++++++++++++++++++++-------- applications/ebos/eclwellmanager.hh | 12 ++--- 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/applications/ebos/eclpeacemanwell.hh b/applications/ebos/eclpeacemanwell.hh index cc736f362..88badda2c 100644 --- a/applications/ebos/eclpeacemanwell.hh +++ b/applications/ebos/eclpeacemanwell.hh @@ -237,6 +237,32 @@ public: EclPeacemanWell(const Simulator &simulator) : simulator_(simulator) { + // set the initial status of the well + wellType_ = Undefined; + wellStatus_ = Shut; + controlMode_ = BottomHolePressure; + + wellTotalVolume_ = 0.0; + + bhpLimit_ = 0.0; + thpLimit_ = 0.0; + + targetBottomHolePressure_ = 0.0; + actualBottomHolePressure_ = 0.0; + maximumSurfaceRate_ = 0.0; + maximumReservoirRate_ = 0.0; + + actualWeightedSurfaceRate_ = 0.0; + actualWeightedResvRate_ = 0.0; + for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { + actualSurfaceRates_[phaseIdx] = 0.0; + actualResvRates_[phaseIdx] = 0.0; + + volumetricWeight_[phaseIdx] = 0.0; + } + + refDepth_ = 0.0; + // set the composition of the injected fluids based. If // somebody is stupid enough to inject oil, we assume he wants // to loose his fortune on dry oil... @@ -249,6 +275,8 @@ public: // set the temperature to 25 deg C, just so that it is set injectionFluidState_.setTemperature(273.15 + 25); + + injectedPhaseIdx_ = oilPhaseIdx; } /*! @@ -1439,6 +1467,20 @@ protected: // the number of times beginIteration*() was called for the current time step int iterationIdx_; + // the type of the well (injector, producer or undefined) + WellType wellType_; + + // Specifies whether the well is currently open, closed or shut. The difference + // between "closed" and "shut" is that for the former, the well is assumed to be + // closed above the reservoir so that cross-flow within the well is possible while + // the well is completely separated from the reservoir if it is shut. (i.e., no + // crossflow is possible in this case.) + WellStatus wellStatus_; + + // specifies the quantities which are controlled for (i.e., which + // should be assumed to be externally specified and which should + // be computed based on those) + ControlMode controlMode_; // the sum of the total volumes of all the degrees of freedoms that interact with the well Scalar wellTotalVolume_; @@ -1447,14 +1489,6 @@ protected: Scalar bhpLimit_; Scalar thpLimit_; - // specifies the quantities which are controlled for (i.e., which - // should be assumed to be externally specified and which should - // be computed based on those) - ControlMode controlMode_; - - // the type of the well (injector, producer or undefined) - WellType wellType_; - // The bottom hole pressure to be targeted by the well model. This may be computed // from the tubing head pressure (if the control mode is TubingHeadPressure), or it may be // just the user-specified bottom hole pressure if the control mode is @@ -1484,16 +1518,13 @@ protected: Scalar actualWeightedResvRate_; std::array actualResvRates_; - // Specifies whether the well is currently open, closed or shut. The difference - // between "closed" and "shut" is that for the former, the well is assumed to be - // closed above the reservoir so that cross-flow within the well is possible while - // the well is completely separated from the reservoir if it is shut. (i.e., no - // crossflow is possible in this case.) - WellStatus wellStatus_; - // The relative weight of the volumetric rate of each fluid Scalar volumetricWeight_[numPhases]; + // the reference depth for the bottom hole pressure. if not specified otherwise, this + // is the position of the _highest_ DOF in the well. + Scalar refDepth_; + // The thermodynamic state of the fluid which gets injected // // The fact that this attribute is mutable is kind of an hack @@ -1502,10 +1533,6 @@ protected: mutable FluidState injectionFluidState_; int injectedPhaseIdx_; - - // the reference depth for the bottom hole pressure. if not specified otherwise, this - // is the position of the _highest_ DOF in the well. - Scalar refDepth_; }; } // namespace Ewoms diff --git a/applications/ebos/eclwellmanager.hh b/applications/ebos/eclwellmanager.hh index 74053d7c8..01ef91ab5 100644 --- a/applications/ebos/eclwellmanager.hh +++ b/applications/ebos/eclwellmanager.hh @@ -683,8 +683,8 @@ protected: auto deckSchedule = eclStatePtr->getSchedule(); auto eclGrid = eclStatePtr->getEclipseGrid(); - assert( eclGrid->getNX() == simulator_.gridManager().cartesianDimensions()[ 0 ] ); - assert( eclGrid->getNY() == simulator_.gridManager().cartesianDimensions()[ 1 ] ); + assert((int) eclGrid->getNX() == simulator_.gridManager().cartesianDimensions()[0]); + assert((int) eclGrid->getNY() == simulator_.gridManager().cartesianDimensions()[1]); // compute the mapping from logically Cartesian indices to the well the // respective completion. @@ -708,9 +708,11 @@ protected: cartesianCoordinate[ 0 ] = completion->getI(); cartesianCoordinate[ 1 ] = completion->getJ(); cartesianCoordinate[ 2 ] = completion->getK(); - const int cartIdx = simulator_.gridManager().cartesianIndex( cartesianCoordinate ); - assert( cartIdx == (completion->getI() + completion->getJ()*eclGrid->getNX() - + completion->getK()*eclGrid->getNX()*eclGrid->getNY() ) ); + unsigned cartIdx = simulator_.gridManager().cartesianIndex( cartesianCoordinate ); + assert(cartIdx == + (completion->getI() + + completion->getJ()*eclGrid->getNX() + + completion->getK()*eclGrid->getNX()*eclGrid->getNY() ) ); // in this code we only support each cell to be part of at most a single // well. TODO (?) change this?