mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-16 20:24:48 -06:00
Merge pull request #1915 from GitPaean/fixing_warnings_
fixing warnings under opm-simulators
This commit is contained in:
commit
e731715924
@ -659,7 +659,6 @@ public:
|
|||||||
if (enableTuning_) {
|
if (enableTuning_) {
|
||||||
// if support for the TUNING keyword is enabled, we get the initial time
|
// if support for the TUNING keyword is enabled, we get the initial time
|
||||||
// steping parameters from it instead of from command line parameters
|
// steping parameters from it instead of from command line parameters
|
||||||
const auto& schedule = simulator.vanguard().schedule();
|
|
||||||
const auto& tuning = schedule.getTuning();
|
const auto& tuning = schedule.getTuning();
|
||||||
initialTimeStepSize_ = tuning.getTSINIT(0);
|
initialTimeStepSize_ = tuning.getTSINIT(0);
|
||||||
maxTimeStepAfterWellEvent_ = tuning.getTMAXWC(0);
|
maxTimeStepAfterWellEvent_ = tuning.getTMAXWC(0);
|
||||||
@ -745,7 +744,7 @@ public:
|
|||||||
void deserialize(Restarter& res)
|
void deserialize(Restarter& res)
|
||||||
{
|
{
|
||||||
// reload the current episode/report step from the deck
|
// reload the current episode/report step from the deck
|
||||||
beginEpisode(/*isOnRestart=*/true);
|
beginEpisode();
|
||||||
|
|
||||||
// deserialize the wells
|
// deserialize the wells
|
||||||
wellModel_.deserialize(res);
|
wellModel_.deserialize(res);
|
||||||
@ -773,7 +772,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Called by the simulator before an episode begins.
|
* \brief Called by the simulator before an episode begins.
|
||||||
*/
|
*/
|
||||||
void beginEpisode(bool isOnRestart = false)
|
void beginEpisode()
|
||||||
{
|
{
|
||||||
// Proceed to the next report step
|
// Proceed to the next report step
|
||||||
auto& simulator = this->simulator();
|
auto& simulator = this->simulator();
|
||||||
@ -1514,7 +1513,7 @@ public:
|
|||||||
|
|
||||||
// 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);
|
const 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);
|
||||||
|
|
||||||
@ -1528,7 +1527,6 @@ public:
|
|||||||
// if requested, compensate systematic mass loss for cells which were "well
|
// if requested, compensate systematic mass loss for cells which were "well
|
||||||
// behaved" in the last time step
|
// behaved" in the last time step
|
||||||
if (enableDriftCompensation_) {
|
if (enableDriftCompensation_) {
|
||||||
unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
|
||||||
const auto& intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
|
const auto& intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
|
||||||
const auto& simulator = this->simulator();
|
const auto& simulator = this->simulator();
|
||||||
const auto& model = this->model();
|
const auto& model = this->model();
|
||||||
@ -2651,10 +2649,10 @@ private:
|
|||||||
//////
|
//////
|
||||||
// set temperature
|
// set temperature
|
||||||
//////
|
//////
|
||||||
Scalar temperature = tempiData[cartesianDofIdx];
|
Scalar temperatureLoc = tempiData[cartesianDofIdx];
|
||||||
if (!std::isfinite(temperature) || temperature <= 0)
|
if (!std::isfinite(temperatureLoc) || temperatureLoc <= 0)
|
||||||
temperature = FluidSystem::surfaceTemperature;
|
temperatureLoc = FluidSystem::surfaceTemperature;
|
||||||
dofFluidState.setTemperature(temperature);
|
dofFluidState.setTemperature(temperatureLoc);
|
||||||
|
|
||||||
//////
|
//////
|
||||||
// set saturations
|
// set saturations
|
||||||
|
@ -80,7 +80,7 @@ namespace Opm
|
|||||||
OPM_THROW(std::runtime_error, "Trying to add well " << wellChild.name() << " Step: " << boost::lexical_cast<std::string>(timeStep) << " to group named " << wellChild.groupName() << ", but this group does not exist in the WellCollection.");
|
OPM_THROW(std::runtime_error, "Trying to add well " << wellChild.name() << " Step: " << boost::lexical_cast<std::string>(timeStep) << " to group named " << wellChild.groupName() << ", but this group does not exist in the WellCollection.");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<WellsGroupInterface> child = createWellWellsGroup(wellChild, summaryState, timeStep, phaseUsage);
|
std::shared_ptr<WellsGroupInterface> child = createWellWellsGroup(wellChild, summaryState, phaseUsage);
|
||||||
|
|
||||||
WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent);
|
WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent);
|
||||||
if (!parent_as_group) {
|
if (!parent_as_group) {
|
||||||
|
@ -1588,7 +1588,7 @@ namespace Opm
|
|||||||
'CMODE_UNDEFINED' - we do not carry that over the specification
|
'CMODE_UNDEFINED' - we do not carry that over the specification
|
||||||
objects here.
|
objects here.
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well, const SummaryState& summaryState, size_t timeStep, const PhaseUsage& phase_usage )
|
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well, const SummaryState& summaryState, const PhaseUsage& phase_usage )
|
||||||
{
|
{
|
||||||
InjectionSpecification injection_specification;
|
InjectionSpecification injection_specification;
|
||||||
ProductionSpecification production_specification;
|
ProductionSpecification production_specification;
|
||||||
|
@ -543,7 +543,6 @@ namespace Opm
|
|||||||
/// \param[in] the phase usage
|
/// \param[in] the phase usage
|
||||||
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well,
|
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
size_t timeStep,
|
|
||||||
const PhaseUsage& phase_usage );
|
const PhaseUsage& phase_usage );
|
||||||
|
|
||||||
/// Creates the WellsGroupInterface for the given Group
|
/// Creates the WellsGroupInterface for the given Group
|
||||||
|
@ -294,7 +294,6 @@ namespace Opm
|
|||||||
|
|
||||||
void WellsManager::setupWellControls(const std::vector<Well2>& wells,
|
void WellsManager::setupWellControls(const std::vector<Well2>& wells,
|
||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
size_t timeStep,
|
|
||||||
std::vector<std::string>& well_names,
|
std::vector<std::string>& well_names,
|
||||||
const PhaseUsage& phaseUsage,
|
const PhaseUsage& phaseUsage,
|
||||||
const std::vector<int>& wells_on_proc) {
|
const std::vector<int>& wells_on_proc) {
|
||||||
@ -599,7 +598,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// only handle the guide rates from the keyword WGRUPCON
|
// only handle the guide rates from the keyword WGRUPCON
|
||||||
void WellsManager::setupGuideRates(const std::vector<Well2>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index)
|
void WellsManager::setupGuideRates(const std::vector<Well2>& wells, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index)
|
||||||
{
|
{
|
||||||
for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter ) {
|
for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter ) {
|
||||||
const auto& well = *wellIter;
|
const auto& well = *wellIter;
|
||||||
|
@ -170,7 +170,7 @@ namespace Opm
|
|||||||
WellsManager(const WellsManager& other);
|
WellsManager(const WellsManager& other);
|
||||||
WellsManager& operator=(const WellsManager& other);
|
WellsManager& operator=(const WellsManager& other);
|
||||||
static void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed );
|
static void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed );
|
||||||
void setupWellControls(const std::vector<Well2>& wells, const SummaryState& summaryState, size_t timeStep,
|
void setupWellControls(const std::vector<Well2>& wells, const SummaryState& summaryState,
|
||||||
std::vector<std::string>& well_names, const PhaseUsage& phaseUsage,
|
std::vector<std::string>& well_names, const PhaseUsage& phaseUsage,
|
||||||
const std::vector<int>& wells_on_proc);
|
const std::vector<int>& wells_on_proc);
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ namespace Opm
|
|||||||
std::vector<int>& wells_on_proc,
|
std::vector<int>& wells_on_proc,
|
||||||
const std::unordered_set<std::string>& deactivated_wells);
|
const std::unordered_set<std::string>& deactivated_wells);
|
||||||
|
|
||||||
void setupGuideRates(const std::vector<Well2>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
|
void setupGuideRates(const std::vector<Well2>& wells, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
Wells* w_;
|
Wells* w_;
|
||||||
|
@ -226,16 +226,16 @@ void WellsManager::createWellsFromSpecs(const std::vector<Well2>& wells, size_t
|
|||||||
destroy_wells( w );
|
destroy_wells( w );
|
||||||
|
|
||||||
// Add wells.
|
// Add wells.
|
||||||
for (int w = 0; w < num_wells; ++w) {
|
for (int iw = 0; iw < num_wells; ++iw) {
|
||||||
const int w_num_perf = wellperf_data[w].size();
|
const int w_num_perf = wellperf_data[iw].size();
|
||||||
std::vector<int> perf_cells (w_num_perf);
|
std::vector<int> perf_cells (w_num_perf);
|
||||||
std::vector<double> perf_prodind(w_num_perf);
|
std::vector<double> perf_prodind(w_num_perf);
|
||||||
std::vector<int> perf_satnumid(w_num_perf);
|
std::vector<int> perf_satnumid(w_num_perf);
|
||||||
|
|
||||||
for (int perf = 0; perf < w_num_perf; ++perf) {
|
for (int perf = 0; perf < w_num_perf; ++perf) {
|
||||||
perf_cells [perf] = wellperf_data[w][perf].cell;
|
perf_cells [perf] = wellperf_data[iw][perf].cell;
|
||||||
perf_prodind[perf] = wellperf_data[w][perf].well_index;
|
perf_prodind[perf] = wellperf_data[iw][perf].well_index;
|
||||||
perf_satnumid[perf] = wellperf_data[w][perf].satnumid;
|
perf_satnumid[perf] = wellperf_data[iw][perf].satnumid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const double* comp_frac = NULL;
|
const double* comp_frac = NULL;
|
||||||
@ -243,21 +243,21 @@ void WellsManager::createWellsFromSpecs(const std::vector<Well2>& wells, size_t
|
|||||||
// We initialize all wells with a null component fraction,
|
// We initialize all wells with a null component fraction,
|
||||||
// and must (for injection wells) overwrite it later.
|
// and must (for injection wells) overwrite it later.
|
||||||
const int ok =
|
const int ok =
|
||||||
add_well(well_data[w].type,
|
add_well(well_data[iw].type,
|
||||||
well_data[w].reference_bhp_depth,
|
well_data[iw].reference_bhp_depth,
|
||||||
w_num_perf,
|
w_num_perf,
|
||||||
comp_frac,
|
comp_frac,
|
||||||
perf_cells.data(),
|
perf_cells.data(),
|
||||||
perf_prodind.data(),
|
perf_prodind.data(),
|
||||||
perf_satnumid.data(),
|
perf_satnumid.data(),
|
||||||
well_names[w].c_str(),
|
well_names[iw].c_str(),
|
||||||
well_data[w].allowCrossFlow,
|
well_data[iw].allowCrossFlow,
|
||||||
w_);
|
w_);
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
OPM_THROW(std::runtime_error,
|
OPM_THROW(std::runtime_error,
|
||||||
"Failed adding well "
|
"Failed adding well "
|
||||||
<< well_names[w]
|
<< well_names[iw]
|
||||||
<< " to Wells data structure.");
|
<< " to Wells data structure.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
|
|||||||
pu, cartesian_to_compressed, interleavedPerm.data(), ntg,
|
pu, cartesian_to_compressed, interleavedPerm.data(), ntg,
|
||||||
wells_on_proc, deactivated_wells);
|
wells_on_proc, deactivated_wells);
|
||||||
|
|
||||||
setupWellControls(wells, summaryState, timeStep, well_names, pu, wells_on_proc);
|
setupWellControls(wells, summaryState, well_names, pu, wells_on_proc);
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto& fieldGroup = schedule.getGroup( "FIELD" );
|
const auto& fieldGroup = schedule.getGroup( "FIELD" );
|
||||||
@ -401,7 +401,7 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
|
|||||||
|
|
||||||
if (well_collection_.groupControlActive()) {
|
if (well_collection_.groupControlActive()) {
|
||||||
// here does not consider the well potentials related guide rate setting
|
// here does not consider the well potentials related guide rate setting
|
||||||
setupGuideRates(wells, timeStep, well_data, well_names_to_index);
|
setupGuideRates(wells, well_data, well_names_to_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug output.
|
// Debug output.
|
||||||
|
@ -437,8 +437,8 @@ namespace Opm {
|
|||||||
resultDenom += pressureNew*pressureNew;
|
resultDenom += pressureNew*pressureNew;
|
||||||
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++ phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++ phaseIdx) {
|
||||||
Scalar tmp = saturationsNew[phaseIdx] - saturationsOld[phaseIdx];
|
const Scalar tmpSat = saturationsNew[phaseIdx] - saturationsOld[phaseIdx];
|
||||||
resultDelta += tmp*tmp;
|
resultDelta += tmpSat * tmpSat;
|
||||||
resultDenom += saturationsNew[phaseIdx]*saturationsNew[phaseIdx];
|
resultDenom += saturationsNew[phaseIdx]*saturationsNew[phaseIdx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -882,9 +882,9 @@ namespace Opm {
|
|||||||
const BlackoilWellModel<TypeTag>&
|
const BlackoilWellModel<TypeTag>&
|
||||||
wellModel() const { return well_model_; }
|
wellModel() const { return well_model_; }
|
||||||
|
|
||||||
void beginReportStep(bool isRestart)
|
void beginReportStep()
|
||||||
{
|
{
|
||||||
ebosSimulator_.problem().beginEpisode(isRestart);
|
ebosSimulator_.problem().beginEpisode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void endReportStep()
|
void endReportStep()
|
||||||
|
@ -204,10 +204,6 @@ public:
|
|||||||
wellModel_().initFromRestartFile(*restartValues);
|
wellModel_().initFromRestartFile(*restartValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
// beginReportStep(...) wants to know when we are at the
|
|
||||||
// beginning of a restart
|
|
||||||
bool firstRestartStep = isRestart();
|
|
||||||
|
|
||||||
// Main simulation loop.
|
// Main simulation loop.
|
||||||
while (!timer.done()) {
|
while (!timer.done()) {
|
||||||
// Report timestep.
|
// Report timestep.
|
||||||
@ -252,9 +248,7 @@ public:
|
|||||||
ebosSimulator_.startNextEpisode(ebosSimulator_.startTime() + schedule().getTimeMap().getTimePassedUntil(timer.currentStepNum()),
|
ebosSimulator_.startNextEpisode(ebosSimulator_.startTime() + schedule().getTimeMap().getTimePassedUntil(timer.currentStepNum()),
|
||||||
timer.currentStepLength());
|
timer.currentStepLength());
|
||||||
ebosSimulator_.setEpisodeIndex(timer.currentStepNum());
|
ebosSimulator_.setEpisodeIndex(timer.currentStepNum());
|
||||||
solver->model().beginReportStep(firstRestartStep);
|
solver->model().beginReportStep();
|
||||||
firstRestartStep = false;
|
|
||||||
|
|
||||||
|
|
||||||
// If sub stepping is enabled allow the solver to sub cycle
|
// If sub stepping is enabled allow the solver to sub cycle
|
||||||
// in case the report steps are too large for the solver to converge
|
// in case the report steps are too large for the solver to converge
|
||||||
|
@ -335,7 +335,6 @@ protected:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const WellModel& wellModel = simulator_.problem().wellModel();
|
|
||||||
typedef WellModelMatrixAdapter< Matrix, Vector, Vector, WellModel, false > Operator;
|
typedef WellModelMatrixAdapter< Matrix, Vector, Vector, WellModel, false > Operator;
|
||||||
Operator opA(*matrix_, *matrix_, wellModel);
|
Operator opA(*matrix_, *matrix_, wellModel);
|
||||||
solve( opA, x, *rhs_ );
|
solve( opA, x, *rhs_ );
|
||||||
|
@ -520,8 +520,8 @@ namespace Opm {
|
|||||||
failing_wells.insert(wf.wellName());
|
failing_wells.insert(wf.wellName());
|
||||||
}
|
}
|
||||||
if (sr_size >= num_steps) {
|
if (sr_size >= num_steps) {
|
||||||
for (int step = 1; step < num_steps; ++step) {
|
for (int s = 1; s < num_steps; ++s) {
|
||||||
const auto& srep = sr[sr_size - 1 - step];
|
const auto& srep = sr[sr_size - 1 - s];
|
||||||
// Report must be from same report step and substep, otherwise we have
|
// Report must be from same report step and substep, otherwise we have
|
||||||
// not chopped/retried enough times on this step.
|
// not chopped/retried enough times on this step.
|
||||||
if (srep.report_step != rep_step || srep.current_step != sub_step) {
|
if (srep.report_step != rep_step || srep.current_step != sub_step) {
|
||||||
|
@ -389,7 +389,7 @@ namespace Opm {
|
|||||||
|
|
||||||
void prepareGroupControl(Opm::DeferredLogger& deferred_logger);
|
void prepareGroupControl(Opm::DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void computeRESV(const std::size_t step, Opm::DeferredLogger& deferred_logger);
|
void computeRESV(Opm::DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void extractLegacyCellPvtRegionIndex_();
|
void extractLegacyCellPvtRegionIndex_();
|
||||||
|
|
||||||
@ -414,11 +414,10 @@ namespace Opm {
|
|||||||
void wellsToState( const data::Wells& wells,
|
void wellsToState( const data::Wells& wells,
|
||||||
const PhaseUsage& phases,
|
const PhaseUsage& phases,
|
||||||
const bool handle_ms_well,
|
const bool handle_ms_well,
|
||||||
const int report_step,
|
|
||||||
WellStateFullyImplicitBlackoil& state ) const;
|
WellStateFullyImplicitBlackoil& state ) const;
|
||||||
|
|
||||||
// whether there exists any multisegment well open on this process
|
// whether there exists any multisegment well open on this process
|
||||||
bool anyMSWellOpenLocal(const Wells* wells, const int report_step) const;
|
bool anyMSWellOpenLocal(const Wells* wells) const;
|
||||||
|
|
||||||
const Well2& getWellEcl(const std::string& well_name) const;
|
const Well2& getWellEcl(const std::string& well_name) const;
|
||||||
};
|
};
|
||||||
|
@ -169,23 +169,18 @@ namespace Opm {
|
|||||||
forceShutWellByNameIfPredictionMode(const std::string& wellname,
|
forceShutWellByNameIfPredictionMode(const std::string& wellname,
|
||||||
const double simulation_time)
|
const double simulation_time)
|
||||||
{
|
{
|
||||||
Opm::DeferredLogger local_deferredLogger;
|
|
||||||
// Only add the well to the closed list on the
|
// Only add the well to the closed list on the
|
||||||
// process that owns it.
|
// process that owns it.
|
||||||
int well_was_shut = 0;
|
int well_was_shut = 0;
|
||||||
for (const auto& well : well_container_) {
|
for (const auto& well : well_container_) {
|
||||||
if (well->name() == wellname) {
|
if (well->name() == wellname) {
|
||||||
if (well->underPredictionMode(local_deferredLogger)) {
|
if (well->underPredictionMode()) {
|
||||||
wellTestState_.closeWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time);
|
wellTestState_.closeWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time);
|
||||||
well_was_shut = 1;
|
well_was_shut = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Opm::DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger);
|
|
||||||
if (terminal_output_) {
|
|
||||||
global_deferredLogger.logMessages();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Communicate across processes if a well was shut.
|
// Communicate across processes if a well was shut.
|
||||||
well_was_shut = ebosSimulator_.vanguard().grid().comm().max(well_was_shut);
|
well_was_shut = ebosSimulator_.vanguard().grid().comm().max(well_was_shut);
|
||||||
@ -263,8 +258,8 @@ namespace Opm {
|
|||||||
well_state_.init(wells(), cellPressures, schedule(), wells_ecl_, timeStepIdx, &previous_well_state_, phase_usage_);
|
well_state_.init(wells(), cellPressures, schedule(), wells_ecl_, timeStepIdx, &previous_well_state_, phase_usage_);
|
||||||
|
|
||||||
// handling MS well related
|
// handling MS well related
|
||||||
if (param_.use_multisegment_well_&& anyMSWellOpenLocal(wells(), timeStepIdx)) { // if we use MultisegmentWell model
|
if (param_.use_multisegment_well_&& anyMSWellOpenLocal(wells())) { // if we use MultisegmentWell model
|
||||||
well_state_.initWellStateMSWell(wells(), wells_ecl_, timeStepIdx, phase_usage_, &previous_well_state_);
|
well_state_.initWellStateMSWell(wells(), wells_ecl_, phase_usage_, &previous_well_state_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the previous well state. This is used to restart failed steps.
|
// update the previous well state. This is used to restart failed steps.
|
||||||
@ -276,7 +271,7 @@ namespace Opm {
|
|||||||
|
|
||||||
int exception_thrown = 0;
|
int exception_thrown = 0;
|
||||||
try {
|
try {
|
||||||
computeRESV(timeStepIdx, local_deferredLogger);
|
computeRESV(local_deferredLogger);
|
||||||
} catch (const std::exception& e){
|
} catch (const std::exception& e){
|
||||||
exception_thrown = 1;
|
exception_thrown = 1;
|
||||||
}
|
}
|
||||||
@ -502,9 +497,9 @@ namespace Opm {
|
|||||||
if (nw > 0) {
|
if (nw > 0) {
|
||||||
const auto phaseUsage = phaseUsageFromDeck(eclState());
|
const auto phaseUsage = phaseUsageFromDeck(eclState());
|
||||||
const size_t numCells = Opm::UgGridHelpers::numCells(grid());
|
const size_t numCells = Opm::UgGridHelpers::numCells(grid());
|
||||||
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal(wells, report_step));
|
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal(wells));
|
||||||
well_state_.resize(wells, wells_ecl_, schedule(), handle_ms_well, report_step, numCells, phaseUsage); // Resize for restart step
|
well_state_.resize(wells, wells_ecl_, schedule(), handle_ms_well, numCells, phaseUsage); // Resize for restart step
|
||||||
wellsToState(restartValues.wells, phaseUsage, handle_ms_well, report_step, well_state_);
|
wellsToState(restartValues.wells, phaseUsage, handle_ms_well, well_state_);
|
||||||
previous_well_state_ = well_state_;
|
previous_well_state_ = well_state_;
|
||||||
}
|
}
|
||||||
initial_step_ = false;
|
initial_step_ = false;
|
||||||
@ -1645,7 +1640,7 @@ namespace Opm {
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
BlackoilWellModel<TypeTag>::
|
BlackoilWellModel<TypeTag>::
|
||||||
computeRESV(const std::size_t step, Opm::DeferredLogger& deferred_logger)
|
computeRESV(Opm::DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
|
|
||||||
const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells());
|
const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells());
|
||||||
@ -1731,8 +1726,7 @@ namespace Opm {
|
|||||||
wellsToState( const data::Wells& wells,
|
wellsToState( const data::Wells& wells,
|
||||||
const PhaseUsage& phases,
|
const PhaseUsage& phases,
|
||||||
const bool handle_ms_well,
|
const bool handle_ms_well,
|
||||||
const int report_step,
|
WellStateFullyImplicitBlackoil& state) const
|
||||||
WellStateFullyImplicitBlackoil& state ) const
|
|
||||||
{
|
{
|
||||||
|
|
||||||
using rt = data::Rates::opt;
|
using rt = data::Rates::opt;
|
||||||
@ -1825,7 +1819,7 @@ namespace Opm {
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
bool
|
bool
|
||||||
BlackoilWellModel<TypeTag>::
|
BlackoilWellModel<TypeTag>::
|
||||||
anyMSWellOpenLocal(const Wells* wells, const int report_step) const
|
anyMSWellOpenLocal(const Wells* wells) const
|
||||||
{
|
{
|
||||||
bool any_ms_well_open = false;
|
bool any_ms_well_open = false;
|
||||||
|
|
||||||
|
@ -276,7 +276,6 @@ namespace Opm
|
|||||||
// updating the well_state based on well solution dwells
|
// updating the well_state based on well solution dwells
|
||||||
void updateWellState(const BVectorWell& dwells,
|
void updateWellState(const BVectorWell& dwells,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
Opm::DeferredLogger& deferred_logger,
|
|
||||||
const double relaxation_factor=1.0) const;
|
const double relaxation_factor=1.0) const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -528,11 +528,11 @@ namespace Opm
|
|||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
recoverWellSolutionAndUpdateWellState(const BVector& x,
|
recoverWellSolutionAndUpdateWellState(const BVector& x,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
Opm::DeferredLogger& deferred_logger) const
|
Opm::DeferredLogger& /* deferred_logger*/) const
|
||||||
{
|
{
|
||||||
BVectorWell xw(1);
|
BVectorWell xw(1);
|
||||||
recoverSolutionWell(x, xw);
|
recoverSolutionWell(x, xw);
|
||||||
updateWellState(xw, well_state, deferred_logger);
|
updateWellState(xw, well_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -712,13 +712,13 @@ namespace Opm
|
|||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
void
|
void
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
solveEqAndUpdateWellState(WellState& well_state, Opm::DeferredLogger& deferred_logger)
|
solveEqAndUpdateWellState(WellState& well_state, Opm::DeferredLogger& /* deferred_logger */)
|
||||||
{
|
{
|
||||||
// We assemble the well equations, then we check the convergence,
|
// We assemble the well equations, then we check the convergence,
|
||||||
// which is why we do not put the assembleWellEq here.
|
// which is why we do not put the assembleWellEq here.
|
||||||
const BVectorWell dx_well = mswellhelpers::invDXDirect(duneD_, resWell_);
|
const BVectorWell dx_well = mswellhelpers::invDXDirect(duneD_, resWell_);
|
||||||
|
|
||||||
updateWellState(dx_well, well_state, deferred_logger);
|
updateWellState(dx_well, well_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -803,7 +803,6 @@ namespace Opm
|
|||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
updateWellState(const BVectorWell& dwells,
|
updateWellState(const BVectorWell& dwells,
|
||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
Opm::DeferredLogger& deferred_logger,
|
|
||||||
const double relaxation_factor) const
|
const double relaxation_factor) const
|
||||||
{
|
{
|
||||||
const double dFLimit = param_.dwell_fraction_max_;
|
const double dFLimit = param_.dwell_fraction_max_;
|
||||||
@ -1686,9 +1685,9 @@ namespace Opm
|
|||||||
|
|
||||||
// handling the velocity head of intlet segments
|
// handling the velocity head of intlet segments
|
||||||
for (const int inlet : segment_inlets_[seg]) {
|
for (const int inlet : segment_inlets_[seg]) {
|
||||||
const EvalWell density = segment_densities_[inlet];
|
const EvalWell inlet_density = segment_densities_[inlet];
|
||||||
const EvalWell mass_rate = segment_mass_rates_[inlet];
|
const EvalWell inlet_mass_rate = segment_mass_rates_[inlet];
|
||||||
const EvalWell inlet_velocity_head = mswellhelpers::velocityHead(area, mass_rate, density);
|
const EvalWell inlet_velocity_head = mswellhelpers::velocityHead(area, inlet_mass_rate, inlet_density);
|
||||||
resWell_[seg][SPres] += inlet_velocity_head.value();
|
resWell_[seg][SPres] += inlet_velocity_head.value();
|
||||||
for (int pv_idx = 0; pv_idx < numWellEq; ++pv_idx) {
|
for (int pv_idx = 0; pv_idx < numWellEq; ++pv_idx) {
|
||||||
duneD_[seg][inlet][SPres][pv_idx] += inlet_velocity_head.derivative(pv_idx + numEq);
|
duneD_[seg][inlet][SPres][pv_idx] += inlet_velocity_head.derivative(pv_idx + numEq);
|
||||||
@ -1927,7 +1926,7 @@ namespace Opm
|
|||||||
deferred_logger.debug(sstr.str());
|
deferred_logger.debug(sstr.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWellState(dx_well, well_state, deferred_logger, relaxation_factor);
|
updateWellState(dx_well, well_state, relaxation_factor);
|
||||||
|
|
||||||
// TODO: should we do something more if a switching of control happens
|
// TODO: should we do something more if a switching of control happens
|
||||||
this->updateWellControl(ebosSimulator, well_state, deferred_logger);
|
this->updateWellControl(ebosSimulator, well_state, deferred_logger);
|
||||||
|
@ -485,8 +485,7 @@ namespace Opm
|
|||||||
|
|
||||||
// checking convergence of extra equations, if there are any
|
// checking convergence of extra equations, if there are any
|
||||||
void checkConvergenceExtraEqs(const std::vector<double>& res,
|
void checkConvergenceExtraEqs(const std::vector<double>& res,
|
||||||
ConvergenceReport& report,
|
ConvergenceReport& report) const;
|
||||||
DeferredLogger& deferred_logger) const;
|
|
||||||
|
|
||||||
// updating the connectionRates_ related polymer molecular weight
|
// updating the connectionRates_ related polymer molecular weight
|
||||||
void updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
void updateConnectionRatePolyMW(const EvalWell& cq_s_poly,
|
||||||
|
@ -1393,7 +1393,7 @@ namespace Opm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->underPredictionMode(deferred_logger) ) {
|
if (!this->underPredictionMode() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2016,7 +2016,7 @@ namespace Opm
|
|||||||
|
|
||||||
checkConvergenceControlEq(report, deferred_logger);
|
checkConvergenceControlEq(report, deferred_logger);
|
||||||
|
|
||||||
checkConvergenceExtraEqs(res, report, deferred_logger);
|
checkConvergenceExtraEqs(res, report);
|
||||||
|
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
@ -3148,8 +3148,7 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
checkConvergenceExtraEqs(const std::vector<double>& res,
|
checkConvergenceExtraEqs(const std::vector<double>& res,
|
||||||
ConvergenceReport& report,
|
ConvergenceReport& report) const
|
||||||
DeferredLogger& deferred_logger) const
|
|
||||||
{
|
{
|
||||||
// if different types of extra equations are involved, this function needs to be refactored further
|
// if different types of extra equations are involved, this function needs to be refactored further
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ namespace Opm
|
|||||||
bool wellHasTHPConstraints() const;
|
bool wellHasTHPConstraints() const;
|
||||||
|
|
||||||
/// Returns true if the well is currently in prediction mode (i.e. not history mode).
|
/// Returns true if the well is currently in prediction mode (i.e. not history mode).
|
||||||
bool underPredictionMode(Opm::DeferredLogger& deferred_logger) const;
|
bool underPredictionMode() const;
|
||||||
|
|
||||||
// update perforation water throughput based on solved water rate
|
// update perforation water throughput based on solved water rate
|
||||||
virtual void updateWaterThroughput(const double dt, WellState& well_state) const = 0;
|
virtual void updateWaterThroughput(const double dt, WellState& well_state) const = 0;
|
||||||
@ -416,8 +416,8 @@ namespace Opm
|
|||||||
OperabilityStatus operability_status_;
|
OperabilityStatus operability_status_;
|
||||||
|
|
||||||
void wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg,
|
void wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg,
|
||||||
const double simulation_time, const int report_step,
|
const double simulation_time, const WellState& well_state,
|
||||||
const WellState& well_state, WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger);
|
WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
virtual void wellTestingPhysical(const Simulator& simulator, const std::vector<double>& B_avg,
|
virtual void wellTestingPhysical(const Simulator& simulator, const std::vector<double>& B_avg,
|
||||||
const double simulation_time, const int report_step,
|
const double simulation_time, const int report_step,
|
||||||
|
@ -543,7 +543,7 @@ namespace Opm
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
bool
|
bool
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
underPredictionMode(Opm::DeferredLogger& deferred_logger) const
|
underPredictionMode() const
|
||||||
{
|
{
|
||||||
return well_ecl_.predictionMode();
|
return well_ecl_.predictionMode();
|
||||||
}
|
}
|
||||||
@ -799,7 +799,7 @@ namespace Opm
|
|||||||
|
|
||||||
// Based on current understanding, only under prediction mode, we need to shut well due to various
|
// Based on current understanding, only under prediction mode, we need to shut well due to various
|
||||||
// reasons or limits. With more knowlage or testing cases later, this might need to be corrected.
|
// reasons or limits. With more knowlage or testing cases later, this might need to be corrected.
|
||||||
if (!underPredictionMode(deferred_logger) ) {
|
if (!underPredictionMode() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,7 +997,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (testing_reason == WellTestConfig::Reason::ECONOMIC) {
|
if (testing_reason == WellTestConfig::Reason::ECONOMIC) {
|
||||||
wellTestingEconomic(simulator, B_avg, simulation_time, report_step,
|
wellTestingEconomic(simulator, B_avg, simulation_time,
|
||||||
well_state, well_test_state, deferred_logger);
|
well_state, well_test_state, deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1010,8 +1010,8 @@ namespace Opm
|
|||||||
void
|
void
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg,
|
wellTestingEconomic(const Simulator& simulator, const std::vector<double>& B_avg,
|
||||||
const double simulation_time, const int report_step,
|
const double simulation_time, const WellState& well_state,
|
||||||
const WellState& well_state, WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger)
|
WellTestState& welltest_state, Opm::DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
deferred_logger.info(" well " + name() + " is being tested for economic limits");
|
deferred_logger.info(" well " + name() + " is being tested for economic limits");
|
||||||
|
|
||||||
|
@ -297,14 +297,13 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
void resize(const Wells* wells, const std::vector<Well2>& wells_ecl, const Schedule& schedule,
|
void resize(const Wells* wells, const std::vector<Well2>& wells_ecl, const Schedule& schedule,
|
||||||
const bool handle_ms_well, const int report_step, const size_t numCells,
|
const bool handle_ms_well, const size_t numCells, const PhaseUsage& pu)
|
||||||
const PhaseUsage& pu)
|
|
||||||
{
|
{
|
||||||
const std::vector<double> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
|
const std::vector<double> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
|
||||||
init(wells, tmp, schedule, wells_ecl, 0, nullptr, pu);
|
init(wells, tmp, schedule, wells_ecl, 0, nullptr, pu);
|
||||||
|
|
||||||
if (handle_ms_well) {
|
if (handle_ms_well) {
|
||||||
initWellStateMSWell(wells, wells_ecl, report_step, pu, nullptr);
|
initWellStateMSWell(wells, wells_ecl, pu, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,7 +608,7 @@ namespace Opm
|
|||||||
|
|
||||||
/// init the MS well related.
|
/// init the MS well related.
|
||||||
void initWellStateMSWell(const Wells* wells, const std::vector<Well2>& wells_ecl,
|
void initWellStateMSWell(const Wells* wells, const std::vector<Well2>& wells_ecl,
|
||||||
const int time_step, const PhaseUsage& pu, const WellStateFullyImplicitBlackoil* prev_well_state)
|
const PhaseUsage& pu, const WellStateFullyImplicitBlackoil* prev_well_state)
|
||||||
{
|
{
|
||||||
// still using the order in wells
|
// still using the order in wells
|
||||||
const int nw = wells->number_of_wells;
|
const int nw = wells->number_of_wells;
|
||||||
|
@ -67,24 +67,24 @@ BOOST_AUTO_TEST_CASE(deferredlogger)
|
|||||||
|
|
||||||
std::ostringstream log_stream;
|
std::ostringstream log_stream;
|
||||||
initLogger(log_stream);
|
initLogger(log_stream);
|
||||||
auto deferredlogger = Opm::DeferredLogger();
|
auto deferred_logger = Opm::DeferredLogger();
|
||||||
deferredlogger.info("info 1");
|
deferred_logger.info("info 1");
|
||||||
deferredlogger.warning("warning 1");
|
deferred_logger.warning("warning 1");
|
||||||
deferredlogger.error("error 1");
|
deferred_logger.error("error 1");
|
||||||
deferredlogger.error("error 2");
|
deferred_logger.error("error 2");
|
||||||
deferredlogger.problem("problem 1");
|
deferred_logger.problem("problem 1");
|
||||||
deferredlogger.bug("bug 1");
|
deferred_logger.bug("bug 1");
|
||||||
deferredlogger.debug("debug 1");
|
deferred_logger.debug("debug 1");
|
||||||
deferredlogger.note("note 1");
|
deferred_logger.note("note 1");
|
||||||
deferredlogger.note("tagme", "note 2");
|
deferred_logger.note("tagme", "note 2");
|
||||||
deferredlogger.note("tagme", "note 3");
|
deferred_logger.note("tagme", "note 3");
|
||||||
deferredlogger.note("tagme", "note 3");
|
deferred_logger.note("tagme", "note 3");
|
||||||
deferredlogger.note("tagme", "note 3");
|
deferred_logger.note("tagme", "note 3");
|
||||||
deferredlogger.note("tagme", "note 3");
|
deferred_logger.note("tagme", "note 3");
|
||||||
deferredlogger.note("tagme", "note 3");
|
deferred_logger.note("tagme", "note 3");
|
||||||
deferredlogger.note("tagme", "note 3");
|
deferred_logger.note("tagme", "note 3");
|
||||||
|
|
||||||
deferredlogger.logMessages();
|
deferred_logger.logMessages();
|
||||||
|
|
||||||
auto counter = OpmLog::getBackend<CounterLog>("COUNTER");
|
auto counter = OpmLog::getBackend<CounterLog>("COUNTER");
|
||||||
BOOST_CHECK_EQUAL( 1 , counter->numMessages(Log::MessageType::Warning) );
|
BOOST_CHECK_EQUAL( 1 , counter->numMessages(Log::MessageType::Warning) );
|
||||||
|
@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
|
|||||||
|
|
||||||
for (size_t i=0; i<wells.size(); i++) {
|
for (size_t i=0; i<wells.size(); i++) {
|
||||||
const auto& well = wells[i];
|
const auto& well = wells[i];
|
||||||
std::shared_ptr<WellsGroupInterface> wellsGroup = createWellWellsGroup(well, summaryState, 2, pu);
|
std::shared_ptr<WellsGroupInterface> wellsGroup = createWellWellsGroup(well, summaryState, pu);
|
||||||
BOOST_CHECK_EQUAL(well.name(), wellsGroup->name());
|
BOOST_CHECK_EQUAL(well.name(), wellsGroup->name());
|
||||||
if (well.isInjector()) {
|
if (well.isInjector()) {
|
||||||
const auto controls = well.injectionControls(summaryState);
|
const auto controls = well.injectionControls(summaryState);
|
||||||
|
@ -79,7 +79,7 @@ namespace {
|
|||||||
|
|
||||||
state.initWellStateMSWell(wmgr.c_wells(),
|
state.initWellStateMSWell(wmgr.c_wells(),
|
||||||
setup.sched.getWells2(timeStep),
|
setup.sched.getWells2(timeStep),
|
||||||
timeStep, setup.pu, nullptr);
|
setup.pu, nullptr);
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user