Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inscell uninitialized #1

Open
jordisanglas opened this issue May 23, 2019 · 0 comments
Open

inscell uninitialized #1

jordisanglas opened this issue May 23, 2019 · 0 comments

Comments

@jordisanglas
Copy link
Contributor

For some reason, this bug only happens if dfnTrans is compiled without the -O6 optimization flag.

In the function NeighborCells(), inscell is not initialized to 0. It might happen that, in the first step of the do while loop, the condition inside the if statement is not fulfilled for any of the 4 steps of the for loop (this can happen when the particle is in a cell in contact with an intersection). In that case, the program finishes the first step of the do while loop with inscell uninitialized. Therefore, the condition inscell==0 is evaluated using an incorrect value for inscell. As a consequence, the loop might finish earlier than expected.

This bug has the result that many particles get lost (tested with the truncated_power_law_dist test, without the -O6 compilation flag). Adding inscell=0 at the beginning of the function solves this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant