Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #36
We were using half-steps in height for the A and B matrices. The problem came from doing this with the A matrix but not with the Q matrix. This is (temporarly?) fixed by removing the half-steps for calculating A and B.
Explanation
To explain the problem lets take an example:
For a stream of electrons coming down, at an altitude z and energy E we were 'removing' electrons degrading in energy or scattering in pitch-angle. This was done using half-step in height so using neutral densities at altitude (z + 1/2). But now when calculating the matrix Q the 'source' of electrons at lower energies, we are not using neutral densities at altitude z, without taking half-steps. As neutral densities are higher at lower altitudes, this led to an imbalance in the production and loss of electrons, with more electrons being produced than removed.
Below are profiles of Ie at different energies and varying dz.
With halfsteps:
Without halfsteps:
(x-axis Ie, y-axis altitude)