Cache homogeneous solution

Merged
#205 · Created  · Last updated

Merged pull request

Merged in feature/cache_homogenous_solution (pull request #205)

220ccdb·Author: ·Closed by: ·2023-05-15

Description

  • 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 and invert_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 the invert_rhs_1 clearer as this is a key routine in GS2’s algorithm.

0 attachments

0 comments

Loading commits...