mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
removing white spaces in the wells folder
This commit is contained in:
parent
3f436501d2
commit
a525f0865f
@ -421,7 +421,7 @@ actionOnBrokenConstraints(const Group& group,
|
||||
group.name(),
|
||||
Group::ProductionCMode2String(oldControl),
|
||||
Group::ProductionCMode2String(newControl));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ss = fmt::format("Procedure on exceeding {} limit is NONE for group {}. Nothing is done.",
|
||||
Group::ProductionCMode2String(oldControl),
|
||||
|
@ -665,7 +665,7 @@ namespace Opm {
|
||||
this->calculateProductivityIndexValues(local_deferredLogger);
|
||||
|
||||
this->commitWGState();
|
||||
|
||||
|
||||
const Opm::Parallel::Communication& comm = grid().comm();
|
||||
DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger, comm);
|
||||
if (terminal_output_) {
|
||||
@ -889,7 +889,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
// Collect log messages and print.
|
||||
|
||||
|
||||
const Opm::Parallel::Communication& comm = grid().comm();
|
||||
DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger, comm);
|
||||
if (terminal_output_) {
|
||||
@ -1565,7 +1565,7 @@ namespace Opm {
|
||||
int nw = this->numLocalWellsEnd();
|
||||
int rdofs = local_num_cells_;
|
||||
for ( int i = 0; i < nw; i++ ){
|
||||
int wdof = rdofs + i;
|
||||
int wdof = rdofs + i;
|
||||
jacobian[wdof][wdof] = 1.0;// better scaling ?
|
||||
}
|
||||
|
||||
@ -1611,14 +1611,14 @@ namespace Opm {
|
||||
int nw = this->numLocalWellsEnd();
|
||||
int rdofs = local_num_cells_;
|
||||
for(int i=0; i < nw; i++){
|
||||
int wdof = rdofs + i;
|
||||
int wdof = rdofs + i;
|
||||
jacobian.entry(wdof,wdof) = 1.0;// better scaling ?
|
||||
}
|
||||
std::vector<std::vector<int>> wellconnections = getMaxWellConnections();
|
||||
for(int i=0; i < nw; i++){
|
||||
const auto& perfcells = wellconnections[i];
|
||||
for(int perfcell : perfcells){
|
||||
int wdof = rdofs + i;
|
||||
int wdof = rdofs + i;
|
||||
jacobian.entry(wdof,perfcell) = 0.0;
|
||||
jacobian.entry(perfcell, wdof) = 0.0;
|
||||
}
|
||||
@ -2138,7 +2138,7 @@ namespace Opm {
|
||||
this->closed_this_step_.insert(wname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Opm::Parallel::Communication comm = grid().comm();
|
||||
DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger, comm);
|
||||
if (terminal_output_) {
|
||||
|
@ -71,7 +71,7 @@ namespace Opm
|
||||
const int report_step_idx_;
|
||||
DeferredLogger &deferred_logger_;
|
||||
const std::string date_string_;
|
||||
const UnitSystem& unit_system_;
|
||||
const UnitSystem& unit_system_;
|
||||
const WellState &well_state_;
|
||||
WellTestState &well_test_state_;
|
||||
const Schedule &schedule_;
|
||||
|
@ -218,9 +218,9 @@ assemblePressureLoss(const int seg,
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
|
||||
assembleHydroPressureLoss(const int seg,
|
||||
const int seg_density,
|
||||
const EvalWell& hydro_pressure_drop_seg,
|
||||
assembleHydroPressureLoss(const int seg,
|
||||
const int seg_density,
|
||||
const EvalWell& hydro_pressure_drop_seg,
|
||||
Equations& eqns1) const
|
||||
{
|
||||
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
|
||||
@ -233,9 +233,9 @@ assembleHydroPressureLoss(const int seg,
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
|
||||
assemblePressureEqExtraDerivatives(const int seg,
|
||||
const int seg_upwind,
|
||||
const EvalWell& extra_derivatives,
|
||||
assemblePressureEqExtraDerivatives(const int seg,
|
||||
const int seg_upwind,
|
||||
const EvalWell& extra_derivatives,
|
||||
Equations& eqns1) const
|
||||
{
|
||||
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
|
||||
@ -243,7 +243,7 @@ assemblePressureEqExtraDerivatives(const int seg,
|
||||
// Frac - derivatives are zero (they belong to upwind^2)
|
||||
eqns.D()[seg][seg_upwind][SPres][SPres] += extra_derivatives.derivative(SPres + Indices::numEq);
|
||||
eqns.D()[seg][seg_upwind][SPres][WQTotal] += extra_derivatives.derivative(WQTotal + Indices::numEq);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
|
@ -88,14 +88,14 @@ public:
|
||||
Equations& eqns) const;
|
||||
|
||||
|
||||
void assembleHydroPressureLoss(const int seg,
|
||||
const int seg_density,
|
||||
const EvalWell& hydro_pressure_drop_seg,
|
||||
Equations& eqns1) const;
|
||||
void assembleHydroPressureLoss(const int seg,
|
||||
const int seg_density,
|
||||
const EvalWell& hydro_pressure_drop_seg,
|
||||
Equations& eqns1) const;
|
||||
|
||||
void assemblePressureEqExtraDerivatives(const int seg,
|
||||
const int seg_upwind,
|
||||
const EvalWell& extra_derivatives,
|
||||
void assemblePressureEqExtraDerivatives(const int seg,
|
||||
const int seg_upwind,
|
||||
const EvalWell& extra_derivatives,
|
||||
Equations& eqns1) const;
|
||||
|
||||
//! \brief Assemble pressure terms.
|
||||
|
@ -214,7 +214,7 @@ template<typename FluidSystem, typename Indices, typename Scalar>
|
||||
void
|
||||
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
|
||||
assembleDefaultPressureEq(const int seg,
|
||||
WellState& well_state,
|
||||
WellState& well_state,
|
||||
const bool use_average_density)
|
||||
{
|
||||
assert(seg != 0); // not top segment
|
||||
@ -226,7 +226,7 @@ assembleDefaultPressureEq(const int seg,
|
||||
EvalWell extra_derivatives;
|
||||
|
||||
// we need to handle the pressure difference between the two segments
|
||||
// hydrostatic pressure loss is assembled seperately at the end
|
||||
// hydrostatic pressure loss is assembled seperately at the end
|
||||
// TODO: we might be able to add member variables to store these values, then we update well state
|
||||
// after converged
|
||||
|
||||
@ -339,7 +339,7 @@ assembleAccelerationAndHydroPressureLosses(const int seg,
|
||||
// this part needs to be assembled separately. Optionally use average density variant.
|
||||
const auto hydro_pressure_drop_seg = segments_.getHydroPressureLoss(seg, seg);
|
||||
auto& ws = well_state.well(baseif_.indexOfWell());
|
||||
auto& segments = ws.segments;
|
||||
auto& segments = ws.segments;
|
||||
if (!use_average_density){
|
||||
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(baseif_).
|
||||
assembleHydroPressureLoss(seg, seg, hydro_pressure_drop_seg, linSys_);
|
||||
|
@ -509,7 +509,7 @@ volumeFraction(const int seg,
|
||||
// oil_fraction may turn out negative due to round-off, in that case
|
||||
// set to zero (but keep derivatives)
|
||||
if (oil_fraction.value() < 0.0) {
|
||||
oil_fraction.setValue(0.0);
|
||||
oil_fraction.setValue(0.0);
|
||||
}
|
||||
return oil_fraction;
|
||||
}
|
||||
|
@ -505,11 +505,11 @@ getFrictionPressureLoss(const int seg, const bool return_extra_derivatives) cons
|
||||
EvalWell density = densities_[seg_upwind];
|
||||
EvalWell visc = viscosities_[seg_upwind];
|
||||
// In the reverse flow case, we don't have enough slots for all derivatives, e.g.,
|
||||
// upwind pressure and flow. We amend this by a second function call optioin, where
|
||||
// upwind pressure and flow. We amend this by a second function call optioin, where
|
||||
// only these remaining derivatives are considered.
|
||||
// For reference: the pressure equation assumes pressure/flow derivatives are given
|
||||
// at segment node while fraction derivatives are given at upwind node.
|
||||
|
||||
// For reference: the pressure equation assumes pressure/flow derivatives are given
|
||||
// at segment node while fraction derivatives are given at upwind node.
|
||||
|
||||
if (seg != seg_upwind) {
|
||||
if (!return_extra_derivatives){
|
||||
constexpr int WQTotal = Indices::numEq + PrimaryVariables::WQTotal;
|
||||
@ -532,7 +532,7 @@ getFrictionPressureLoss(const int seg, const bool return_extra_derivatives) cons
|
||||
mass_rate.clearDerivatives();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const auto& segment_set = well_.wellEcl().getSegments();
|
||||
const int outlet_segment_index = segment_set.segmentNumberToIndex(segment_set[seg].outletSegment());
|
||||
const double length = segment_set[seg].totalLength() - segment_set[outlet_segment_index].totalLength();
|
||||
|
@ -1032,7 +1032,7 @@ namespace Opm
|
||||
};
|
||||
|
||||
WellInterface<TypeTag>::getMobility(ebosSimulator, perf, mob, obtain, deferred_logger);
|
||||
|
||||
|
||||
if (this->isInjector() && this->well_ecl_.getInjMultMode() != Well::InjMultMode::NONE) {
|
||||
const auto perf_ecl_index = this->perforationData()[perf].ecl_index;
|
||||
const Connection& con = this->well_ecl_.getConnections()[perf_ecl_index];
|
||||
@ -1445,7 +1445,7 @@ namespace Opm
|
||||
bool relax_convergence = false;
|
||||
this->regularize_ = false;
|
||||
|
||||
// Max status switch frequency should be 2 to avoid getting stuck in cycle
|
||||
// Max status switch frequency should be 2 to avoid getting stuck in cycle
|
||||
const int min_its_after_switch = 2;
|
||||
int its_since_last_switch = min_its_after_switch;
|
||||
int switch_count= 0;
|
||||
@ -1453,13 +1453,13 @@ namespace Opm
|
||||
const auto& summary_state = ebosSimulator.vanguard().summaryState();
|
||||
const bool allow_switching = !this->wellUnderZeroRateTarget(summary_state, well_state) && (this->well_ecl_.getStatus() == WellStatus::OPEN);
|
||||
bool changed = false;
|
||||
bool final_check = false;
|
||||
bool final_check = false;
|
||||
|
||||
for (; it < max_iter_number; ++it, ++debug_cost_counter_) {
|
||||
its_since_last_switch++;
|
||||
if (its_since_last_switch >= min_its_after_switch){
|
||||
const double wqTotal = this->primary_variables_.getWQTotal().value();
|
||||
changed = this->updateWellControlAndStatusLocalIteration (ebosSimulator, well_state, group_state, inj_controls, prod_controls, wqTotal, deferred_logger);
|
||||
changed = this->updateWellControlAndStatusLocalIteration (ebosSimulator, well_state, group_state, inj_controls, prod_controls, wqTotal, deferred_logger);
|
||||
if (changed){
|
||||
its_since_last_switch = 0;
|
||||
switch_count++;
|
||||
@ -1566,7 +1566,7 @@ namespace Opm
|
||||
} else {
|
||||
this->operability_status_.operable_under_only_bhp_limit = !is_stopped;
|
||||
}
|
||||
// We reset the well status to it's original state. Status is updated
|
||||
// We reset the well status to it's original state. Status is updated
|
||||
// on the outside based on operability status
|
||||
this->wellStatus_ = well_status;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ namespace Opm {
|
||||
}
|
||||
attr.saltConcentration += fs.saltConcentration().value() * pv_cell;
|
||||
if (FluidSystem::enableDissolvedGasInWater()) {
|
||||
attr.rsw += fs.Rsw().value() * pv_cell;
|
||||
attr.rsw += fs.Rsw().value() * pv_cell;
|
||||
}
|
||||
if (FluidSystem::enableVaporizedWater()) {
|
||||
attr.rvw += fs.Rvw().value() * pv_cell;
|
||||
@ -308,7 +308,7 @@ namespace Opm {
|
||||
* \param[in] rs Dissolved gas/oil ratio.
|
||||
*
|
||||
* \param[in] rv Vaporised oil/gas ratio.
|
||||
*
|
||||
*
|
||||
* \param[in] rsw Dissolved gas/water ratio.
|
||||
*
|
||||
* \param[in] rwv Vaporised water/gas ratio.
|
||||
|
@ -46,7 +46,7 @@
|
||||
namespace {
|
||||
|
||||
constexpr double EPSILON = 1.0e-14;
|
||||
|
||||
|
||||
//! \brief Relaxation factor considering only one fraction value.
|
||||
template<class Scalar>
|
||||
Scalar relaxationFactorFraction(const Scalar old_value,
|
||||
|
@ -2167,26 +2167,26 @@ namespace Opm
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const int max_iter = this->param_.max_inner_iter_wells_;
|
||||
|
||||
|
||||
int it = 0;
|
||||
bool converged;
|
||||
bool relax_convergence = false;
|
||||
this->regularize_ = false;
|
||||
const auto& summary_state = ebosSimulator.vanguard().summaryState();
|
||||
|
||||
// Max status switch frequency should be 2 to avoid getting stuck in cycle
|
||||
// Max status switch frequency should be 2 to avoid getting stuck in cycle
|
||||
constexpr int min_its_after_switch = 2;
|
||||
int its_since_last_switch = min_its_after_switch;
|
||||
int switch_count= 0;
|
||||
const auto well_status = this->wellStatus_;
|
||||
const bool allow_switching = !this->wellUnderZeroRateTarget(summary_state, well_state) && (this->well_ecl_.getStatus() == WellStatus::OPEN);
|
||||
bool changed = false;
|
||||
bool final_check = false;
|
||||
bool final_check = false;
|
||||
do {
|
||||
its_since_last_switch++;
|
||||
if (allow_switching && its_since_last_switch >= min_its_after_switch){
|
||||
const double wqTotal = this->primary_variables_.eval(WQTotal).value();
|
||||
changed = this->updateWellControlAndStatusLocalIteration(ebosSimulator, well_state, group_state, inj_controls, prod_controls, wqTotal, deferred_logger);
|
||||
changed = this->updateWellControlAndStatusLocalIteration(ebosSimulator, well_state, group_state, inj_controls, prod_controls, wqTotal, deferred_logger);
|
||||
if (changed){
|
||||
its_since_last_switch = 0;
|
||||
switch_count++;
|
||||
@ -2197,7 +2197,7 @@ namespace Opm
|
||||
final_check = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assembleWellEqWithoutIteration(ebosSimulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger);
|
||||
|
||||
if (it > this->param_.strict_inner_iter_wells_) {
|
||||
@ -2216,14 +2216,14 @@ namespace Opm
|
||||
its_since_last_switch = min_its_after_switch;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++it;
|
||||
solveEqAndUpdateWellState(summary_state, well_state, deferred_logger);
|
||||
initPrimaryVariablesEvaluation();
|
||||
} while (it < max_iter);
|
||||
|
||||
|
||||
if (converged) {
|
||||
if (allow_switching){
|
||||
// update operability if status change
|
||||
|
@ -47,7 +47,7 @@ checkIndividualConstraints(SingleWellState& ws,
|
||||
auto new_cmode = this->activeProductionConstraint(ws, summaryState,
|
||||
calcReservoirVoidageRates,
|
||||
thp_limit_violated_but_not_switched,
|
||||
deferred_logger,
|
||||
deferred_logger,
|
||||
prod_controls);
|
||||
if (new_cmode != ws.production_cmode) {
|
||||
ws.production_cmode = new_cmode;
|
||||
@ -58,7 +58,7 @@ checkIndividualConstraints(SingleWellState& ws,
|
||||
if (well_.isInjector()) {
|
||||
auto new_cmode = this->activeInjectionConstraint(ws, summaryState,
|
||||
thp_limit_violated_but_not_switched,
|
||||
deferred_logger,
|
||||
deferred_logger,
|
||||
inj_controls);
|
||||
if (new_cmode != ws.injection_cmode) {
|
||||
ws.injection_cmode = new_cmode;
|
||||
|
@ -1311,7 +1311,7 @@ namespace WellGroupHelpers
|
||||
const auto chain = groupChainTopBot(name, group.name(), schedule, reportStepIdx);
|
||||
// Because 'name' is the last of the elements, and not an ancestor, we subtract one below.
|
||||
const std::size_t num_ancestors = chain.size() - 1;
|
||||
// we need to find out the level where the current well is applied to the local reduction
|
||||
// we need to find out the level where the current well is applied to the local reduction
|
||||
std::size_t local_reduction_level = 0;
|
||||
for (std::size_t ii = 1; ii < num_ancestors; ++ii) {
|
||||
const int num_gr_ctrl = groupControlledWells(schedule,
|
||||
@ -1522,10 +1522,10 @@ namespace WellGroupHelpers
|
||||
const int reportStepIdx,
|
||||
const FieldPropsManager& fp,
|
||||
const PhaseUsage& pu,
|
||||
std::map<std::string, std::unique_ptr<AverageRegionalPressureType>>& regionalAveragePressureCalculator)
|
||||
std::map<std::string, std::unique_ptr<AverageRegionalPressureType>>& regionalAveragePressureCalculator)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
setRegionAveragePressureCalculator( schedule.getGroup(groupName, reportStepIdx), schedule,
|
||||
setRegionAveragePressureCalculator( schedule.getGroup(groupName, reportStepIdx), schedule,
|
||||
reportStepIdx, fp, pu, regionalAveragePressureCalculator);
|
||||
}
|
||||
const auto& gpm = group.gpmaint();
|
||||
|
@ -327,7 +327,7 @@ public:
|
||||
/// to the rates returned by computeCurrentWellRates().
|
||||
void updateWellStateRates(const Simulator& ebosSimulator,
|
||||
WellState& well_state,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void solveWellEquation(const Simulator& ebosSimulator,
|
||||
WellState& well_state,
|
||||
|
@ -267,7 +267,7 @@ namespace Opm
|
||||
{
|
||||
const auto& summary_state = ebos_simulator.vanguard().summaryState();
|
||||
const auto& schedule = ebos_simulator.vanguard().schedule();
|
||||
|
||||
|
||||
if (this->wellUnderZeroRateTarget(summary_state, well_state) || !(this->well_ecl_.getStatus() == WellStatus::OPEN)) {
|
||||
return false;
|
||||
}
|
||||
@ -297,7 +297,7 @@ namespace Opm
|
||||
updateWellStateWithTarget(ebos_simulator, group_state, well_state, deferred_logger);
|
||||
} else {
|
||||
ws.thp = this->getTHPConstraint(summary_state);
|
||||
}
|
||||
}
|
||||
updatePrimaryVariables(summary_state, well_state, deferred_logger);
|
||||
}
|
||||
return changed;
|
||||
@ -310,9 +310,9 @@ namespace Opm
|
||||
const bool has_thp = this->wellHasTHPConstraints(summary_state);
|
||||
if (has_thp){
|
||||
// calculate bhp from thp-limit (using explicit fractions zince zero rate)
|
||||
// TODO: this will often be too strict condition for re-opening, a better
|
||||
// option is probably minimum bhp on current vfp-curve, but some more functionality
|
||||
// is needed for this option to be robustly implemented.
|
||||
// TODO: this will often be too strict condition for re-opening, a better
|
||||
// option is probably minimum bhp on current vfp-curve, but some more functionality
|
||||
// is needed for this option to be robustly implemented.
|
||||
std::vector<double> rates(this->num_components_);
|
||||
const double bhp_thp = WellBhpThpCalculator(*this).calculateBhpFromThp(well_state, rates, this->well_ecl_, summary_state, this->getRefDensity(), deferred_logger);
|
||||
if (this->isInjector()){
|
||||
@ -444,7 +444,7 @@ namespace Opm
|
||||
} else {
|
||||
converged = this->iterateWellEqWithSwitching(ebosSimulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger);
|
||||
}
|
||||
|
||||
|
||||
} catch (NumericalProblem& e ) {
|
||||
const std::string msg = "Inner well iterations failed for well " + this->name() + " Treat the well as unconverged. ";
|
||||
deferred_logger.warning("INNER_ITERATION_FAILED", msg);
|
||||
@ -795,7 +795,7 @@ namespace Opm
|
||||
updateWellOperability(const Simulator& ebos_simulator,
|
||||
const WellState& well_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
{
|
||||
if (this->param_.local_well_solver_control_switching_) {
|
||||
const bool success = updateWellOperabilityFromWellEq(ebos_simulator, well_state, deferred_logger);
|
||||
if (success) {
|
||||
@ -841,7 +841,7 @@ namespace Opm
|
||||
// equations should be converged at this stage, so only one it is needed
|
||||
bool converged = iterateWellEquations(ebos_simulator, dt, well_state_copy, group_state, deferred_logger);
|
||||
return converged;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user