Skip to content

SolveMain() silently reports success when -a auto-refinement never converges #9

Description

@dhgaddy

CSolveCap::SolveMain()'s auto-refinement (-a) loop only assigns
capRe/capIm on its convergence break:

if(diff <= globalVars.m_dAutoMaxErr) {
    capRe = cRe[i];
    capIm = cIm[i];
    break;
}

That's the only assignment in the loop. If it runs out all
SOLVE_MAX_AUTO_ITERATIONS rounds without ever hitting this break,
the loop just ends and the function returns ret, still holding
FC_NORMAL_END from the last SolveForCapacitance() call --
"success," with an output matrix that was never populated for that
run. Nothing distinguishes this from a real convergence.

Fix: populate capRe/capIm with the last computed iteration and
return a new, distinct code (FC_CONVERGENCE_FAILED) instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions