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.
This commit is contained in:
Andreas Lauser 2015-09-22 13:20:42 +02:00
parent 324b764a96
commit e77cad793b
2 changed files with 53 additions and 24 deletions

View File

@ -237,6 +237,32 @@ public:
EclPeacemanWell(const Simulator &simulator) EclPeacemanWell(const Simulator &simulator)
: 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 // set the composition of the injected fluids based. If
// somebody is stupid enough to inject oil, we assume he wants // somebody is stupid enough to inject oil, we assume he wants
// to loose his fortune on dry oil... // 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 // set the temperature to 25 deg C, just so that it is set
injectionFluidState_.setTemperature(273.15 + 25); injectionFluidState_.setTemperature(273.15 + 25);
injectedPhaseIdx_ = oilPhaseIdx;
} }
/*! /*!
@ -1439,6 +1467,20 @@ protected:
// the number of times beginIteration*() was called for the current time step // the number of times beginIteration*() was called for the current time step
int iterationIdx_; 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 // the sum of the total volumes of all the degrees of freedoms that interact with the well
Scalar wellTotalVolume_; Scalar wellTotalVolume_;
@ -1447,14 +1489,6 @@ protected:
Scalar bhpLimit_; Scalar bhpLimit_;
Scalar thpLimit_; 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 // 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 // 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 // just the user-specified bottom hole pressure if the control mode is
@ -1484,16 +1518,13 @@ protected:
Scalar actualWeightedResvRate_; Scalar actualWeightedResvRate_;
std::array<Scalar, numPhases> actualResvRates_; std::array<Scalar, numPhases> 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 // The relative weight of the volumetric rate of each fluid
Scalar volumetricWeight_[numPhases]; 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 thermodynamic state of the fluid which gets injected
// //
// The fact that this attribute is mutable is kind of an hack // The fact that this attribute is mutable is kind of an hack
@ -1502,10 +1533,6 @@ protected:
mutable FluidState injectionFluidState_; mutable FluidState injectionFluidState_;
int injectedPhaseIdx_; 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 } // namespace Ewoms

View File

@ -683,8 +683,8 @@ protected:
auto deckSchedule = eclStatePtr->getSchedule(); auto deckSchedule = eclStatePtr->getSchedule();
auto eclGrid = eclStatePtr->getEclipseGrid(); auto eclGrid = eclStatePtr->getEclipseGrid();
assert( eclGrid->getNX() == simulator_.gridManager().cartesianDimensions()[ 0 ] ); assert((int) eclGrid->getNX() == simulator_.gridManager().cartesianDimensions()[0]);
assert( eclGrid->getNY() == simulator_.gridManager().cartesianDimensions()[ 1 ] ); assert((int) eclGrid->getNY() == simulator_.gridManager().cartesianDimensions()[1]);
// compute the mapping from logically Cartesian indices to the well the // compute the mapping from logically Cartesian indices to the well the
// respective completion. // respective completion.
@ -708,9 +708,11 @@ protected:
cartesianCoordinate[ 0 ] = completion->getI(); cartesianCoordinate[ 0 ] = completion->getI();
cartesianCoordinate[ 1 ] = completion->getJ(); cartesianCoordinate[ 1 ] = completion->getJ();
cartesianCoordinate[ 2 ] = completion->getK(); cartesianCoordinate[ 2 ] = completion->getK();
const int cartIdx = simulator_.gridManager().cartesianIndex( cartesianCoordinate ); unsigned cartIdx = simulator_.gridManager().cartesianIndex( cartesianCoordinate );
assert( cartIdx == (completion->getI() + completion->getJ()*eclGrid->getNX() assert(cartIdx ==
+ completion->getK()*eclGrid->getNX()*eclGrid->getNY() ) ); (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 // in this code we only support each cell to be part of at most a single
// well. TODO (?) change this? // well. TODO (?) change this?