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

computeScatteringAngle - leftover doesn't vary across the whole range #3

Open
StuartRussant opened this issue Oct 25, 2017 · 0 comments

Comments

@StuartRussant
Copy link

INTEGRATOR/monteCarloRadiativeTransfer.f95, subroutine computeScatteringAngle

In this subroutine the definition of 'leftover' is:
leftover = randomDeviate - real(angleIndex - 1)/real(numIntervals)

Also, angleIndex = int(randomDeviate * numInterval) + 1

so if I simplify the words we have:
leftover = r - int( r * N ) / N

which is always going to be close to zero.

The line in question should be:
leftover = randomDeviate * real(numIntervals) - real(angleIndex - 1)

allowing leftover to vary from 0 to 1

Stuart

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