Cache homogeneous solution
David Dickinson
Branch: feature/cache_homogenous_solution
Branch: next
Merged
Merged pull request
Merged in feature/cache_homogenous_solution (pull request #205)
Merged in feature/cache_homogenous_solution (pull request #205)
Move calculation of homogenous solution into initialisation
Removes this duplicated calculation from the invert_rhs_1 routine. This will slightly increase memory usage in ballooning space simulations but saves duplicated work from each timestep and helps hopefully make the homogenous and inhomogenous solution clearer by separating them out.
Simplify logic, add comments and tidy
init_homogeneous_g
andinvert_rhs_1
The homogeneous solution used for trapped particle B.C., self-periodic domains and the linked B.C. was being calculated for every call to
invert_rhs_1
on every timestep, but should be time independent (for fixed timestep). This PR therefore moves the calculation of this solution to the initialisation phase and stores the result. There is a small (~10%) performance increase from this, but the primary motivation is to make theinvert_rhs_1
clearer as this is a key routine in GS2’s algorithm.