How distributed simulation works - maciek123/pyage-forams GitHub Wiki

Handling remote neighbourood

During distributed simulation, everything inside single node works exactly as in centralized simulation, with an exception for border part of the grid. Border cells of a node might not be really a border cells, as their neighbours may be located on other node.

To preserve logical structure of distributed grid, shadow cells were introduced. Those local objects are "shadowing" remote ones and synchronizing their states periodically. Every time a foram wants to eat algae from a remote neighbour or migrate there, it calls methods of shadow cell object, the same way as in "local" case.

Forams do not need to know if they interact with local or shadow cells. Everything is handled by cell objects.

Topology setup

During bootstrap of the simulation, neighbours property is read. It has format of mapping between sides and nodes names, e.g. "right" : "node_A". It means that node with name "node_A" is right-neighobur of the node. Before the simulation starts, remote cells (from the left border of node_A) are fetch and "shadowed" by creating local shadow cell objects and setting them as neighbours on the right border of the cell.