A computer-implemented method for simulating fluid flow in a petroleum reservoir, the fluid flow being governed by partial differential equations, wherein the simulating comprises obtaining a solution to the partial differential equations by solving an associated set of linear equations on distributed memory parallel processors; the linear equations being associated with nodes and connections, where the equations at a node contain the unknowns at the node and at neighbouring nodes to which the nodes are connected, each node corresponding to a physical unit, wherein the set of physical units is divided into domains separated by partitioning interfaces, wherein all nodes of a domain are assigned to a particular processor configured to solve the linear equations associated with nodes in that domain; wherein nodes that do not have a connection that crosses a partitioning interface are designated as interior nodes; and nodes that have a connection that crosses a partitioning interfaces are designated as boundary nodes; wherein each domain comprises a set of boundary nodes and a set of interior nodes; the method comprising ordering the multiple nodes underlying the linear equations, the ordering comprising: assigning exactly one code out of no more than three codes to each boundary node, the three codes consisting of a first code, a second code, and a third code wherein the first, second and third codes are different, by: assigning the first code to each boundary node representing a first boundary node, wherein each first boundary node connection cannot cross a partitioning interface to connect two first boundary nodes; assigning the second code to each boundary node representing a second boundary node, wherein each second boundary node connection cannot cross a partitioning interface to connect two second boundary nodes; and assigning the third code to each boundary node representing a third boundary node, wherein each third boundary node connection cannot cross a partitioning interface to connect an interior node and wherein each third boundary node can connect to nodes of any code in any domain; and wherein nodes of each of the first and second codes must occur on all of the processors, the method further comprising solving the underlying linear equations starting with the interior nodes and in an order determined by the three codes, and wherein the boundary nodes with the third code are made accessible by message passing prior to solving the underlying linear equations in an order determined by the three codes, so that the message passing can be overlapped with the local processing of the interior nodes. assigning the first code to each boundary node representing a first boundary node, wherein each first boundary node connection cannot cross a partitioning interface to connect two first boundary nodes; assigning the second code to each boundary node representing a second boundary node, wherein each second boundary node connection cannot cross a partitioning interface to connect two second boundary nodes; and assigning the third code to each boundary node representing a third boundary node, wherein each third boundary node connection cannot cross a partitioning interface to connect an interior node and wherein each third boundary node can connect to nodes of any code in any domain; and