ebos: allow to completely disable the well treatment

this is useful if wells shall be handled externally (e.g. most
prominently the upcoming flow wrapper which uses ebos to linearize the
mass balance equations).

disabling the well treatment can be done by setting the DisableWells
property to "true".
This commit is contained in:
Andreas Lauser 2016-06-07 17:43:45 +02:00
parent f0161dc1c9
commit 98cfa30f92

View File

@ -103,6 +103,9 @@ NEW_PROP_TAG(EnableWriteAllSolutions);
// The number of time steps skipped between writing two consequtive restart files // The number of time steps skipped between writing two consequtive restart files
NEW_PROP_TAG(RestartWritingInterval); NEW_PROP_TAG(RestartWritingInterval);
// Disable well treatment (for users which do this externally)
NEW_PROP_TAG(DisableWells);
// Set the problem property // Set the problem property
SET_TYPE_PROP(EclBaseProblem, Problem, Ewoms::EclProblem<TypeTag>); SET_TYPE_PROP(EclBaseProblem, Problem, Ewoms::EclProblem<TypeTag>);
@ -197,6 +200,9 @@ SET_STRING_PROP(EclBaseProblem, GridFile, "data/ecl.DATA");
// between writing restart files // between writing restart files
SET_INT_PROP(EclBaseProblem, RestartWritingInterval, 0xffffff); // disable SET_INT_PROP(EclBaseProblem, RestartWritingInterval, 0xffffff); // disable
// By default, ebos should handle the wells internally, so we don't disable the well
// treatment
SET_INT_PROP(EclBaseProblem, DisableWells, false);
} // namespace Properties } // namespace Properties
/*! /*!
@ -389,8 +395,9 @@ public:
simulator.setTimeStepSize(dt); simulator.setTimeStepSize(dt);
} }
// set up the wells if (!GET_PROP_VALUE(TypeTag, DisableWells))
wellManager_.beginEpisode(this->simulator().gridManager().eclState(), isOnRestart); // set up the wells
wellManager_.beginEpisode(this->simulator().gridManager().eclState(), isOnRestart);
} }
/*! /*!
@ -398,14 +405,16 @@ public:
*/ */
void beginTimeStep() void beginTimeStep()
{ {
wellManager_.beginTimeStep(); if (!GET_PROP_VALUE(TypeTag, DisableWells)) {
wellManager_.beginTimeStep();
// this is a little hack to write the initial condition, which we need to do // this is a little hack to write the initial condition, which we need to do
// before the first time step has finished. // before the first time step has finished.
static bool initialWritten = false; static bool initialWritten = false;
if (this->simulator().episodeIndex() == 0 && !initialWritten) { if (this->simulator().episodeIndex() == 0 && !initialWritten) {
summaryWriter_.write(wellManager_, /*isInitial=*/true); summaryWriter_.write(wellManager_, /*isInitial=*/true);
initialWritten = true; initialWritten = true;
}
} }
} }
@ -413,13 +422,19 @@ public:
* \brief Called by the simulator before each Newton-Raphson iteration. * \brief Called by the simulator before each Newton-Raphson iteration.
*/ */
void beginIteration() void beginIteration()
{ wellManager_.beginIteration(); } {
if (!GET_PROP_VALUE(TypeTag, DisableWells))
wellManager_.beginIteration();
}
/*! /*!
* \brief Called by the simulator after each Newton-Raphson iteration. * \brief Called by the simulator after each Newton-Raphson iteration.
*/ */
void endIteration() void endIteration()
{ wellManager_.endIteration(); } {
if (!GET_PROP_VALUE(TypeTag, DisableWells))
wellManager_.endIteration();
}
/*! /*!
* \brief Called by the simulator after each time integration. * \brief Called by the simulator after each time integration.
@ -434,10 +449,12 @@ public:
this->model().checkConservativeness(/*tolerance=*/-1, /*verbose=*/true); this->model().checkConservativeness(/*tolerance=*/-1, /*verbose=*/true);
#endif // NDEBUG #endif // NDEBUG
wellManager_.endTimeStep(); if (!GET_PROP_VALUE(TypeTag, DisableWells)) {
wellManager_.endTimeStep();
// write the summary information after each time step // write the summary information after each time step
summaryWriter_.write(wellManager_); summaryWriter_.write(wellManager_);
}
bool cachesInvalid = false; bool cachesInvalid = false;
@ -696,10 +713,12 @@ public:
*/ */
void initialSolutionApplied() void initialSolutionApplied()
{ {
// initialize the wells. Note that this needs to be done after initializing the if (!GET_PROP_VALUE(TypeTag, DisableWells)) {
// intrinsic permeabilities and the after applying the initial solution because // initialize the wells. Note that this needs to be done after initializing the
// the well model uses these... // intrinsic permeabilities and the after applying the initial solution because
wellManager_.init(this->simulator().gridManager().eclState()); // the well model uses these...
wellManager_.init(this->simulator().gridManager().eclState());
}
// update the data required for capillary pressure hysteresis // update the data required for capillary pressure hysteresis
updateHysteresis_(); updateHysteresis_();
@ -723,13 +742,15 @@ public:
{ {
rate = 0.0; rate = 0.0;
wellManager_.computeTotalRatesForDof(rate, context, spaceIdx, timeIdx); if (!GET_PROP_VALUE(TypeTag, DisableWells)) {
wellManager_.computeTotalRatesForDof(rate, context, spaceIdx, timeIdx);
// convert the source term from the total mass rate of the // convert the source term from the total mass rate of the
// cell to the one per unit of volume as used by the model. // cell to the one per unit of volume as used by the model.
unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx); unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx) for (unsigned eqIdx = 0; eqIdx < numEq; ++ eqIdx)
rate[eqIdx] /= this->model().dofTotalVolume(globalDofIdx); rate[eqIdx] /= this->model().dofTotalVolume(globalDofIdx);
}
} }
/*! /*!