Solving the structural system and the network is done in an alternating way. At the start of a network loop the unknowns (mass flow, total temperature, total pressure) are initialized. This is especially important for gas networks, since the initial values are taken as starting solution. Since the gas equations are very nonlinear, a good initial guess may accelerate the Newton-Raphson convergence quite a bit (or make a convergence possible in the first place).

At first an initial pressure distribution is determined. To that end the pressure value for nodes with a pressure boundary condition is stored in v (2,i), where i is the global node number. If no pressure boundary conditions applies, the minus the number of elements to which the node belongs is stored in the same field. If a node belongs to only one element, it is a boundary node and a fictitious initial pressure slightly smaller than the minimum pressure boundary condition is assigned to it. In that way, all boundary nodes are guaranteed to have a value assigned. The initial pressure in all other nodes is determined by solving for the Laplace equation in the network, i.e. the value in a node is the mean of the values in all surrounding nodes. To obtain a more realistic distribution the values are biased by an inverse tangent function, i.e. the values upstream decrease more slowly than on the downstream side of the network.

Another item taken care of at the start of initialnet.f is the determination of the number of gas pipe or restrictor elements the nodes belong to. If an end node i belongs to at most 2 elements of type gas pipe or restrictor and to no other elements one of the global element numbers is stored in ineighe(i) and the static temperature is determined from the other variables using the mass flow in this element. If not, the node is considered to be a big chamber for which total and static values coincide.

The temperature initial conditions are fixed at 293 K (only for those nodes for which no temperature boundary condition applies). In general, the temperature initial conditions are not so critical for the global convergence. For geometric quantities the initial value is zero. For the gate valve this is changed to the minimum allowable value of 0.125 (cf. liquidpipe.f).

Based on the total temperature and total pressure the mass flow in the elements is determined using the element equations. This is the second task to be accomplished by the element routines (characterized by iflag=1).

Finally, the static temperature is calculated for the nodes not identified as chambers based on the total pressure, total temperature and mass flow.