  Neural networks are increasingly used in complex (data-driven) simulations as
surrogates or for accelerating the computation of classical surrogates. In many
applications physical constraints, such as mass or energy conservation, must be
satisfied to obtain reliable results. However, standard machine learning
algorithms are generally not tailored to respect such constraints. We propose
two different strategies to generate constraint-aware neural networks. We test
their performance in the context of front-capturing schemes for strongly
nonlinear wave motion in compressible fluid flow. Precisely, in this context
so-called Riemann problems have to be solved as surrogates. Their solution
describes the local dynamics of the captured wave front in numerical
simulations. Three model problems are considered: a cubic flux model problem,
an isothermal two-phase flow model, and the Euler equations. We demonstrate
that a decrease in the constraint deviation correlates with low discretization
errors for all model problems, in addition to the structural advantage of
fulfilling the constraint.
