Skip to content

Updating AICD/SICD scaling factors after parsing the whole report step#4803

Merged
bska merged 4 commits into
OPM:masterfrom
GitPaean:updating_wsegsicd_wsegaicd
Oct 20, 2025
Merged

Updating AICD/SICD scaling factors after parsing the whole report step#4803
bska merged 4 commits into
OPM:masterfrom
GitPaean:updating_wsegsicd_wsegaicd

Conversation

@GitPaean
Copy link
Copy Markdown
Member

@GitPaean GitPaean commented Oct 17, 2025

it is allowed to specify COMPSEGS after the WSEGACID/WSEGSICD keywords.

following the testing through OPM/opm-tests#1413 .

This PR is another example that affects how the OPM-flow parse keywords. The SCHEDULE is very flexible, any keywords can be modified by a later input. There might be more situations that we have to use the final specification within the report step.

@GitPaean GitPaean added the manual:enhancement This is an enhancement/improvent that needs to be documented in the manual label Oct 17, 2025
@GitPaean
Copy link
Copy Markdown
Member Author

jenkins build this please

@GitPaean GitPaean force-pushed the updating_wsegsicd_wsegaicd branch 2 times, most recently from cc9acfd to 9aa6175 Compare October 17, 2025 21:01
@GitPaean
Copy link
Copy Markdown
Member Author

I am marking the PR as ready for review.

it is allowed to specify COMPSEGS after the WSEGACID/WSEGSICD keywords
@GitPaean GitPaean force-pushed the updating_wsegsicd_wsegaicd branch from 9aa6175 to c1ebbcd Compare October 17, 2025 21:08
@GitPaean GitPaean marked this pull request as ready for review October 17, 2025 21:20
@GitPaean
Copy link
Copy Markdown
Member Author

The tests in MultisegmentWellTests.cpp are relatively simple and not touching the report steps, so the PR does not affect the tests there.

If it is desirable to extend the tests there, please let me know.

@GitPaean
Copy link
Copy Markdown
Member Author

jenkins build this please

@GitPaean
Copy link
Copy Markdown
Member Author

The tests in MultisegmentWellTests.cpp are relatively simple and not touching the report steps, so the PR does not affect the tests there.

If it is desirable to extend the tests there, please let me know.

I added a test in MultisegmentWellTests.cpp .

@GitPaean
Copy link
Copy Markdown
Member Author

jenkins build this please

@GitPaean GitPaean force-pushed the updating_wsegsicd_wsegaicd branch from 01eccd7 to 09d78f2 Compare October 19, 2025 22:06
@GitPaean
Copy link
Copy Markdown
Member Author

jenkins build this please

@GitPaean GitPaean requested a review from bska October 20, 2025 07:26
Copy link
Copy Markdown
Member

@daavid00 daavid00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, I have tested in those decks in model 3 and now they run. Just a few nitpicks.

void updateAutoICD(const AutoICD& aicd);
void updateValve(const Valve& valve, const double segment_length);
void updateValve(const Valve& valve);
bool updateICDScalingFactor(const double outllet_segment_length, const double completion_length);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outlet

const int segment_number = segment.segmentNumber();
const auto outlet_segment = this->getFromSegmentNumber(segment_number).outletSegment();
const auto outlet_segment_length = this->segmentLength(outlet_segment);
const auto completion_length = connections.segment_perf_length(segment_number);;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;

Comment thread opm/input/eclipse/Schedule/Schedule.cpp Outdated
auto& sched_state = this->snapshots.back();
for (const auto& well : sched_state.wells()) {
if (!well.get().isMultiSegment()) {
continue;;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;

@GitPaean
Copy link
Copy Markdown
Member Author

Thanks for this, I have tested in those decks in model 3 and now they run. Just a few nitpicks.

Thanks for the comments. I have updated the PR accordingly.

@GitPaean
Copy link
Copy Markdown
Member Author

jenkins build this please

Copy link
Copy Markdown
Member

@bska bska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much appreciated. Other than the top-level Schedule::updateICDScalingFactors() function, this looks good to me.

Comment thread opm/input/eclipse/Schedule/Schedule.cpp Outdated
}
auto new_well{well.get()};
if (new_well.updateICDFlowScalingFactors()) {
sched_state.wells.update( std::move(new_well) );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a little scary to me. You're effectively updating a structure over which you're iterating a sequence of references. I think I'd probably make this a two-stage process instead

auto updatedWells = std::vector<Well>{};
for (const auto& wellPair : sched_state.wells) { // Note: .wells rather than .wells()
    if (! wellPair.second->isMultiSegment()) { continue; }

    auto new_well = *wellPair.second;
    if (new_well.updateICDFlowScalingFactors()) {
        updatedWells.push_back(std::move(new_wells));
    }
}

for (auto&& updatedWell : updatedWells) {
    sched_state.wells.update(std::move(updatedWell));
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I thought some while somehow decided to go ahead. Will update.

@GitPaean GitPaean force-pushed the updating_wsegsicd_wsegaicd branch from b4029c6 to ffa856e Compare October 20, 2025 09:05
@GitPaean
Copy link
Copy Markdown
Member Author

jenkins build this please

@GitPaean GitPaean added manual:bugfix This PR is a bug fix and should be noted in the manual and removed manual:enhancement This is an enhancement/improvent that needs to be documented in the manual labels Oct 20, 2025
Copy link
Copy Markdown
Member

@bska bska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the updates. This looks good to me now and I'll merge into master.

@bska bska merged commit c7138be into OPM:master Oct 20, 2025
1 of 4 checks passed
@GitPaean GitPaean deleted the updating_wsegsicd_wsegaicd branch October 20, 2025 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:bugfix This PR is a bug fix and should be noted in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants