Merge pull request #5833 from akva2/janitoring

Some janitoring
This commit is contained in:
Bård Skaflestad
2025-01-02 13:42:25 +01:00
committed by GitHub

View File

@@ -1166,21 +1166,19 @@ namespace Opm {
DeferredLogger& deferred_logger) const
{
// Finding the location of the well in wells_ecl
const int nw_wells_ecl = this->wells_ecl_.size();
int index_well_ecl = 0;
for (; index_well_ecl < nw_wells_ecl; ++index_well_ecl) {
if (well_name == this->wells_ecl_[index_well_ecl].name()) {
break;
}
}
const auto it = std::find_if(this->wells_ecl_.begin(),
this->wells_ecl_.end(),
[&well_name](const auto& w)
{ return well_name == w.name(); });
// It should be able to find in wells_ecl.
if (index_well_ecl == nw_wells_ecl) {
if (it == this->wells_ecl_.end()) {
OPM_DEFLOG_THROW(std::logic_error,
fmt::format("Could not find well {} in wells_ecl ", well_name),
deferred_logger);
}
return this->createWellPointer(index_well_ecl, report_step);
const int pos = static_cast<int>(std::distance(this->wells_ecl_.begin(), it));
return this->createWellPointer(pos, report_step);
}
@@ -1976,16 +1974,16 @@ namespace Opm {
{
int nw = this->numLocalWellsEnd();
int rdofs = local_num_cells_;
for(int i=0; i < nw; i++){
for (int i = 0; i < nw; ++i) {
int wdof = rdofs + i;
jacobian.entry(wdof,wdof) = 1.0;// better scaling ?
}
std::vector<std::vector<int>> wellconnections = this->getMaxWellConnections();
for(int i=0; i < nw; i++){
const auto wellconnections = this->getMaxWellConnections();
for (int i = 0; i < nw; ++i) {
const auto& perfcells = wellconnections[i];
for(int perfcell : perfcells){
for (int perfcell : perfcells) {
int wdof = rdofs + i;
jacobian.entry(wdof,perfcell) = 0.0;
jacobian.entry(wdof, perfcell) = 0.0;
jacobian.entry(perfcell, wdof) = 0.0;
}
}