Continuous and discontinous compressible flows in a converging-diverging
  channel solved by physics-informed neural networks without data
Physics-informed neural networks (PINNs) are employed to solve the classical
compressible flow problem in a converging-diverging nozzle. This problem
represents a typical example described by the Euler equations, thorough
understanding of which serves as a guide for solving more general compressible
flows. Given a geometry of the channel, analytical solutions for the steady
states indeed exist and they depend on the ratio between the back pressure of
the outlet and stagnation pressure of the inlet. Moreover, in the diverging
region, the solution may branch into subsonic flow, supersonic flow, and a
mixture of both with a discontinuous transition where a normal shock takes
place. Classical numerical schemes with shock-fitting/capturing methods have
been designed to solve this type of problem effectively, whereas the original
PINNs fail in front of the hyperbolic non-linear partial differential
equations. We make a first attempt to exploit the power of PINNs to directly
solve this problem by adjusting the weights of different components of the loss
function, to acquire physical solutions and meanwhile avoid trivial solutions.
With a universal setting yet no exogenous data, we are able to solve this
problem accurately, that is, for different given pressure ratios PINNs provide
different branches of solutions at both steady and unsteady states, some of
which are discontinuous in nature.
Liang Hong, Song Zilong, Zhao Chong, Bian Xin
Continuous and discontinous compressible flows in a converging-diverging channel solved by physics-informed neural networks without data

###### Abstract

Physics-informed neural networks (PINNs) are employed to solve the classical compressible flow problem in a converging-diverging nozzle. This problem represents a typical example described by the Euler equations, thorough understanding of which serves as a guide for solving more general compressible flows. Given a geometry of the channel, analytical solutions for the steady states indeed exist and they depend on the ratio between the back pressure of the outlet and stagnation pressure of the inlet. Moreover, in the diverging region, the solution may branch into subsonic flow, supersonic flow, and a mixture of both with a discontinuous transition where a normal shock takes place. Classical numerical schemes with shock-fitting/capturing methods have been designed to solve this type of problem effectively, whereas the original PINNs fail in front of the hyperbolic non-linear partial differential equations. We make a first attempt to exploit the power of PINNs to directly solve this problem by adjusting the weights of different components of the loss function, to acquire physical solutions and meanwhile avoid trivial solutions. With a universal setting yet no exogenous data, we are able to solve this problem accurately, that is, for different given pressure ratios PINNs provide different branches of solutions at both steady and unsteady states, some of which are discontinuous in nature.

**AMS subject classifications**: 35L51, 76L05, 76N06

**Key words**: unsteady compressible flow, normal shock, physics-informed neural networks, direct numerical simulation.

## 1 Introduction

Euler equations embrace the conservation laws for inviscid fluids, which are often compressible at high speed [1]. It is infeasible to derive an analytical solution for this type of equations
except in a few special cases. A discontinuous solution associated with shock wave may be generated due to the hyperbolic and non-linear properties of the partial differential equations (PDEs) when the fluid moves at speeds comparable to its speed of sound [2]. This further poses challenges for the development of numerical schemes and therefore, have induced many ingenious efforts in the past a few decades [3, 4]. There is generally a trade-off between accuracy and stability in the numerical methods [5]. The low order methods can produce stable but less accurate results, where sharp profiles of shocks are smoothed. To the contrary, the high-order methods are able to generate relatively accurate results, but are often troubled by instabilities and Gibbs phenomenon near the discontinuities [6]. Furthermore, the requirement of stability also imposes a strict CFL limit to the numerical methods, resulting in small time steps in simulations. These facts render the simulations by traditional numerical methods both human-intelligence concentrated and computationally intensive [7, 8, 9, 10].

Recently, machine learning methods, in particular, the deep neural networks (DNNs) have received enormous attentions and are trying to replace human bounding by network training and infering. Due to the tremendous successes in other fields, they also quickly became an alternative approach to solve PDEs [11, 12, 13, 14]. When solving the Euler equations, DNNs can be embedded into the traditional numerical methods to facilitate accurate results [15, 16, 17]. As another paradigm driven by the date science, DNNs can be trained by a large amount of analytical/experimental/simulation data, corresponding to the so-called _supervised learning_. Once trained, the DNNs can offer solutions for the PDEs in interpolated and even slighly extrapolated space of parameters much faster than the traditional numerical schemes. However, data are not always abundant in realistic applications or only partially accessible at best. To address this issue, physics-informed neural networks (PINNs) are proposed and trained by combining physics laws in the form of PDEs together with available data [18]. In contrast to the undecorated DNNs, PINNs can be trained with data in shortage or even missing to solve a forward problem described by known PDEs. This corresponds to an _unsupervised or weakly supervised learning_. Moreover, PINNs can also deal with an inverse problem at ease, where some coefficient values in the PDEs are unclear, such as the viscosity in the Navier-Stokes equations [19]. Since its invention, there have already been many innovative works to improve the accuracy and efficiency of PINNs [20, 21, 22, 23, 24, 25]. Concerning the discontinuous solutions of PDEs, quite a few work have been conducted with PINNs. In the seminal work of PINNs [18], a viscous term is added to smooth the shock produced by the Burgers' equation. Mao et al. [26] choose to distribute more sampling points in the discontinuous region identified beforehand, forming a cluster of points for a better training. Compared with uniformly or randomly sampled distribution of points, their strategy achieves a higher precision. The conservative PINNs proposed by Jagtap et al. [27] solve the continuous and discontinuous regions separately, where in the discontinuous part a larger network and more data are selected for training. Their work demonstrates that a special division of the training area can get more accurate solutions than that of other conventional divisions. Moreover, Patel et al. propose control-volume based PINNs [28] and combine them with a finite volume method, when no derivative exists in the discontinuous part. They define a loss function for a single control volume and obliterate derivative operation by integrating the equation, to ensure a correct solution.

Different from previous works, we aim to employ PINNs to solve a forward problem of compressible flows _without exogenous data_, corresponding to an unsupervised learning. In particular, we are interested in a typical flow problem taking place in a so-called de Laval nozzle or converging-diverging (CD) nozzle. Its actual solution depends on the ratio between the pressures at the outlet and inlet, and in the diverging region it may branch into subsonic flow, super
sonic flow, and a mixture of both with discontinuous transition where a normal shock takes place. Since both analytical and numerical solutions for steady states exist in textbooks[1, 3], this problem serves as an ideal benchmark to examine PINNs' performance for continuous and discontinuous compressible flows. A thorough understanding of the procedure for seeking solutions of this simple problem may provide a guidance to solve more general compressible flows, whether there is auxiliary data or not.

A typical three-dimensional CD nozzle with axis-symmetry is shown in Fig. 1(a). We assume that the velocity has only one component in the x direction \(V(x)\) and it changes with the area \(A(x)\) of the cross section, which varies smoothly and slowly. Therefore, one-dimensional equations are adequate to describe the flows. The smallest area named as throat controls the flow rate when the flow is supersonic in the diverging part. According to the pressure ratio between the back pressure \(P_{b}\) at the outlet and stagnation pressure \(P_{0}\) at the inlet, flow characteristics vary, as shown in Fig. 1(b). In particular, flows with a mixture of subsonic-supersonic-subsonic properties take place, as curves D or E, when \(P_{b}\) is moderate. Normal shock waves are generated for the transition from supersonic back to subsonic flows to raise the inner pressure up to conform with the back pressure at the outlet. The generation of shock wave is a non-isentropic process and manifests itself as a discontinuity in the context of continuum mechanics, which renders reliable solutions of the traditional numerical methods difficult.

In this work, we adopt a specific version of PINNs with a universal setting to resolve the flows in the CD nozzle, whether there is a shock wave or not, without any auxiliary data. By varying \(P_{b}\), it offers different branches of solutions correctly. If there is a normal shock, it identifies the shock location accurately and meanwhile provides a sharp solution. The structure of the paper is arranged as follows. In Sec. 2, flow equations together with the structure and parameters of PINNs are introduced. In Sec. 3, hard constraints on the boundaries are introduced and weights of different loss functions are universally determined so that different flow characteristics are predicted at steady states. In Sec. 4 unsteady flows are solved and the influence of different hyper-parameters of the neural networks is analyzed to successfully improve the accuracy of solutions.

Figure 1: (a) one dimensional approximation to the flow within a converging-diverging (CD) nozzle; (b) pressure distributions and flow characteristics along the CD nozzle according to various ratios between the back/outlet pressure and stagnation/inlet pressure. Curves A and B correspond to subsonic flows; curve F corresponds to a subsonic-supersonic flow; curve D and E correspond to flows with norm shocks in-between supersonic-subsonic transitions.
In Sec. 5, governing equations in conservative form are discussed and finally, in Sec. 6 a summary is made.

## 2 The method

The one-dimensional Euler's equations are adopted to describe the flows and more specifically, a simple differential form is initially considered

\[\left\{\begin{aligned} A\frac{\partial\rho}{\partial t}+Av \frac{\partial\rho}{\partial x}+A\rho\frac{\partial v}{\partial x}+v\rho\frac{ \partial A}{\partial x}&=0,\\ A\rho\frac{\partial v}{\partial t}+Av\rho\frac{\partial v}{ \partial x}+A\frac{\partial P}{\partial x}&=0,\\ A\rho\frac{\partial T}{\partial t}+Av\rho\frac{\partial T}{ \partial x}+P\left(A\frac{\partial v}{\partial x}+v\frac{\partial A}{\partial x }\right)&=0,\\ P-\rho RT&=0.\end{aligned}\right. \tag{2.1}\]

Here \(\rho\), \(v\), \(T\), and \(P\) are density, velocity, temperature, and pressure, respectively. \(R\) is the universal gas constant. We fix the stagnation properties such as density \(\rho_{0}\), temperature \(T_{0}\), and pressure \(P_{0}\) at the inlet (left) and adjust the the back pressure \(P_{b}\) at the outlet (right), to generate different flow regimes in the CD nozzle, as shown in Fig. 1. A typical set of stagnation values are \(\rho_{0}\!=\!1.52kg/m^{3}\), \(T_{0}\!=\!286.1K\), and \(P_{0}\!=\!1.247\times 10^{5}N/m^{2}\), respectively.

Flow properties are made dimensionless by \(\rho_{0}\), \(T_{0}\) and throat area \(A^{*}\) as follows:

\[\rho^{\prime}\!=\!\frac{\rho}{\rho_{0}},T^{\prime}\!=\!\frac{T}{T_{0}},A^{ \prime}\!=\!\frac{A}{A^{*}}.\]

Therefore, the sound speed at stagnation is \(a_{0}\!=\!\sqrt{\gamma RT_{0}}\), where \(\gamma\!=\!1.4\) is the specific-heat ratio of air. Furthermore, \(P^{\prime}\!=\!P/P_{0}\), \(v^{\prime}\!=\!v/a_{0}\), and \(x^{\prime}\!=\!x/\sqrt{A^{*}}\), \(t^{\prime}\!=\!ta_{0}/\sqrt{A^{*}}\). Eqs. (2.1) become dimensionless as

\[\left\{\begin{aligned} A^{\prime}\frac{\partial\rho^{ \prime}}{\partial t^{\prime}}+A^{\prime}v^{\prime}\frac{\partial\rho^{\prime }}{\partial x^{\prime}}+A^{\prime}\rho^{\prime}\frac{\partial v^{\prime}}{ \partial x^{\prime}}+v\rho\frac{\partial A^{\prime}}{\partial x^{\prime}}& =0,\\ A^{\prime}\left(\gamma\rho^{\prime}\frac{\partial v^{\prime}}{ \partial t^{\prime}}+\gamma v^{\prime}\rho^{\prime}\frac{\partial v^{\prime}}{ \partial x^{\prime}}+\frac{\partial P^{\prime}}{\partial x^{\prime}}\right)& =0,\\ A^{\prime}\rho^{\prime}\frac{\partial T^{\prime}}{\partial t^{ \prime}}\left(\frac{1}{\gamma\!-\!1}\right)+A^{\prime}v^{\prime}\rho^{\prime} \frac{\partial T^{\prime}}{\partial x^{\prime}}\left(\frac{1}{\gamma\!-\!1} \right)+P^{\prime}\left(A^{\prime}\frac{\partial v^{\prime}}{\partial x^{ \prime}}+v\frac{\partial A^{\prime}}{\partial x^{\prime}}\right)&=0,\\ P^{\prime}-\rho^{\prime}T^{\prime}&=0.\end{aligned}\right. \tag{2.2}\]

In the rest of this paper, all physical quantities shall appear in dimensionless form. Therefore, we remove all " \({}^{\prime}\) "s in the equations for convenience.

We define the cross-section of the CD nozzle as a parabolic function along the \(x\) axis: \(A(x)\!=\!1+2.2*(x\!-\!1.5)^{2}\), where the minimum area \(A^{*}\!=\!1\) takes place at \(x\!=\!1.5\), as shown in Fig. 2. This geometry is nothing special and only taken for convenience. The methodology presented later also applies to more general geometries.

The structure of the neural networks (NNs) is presented in Fig. 3, where it is trained without any auxiliary data, except for the boundary and initial conditions. The
Figure 3: The structure of PINNs. On the left is a simple feedforward neural network to be trained while on the right is the physics information expressed in PDEs. A loss function composed of boundary conditions, initial conditions, and physics equations together guides the training of the neural network.

Figure 2: A converging-diverging nozzle with cross-section area \(A\) described by a parabolic function of \(x\) along the axis with \(x\in(0,2.25)\), where the throat has the minimum area \(A^{*}=1\) at \(x=1.5\). \(\rho_{0}\), \(T_{0}\) and \(P_{0}\) are the stagnation density, temperature, and pressure at the inlet (left), respectively. \(P_{b}\) is the back pressure at the outlet (right). We adjust \(P_{b}\) to vary the pressure ratio and to generate different flow regimes in the nozzle.
is expressed as follows

\[Loss=Loss_{BC}+Loss_{IC}+Loss_{F}, \tag{2.3}\]

where \(Loss_{BC}\), \(Loss_{IC}\), and \(Loss_{F}\) correspond to the sub-loss function of boundary conditions, initial conditions, and PDEs, respectively. The sub-loss function of the PDEs has four components originated from the four equations in Eqs. (2.2)

\[\left\{\begin{aligned} A\frac{\partial\rho}{\partial t}+Av \frac{\partial\rho}{\partial x}+A\rho\frac{\partial v}{\partial x}+v\rho\frac {\partial A}{\partial x}&=F_{1}(x,t),\\ A\left(\gamma\rho\frac{\partial v}{\partial t}+\gamma v\rho\frac {\partial v}{\partial x}+\frac{\partial P}{\partial x}\right)&=F _{2}(x,t),\\ A\rho\frac{\partial T}{\partial t}\left(\frac{1}{\gamma-1} \right)+Av\rho\frac{\partial T}{\partial x}\left(\frac{1}{\gamma-1}\right)+P \left(A\frac{\partial v}{\partial x}+v\frac{\partial A}{\partial x}\right)& =F_{3}(x,t),\\ P-\rho T&=F_{4}(x,t).\end{aligned}\right. \tag{2.4}\]

Here \(F_{1}(x,t)\), \(F_{2}(x,t)\), \(F_{3}(x,t)\), and \(F_{4}(x,t)\) represent residuals of the mass, momentum, energy, and state equations, respectively. We assume that pressure \(P\) and density \(\rho\) are two individual variables so that the NNs have both variables as outputs. Accordingly, \(P\) and \(\rho\) form a sub-loss function \(F_{4}(x,t)\) via the residual from the equation of state. Each component of the loss function has an associated weight \(\omega_{i}\) and in part they determine the optimization of the network parameters:

\[F=\omega_{1}F_{1}+\omega_{2}F_{2}+\omega_{3}F_{3}+\omega_{4}F_{4}. \tag{2.5}\]

By default \(w_{i}=1\) for \(i=1,2,3,4\). All the sub-loss functions are expressed in the form of mean squared errors (MSEs)

\[Loss_{BC} =MSE_{BC}, \tag{2.6}\] \[Loss_{IC} =MSE_{IC},\] (2.7) \[Loss_{F} =MSE_{F}=\sum_{i=1}^{4}\frac{\omega_{i}}{N_{F}}\sum_{j=1}^{N_{F} }\left|F_{i}\left(x_{j},t_{j}\right)\right|^{2}, \tag{2.8}\]

where \(F_{i}\left(x_{j},t_{j}\right)\) is the corresponding residual at point \((x_{j},t_{j})\) among all \(N_{F}\) training poings. The actual expressions of \(Loss_{BC}\) and \(Loss_{IC}\) are problem-dependent and shall be described in later sections. Because the NNs adopt the chain rule of derivatives, we do not need to approximate the partial differential terms by any special numerical scheme as in the traditional numerical methods. In the process of minimizing the loss function towards zero, the back propagation algorithm optimizes the parameters (weights and biases) of the NNs. In this context, the optimization process is also named as training. Once trained, the NNs can predict values \(\rho\), \(v\), \(T\), and \(P\) for any given \(x\) and \(t\).

## 3 Steady state solutions

We commence to solve for flow problems within the CD nozzle at steady states, therefore the terms containing partial derivative with respect to time in Eqs. (2.2) and (2.4) are temporarily
discarded. For the steady states, we can obtain accurate solutions via analytical methods and make use of them to evaluate the performance of PINNs. In Sec. 3.1 we solve the flows in the diverging part of the nozzle by imposing the critical states of the throat as boundary conditions. In Sec. 3.2, we capture the shock wave by modifying the NNs and obtain accurate solutions at a high resolution of sampling points. In Sec. 3.3, we investigate the effects due to the number of training points on the accuracy of solutions.

### Diverging channel

The flow characteristics are relatively simple in the converging part of the CD nozzle, whereas it is rather complex in the diverging part. Therefore, we first impose the physical quantities at the throat as inlet boundary conditions and calculate flows in the diverging part alone. The analytical solutions to this problem are expressed as follows,

\[\left\{\begin{aligned} \left[1\!+\!\frac{1}{2}\left(\gamma\!-\! 1\right)Ma^{2}\right]^{\frac{1}{\left(\gamma-1\right)}}=&\frac{ 1}{\rho},\\ \frac{1}{Ma}\left[\frac{1\!+\!\frac{1}{2}\left(\gamma\!-\!1 \right)Ma^{2}}{\frac{1}{2}\left(\gamma\!+\!1\right)}\right]^{\frac{1}{2}\left( \gamma+1\right)\left(\gamma-1\right)}=&\frac{1}{A^{*}},\\ 1\!+\!\frac{1}{2}\left(\gamma\!-\!1\right)Ma^{2}=& \frac{1}{T},\\ \left[1\!+\!\frac{1}{2}\left(\gamma\!-\!1\right)Ma^{2}\right]^{ \frac{\gamma}{\left(\gamma-1\right)}}=&\frac{1}{P},\end{aligned}\right. \tag{3.1}\]

which are valid for both subsonic and supersonic flows. As they are not in explicit form, some iterative procedures are necessary and we adopt a web-based applet to calculate accurate solutions with 8 decimal digits as references [29].

More specifically, we take the critical state of air reaching the speed of sound at the throat. Accordingly, the inlet boundary conditions for the diverging channel are

\[\left(\rho_{x=1.5},\upsilon_{x=1.5},T_{x=1.5},P_{x=1.5}\right)=\left(0.634,0.9 12,0.833,0.528\right).\]

Given the geometry, analytical solution may be subsonic, supersonic and a mixture of both with a discontinuous shock. Both subsonic and supersonic solutions are smooth and unique, such as \(C\) and \(F\) curves on Fig. 1(b), and are available from Eqs. (3.1). Moreover, there are infinitely many solutions, each of which has a discontinuous shock, such as \(D\) and \(E\) curves on Fig. 1(b) and more are not shown. Each solution is unique corresponding to one specific boundary condition at the outlet. Out of curiosity, however, we intentionally leave the outlet boundary for free, to interrogate what PINNs generate.

The computational domain is for \(x\!\in\![1.5,2.25]\) and the loss function expressed as MSEs for the inlet boundary is defined as

\[MSE_{BC}=MSE_{\rho}+MSE_{v}+MSE_{T}+MSE_{P}, \tag{3.2}\]
with:

\[\begin{split} MSE_{\rho}&=\frac{1}{N_{BC}}\sum_{j=1}^{N_ {BC}}(\left|\rho_{NN}\left(x_{j}=1.5\right)-\rho(x_{j}=1.5)\right|^{2}),\\ MSE_{v}&=\frac{1}{N_{BC}}\sum_{j=1}^{N_{BC}}(\left|v _{NN}\left(x_{j}=1.5\right)-v(x_{j}=1.5)\right|^{2}),\\ MSE_{T}&=\frac{1}{N_{BC}}\sum_{j=1}^{N_{BC}}(\left|T _{NN}\left(x_{j}=1.5\right)-T(x_{j}=1.5)\right|^{2}),\\ MSE_{P}&=\frac{1}{N_{BC}}\sum_{j=1}^{N_{BC}}(\left|P _{NN}\left(x_{j}=1.5\right)-P(x_{j}=1.5)\right|^{2}).\end{split} \tag{3.3}\]

Here the values with subscript "\({}_{NN}\)" are the ones predicted by the NN, while the bare values are imposed ones. NNs' parameters for weight and bias are initialized by Glorot scheme [30]. This convention also applies later on. The NN has 3 hidden layers, each layer has 30 neurons, and \(\tanh\) is the activation function. We choose \(N_{BC}=1\) and \(N_{F}=100\) points in the x direction, for the inlet boundary and collocation points within the physical domain, respectively. To investigate clearly the influence of other parameters on the results, we intentionally choose all training points uniformly distributed.

Figure 4: Evolution of the loss function for a typical instance of PINNs for solving the flows in the diverging channel: with Adam and L-BFGS optimizers, each component of the loss function descends towards minimization with more training epochs.
The training proceeds with Adam optimizer of learning rate 0.0001 for 2000 epochs and continues with L-BFGS optimizer for 500 epochs [31, 32]. A typical evolution of the loss function is shown in Fig. 4, where each component descends clearly towards minimization with more training epochs. After completion of the training, 50 evenly distributed points in the computational domain are selected for predicting \(\rho\), \(Ma\!=\!v/c\!=\!v/\sqrt{\gamma RT}\), \(T\) and \(P\), which corresponds to a simple forward pass of the NNs. Since both sets of points are evenly distributed, the prediction points are actually a subset of the training points. This convention also applies later on, unless otherwise stated.

With the same setting, we run multiple instances of PINNs to predict the flow solutions. Surprisingly, for each instance we may obtain one of two different solutions randomly. One is for supersonic flows and the other is for subsonic flows, as shown in Fig. 5. Moreover, both the

Figure 5: Solutions for flows in the diverging channel. Only inlet boundary conditions are imposed while the outlet boundary conditions are intentionally left free. Each running instance of PINNs generates an accurate supersonic or subsonic solution randomly, due to the inherent randomness during the initialization of the NN’s parameters. Furthermore, PINNs deliberately avoid the subtle branch of infinite many solutions, which involve discontinuous shocks.
subsonic and supersonic solutions of PINNs are in excellent agreement with the analytical ones, described by Eqs. (3.1). After many instances of training and prediction, this observation is repeatable, that is, without providing the outlet boundary condition, PINNs are always able to find one of the two smooth solutions. We attribute this uncertain outcome to the random initialization of the NN's parameters [30]. Nevertheless, without an appropriate boundary condition for the outlet, PINNs deliberately circumvent the discontinuous solutions.

### Converging-diverging nozzle

We continue to consider the whole geometry of the CD nozzle. Stagnation values of density, temperature, and pressure are given at the inlet, while a back pressure \(P_{b}\) is provided at the outlet. Depending on the value of \(P_{b}\), different flow characteristics occur. For smooth solutions of both subsonic and supersonic flows, the analytical expressions in Eq. (3.1) are utilized. For a solution with a normal shock in the diverging part, we refer to the Rankine-Hugoniot equations as follows:

\[\left\{\begin{aligned} \frac{(\gamma+1)Ma_{1}^{2}}{(\gamma-1)Ma_{1}^{2 }+2}=&\frac{\rho_{1}}{\rho_{2}},\\ \frac{(\gamma-1)Ma_{1}^{2}+2}{2\gamma Ma_{1}^{2}-(\gamma-1)}=& Ma_{2}^{2},\\ [2+(\gamma-1)Ma_{1}^{2}]\frac{2\gamma Ma_{1}^{2}-(\gamma-1)}{( \gamma+1)^{2}Ma_{1}^{2}}=&\frac{T_{1}}{T_{2}},\\ \frac{1}{\gamma+1}[2\gamma Ma_{1}^{2}-(\gamma-1)]=& \frac{P_{1}}{P_{2}},\end{aligned}\right. \tag{3.4}\]

which relates the physical values before and after the shock. A similar solution strategy is adopted to calculate two accurate and smooth solutions with 8 decimal digits pieced together at the shock as references [29].

The computational domain is: \(x\in[0,2.25]\). The following boundary conditions are applied in PINNs:

\[(\rho_{x=0},T_{x=0},P_{x=0})=(1.0,1.0,1.0),\quad P_{x=2.25}=P_{b}.\]

Therefore, the loss function for the boundary conditions is expressed as MSEs as follows:

\[MSE_{BC}=MSE_{\rho}+MSE_{T}+MSE_{P} \tag{3.5}\]

with:

\[MSE_{\rho}=\frac{1}{N_{BC}}\sum_{j=1}^{N_{BC}}(\left|P_{NN}\left(x_{j}=0 \right)-\rho(x_{j}=0)\right|^{2}),\]

\[MSE_{T}=\frac{1}{N_{BC}}\sum_{j=1}^{N_{BC}}(\left|T_{NN}\left(x_{j}=0\right)- T(x_{j}=0)\right|^{2}), \tag{3.6}\]

\[MSE_{P}=\frac{1}{N_{BC}}\sum_{j=1}^{N_{BC}}(\left|P_{NN}\left(x_{j}=0\right)- P(x_{j}=0)\right|^{2}+\left|P_{NN}\left(x_{j}=2.25\right)-P(x_{j}=2.25)\right|^{2}).\]

The NN has 3 hidden layers and each layer 30 neurons. \(N_{BC}=2\) and \(N_{F}=200\) are evenly distributed in the \(x\) direction. The training proceeds with Adam optimizer for 2000 epochs and
continues with L-BFGS optimizer for 500 epochs. After training, 50 evenly distributed points are selected for predicting solutions.

Firstly, \(P_{b}=0.07726\), the flow is subsonic in the converging part and completely supersonic in the diverging part. The solutions from PINNs are shown in the Fig. 6, where the reference solutions according to Eqs. (3.1) are also presented for comparison. We observe that PINNs with a default setting offer excellent accuracy for this type of compressible flow, where there is smooth transition from a subsonic flow to a supersonic flow at the throat \(x=1.5\), corresponding to curve F on Fig. 1(b).

Furthermore, we set \(P_{b}=0.81017\). According to Eqs. (3.1) and (3.4), a normal shock wave is expected at \(x=1.875\) in the diverging part of the nozzle. With a default setting, PINNs offer solutions that are far away from the references, as shown in Fig. 7. An examination at the evolution of the loss function during training reveals that the troublemakers are the losses for the boundary condition and momentum equation, as shown in Fig. 8. Increasing the number of training epochs

Figure 6: PINNs’ solutions for supersonic continuous flows: with \(P_{b}=0.07726\), the solutions of \(\rho\), \(Ma\), \(T\), and \(P\) are smooth, with subsonic flow in the converging part while supersonic flow in the diverging part. References are taken from the analytical solutions governed by Eq. (3.1).
Figure 7: PINNs’ solutions for subsonic and supersonic discontinuous flows. With \(P_{b}=0.81017\), the analytical solutions of \(\rho\), \(Ma\), \(T\), and \(P\) are governed by by Eqs. (3.1) and (3.4). Solutions should be smooth and subsonic in the converging part and become discontinuous at \(x=1.875\) in the diverging part, where a normal shock wave is expected. PINNs with default settings fail to reproduce the correct solutions and increasing the number of training points and/or epochs does not help.
Figure 8: Evolution of the loss function of PINNs for solving the flows in the CD nozzle with \(P_{b}=0.81017\), where a normal shock is expected in the diverging part: with Adam and L-BFGS optimizers, components of the loss function are reluctant to descend towards minimization, especially those for boundary (BC) and momentum equation (F2).
for ten times from 2500 to 25000 epochs does not improve the descent of the loss function. Enhancing the number of sampling points ten times from 200 to 2000 does not help either (results are not shown).

A few notes are in order. Since we employ PINNs as a direct numerical simulation tool without prior data, they not aware of the shock location in advance and can not distribute more sampling points around the shock. This renders an accurate prediction of the discontinuous flow by PINNs challenging. After a closer inspection on Fig. 7(b), we observe that the velocity/Mach number profile is almost flat around zero. This indicates that during the training the optimizer of NNs ignores the residual of momentum equation. Leaving a flat velocity implies all velocity terms can be discarded from \(F_{1}\), \(F_{2}\) and \(F_{3}\) in Eq. (4), since \(\partial v/\partial x\approx 0\). We interpret \(v(x)=constant\) as a trivial, but wrong solution. For the loss of \(F_{1}\) and \(F_{3}\), the term \(\partial A/\partial x\) is known from the geometry, which demands the residuals towards zero, as shown in Fig. 8. However, with the trivial solution of \(v(x)=constant\), the pressure cannot satisfy two Dirichlet boundary conditions for the inlet and outlet simultaneously that is, \(\partial P/\partial x=0\) is impossible, as shown in Fig. 7(d). With \(\partial v/\partial x\approx 0\), \(\partial P/\partial x\) is the only term left in \(F_{2}\), which does not descend towards zero. Consequently, the losses for boundary condition and \(F_{2}\) are both large and do not descend easily, as shown in Fig. 8.

Motivated by the observations and speculations above, we introduce two small modifications into the vanilla version PINNs. Firstly, we choose to redistribute the weights between the components of the loss function for the PDEs as \(\omega_{1}:\omega_{2}:\omega_{3}:\omega_{4}=1:20:1:1\), to enhance the descent of

Figure 9: Evolution of the loss function of PINNs for solving the flows in the CD nozzle with \(P_{b}=0.81\), where a normal shock is expected in the diverging part: with Adam and L-BFGS optimizers. With more weight on the momentum equation and hard constrain on the Dirichlet boundary conditions, all components of the loss function descend easily.
Figure 10: PINNs’ solutions for subsonic and supersonic flows with discontinuity. With \(P_{b}=0.81017\), the analytical solutions of \(\rho\), \(Ma\), \(T\), and \(P\) are governed by by Eqs. (3.1) and (3.4). Solutions should be smooth and subsonic in the converging part and become discontinuous at \(x=1.875\) in the diverging part, where a normal shock wave is expected. PINNs with a proper weight on the momentum loss function and hard constraint on the Dirichlet boundary conditions identify shock location and reproduce accurately discontinuous flows at ease.
momentum residual. In addition, we employ hard constraints of pressure to satisfy the Dirichlet boundary conditions exactly, instead of minimizing the MSEs. The NN still has 3 hidden layers and each layer has 30 neurons. Moreover, 2000 uniformly distributed points in the x direction are selected as training points. The training proceeds with Adam for 20000 epochs and continues with L-BFGS for 5000 epochs. The upgraded evolution of loss function during training is shown in Fig. 9, where a clear descent for all components is observed. Furthermore, new predictions of PINNs are in Fig. 10, where a normal shock wave is observed at \(x=1.875\) and meanwhile sharp profiles are reproduced accurately for \(\rho\), \(Ma\), \(T\) and \(P\) with 50 points. We emphasize that with this new setting, the location of the shock is identified by PINNs automatically without any other efforts. We note that both the modified weights and hard constraints on the Dirichlet boundary conditions are necessary for the accurate solutions.

Lastly, we set \(P_{b}=0.95055\) so that a subsonic flow is expected in the entire nozzle. Results

Figure 11: PINNs’ solutions for subsonic flows. For \(P_{b}=0.95055\), a subsonic flow is expected in the entire nozzle as curve B on Fig. 1(b). PINNs with a default setting cannot deal with continuous problem properly, whereas PINNs with modified weights and hard constrains on the Dirichlet boundary conditions predict the flows accurately.
of two versions of PINNs are presented in Fig. 11. We observe that PINNs with a default setting provides a trivial and wrong solution of \(v(x)\approx 0\) and also incorrect solutions for \(\rho\), \(T\) and \(P\). With modified weights of on the momentum loss and hard constrains on the Dirichlet boundary conditions, PINNs are able to predict accurately the continuous subsonic flow in the entire nozzle, which turns trend after the throat at \(x=1.5\). This corresponds to curve B on Fig. 1(b).

With this new setting, PINNs are also able to reproduce Figs. 5 and 6, results of which are omitted. Therefore, we shall continue to use this version of PINNs for the rest of the work.

### Effects of resolution

In this section, the effects of the number of training points for PINNs are explored. We exemplify this study by \(P_{b}=0.81017\), where a normal shock is expected in the diverging part of the nozzle. Four different numbers of training points are selected: 200, 500, 1000 and 2000, which are uniformly distributed in the x direction. After training, physical quantities at 50 uniformly distributed points are selected for predictions. As shown in Fig. 12, with all four resolutions of training, results are stable and accurate for density, Mach number, temperature and pressure. It is worth noting that there is no Gibbs phenomenon, which is typically observed in traditional numerical methods.
Figure 12: The number of training points is 200,500,1000 and 2000, respectively. The prediction has 50 points. They are all evenly distributed in the \(x\) direction.
Time-dependent solutions

A more realistic flow in a CD nozzle has transit states from rest to the steady state. There are no analytical solutions for this time-dependent flow, which makes a numerical procedure necessary. In this section, we leverage the power of PINNs to tackle this time-dependent problem, possibly with normal shocks. In Sec. 4.1, PINNs are employed to solve the time-dependent flows, for which steady state is supersonic in the diverging part of the nozzle. In Sec. 4.2, the influences of NNs' parameters, such as the size, the number of training points and different distributions of training points on the solution accuracy are discussed. In Sec. 4.3, different initial conditions for the time-dependent flows are investigated, for which steady state has a normal shock.

### Subsonic-supersonic continuous flow

In this section, we solve the unsteady flow in the nozzle for the initial and boundary conditions given as follows

\[\begin{split}(\rho_{x}^{t=0},v_{x}^{t=0},T_{x}^{t=0},P_{x}^{t=0} )=(1.0,0.0,1.0,1.0),\\ (\rho_{x=0}^{t},T_{x=0}^{t},P_{x=0}^{t})=(1.0,1.0,1.0),\quad P_{x= 2.25}^{t}=P_{b}=0.07726.\end{split}\]

As shown in the previous section, the flow is supersonic in the diverging part of the nozzle for a steady flow. For a time-dependent flow, the computational domain in space and time is \(x\in[0,2.25]\) and \(t\in[0,8]\), respectively. Furthermore, the loss function for ICs expressed as MSEs is defined as

\[MSE_{IC}=MSE_{\rho}^{IC}+MSE_{v}^{IC}+MSE_{T}^{IC}+MSE_{P}^{IC} \tag{4.1}\]

with:

\[\begin{split} MSE_{\rho}^{IC}=&\frac{1}{N_{IC}} \sum_{j=1}^{N_{IC}}(\big{|}\rho_{NN}\big{(}x_{j},0\big{)}-\rho(x_{j},0)\big{|} ^{2}),\\ MSE_{v}^{IC}=&\frac{1}{N_{IC}}\sum_{j=1}^{N_{IC}}( \big{|}v_{NN}\big{(}x_{j},0\big{)}-v(x_{j},0)\big{|}^{2}),\\ MSE_{T}^{IC}=&\frac{1}{N_{IC}}\sum_{j=1}^{N_{IC}}( \big{|}T_{NN}\big{(}x_{j},0\big{)}-T(x_{j},0)\big{|}^{2}),\\ MSE_{P}^{IC}=&\frac{1}{N_{IC}}\sum_{j=1}^{N_{IC}}( \big{|}P_{NN}\big{(}x_{j},0\big{)}-P(x_{j},0)\big{|}^{2}).\end{split} \tag{4.2}\]

In addition, the boundary conditions for pressure are implemented as hard constraints as before. The NN has 3 hidden layers and each layer has 30 neurons. Moreover, 100 points are selected for boundary conditions and 150 points for initial conditions. The training starts with Adam optimizer for 10000 epochs and continues with L-BFGS for 15000 epochs.

The results of PINNs at 5 discrete time instants are shown in Fig. 13, where the flow quickly reaches supersonic state in the diverging part and become steady state for \(t\geqslant 6\). We note that the time evolution for each physical value (\(\rho\), \(Ma\), \(T\), and \(P\)) is always monotonic along the \(x\) direction. However, the same evolution of all physical values indicate overshoot in time, that is, steady profiles of \(\rho\), \(Ma\), \(T\), and \(P\) for \(t\geqslant 6\) are in-between profiles at \(t=1\) and \(t=2\). Furthermore,
Figure 13: PINNs’ solutions for time-dependent subsonic-supersonic flows at \(t=0,1,2,3,6,8\). Density, Mach number, temperature and pressure reach steady states for \(t\geq 6\).
Figure 14: PINNs’s solutions for time-dependent subsonic-supersonic flows with continuous evolutions for density, Mach number, temperature and pressure.
we present continuous maps for the physical values in both space and time in Fig. 14. Similarly as in the discrete instants in Fig. 13, all four physical values in the continuous color maps are monotonic along the \(x\) direction, but overshoot in time before reaching steady states.

The training loss of PINNs for this problem is shown in Fig. 15, where a catenation of L-BFGS after Adam is effective to reduce the loss to a much lower level.

### Exploration of neural networks' parameters for discontinuous flows

The computational domain is given as \(x\in[0,2.25]\) and \(t\in[0,25]\). The initial and boundary conditions for the time-dependent flow are as follows

\[(\rho_{x}^{t=0},r_{x}^{t=0},T_{x}^{t=0},P_{x}^{t=0})=(1.0,0.0,1.0,1. 0)\,,\] \[(\rho_{x=0}^{t},T_{x=0}^{t},P_{x=0}^{t})=(1.0,1.0,1.0),\quad P_{x= 2.25}^{t}=P_{b}=0.81017.\]

The steady state with these boundary conditions was studied in section 3.2, which corresponds to a flow with a normal shock at \(x=1.875\) in the diverging part. When solving the unsteady process with discontinuity, we find that the NNs with the previous setting result in a poor prediction for the solutions at steady state. It is understandable, as we have one extra dimension of time for the physical quantities to evolve. Therefore, we commence to explore the effects of the parameters of NNs and examine PINNs' solutions at steady states after going through the time-dependent states.

We employ four sets of parameters as listed in Table 1, where we have two architectures of NNs: 3 hidden layers \(\times\) 30 neurons and 4 hidden layers \(\times\) 50 neurons. For the training

Figure 15: Training loss of PINNs for the continuous time-dependent flows.
points, we have \(100\times 100\) regular points uniformly distributed in the whole space-time domain \(x\times t\in[0,2.25]\times[0,25]\). As an attempt to enhance resolution, we add \(30\times 30\) extra points uniformly distributed in the space-time domain of the diverging region of the nozzle \(x\times t\in[1.5,2.25]\times[0,25]\). For the initial and boundary conditions, \(150\) and \(100\) points are universally applied, respectively. Each training starts with Adam optimizer for \(10000\) epochs and continues with L-BFGS for \(15000\) epochs.

For the time being, we discard PINNs' results at transit states and present solutions at steady states. We observe that the first setup of \(NN_{a}\) reproduces the steady states qualitatively, as shown in Fig. 16, where an norm shock can be identified albeit at a location biased towards upstream. The overall profiles of \(\rho\), \(Ma\), \(T\) and \(P\) are accurate for the subsonic region before the shock, and deteriorate evidently after the shock. Next, we consider two individual improvements over the NNs: one is with enhanced number of layers and neurons corresponding to setup \(NN_{b}\); another is with enlarged number of sampling points in the diverging region of the nozzle corresponding to setup \(NN_{c}\). Both setups improve the results substantially, but the solutions are still not sufficiently accurate, as shown in Figs. 22 and 23 in Appendix A. Furthermore, we look at PINNs' results with setup \(NN_{d}\) in Fig. 17, which represents the combined efforts of improvement on the NN's achitecture and increased number of training points. We observe that solutions from PINNs solving an unsteady process predict the steady states correctly, with the same accuracy as the solutions of a steady flow solved by PINNs.

Lastly, we present the complete evolution of \(\rho\), \(Ma\), \(T\) and \(P\) in Fig. 18. From the color maps of physical values in the whole space-time domain, we may divide approximately the evolution into three stages in time. At the first stage for \(t\lesssim 5\), the flow has clearly subsonic characteristics: all four physics values develop rapidly, but always have continuous profiles. At the second stage between \(5\lesssim t\lesssim 8.5\), supersonic characteristics of the flow arise at downstream of the throat at \(x=1.5\), but the physical values are still continuous. At the third stage for \(t\gtrsim 8.5\), discontinuous phenomena emerge. Later on, physical values settle for \(t\gtrsim 10\), where a sharp interface for physics values is evident at \(x=1.875\).
Figure 16: PINNs’ results with setup \(NN_{a}\) for steady states from unsteady process: 3 hidden layers and each layer 30 neurons; Regular \(100\!\times\!100\) training points for space-time domain \(x\!\times\!t\!\in\![0,2.25]\times\![0,25]\).
Figure 17: PINNs’ results with setup \(NN_{d}\) for steady states from unsteady process: 4 hidden layers and each layer 50 neurons; Regular \(100\times 100\) training points for space-time domain \(x\times t\in[0,2.25]\times[0,25]\). Extra \(30\times 30\) training points for space-time domain \(x\times t\in[1.5,2.25]\times[0,25]\).
Figure 18: PINNs’s results for time-dependent subsonic-supersonic flows with discontinuous evolutions for density, Mach number, temperature and pressure. The setup of PINNs is with \(NN_{d}\) as listed in Table 1.
This corresponds to the scenario when the inlet is already open and the outlet is closed before the flow. Therefore, the density and pressure inside the nozzle are identical as the stagnation values of the inlet. As second initial condition, we consider that the outlet is open and the inlet is closed before the flow. Therefore, the density and pressure inside the nozzle are identical as the values of the outlet. The values for the second initial condition are as follows

\[(\rho_{x}^{t=0},v_{x}^{t=0},T_{x}^{t=0},P_{x}^{t=0})=(\rho_{b}=0.81017,0.0,1.0,P _{b}=0.81017).\]

For both cases, the temperature initially has a stagnation value of \(T=1.0\) in the entire nozzle and the boundary conditions are identical as follows

\[(\rho_{x=0}^{t},T_{x=0}^{t},P_{x=0}^{t})=(1.0,1.0,1.0),\quad P_{x=2.25}^{t}=P_{ b}=0.81017.\]

We observe that both flows develop rapidly from the two different initial conditions. After \(t=1\), the two paths of transition states of all physical values are already very similar, as shown in

Figure 19: PINNs’ results at 6 instants of short time for time-dependent discontinuous flows with the first initial conditions: before the flow the inlet is open while the outlet is closed.
Figure 20: PINNs’ results at 6 instants of short time for time-dependent discontinuous flows with the second initial conditions: before the flow the inlet is closed while the outlet is open.
Figs. 24 and 25 in Appendix B. Therefore, here we only present the two sets of results for \(t\in[0,1]\) in Figs. 19 and 20. With the first initial conditions, \(\rho\), \(v\) and \(T\) evolve quickly but smoothly except for \(P\), as there is a discontinuous jump between the boundary value and inner initial values at the outlet. Nevertheless, the pressure becomes continuous after \(t=0.2\), as shown in Fig. 19(d). With the second initial conditions, \(v\) and \(T\) values evolve quickly but smoothly except for \(\rho\) and \(P\), as there are discontinuous jumps between the boundary value and inner initial values at the inlet. Nevertheless, both the density and pressure become continuous after \(t=0.2\), as shown in Figs. 20(a) and (d).

## 5 Solutions in conservative form

In classical numerical methods a conservative form of the PDEs is in favor and numerical solutions of the non-conservative form tend to be unstable. Therefore, we consider the solution procedure of PINNs in the context of conservative form, which is given as follows

\[\partial_{t}U+\nabla\cdot K=J. \tag{5.1}\]

\(U,K\) and \(J\) are vectors: \(U=\begin{pmatrix}U_{1}\\ U_{2}\\ U_{3}\end{pmatrix},K=\begin{pmatrix}K_{1}\\ K_{2}\\ K_{3}\end{pmatrix}J=\begin{pmatrix}J_{1}\\ J_{2}\\ J_{3}\end{pmatrix},\) and they are defined as

\[\left\{\begin{aligned} \rho A&=U_{1},\\ \rho Av&=U_{2},\\ \rho A(\frac{T}{\gamma-1}+\frac{\gamma}{2}v^{2})&=U_{3}. \end{aligned}\right. \tag{5.2}\]

\[\left\{\begin{aligned} \rho Av&=K_{1},\\ \rho Av^{2}+\frac{1}{\gamma}PA&=K_{2},\\ \rho A(\frac{T}{\gamma-1}+\frac{\gamma}{2}v^{2})+PAv&=K_{3}. \end{aligned}\right. \tag{5.3}\]

\[\left\{\begin{aligned} 0&=J_{1},\\ \frac{1}{\gamma}P\frac{\partial A}{\partial x}&=J_{2},\\ 0&=J_{3}.\end{aligned}\right. \tag{5.4}\]

Accordingly, we have to adjust the outputs of the NNs to be \(U_{1},U_{2},U_{3}\) and \(P\), as shown in Fig. 21. To facilitate the construction of loss function, we have to rewrite \(K_{i}\) as a function of the NNs' outputs, namely, \(U_{i}\), as follows

\[\left\{\begin{aligned}  U_{2}&=K_{1},\\ \frac{U_{2}^{2}}{U_{1}}+\frac{\gamma-1}{\gamma}(U_{3}-\frac{ \gamma}{2}\frac{U_{2}^{2}}{U_{1}})&=K_{2},\\ \gamma\frac{U_{2}U_{3}}{U_{1}}-\frac{\gamma(\gamma-1)}{2}\frac{U_{2}^{3}}{U_{ 1}^{2}}&=K_{3},\end{aligned}\right. \tag{5.5}\]
where we have used the fact \(P=\rho T\) from the equation of state. Therefore, each component of the loss function is as follows

\[\left\{\begin{aligned} \frac{\partial U_{1}}{\partial t}+\frac{ \partial K_{1}}{\partial x}&=F_{1}(x,t),\\ \frac{\partial U_{2}}{\partial t}+\frac{\partial K_{2}}{\partial x }-\frac{1}{\gamma}P\frac{\partial A}{\partial x}&=F_{2}(x,t),\\ \frac{\partial U_{3}}{\partial t}+\frac{\partial K_{3}}{\partial x }&=F_{3}(x,t),\\ P-\frac{U_{1}}{A}(\gamma-1)\left(\frac{U_{3}}{U_{1}}-\frac{ \gamma}{2}\frac{U_{2}^{2}}{U_{1}^{2}}\right)&=F_{4}(x,t).\end{aligned}\right. \tag{5.6}\]

Here \(F_{1}(x,t)\), \(F_{2}(x,t)\), \(F_{3}(x,t)\), and \(F_{4}(x,t)\) represent residuals of the mass, momentum, energy, and state equations, respectively. For automatic differentiation, we have to expand all terms \(K_{i}\) in Eqs. (5.6) with \(U_{i}\) from Eqs. (5.5). These expansions quickly become unpleasant with many dividing operations, which poses challenges for gradient calculations and optimizations of the NNs' parameters. Despite our best efforts, the loss function does not descend easily and no meaningful predictions are made by PINNs with the conservative form.

## 6 Conclusions

We applied physics-informed neural networks or PINNs to directly solve steady and time-dependent compressible flows within a converging-diverging channel, corresponding to an unsupervised learning. With different boundary conditions, the flow may be completely subsonic, subsonic via a smooth transition to supersonic, or further from supersonic via a discontinuous transition back to subsonic.

Firstly, for a simple diverging channel, when sonic boundary conditions are imposed at the inlet and the outlet are left intentionally free, PINNs provide a subsonic or a supersonic continuous solution randomly and deliberately avoid solutions with discontinuity. The stochastic outcomes result from the randomness during initialization of the neural networks (NNs); Secondly, for a converging-diverging nozzle, PINNs with a default setting cannot capture transition from supersonic to subsonic flows with a discontinuity for the normal shock, although given proper boundary conditions at both the inlet and outlet. Instead, the loss function is unwilling to descend

Figure 21: The structure of PINNs for Euler equations in conservative form.
during training and consequently, a trivial solution with zero velocity and incorrect continuous profiles for other physical values are obtained. The two examples above indicate that during training the optimizer somehow "minimizes its efforts" before minimizing the loss function: it is inclined to offer smooth solutions (right or wrong) and reluctant to find discontinuous solutions. Hence, a small remedy of PINNs is pertinent.

After a close inspection on the descent of each component of the loss function and predictions of the physical values, we promote to put 20 times more weight on the minimization of the momentum equation and meanwhile enforce hard constraints on the boundary conditions of pressure. This exertion is coincident with a recent effort put forward by Perdikaris' group [33], where a dynamic weight is proposed to balance the gradients among different components of the loss function, to mitigate gradient vanishing. For the problems considered in this work, we acknowledge a constant heavy weight for the momentum loss being adequate for accurate solutions, after a couple of numerical experiments with trial and error.

With 90 neurons and 100 training points, the so-modified version of PINNs is able to deliver accurate solutions at steady states for subsonic flows, supersonic flows and mixture of both with a norm shock as sharp transition from supersonic to subsonic flows. For unsteady processes, with 200 neurons and 16900 training points, PINNs are able to predict accurately the time-dependent flows until steady states. Whether for steady or unsteady flows, PINNs are able to identify the locations of shocks accurately and offer very sharp profiles for the transitions without Gibbs phenomenon. These results are promising, as they encourage us to apply PINNs to solve more discontinuous physics phenomena and to replace/supplement traditional numerical schemes to a certain extent. Finally, when the PDEs are expressed in the conservative form, which is in favor by traditional numerical schemes, the output terms of the NNs and their corresponding loss function are entangled and not viable for an effective optimization. Consequently, the predictions offered by PINNs are incorrect. This indicates that PINNs prefer the simple differential form of the PDEs over the conservative form, as the former is more appropriate for straightforward automatic differentiation during optimization.

We envisage two research lines beyond this work. One is to explore PINNs as a direct numerical solver for more general compressible flows in two and three dimensions, especially with shock phenomena. From the performance on one-dimensional flows, it seems promising for PINNs to solve more compressible/discontinuous flows, where no exquisite shock-capturing schemes are essential. Another one is to supply PINNs with partially available experimental data, such as a few pressure values via sensors within the flow, to recover other physics values and/or to estimate unknown coefficients in the PDEs, such as wall frictions.

## Acknowledgments

X. Bian received the starting grant from 100 talents program of Zhejiang University. This work is partially supported by Hangzhou Shiguangji Intelligent Electronics Technology Co., Ltd, Hangzhou, China. The authors appreciate discussions with Dr. Bonan Xu and Mr. Yongzheng Zhu.