thermochimica
thermochimica copied to clipboard
Reduce dynamic memory allocations
Reason.
Dynamic memory allocation such as in PolyRegularQKTO
takes a significant amount of time such as in the example below.
Proposed Solution Reserve enough memory at start of program? A proper solution will obviously need more thought and a redesign of the code (or just use Yellowjacket-GEM 😅)
Impact Faster multiphysics
Additional context
Any fortran array with a size that is dependent on a runtime variable will lead to a malloc/free pair. The profile shows that > 30% of the Thermochimica time is spent in either malloc or free. At first glance it looks like those could largely be avoided by reusing buffer space (sized for the maximim number of species in a given phase for example).
@markuspiro any suggestions?