**Next:**Convergence criteria

**Up:**Aerodynamic and hydraulic networks

**Previous:**Initializing the unknowns

**Contents**

### Calculating the residual and setting up the equation system

The residual of the governing equations is calculated in subroutine resultnet.f. At the start of the routine the static temperature is calculated for the nodes not identified as chambers based on the total pressure, total temperature and mass flow. Then, a loop is initialized covering all network elements. For each element the contributions to the conservation of mass equation and to the conservation of energy equation (or, equivalently, to the isothermal equation if the element is an isothermal gas pipe element) of its corner nodes are determined. Subsequently, the satisfaction of the element equation is verified. This is the third mode the element routines are called in, characterized by iflag=2. Finally, the energy contributions resulting from the interaction with the walls and due to prescribed heat generation in the network are taken into account. The residual constitutes the right hand side of the network system.

Setting up the equation system is done in subroutine mafillnet.f. The structure of the routine is very similar to the resultnet routine: in a loop over all elements the coefficients of the equations (conservation of mass and momentum and the conservation of energy, or, if applicable, the isothermal condition) are determined. This includes effects from the interaction with the walls. This leads to the left hand side of the system of equations.

**Next:**Convergence criteria

**Up:**Aerodynamic and hydraulic networks

**Previous:**Initializing the unknowns

**Contents**guido dhondt 2012-10-06