SCOPFLOW multi-period output: constraint multipliers are taken from the primal vector x

Open
#156 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Read src/scopflow/interface/scopflowoutput.cpp, focusing on SCOPFLOWPrintSolution and SCOPFLOWSaveSolutionAllBase and how the primal and multiplier arrays are placed. Check the contingency index against scopflow->cstart as well. Done means multi-period output uses multiplier values for multiplier columns, and MINIMAL output associates contingencies with the correct solution across MPI ranks.

Written by the indexing model from the issue text.

Description

bug
Issue applies to:
  • pflow
  • OPFLOW
  • TCOPFLOW
  • SCOPFLOW
  • SOPFLOW
  • CMake and build system
  • Spack
  • Visualization
  • Documentation
  • Other
Summary

In the multi-period branches of SCOPFLOWPrintSolution and SCOPFLOWSaveSolutionAllBase
(src/scopflow/interface/scopflowoutput.cpp), the multipliers are fetched with
VecGetArrayRead(tcopflow->Lambda, &lambda), but the per-period OPFLOW multiplier vector
is then placed on the primal array x:

ierr = VecPlaceArray(opflow->Lambda, x + tcopflow->gstarti[t]);   // SaveSolutionAllBase
ierr = VecPlaceArray(opflow->Lambda, x + tcopflow->gstarti[0]);   // PrintSolution

lambda is never used. The printed and saved multipliers (mult_Pmis, mult_Qmis and the
other multiplier columns) of a multi-period SCOPFLOW run are therefore primal values. Because
gstarti is a constraint offset, the read can also go past the end of x.

Related, same function: in SCOPFLOWSaveSolutionAllBase,
ContigencyAppendMinimal(&(scopflow->ctgclist->cont[c]), c, ...) uses the rank-local index
c, while the solution uses scopflow->cstart + c. With MINIMAL output and more than one
MPI rank, the appended contingency does not match the file.

Description how to reproduce the issue

Found by reading the source; not reproduced on a run. Any multi-period SCOPFLOW run with
-scopflow_enable_multiperiod -save_output (or -print_output) goes through these lines.

ExaGO version

Source read at 587374f and on develop 43726da (2026-10-19); the lines are unchanged between them.

System and environment details

PRETTY_NAME="Ubuntu 24.04.4 LTS"
6.18.33.2-microsoft-standard-WSL2
gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0

Additional information

No response

Possible fix or workaround

Use lambda instead of x in both calls:

ierr = VecPlaceArray(opflow->Lambda, lambda + tcopflow->gstarti[t]);
ierr = VecPlaceArray(opflow->Lambda, lambda + tcopflow->gstarti[0]);

and pass scopflow->cstart + c to ContigencyAppendMinimal.

Dominant language
Python
Stars
17
Forks
11
Avg merge
2d 11h
Merged PRs (30d)
2

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ORNL/ExaGO

All issues in ORNL/ExaGO

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.