Determining the basic characteristics of the network

In subroutine envtemp.f the basic properties of the network are determined. It is called at the start of nonlingeo.c. At first the gas nodes are identified and sorted. A node is a gas node if any of the following conditions is satisfied:

In that way also the field nactdog is filled (with the value 1 for an unknown variable, 0 else). Next, the known boundary values (*BOUNDARY cards) are subtracted, and the unknown DOFs are numbered consecutively yielding the final form for nactdog. Notice that the global number of gas node i is itg(i). Since field its is ordered in an ascending order, subroutine nident.f can be used to find the local gas node number for a given global number. In the remaining test “gas node i” refers to the local number whereas “node i” refers to a global number.

In a loop over all network elements the necessary equations are determined. In a given corner node the conservation of mass equation is formulated if the mass flow in at least one of the adjacent network elements is unknown. The conservation of energy is written if the temperature in the corner node is unknown. Finally, conservation of momentum equation (also called element equation) is formulated for a midside node of a network element if not all quantities in the element equation are known. This latter check is performed in the subroutine flux.f (characterized by iflag=0). It contains on its own subroutines for several fluid section types, e.g. subroutine orifice.f for the fluid section of type ORIFICE. The number of unknowns relevant for the network element depends on its section type. After having identified all necessary equations in field nacteq they are numbered and the number of equations is compared with the number of unknowns. They must be equal in order to have a unique solution.

Next, multiple point constraints among network nodes are taken into account. They are defined using the *EQUATION keyword card. It is not allowed to use network nodes and non-network nodes in one and the same equation.

Finally, dependent and independent nodes are determined for each isothermal element and the appropriate entries in field nacteq (third row, cf. previous section) are defined. If at the stage of the matrix filling an corner node is a dependent node of an isothermal element the conservation of energy equation in that node is replaced by an equation that the static temperature in the dependent and independent node are equal. Fields ipogn and ign are deleted after leaving envtemp.f