Fix inconsistent L* values in make_lstar1 caused by persistent Ilflag state#70
Open
lkncl wants to merge 2 commits intoPRBEM:mainfrom
Open
Fix inconsistent L* values in make_lstar1 caused by persistent Ilflag state#70lkncl wants to merge 2 commits intoPRBEM:mainfrom
lkncl wants to merge 2 commits intoPRBEM:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #69
fixes #41
Summary
This PR fixes a bug where calling
make_lstar1with identical inputs returns inconsistent L* values.The issue originates from the
COMMON /flag_L/ Ilflagvariable, which is used insidecalcul_Lstar_optto decide whether to reuse a predicted foot-point (whenIlflag = 1) or compute a new linear estimate (whenIlflag = 0).Previously:
Ilflag was only initialized to
0insidemake_lstar1.After the first successful L* computation,
Ilflagbecame1and was not reset before subsequent calls.This caused
calcul_Lstar_optto reuse the last theta value from previous calls, leading to inconsistent L* results for identical inputs.This bug only affects make_lstar1: all other routines calling calcul_Lstar_opt do not rely on the returned value of
Ilflag.I have checked that the logic around these calls does not involves
Ilflag. Moreoever,make_lstar_shell_splitting1,make_lstar_shell_splitting2already have aIlflag=0line before each call.What this PR changes
✔️ 1. Removed the handling of
Ilflagfrom the caller (make_lstar1)make_lstar1no longer usesIlflagThe logic related to Ilflag_old and the fallback call has been removed.
✔️ 2.
Ilflagis now always initialized to0insidecalcul_Lstar_optThis ensures deterministic behavior: each computation starts cleanly and does not reuse stale state.
✔️ 3. Removed the conditional branch based on
IlflagOutcome
After this fix, calling
make_lstar1multiple times with identical parameters now returns consistent L*, Lm, B, Beq, I, and MLT values.