1. Introduction
The efficient transportation and distribution of natural gas play a pivotal role in the economic development and energy security of nations worldwide [
1]. In Kazakhstan, a country abundant in oil and gas resources, the modeling of gas flow in tubes holds significant importance across various sectors. Understanding and accurately predicting the behavior of gas within pipelines and distribution networks are paramount for optimizing infrastructure, ensuring energy supply reliability, and promoting environmental sustainability [
2,
3]. Thus modeling gas flow in tubes holds critical significance for Kazakhstan, impacting its oil and gas industry, energy sector development, infrastructure planning, environmental stewardship, research and innovation endeavors, and safety assurance. Through advanced machine learning and computational fluid dynamics simulations, country can optimize its energy resources, promote sustainable development, and bolster resilience in its energy infrastructure.
The comprehensive modeling of gas flow in tubes relies fundamentally on solving partial differential equations (PDEs) governing fluid dynamics. PDEs, such as the Euler equations, form the mathematical framework for describing the conservation laws of mass, momentum, and energy in fluid flow. Solving these equations numerically using advanced computational techniques enables the accurate prediction of gas behavior, including shock wave propagation, turbulence effects, and flow characteristics within pipelines and tubes. In recent years, significant progress has been made in computational fluid dynamics (CFD) [
4,
5] in solving numerically PDEs, particularly in solving Navier-Stokes equations [
6,
7,
8], which has revolutionized ability to simulate and analyze complex fluid flow phenomena using techniques like Finite Difference (FD) [
9,
10,
11] and Finite Volume (FV) methods [
12,
13]. Event though models such as Navier-Stokes equations [
14,
15,
16,
17,
18] are able to describe the underlying problem, at this point modeling still requires a large amount of computation cost to achieve high precision.
The rapid growth of data, the parallel computing emergence, the advent of graphics processors (GPUs) together with advanced theoretical results in numerical analysis has resulted in the explosive growth of machine learning (ML) [
19,
20], particularly in the area of physical problems and mathematical physics. Modern models such as Physics-Informed Neural Networks (PINNs) [
21,
22,
23,
24,
25] is a type of artificial neural networks that can dramatically reduce the computational complexity of modeling physical processes. The further need for development of potential of these models is still relevant and they are still not a uniform method of the CFD, but in the field of forward problems it has the higher precision and illustrates promising future. In recent advancements, PINNs have been employed for solving compressible flow governed by the Navier-Stokes equations [
26,
27], offering efficient simulations. However, despite these advancements, achieving optimal results in compressible flow remains difficult process and still an art.
This research considers a transient gas flow in pipelines using Physics-Informed Neural Networks, with manual selection of the necessary hyperparameters using a weighted loss function [
28]. In addition to that, evaluation of the PINN model performance, the following problems will be solved for demonstrating the effectiveness of the method: Burgers Equation [
29,
30], Viscous Burgers Equation [
30,
31] and Euler’s Equations of gas dynamics [
32,
33], where the main focus will be on the compressible flow problem.
The article is organized as follows.
Section 2 introduces the physical problem in the general form of the PDE with initial and boundary conditions. Next
Section 3 illustrates the numerical continuous PINN model with the forward propagation procedure for the predictions of the true solutions, multi-objective loss for the optimization and architecture of the model. In addition to that, the discrete CFD model, which applied Runge-Kutta 4 step method with general form and space derivatives discretization. In
Section 4 one-dimensional problems are solved with short discussions of it’s mathematical form: PDE, initial and boundary conditions and physical descriptions with graphical comparisons to analytical solutions and with
L norm error measures.
2. Physical Problem
The physical problem involves gas flow in the pipe, which is described by system of Euler’s equations. Equations govern the motion of adiabatic, inviscid, compressible fluids, providing a powerful model for analyzing fluid dynamics in many practical scenarios. In order to capture speed of the rarefaction wave, the discontinuity and shock contacts, the problem is considered in a chamber that is is separated by regions with high pressure and low pressure at interface point
, as shown in
Figure 1. The physical process is observed for the time domain
. The space domain is defined as
.
Euler’s system of equations represents conservation of mass, momentum, and energy. The conservation of mass in the system is described by continuity equation. It determines how changes in density affect fluid flow and ensures that the total mass within a fluid volume remains constant over time:
where the density of gas
changes with respect to time and space as influenced by the flow velocity component
.
The conservation of momentum is based on Newton’s laws of motion:
The momentum equation describing how the velocity of the fluid changes in response to convection and pressure
. It influences the formation of shocks and determines the acceleration of the gas flow.
The general form of the energy equation is derived from principles of conservation of energy, which is expresses as:
The energy equation describes the conservation of energy in fluid flow, it influences the system by determining how energy is transferred through advection and how work done by pressure forces, where
is the total energy and defines as,
with specific heat ratio
equal to
.
Taking into account shock phenomena generation, next initial conditions are used:
The Dirichlet boundary conditions is applied as boundary conditions, meaning that the quantities take on the values prescribed by the initial conditions at both boundaries, which ensures that the flow at the boundaries remains consistent with the initial conditions.
The transient gas flow in pipelines can be expressed in general form as:
The solution is denoted by
with spatial coordinate
, time
t and parameter of the PDE
, where
is the computational domain and
is the boundary. Here,
is a linear or nonlinear differential operator, initial condition operator
and boundary condition operator
. Note that this form of reprezenation of parametrized PDE can be used for other problems as well.
3. Methodology
3.1. Continuous PINN Time Model
The continuous PINN time model is used as framework for solving PDE, the left-hand side of the equation is defined as,
the fully-connected deep
L neural network with inputs
and outputs
is defined as,
the forward propagation procedure will be used to approximate solution
as follows,
Here, activation value
denotes the output of the
layer with weights matrix
and bias vector
and nonlinear activation function
, where
denotes the number of neurons in
layer. For the last layer
L linear activation function with
outputs is used to approximate solution, as
.
The construction that converts PDE into an optimization problem is combined multi-objective weighted squared loss
,
where individual loss term is defined as,
weights and biases denoted by
can be trained by minimizing,
Here, for train the initial conditions is used as inputs and is used as outputs, for the boundary conditions is inputs and is outputs, for training the residual only inputs is required , where all data points would be picked at random either from entire computational domain or some subset without repetitions and . The multi-objective optimization goal is to train both supervised and unsupervised losses, where residual loss plays role as regularization term that allows model to generalize information outside of some local region and prevent overfitting by penalization of the physical constraints and is balances between loss importances. It can be seen that with higher number of initial and boundary data physics loss becomes less important and vice-versa with less available data physics loss becomes more important .
In order to solve optimization problem ADAM optimizer algorithm is used. For the calculations of the partial derivatives for the automatic differentiation (AD) would be applied, which means that outputs of the neural network would be directly used to calculate it’s derivatives with respect to the inputs , as .
In
Figure 2, there is shown a schematic representation of PINN with key elements (Neural Network, automatic differentiation AD, Loss) with inputs
and outputs
u and
v. With AD outputs is differentiated with respect to it’s inputs in order to construct
loss, then outputs is directly used to compute
losses then final loss
is computed.
3.2. Discrete Time Model
The Runge-Kutta (RK4) method for time integration is used as discrete time model CFD, it’s particularly effective for addressing nonlinear problems. This method is characterized by it’s fourth-order accuracy in time. Applying RK4 for general form of the case problem:
The Runge-Kutta’s all 4 steps written as:
Given the fact that the RK4 scheme only affects time, schemes are needed to approximate the space for convective and viscous terms in order to achieve second-order accuracy in space. Thus the upwind scheme is used for the flux terms:
where
and
are the average of the nodal point values, and are defined as follows:
functions
and
depend on the signs of
and
, and are defined as follows,
This approach, specifically employed for convective terms calculates average values of velocities at the cell boundaries of the spatial grid around each node point. It uses the directions of these velocities to establish which grid node the values of
need to be calculated, forming the differences in the flow. The central difference scheme is used for derivatives not involving non linearity:
The central difference scheme provides an approximation of spatial derivatives for the viscous part of the equations, where
F is the flux function.
4. Computational Experiments
First, viscid and inviscid Burgers’ equations are considered as reference solution to verify both approaches. The computational experiments of the PINN and RK4 models will be compared to it’s analytical solutions graphically and with L norm measures. Following with results for case study problem.
The input data for the PINN model, such as, NN setup, number of initial conditions points
, number of boundary conditions points
, number of interior points
, nonlinear activation function
, learning rate
for the ADAM optimizer, value
, number of iterations epochs is given in
Table 1, where
are grid sizes for the space and time domain, respectively. In adition to that, input data for the CFD model, which is, grid size
, CFL
number are presented in
Table 2.
The precision of the proposed models will be measured with the following L norms defined as follows,
4.1. Verification
Inviscid Burgers Equation
Despite simplicity of the Burgers equation without viscous part, it plays significant role in physics due to ability of capturing essential fluid phenomena such as turbulence and wave propagation. Equation describes the behavior of non-linear waves and shock waves:
with the initial condition:
where the time at which a shock forms is indicated by the
parameter and set equal to 1. Next boundary conditions are used:
Figure 3 illustrates the comparison of the numerical solutions of the inviscid Burgers equation with it’s analytical solution. The graph highlights the accuracy of both numerical approaches in capturing the complex behavior of this fluid dynamics problem.
The error measures for the Burgers equation are given in
Table 3, it can be seen that RK4 model is slightly better than PINN model, but it uses almost five times more space points.
Viscous Burgers Equation The viscosity introduces additional mathematical complexity, allowing for the study of phenomena such as dissipation of kinetic energy, boundary layer separation, and transition to turbulence. This transition provides valuable insights into the behavior of fluid flows near solid boundaries and in regions of high velocity gradient. Viscous Burgers equation is described as:
where
affects the diffusion term, which characterizes the viscosity in the equation and set equal to 0.01. Next initial condition are prescribed:
following by boundary conditions:
Figure 4 demonstrates comparison between the numerical solutions and the analytical solution for the Burgers Equation with viscosity. The presence of a viscous term in the equation has a distinct impact on the solution. Both methods shows high accuracy of capturing shock wave.
The error measures for the Viscous Burgers equation are given in
Table 4. Similar to previous case RK4 method shows slightly better results due to higher number of space points.
4.2. Case Study
Since both methods have been verified, a case study is investigated for further analysis of capturing unique characteristics of gas flow in pipe, which involves contact discontinuity ans shock wave.
Figure 5 illustrates three distinct plots with comparisons to analytical solutions. The significance of these plots lies in their ability to demonstrate the accuracy of the numerical methods in capturing the complex behavior of compressible flows. It can be seen that RK4 model has some oscillations in velocity
u and pressure
p profiles, while PINN model is more smooth.
The error measures for the Euler’s equation for the density
, velocity
u and pressure
p are given in
Table 5,
Table 6,
Table 7. The RK4 model has better results for the
norms, while PINN model has better result for the
, which also can be seen by the plotted profiles, since CFD model has oscillations.
The results obtained from computational experiments are sufficient for both models in terms of comparing them with analytical plots and using L norms. The results show that the CFD model outperforms the PINN model, but it was achieved due to higher number of points for space discretization. The CFD model starts to exhibit oscillations for velocity and pressure, while the PINN model gives a smoother solution, as can be seen from the values of norms. This effect could be explained by the PINN nature to integrate physical laws into numerical solution. Thus it creates smooth and continuous solutions. Although the CFD model gives better computational and optimal results for the case of one-dimensional problems, as the dimensionality of the problem and the number of equations increases, the CFD model will require a large grid size and a long computational process and the obtained solutions may have oscillations, while the PINN model can generalize the information using a subset of the entire computational domain in a relatively small number of iterations compared to the CFD model, resulting in a smoother and more optimal solution.
5. Discussion
In the realm of numerical techniques for solving differential equations, both classical CFD and PINN methods offer unique approaches and advantages. Understanding the comparative strengths and limitations of these methods is crucial for selecting the most appropriate approach for a given problem.
Accuracy and Precision:
Classical CFD methods are renowned for its ability to achieve high accuracy, especially when employing fine grid resolutions. This method excels in problems where the underlying physics are well-understood and can be accurately represented by explicit equations. However, CFD methods may encounter challenges near discontinuities or sharp gradients, leading to accuracy degradation in such regions.
Conversely, PINNs adopt a data-driven approach, leveraging neural networks to approximate solutions based on available data. While PINNs may sacrifice some accuracy compared to FDM, particularly in problems with well-defined physics, they offer advantages in handling complex or data-driven scenarios. PINNs can provide smoother and more continuous solutions, making them suitable for problems with irregular geometries or unstructured data.
Computational Efficiency:
Classical CFD methods typically involve explicit grid generation and solving equations at each grid point, which can be computationally intensive for large-scale problems. Conversely, PINNs offer computational efficiency once trained, as they can rapidly generate solutions without the need for explicit grid structures. This efficiency is particularly advantageous for problems with complex geometries or time-dependent constraints.
Flexibility and Adaptability:
Classical CFD methods are constrained by grids shapes and may struggle with problems involving complex or irregular geometries. In contrast, PINNs offer greater flexibility and adaptability, as they can handle unstructured data and irregular domains more effectively. PINNs have the potential to generalize well to new conditions or scenarios not explicitly included in the training data, enhancing their applicability to a wide range of problems.
In conclusion, the choice between classical CFD and PINN methods depends on the specific requirements of the problem, including the nature of the differential equations, the availability of data, the complexity of the geometry, and computational resources. CFD methods excels in problems with well-understood physics and structured domains, offering high accuracy with fine grid resolutions. On the other hand, PINN provides flexibility, generalization, and efficiency advantages, especially for complex or data-driven problems with irregular geometries. By understanding the comparative strengths and limitations of these methods, researchers and engineers can make informed decisions to select the most suitable approach for their specific applications.
6. Conclusions
This article investigates gas flow in pipeline for capturing the propagation speed of the rarefaction wave, the contact discontinuity and the shock discontinuity. First the physical model is defined to provide gas characteristics. Initial and boundary conditions were specified according to case problem. Then two numerical models were proposed: the continuous PINN model and the discrete CFD model (Runge-Kutta 4). The methods were verified through the one-dimensional inviscid and viscous Burgers equations. Following with case study problem estimation, which is described by the system of one-dimensional Euler’s equations. Results show sufficient accuracy in the graphical comparison with the analytical solution and in the L norm indices. According to the results of numerical studies it can be seen that for relatively simple problems classical CFD method is still superior to PINN, but with increasing complexity of the problem CFD suffers from increasing the grid sizes and as a result may have oscillations, where PINN has a smoother solution, which in turn gives to expect from PINN a higher result with increasing the dimensionality of the problem and the number of input equations. In conclusion, this study highlights the effectiveness of both Physics-Informed Neural Networks and classical CFD methods in modeling gas flow in pipelines. By accurately capturing dynamic flow characteristics such as rarefaction waves and shock discontinuities, these numerical techniques provide valuable insights into the behavior of gas transportation systems. The comparison between PINN and CFD approaches underscores the importance of selecting the most appropriate method based on the specific requirements of the problem, ensuring reliable and efficient solutions for modeling gas flow in pipelines.
Future research could be aimed at improving both models: for the continuous PINN model a way to find the most appropriate hyperparameters using for instance Bayesian Hyperparameter Optimization. For the discrete CFD model the approximation of derivatives using the finite difference method should be replaced by more accurate methods with higher order of approximation over space and flexibility on complex domains, such as finite volume method. In addition to that, case study physical problem (Euler’s Equations) should be extended to two-dimensional forms and further to two-dimensional Navier-Stokes equations.
Author Contributions
Authors contributed equally to this work.
Funding
This research has been funded by the Science Committee of the Ministry of Science and Higher Education of the Republic of Kazakhstan (Grant AP14871641).
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Not applicable.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Roth, C.; Hartmann, J.; Schiewe, C.; Staudacher, S. Asymmetric Flow Phenomena Affecting the Characterization of the Control Plant of an Altitude Test Facility for Aircraft Engines. Symmetry 2023, 15. [CrossRef]
- Zhao, X.; Cao, J.; Wang, B.; Yang, X. Experiment Study of Outburst Pulverized Coal-Gas Two-Phase Flow and Characteristic Analysis of Outburst Wave. Geofluids 2021, 2021, 1–11. [CrossRef]
- Meleshko, S.V.; Kaptsov, E.I. Symmetry Analysis of the Two-Dimensional Stationary Gas Dynamics Equations in Lagrangian Coordinates. Mathematics 2024, 12. [CrossRef]
- Anderson, J.D.; Wendt, J. Computational fluid dynamics; Vol. 206, Springer, 1995.
- Chung, T.J. Computational fluid dynamics; Cambridge university press, 2002.
- Philip, N.J.; Mathew, E. NUMERICAL SIMULATION OF SUPERSONIC FLOW OVER A FLAT PLATE AND HEAT FLUX PREDICTION. Int J Adv Engg Tech/Vol. V/Issue II/April-June 2014, 6, 08.
- Hoque, S.; Kalita, P. Numerical Simulation of Supersonic Viscous Flow over a Flat Plate.
- Daidzic, N.E. Unified Theory of Unsteady Planar Laminar Flow in the Presence of Arbitrary Pressure Gradients and Boundary Movement. Symmetry 2022, 14. doi:10.3390/sym14040757. [CrossRef]
- Rysbaiuly, B.; Sinitsa, A.; Capsoni, A. Analytical Inverse Analysis Methodological Approach for Thermo-Physical Parameters Estimation of Multilayered Medium Terrain with Homogenized Sampled Measurements. Symmetry 2022, 14. [CrossRef]
- Alpar, S.; Berger, J.; Rysbaiuly, B.; Belarbi, R. Estimation of soils thermophysical characteristics in a nonlinear inverse heat transfer problem. International Journal of Heat and Mass Transfer 2024, 218. Cited by: 1; All Open Access, Bronze Open Access. [CrossRef]
- Teixeira, F.; Sarris, C.; Zhang, Y.; Na, D.Y.; Berenger, J.P.; Su, Y.; Okoniewski, M.; Chew, W.; Backman, V.; Simpson, J. Finite-difference time-domain methods. Nature Reviews Methods Primers 2023, 3, 75.
- Satheesh Kumar Nair, V. High-Order Numerical Schemes for Compressible Flows 2016.
- Droniou, J. Finite volume schemes for diffusion equations: introduction to and review of modern methods. Mathematical Models and Methods in Applied Sciences 2014, 24, 1575–1619. [CrossRef]
- Fursikov, A. Stabilizability of Two-Dimensional Navier—Stokes Equations with Help of a Boundary Feedback Control. Journal of Mathematical Fluid Mechanics 2001, 3, 259–301. [CrossRef]
- Sritharan, S.; Sundar, P. Large deviations for the two-dimensional Navier–Stokes equations with multiplicative noise. Stochastic Processes and their Applications 2006, 116, 1636–1659. [CrossRef]
- Gottlieb, S.; Tone, F.; Wang, C.; Wang, X.; Wirosoetisno, D. Long time stability of a classical efficient scheme for two-dimensional Navier–Stokes equations. SIAM Journal on Numerical Analysis 2012, 50, 126–150. [CrossRef]
- af Klinteberg, L.; Askham, T.; Kropinski, M.C. A fast integral equation method for the two-dimensional Navier-Stokes equations. Journal of Computational Physics 2020, 409, 109353. [CrossRef]
- Ladyzhenskaya, O.A. Sixth problem of the millennium: Navier-Stokes equations, existence and smoothness. Russian Mathematical Surveys 2003, 58, 251. [CrossRef]
- Alamoudi, M.; Sattari, M.A.; Balubaid, M.; Eftekhari-Zadeh, E.; Nazemi, E.; Taylan, O.; Kalmoun, E.M. Application of Gamma Attenuation Technique and Artificial Intelligence to Detect Scale Thickness in Pipelines in Which Two-Phase Flows with Different Flow Regimes and Void Fractions Exist. Symmetry 2021, 13. [CrossRef]
- Rabczuk, T.; Bathe, K.J. Machine learning in modeling and simulation: methods and applications; Springer, 2023.
- Raissi, M.; Perdikaris, P.; Karniadakis, G.E. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational physics 2019, 378, 686–707. [CrossRef]
- Markidis, S. The old and the new: Can physics-informed deep-learning replace traditional linear solvers? Frontiers in big Data 2021, 4, 669097. [CrossRef]
- Faroughi, S.A.; Soltanmohammadi, R.; Datta, P.; Mahjour, S.K.; Faroughi, S. Physics-informed neural networks with periodic activation functions for solute transport in heterogeneous porous media. Mathematics 2023, 12, 63. [CrossRef]
- Raissi, M.; Perdikaris, P.; Karniadakis, G.E. Physics informed learning machine, 2021. US Patent 10,963,540.
- Wang, Y.; Zhong, L. NAS-PINN: neural architecture search-guided physics-informed neural network for solving PDEs. Journal of Computational Physics 2024, 496, 112603. [CrossRef]
- Cai, S.; Mao, Z.; Wang, Z.; Yin, M.; Karniadakis, G.E. Physics-informed neural networks (PINNs) for fluid mechanics: A review. Acta Mechanica Sinica 2021, 37, 1727–1738. [CrossRef]
- Naderibeni, M.; Reinders, M.J.; Wu, L.; Tax, D.M. Learning solutions of parametric Navier-Stokes with physics-informed neural networks. arXiv preprint arXiv:2402.03153 2024.
- de Wolff, T.; Carrillo, H.; Martí, L.; Sanchez-Pi, N. Towards optimally weighted physics-informed neural networks in ocean modelling. arXiv preprint arXiv:2106.08747 2021.
- Bonkile, M.P.; Awasthi, A.; Lakshmi, C.; Mukundan, V.; Aswin, V. A systematic literature review of Burgers’ equation with recent advances. Pramana 2018, 90, 1–21. [CrossRef]
- Bec, J.; Khanin, K. Burgers turbulence. Physics reports 2007, 447, 1–66. [CrossRef]
- Inan, B.; Bahadir, A.R. Numerical solution of the one-dimensional Burgers’ equation: Implicit and fully implicit exponential finite difference methods. Pramana 2013, 81, 547–556. [CrossRef]
- Lora-Clavijo, F.; Cruz-Pérez, J.; Siddhartha Guzmán, F.; González, J. Exact solution of the 1D riemann problem in Newtonian and relativistic hydrodynamics. Revista mexicana de física E 2013, 59, 28–50. [CrossRef]
- Endres, E.E.; Jenssen, H.K. Compressible 1D Euler Equations with Large Data: A Case Study. Journal of Hyperbolic Differential Equations 2009, 6, 389–406. [CrossRef]
|
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).