Commit 381ef1e
committed
Fix 1D flow perturbation applying random factor twice due to index aliasing
In 1D, eqn_idx%mom%end == eqn_idx%mom%beg (same slot), so the old code
wrote rand*v0 into the slot then read that modified value to compute
(1+rand)*rand*v0, doubling the perturbation.
Fix: save the original mom%beg value before any writes, scale mom%beg
first, and only assign mom%end when num_vels > 1 (i.e., multi-D).
Fixes #13691 parent d513442 commit 381ef1e
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
0 commit comments