mirror of
				https://github.com/OPM/opm-simulators.git
				synced 2025-02-25 18:55:30 -06:00 
			
		
		
		
	make multiple well control switching output more readable
This commit is contained in:
		@@ -456,6 +456,10 @@ namespace Opm {
 | 
				
			|||||||
                well->updateWaterThroughput(dt, this->wellState());
 | 
					                well->updateWaterThroughput(dt, this->wellState());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        // report well switching
 | 
				
			||||||
 | 
					        for (const auto& well : well_container_) {
 | 
				
			||||||
 | 
					            well->reportWellSwitching(this->wellState().well(well->indexOfWell()), local_deferredLogger);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // update the rate converter with current averages pressures etc in
 | 
					        // update the rate converter with current averages pressures etc in
 | 
				
			||||||
        rateConverter_->template defineState<ElementContext>(ebosSimulator_);
 | 
					        rateConverter_->template defineState<ElementContext>(ebosSimulator_);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -278,8 +278,6 @@ protected:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    bool changed_to_stopped_this_step_ = false;
 | 
					    bool changed_to_stopped_this_step_ = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::vector< std::string> well_control_log_;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    double wpolymer() const;
 | 
					    double wpolymer() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    double wfoam() const;
 | 
					    double wfoam() const;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,6 +96,8 @@ WellInterfaceGeneric::WellInterfaceGeneric(const Well& well,
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wsolvent_ = 0.0;
 | 
					    wsolvent_ = 0.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    well_control_log_.clear();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const std::string& WellInterfaceGeneric::name() const
 | 
					const std::string& WellInterfaceGeneric::name() const
 | 
				
			||||||
@@ -377,4 +379,25 @@ double WellInterfaceGeneric::getALQ(const WellState& well_state) const
 | 
				
			|||||||
    return well_state.getALQ(name());
 | 
					    return well_state.getALQ(name());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void WellInterfaceGeneric::reportWellSwitching(const SingleWellState& ws, DeferredLogger& deferred_logger) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (well_control_log_.empty())
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    std::string msg = "    Well " + name()
 | 
				
			||||||
 | 
					        + " control mode changed from ";
 | 
				
			||||||
 | 
					    for (const std::string& from : well_control_log_) {
 | 
				
			||||||
 | 
					        msg += from + "->";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    std::string to;
 | 
				
			||||||
 | 
					    if (isInjector()) {
 | 
				
			||||||
 | 
					        to = Well::InjectorCMode2String(ws.injection_cmode);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        to = Well::ProducerCMode2String(ws.production_cmode);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    msg += to;
 | 
				
			||||||
 | 
					    deferred_logger.info(msg);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace Opm
 | 
					} // namespace Opm
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -169,6 +169,8 @@ public:
 | 
				
			|||||||
    // whether a well is specified with a non-zero and valid VFP table number
 | 
					    // whether a well is specified with a non-zero and valid VFP table number
 | 
				
			||||||
    bool isVFPActive(DeferredLogger& deferred_logger) const;
 | 
					    bool isVFPActive(DeferredLogger& deferred_logger) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void reportWellSwitching(const SingleWellState& ws, DeferredLogger& deferred_logger) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    bool getAllowCrossFlow() const;
 | 
					    bool getAllowCrossFlow() const;
 | 
				
			||||||
    double mostStrictBhpFromBhpLimits(const SummaryState& summaryState) const;
 | 
					    double mostStrictBhpFromBhpLimits(const SummaryState& summaryState) const;
 | 
				
			||||||
@@ -301,6 +303,8 @@ protected:
 | 
				
			|||||||
    double well_efficiency_factor_;
 | 
					    double well_efficiency_factor_;
 | 
				
			||||||
    const VFPProperties* vfp_properties_;
 | 
					    const VFPProperties* vfp_properties_;
 | 
				
			||||||
    const GuideRate* guide_rate_;
 | 
					    const GuideRate* guide_rate_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    std::vector< std::string> well_control_log_;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,6 @@ namespace Opm
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        well_control_log_.clear();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -175,11 +174,11 @@ namespace Opm
 | 
				
			|||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            from = Well::ProducerCMode2String(ws.production_cmode);
 | 
					            from = Well::ProducerCMode2String(ws.production_cmode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        bool oscillating = std::count(well_control_log_.begin(), well_control_log_.end(), from) >= param_.max_number_of_well_switches_;
 | 
					        bool oscillating = std::count(this->well_control_log_.begin(), this->well_control_log_.end(), from) >= param_.max_number_of_well_switches_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (oscillating) {
 | 
					        if (oscillating) {
 | 
				
			||||||
            // only output frist time
 | 
					            // only output frist time
 | 
				
			||||||
            bool output = std::count(well_control_log_.begin(), well_control_log_.end(), from) == param_.max_number_of_well_switches_;
 | 
					            bool output = std::count(this->well_control_log_.begin(), this->well_control_log_.end(), from) == param_.max_number_of_well_switches_;
 | 
				
			||||||
            if (output) {
 | 
					            if (output) {
 | 
				
			||||||
                std::ostringstream ss;
 | 
					                std::ostringstream ss;
 | 
				
			||||||
                ss << "    The control model for well " << this->name()
 | 
					                ss << "    The control model for well " << this->name()
 | 
				
			||||||
@@ -189,7 +188,7 @@ namespace Opm
 | 
				
			|||||||
                   << " switches. The control is kept at " << from;
 | 
					                   << " switches. The control is kept at " << from;
 | 
				
			||||||
                deferred_logger.info(ss.str());
 | 
					                deferred_logger.info(ss.str());
 | 
				
			||||||
                // add one more to avoid outputting the same info again
 | 
					                // add one more to avoid outputting the same info again
 | 
				
			||||||
                well_control_log_.push_back(from);
 | 
					                this->well_control_log_.push_back(from);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -202,7 +201,6 @@ namespace Opm
 | 
				
			|||||||
            assert(iog == IndividualOrGroup::Both);
 | 
					            assert(iog == IndividualOrGroup::Both);
 | 
				
			||||||
            changed = this->checkConstraints(well_state, group_state, schedule, summaryState, deferred_logger);
 | 
					            changed = this->checkConstraints(well_state, group_state, schedule, summaryState, deferred_logger);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        Parallel::Communication cc = ebos_simulator.vanguard().grid().comm();
 | 
					        Parallel::Communication cc = ebos_simulator.vanguard().grid().comm();
 | 
				
			||||||
        // checking whether control changed
 | 
					        // checking whether control changed
 | 
				
			||||||
        if (changed) {
 | 
					        if (changed) {
 | 
				
			||||||
@@ -212,7 +210,6 @@ namespace Opm
 | 
				
			|||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                to = Well::ProducerCMode2String(ws.production_cmode);
 | 
					                to = Well::ProducerCMode2String(ws.production_cmode);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            well_control_log_.push_back(from);
 | 
					 | 
				
			||||||
            std::ostringstream ss;
 | 
					            std::ostringstream ss;
 | 
				
			||||||
            ss << "    Switching control mode for well " << this->name()
 | 
					            ss << "    Switching control mode for well " << this->name()
 | 
				
			||||||
               << " from " << from
 | 
					               << " from " << from
 | 
				
			||||||
@@ -220,7 +217,9 @@ namespace Opm
 | 
				
			|||||||
            if (cc.size() > 1) {
 | 
					            if (cc.size() > 1) {
 | 
				
			||||||
               ss << " on rank " << cc.rank();
 | 
					               ss << " on rank " << cc.rank();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            deferred_logger.info(ss.str());
 | 
					            deferred_logger.debug(ss.str());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            this->well_control_log_.push_back(from);
 | 
				
			||||||
            updateWellStateWithTarget(ebos_simulator, group_state, well_state, deferred_logger);
 | 
					            updateWellStateWithTarget(ebos_simulator, group_state, well_state, deferred_logger);
 | 
				
			||||||
            updatePrimaryVariables(well_state, deferred_logger);
 | 
					            updatePrimaryVariables(well_state, deferred_logger);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user