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

Optimize timestep #57

Merged
merged 17 commits into from
Mar 23, 2021
Merged

Optimize timestep #57

merged 17 commits into from
Mar 23, 2021

Conversation

srichers
Copy link
Collaborator

The timestep now properly takes into account the full potential. The vacuum term is split off from the other terms for two reasons. First, the minimum neutrino energy (and hence maximum vacuum potential) needs only be calculated at the beginning of the simulation because the particle energies don't change. Second, the vacuum and matter/self-interaction potentials combine differently for neutrinos and antineutrinos, so I figured it would be better to just take the more conservative limit and add the magnitudes of those separately rather than do a more complicated grid reduction for neutrinos and antineutrinos separately.

I left in the original way of calculating the timestep as dt_stupid (though it is slightly different in that it includes the vacuum contribution). Setting max_adaptive_speedup to 0 will force the use of the original timestep. Setting it to 1e99 (or in general towards infinity) will allow the timestep to always be the one as determined by the current potential. This can lead to problems if the potential is zero and the timestep becomes extremely large. This can be a problem in the first step of the bipolar test case, for example. I left max_adaptive_speedup as 0 in all of the test parameter files.

Closes #43

Sherwood Richers added 15 commits March 19, 2021 11:18
…plifies the result without extraneous Is in real numbers
…agnitude and one that returns the magnitude squared. This will allow us to add the flux components without repeatedly square rooting and squaring.
…he minimum particle energy in initializing step to avoid doing a reduction over particles at every timestep under the assumption that particle energies do not change
…to limit timestep based on total lepton density
…s 0 because of equal numbers of neutrinos and antineutrinos by introducing a parameter (max_adaptive_speedup). When set to 0 it behaves exactly as before, except for the inclusion of the vacuum potential in the timestep calculation. When set towards infinity, it always allows the "optimized" timestep, which may itself become infinite if terms happen to cancel by chance, but otherwise is a much better estimate of the required timestep
@srichers srichers requested a review from dwillcox March 21, 2021 05:00
@srichers srichers changed the base branch from release to development March 22, 2021 15:48
Copy link
Member

@dwillcox dwillcox left a comment

Choose a reason for hiding this comment

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

Awesome, looks pretty good!

There were a few things I pointed out here and there that may need some clarification :)

Scripts/symbolic_hermitians/HermitianUtils.py Outdated Show resolved Hide resolved
Scripts/symbolic_hermitians/HermitianUtils.py Show resolved Hide resolved
Scripts/symbolic_hermitians/HermitianUtils.py Outdated Show resolved Hide resolved
Scripts/symbolic_hermitians/HermitianUtils.py Show resolved Hide resolved
Source/Evolve.cpp Show resolved Hide resolved
Source/Evolve.cpp Show resolved Hide resolved
Scripts/symbolic_hermitians/generate_code.py Show resolved Hide resolved
Source/FlavoredNeutrinoContainer.H Outdated Show resolved Hide resolved
…ding the ParticleContainer copy operator, fix mistake in conjugation of Hermitian matrices.
Copy link
Member

@dwillcox dwillcox left a comment

Choose a reason for hiding this comment

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

Awesome @srichers ! These changes resolved all the concerns from the initial review.

@dwillcox dwillcox merged commit 5e977f2 into development Mar 23, 2021
@dwillcox
Copy link
Member

Not deleting this branch for now since #59 targets it.

@srichers srichers deleted the optimize_timestep branch April 18, 2021 13:20
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.

optimize timestep
2 participants