The definition of system sleep requires the CPU to either quiesce or power off its cores. This means that no code is running during the time that the system is actually sleeping. If you are seeing progress on your computation, it means that the system is awake during that time. On Macs, there is a concept known as a dark wake, which is when everything is running except for the display and speakers, and system fans are best-effort disabled, so from an observer's perspective the system still looks like it's sleeping even though it's actually fully on. Certain high-performance subsystems will be throttled back during this time for energy and thermal reasons, so some of the tasks running during a dark wake will be slower.
Dark wakes happen for a number of reasons. You can see a record of system sleep and wake events using the
pmset -g log
If you run this and look for the timestamps corresponding to when your system was supposed to be asleep, you are going to find a surprisingly high number of
Sleep sequences during that period. This is when your simulation makes progress.
All of this is expected behavior. To avoid interrupting your simulation with a bunch of sleep-wake-sleep sequences, you need to remember to use Caffeine or the
caffeinate command. The latter, btw, allows you to chain your CLI invocation so that you're less likely to forget:
caffeinate(8) for more details.