## 2 A Fluid Dynamics Model for Traffic Simulation
### The model at junctions  
The conservation of car flows at a junction can be written as the Rankine-Hugoniot relation, imposing an equal value for the sum of flows entering in and leaving from each node \(n\in N\):  
\[\sum_{i\in BS(n)}f(\rho_{i}(t,b_{i}))=\sum_{j\in FS(n)}f(\rho_{j}(t,a_{j})) \hskip 14.226378 pt\forall n\in N \tag{2}\]  
where \(\rho_{i}\), with \(i\in BS(n)\), are the car densities on incoming roads while \(\rho_{j}\), with \(j\in FS(n)\), are the car densities on outgoing arcs. Such a relationship cannot be directly applied on source nodes and sink nodes, and a set of boundary data have to be defined for each one of them, so that the corresponding boundary problem can be solved in order to reproduce car flows entering and leaving the whole traffic network. The key problem is that conservation laws at a junction give rise to an underdetermined system, and some additional hypothesis must be introduced in order to determine a unique solution to the corresponding Riemann problem. Following [13], two main assumptions can be made in this sense:  
1. Let us introduce a set of distribution coefficient, say \(\alpha_{ji}\), reproducing the behaviour of drivers at junctions \(n\) when choosing an outgoing road \(j\in FS(n)\) while coming from an ingoing road \(i\in BS(n)\). Such a set of coefficients give rise, for each node \(n\) different from a source and a sink, to the **traffic distribution matrix**: \[A=\{a_{ji}\}_{j\in FS(n),i\in BS(n)}.\] In order to be feasible, at each junction \(n\), distribution coefficients have to satisfy the following conditions: \[0\leq\alpha_{ji}\leq 1, \forall i\in BS(n),\ \ \ \forall j\in FS(n)\] (3) \[\sum_{j\in FS(n)}\alpha_{ji}=1, \forall i\in BS(n)\] (4) The distribution matrix elements can be considered as the turning ratios typically used in simulation environments to reproduce the choices of drivers at junctions. Such values can be obtained for instance by means of traffic detectors. On the other hand, it is always possible to compute turning ratios whenever an origin-destination (OD) matrix is available for the private car transportation demand, and a proper traffic assignment model can be applied on the considered network. 2. Subject to the conservation law in (2) and to condition (A), drivers behave in such a way to maximize the throughput at each node. Let us now formulate a complete mathematical model for the solution of the Riemann problem at junctions. At each node \(n\), given a certain density distribution over the incident arcs, we have to find a new feasible flow assignment for the extreme points of such arcs. We indicate with \(\gamma_{i},\forall i\in BS(n)\), and with \(\gamma_{j},\forall j\in FS(n)\), the new assignment of flows on the extreme points on the arcs incident to node \(n\). Our aim is the maximization of the throughput at node \(n\), that can be expressed interchangeably by either  
\[\max\sum_{i\in BS(n)}\gamma_{i}\]  
or  
\[\max\sum_{j\in FS(n)}\gamma_{j},\]  
if one considers that the conservation relationships must hold. The set of constraints should take into account that the flow of cars crossing the junction and coming from each road must be less than or equal to the maximum flow assignment on the extreme point of the road itself, say \(\gamma_{i}^{max},\forall i\in BS(n)\). Similar bounds can be expressed on the maximum flow that can be assigned on the extreme points of the outgoing arcs of the junctions, say \(\gamma_{j}^{max},\forall j\in FS(n)\), if one considers the capacity of the arc. Recalling all the conditions assumed until now, the problem can be formulated as a linear programming problem to be solved at each node \(n\):  
\[\max z=\sum_{i\in BS(n)}\gamma_{i} \tag{5}\] \[s.t.\] \[0\leq\gamma_{i}\leq\gamma_{i}^{max}, \forall i\in BS(n)\] (6) \[0\leq\sum_{i\in BS(n)}\alpha_{ji}\cdot\gamma_{i}\leq\gamma_{j}^ {max}, \forall j\in FS(n) \tag{7}\]  
Notice that the left inequality in (7) is automatically satisfied using the first inequality in (6).