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

Fix default value of probability density function particle generator #6093

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gassmoeller
Copy link
Member

Follow-up to #6092 including a changelog entry and one more fix: Previously the default value for the 'probability density function' function expression was 0. This is not a good default, because if the integral of the pdf over the domain is 0 the generator cannot generate particles (and it checks for that and crashes at the moment, thus requiring the user to set a value). This PR changes the default value to 1.0. The nice side effect is that now for all default parameters the 'random uniform' and 'probability density function' generators behave identical. This is expected, because random uniform is just the special case of pdf for a pdf that is constant across the domain.

Comment on lines +58 to +60
// This parameter overwrites one of the parameters in ParsedFunction
// with a new default value of 1.0. The original default value was 0
// everywhere, which is not allowed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice idea!

source/particle/generator/probability_density_function.cc Outdated Show resolved Hide resolved
Co-authored-by: Wolfgang Bangerth <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants