I have a system of differential equations that mimic the clonal population in an immune system. For whoever is curious, the problem definition can be found in the post:
At present, I am simulating with a small number of clones and thus, am able to deal with the memory required. But, for higher number of clones, the performance of my present code is pretty detrimental. Say, for 2000 clones (variable n), the code runs for about 15 hours and stops prematurely because of the shortage of memory. As advised by @ChrisRackauckas in his tutorials, I tried saving only the last point of the simulation, but again faced the same situation.
The code is clearly memory inefficient. I tried using minimizing global variables by defining the function main. But, the memory and the time required increases for these cases. What else can be done for managing the memory?