1. Introduction
Computational fluid dynamics is a critical tool for understanding and predicting complex flow phenomena across a wide range of engineering and scientific problems, with applications from aircraft design to environmental forecasting [
1,
2]. Traditional numerical methods, such as the finite volume and finite element methods, have seen widespread practical success by discretizing the governing equations on computational grids [
3,
4,
5]. However, traditional grid-based methods face high computational costs and geometric constraints when resolving high-fidelity or unsteady flows [
6,
7,
8]. Recently, Physics-Informed Neural Networks (PINNs) have emerged as a mesh-free alternative for solving partial differential equations [
9], integrating physical laws directly into the loss function and showing promise for complex geometries and data-sparse problems [
10,
11,
12,
13,
14,
15]. In fluid mechanics, PINNs have been applied to complex boundary flows [
16], non-Newtonian viscosity modeling [
17], transient pipeline flows [
18], and heat convection [
19].
However, fully unsupervised PINNs struggle with strongly time-dependent flows characterized by broad spatiotemporal scales and localized dynamic features, such as vortex shedding in cylinder wakes [
14,
20,
21]. These flows exhibit sharp transitions from slowly varying regions to highly periodic vortex structures, posing challenges in accurately capturing separation, shear layers, and vortex evolution [
22,
23]. To enhance the performance of PINNs in such problems, various approaches have been explored, such as incorporating supervised data, employing mixed-variable schemes, or adopting enhanced temporal modeling techniques [
24,
25,
26,
27]. Due to the inherent limitations of PINNs in directly handling such strongly time-dependent and physically intense flows, existing studies often rely on supervised data—such as sparse measurement points in the wake region—to improve accuracy [
28,
29]. However, in actual experiments, obtaining even sparse yet precise transient data is often challenging. For instance, hot-wire or hot-film anemometers, while capable of providing flow information, are limited by their intrusive interference with the flow field [
21]. Particle Image Velocimetry (PIV), although able to capture instantaneous velocity distributions in a plane or volumetric domain, may suffer from measurement bias because particles may not perfectly follow fluid parcel motion, thereby constraining its accuracy [
30,
31]. These issues fundamentally limit the practicality and generalizability of such hybrid methods in complex flow modeling. Therefore, developing a PINN-based approach capable of accurately modeling strongly time-dependent, complex spatiotemporally evolving flows under a fully unsupervised condition holds significant theoretical importance and practical value.
To overcome these limitations, this work proposes a fully unsupervised framework termed the Adaptive Hard-Constrained Physics-Informed Neural Network (AHC-PINN). This framework integrates an adaptive sampling scheme driven by the contribution of PDE residuals with a hard-constrained strategy. At its core lies a dynamic sampling algorithm that continuously and quantitatively assesses the contribution of each collocation point to the total loss during training, thereby dynamically prioritizing the allocation of collocation points to regions of high physical activity. Building upon this, the hard-constrained strategy further focuses the training objective on the residual of the governing equations. Validation on a two-dimensional unsteady cylinder flow problem demonstrates that AHC-PINN achieves significantly superior performance in both accuracy and training stability compared to baseline methods. Furthermore, through an analysis of PDE residuals and flow field gradients, this study explicitly identifies the adverse impact of large-gradient regions on the training stability and predictive accuracy of PINNs. This finding provides concrete guidance for subsequent methodological improvements.
3. Results and Discussion
In this study, the physical model considers a two-dimensional transient flow past a circular cylinder, as shown in
Figure 3. To clearly illustrate the flow field structure, a rectangular region near the cylinder is highlighted for detailed analysis. The cylinder is positioned at the center of a square computational domain. After non-dimensionalization, the cylinder diameter is set to 1, and the dimensions of the computational domain are 33.4 in length and 17.5 in width. The flow boundary conditions are set as follows: the left side is a uniform inflow inlet with a velocity of 1; the static pressure at the right-side outlet is set to 0; all other walls and the cylinder surface employ a no-slip boundary condition. The specific boundary condition settings are:
Here, denotes the interior of the geometric domain, while represents its boundaries. After the flow has fully developed into a stable Kármán vortex street, a specific moment is selected as the initial condition, and one full flow cycle is computed. The non-dimensionalized computation time is 1.375, and the model Reynolds number is . During the training phase, the neural network employs the hyperbolic tangent (tanh) as its activation function, uses the Adam optimizer, and adopts a learning rate annealing strategy, with the initial learning rate set to 0.001.
The training effectiveness of AHC-PINN is first evaluated for the cylinder flow problem. Using a baseline network architecture of size
, four configurations are compared: the traditional soft-constrained PINN (sPINN), the soft-constrained PINN with adaptive sampling (A-sPINN), the data-supervised sPINN (sPINN+data), and the proposed AHC-PINN. To further assess performance under data-supervised conditions, sPINN, A-sPINN, and AHC-PINN are also tested with two different amounts of supervision data: 4 and 15 points. According to Xiang et al. [
26], four supervision points constitute the minimum sensor threshold required for conventional methods to achieve initial convergence. Utilizing fewer than four points renders the model entirely incapable of capturing any wake dynamics. In contrast, 15 points correspond to a scenario where a moderately structured sensor array is available within the wake region. Finally, the influence of model capacity on solution accuracy is examined by testing each configuration with three network scales:
,
, and
. In the AHC-PINN framework, both the particular solution network and the distance metric network are designed as lightweight neural networks with a
architecture. Specifically, the particular solution network is trained for 50,000 epochs, while the distance metric network undergoes 300,000 epochs. Given their compact scale, the computational overhead is negligible compared to that of the main network.
The reference solution (ground truth, GT) for the flow field used in this work is obtained by solving the two-dimensional transient incompressible Navier–Stokes equations using the finite element method, with a time step of employed for the transient simulation. To satisfy the LBB stability condition, P2-P1 mixed elements are adopted for spatial discretization, while the Backward Differentiation Formula scheme is utilized for time integration. The nonlinear solver employs the Newton–Raphson method, with a stringent relative tolerance of imposed at each time step to guarantee the accuracy of the temporal evolution. In the grid generation process, coarse, medium, and fine mesh densities were evaluated. With the relative difference between the medium and fine meshes being less than 1.5%, the fine mesh, containing 293,080 elements, was selected to ensure precise reference data for training and testing the PINN. All computational fluid dynamics simulations are performed on an Intel Xeon E5-2640 v4 CPU. The training of the deep neural networks is implemented based on the PyTorch framework and executed on an NVIDIA GeForce RTX 4090 (24 GB) GPU.
To validate the impact of the adaptive sampling algorithm on the solution accuracy of transient cylinder flow, we conducted a comparative analysis of the velocity field predictions at time
.
Figure 4 presents the velocity contours in the wake region and their corresponding absolute errors compared to CFD results for four methods: sPINN, A-sPINN, sPINN+data, and AHC-PINN (all methods employ the 6 × 64 network size; the sPINN+data method utilizes the four true data points near the cylinder shown in
Figure 3).
The results indicate that the unsupervised sPINN encounters significant difficulties in solving this flow problem, with almost no periodic Kármán vortex street structures appearing in the flow field. Combined with the error contour in
Figure 4b and the velocity gradient distribution in
Figure 5a, it is evident that the errors are primarily concentrated in regions with high velocity gradients behind the cylinder. This suggests that the predictive accuracy of PINNs for solving this PDE is largely constrained by the physical variations in high-gradient regions. With the A-sPINN method, the prediction results in the wake region show clear improvement compared to sPINN, and a distinct periodic flow structure becomes observable. This trend is further enhanced after incorporating the hard-constraint strategy (AHC-PINN). Furthermore, observing the PDE loss decay curve in
Figure 5b, even A-sPINN, which only adjusts via loss-driven importance sampling, shows a notably faster reduction in PDE loss than the traditional sPINN method, while AHC-PINN demonstrates an even more significant advantage in lowering the PDE loss.
Figure 5c and
Figure 5d illustrate the loss curves for the BC and IC, respectively.
Table 1 lists the quantitative mean squared errors for each physical quantity, showing a continuous improvement in numerical accuracy as loss-adaptive sampling and the hard-constraint strategy are progressively applied. Under completely unsupervised conditions, AHC-PINN achieves orders-of-magnitude accuracy improvements over conventional sPINN across all physical quantities, and its accuracy even slightly surpasses that of the supervised sPINN+data method. This fully demonstrates the advantage of AHC-PINN in unsupervised scenarios and highlights its significant practical value for real-world engineering problems where obtaining precise point data is challenging.
Although the adaptive sampling mechanism in AHC-PINN necessitates calculating the full-field residual distribution and updating sampling points, which results in a training duration approximately 2.7 times that of sPINN, the method operates as an unsupervised framework that eliminates the prohibitive cost of acquiring high-fidelity labeled flow field data. Consequently, this increase in training time is justifiable when compared to the alternatives of compromising accuracy or relying on inaccessible data.
In
Figure 6, panels (a) and (b) respectively present contour plots of the PDE residual distribution across the temporal and spatial dimensions. For the sPINN method, the PDE residuals are notably concentrated in regions near the cylinder with high velocity gradients, which aligns with our previous analytical conclusions. Based on the analysis of the Navier–Stokes equations, a stream function
is introduced such that
and
, automatically satisfying the continuity equation, while the velocity gradient components manifest as second-order partial derivatives of
. The vorticity is defined as
. Taking the curl of the momentum equations to eliminate the pressure term yields the vorticity transport equation:
Substituting
, we obtain the equation for
:
This equation governs the evolution of the stream function
, which in turn dictates the evolution of the velocity gradient. The continuity equation only requires the velocity field to be divergence-free, imposing no direct constraint on the magnitude of the velocity gradient; in contrast, the vorticity equation derived from the momentum equations directly incorporates the velocity gradient and describes its convection, diffusion, and generation mechanisms. In regions with large velocity gradients, the magnitudes of the nonlinear and viscous terms in the vorticity equation increase significantly—a characteristic prominently observed in the near-wake region behind the cylinder in flow-past-body problems. The distribution of the momentum equation loss shown in
Figure 6c corroborates this view: the loss is predominantly concentrated in this high-gradient region. The substantially reduced momentum equation loss for the A-sPINN method effectively demonstrates the positive impact of the loss-driven sampling strategy for PINNs when dealing with large-gradient regions, while the AHC-PINN method further reduces the overall equation loss across the entire domain. Although introducing supervised data (sPINN+data) can improve prediction accuracy, as observed in
Figure 6, its equation loss remains high. This strategy essentially uses data to provide local compensation in high-gradient regions without fundamentally enhancing the PINN’s ability to fit the governing equations themselves.
Table 2 presents a performance comparison of the four strategies under different network sizes. The results show that the unsupervised method proposed in this work, AHC-PINN, performs better than or close to the data-supervised sPINN+data method in most cases. Under the baseline network size (6 × 64), AHC-PINN outperforms sPINN+data in both MSE and Relative L2 metrics, with only a slightly higher MAE. This outcome demonstrates that through the synergy of loss-adaptive sampling and the hard-constraint mechanism, AHC-PINN effectively enhances the embedding capability of physical laws. For the cylinder flow model, it can achieve accuracy comparable to or even surpassing that of data-supervised methods under unsupervised conditions. Furthermore, as the network size increases progressively from 6 × 32 to 6 × 128, the performance of AHC-PINN continues to improve (the mean squared error decreases from 0.00459 to 0.00254), indicating that the method can fully utilize increased network capacity to enhance modeling capability without showing significant performance saturation. In contrast, the performance improvement of sPINN+data at larger network sizes is unstable, limited by the influence of the data loss term.
Table 3 compares the velocity errors of various methods relative to the CFD benchmarks at
and
. Across these Reynolds number scenarios, AHC-PINN consistently exhibits slightly superior performance compared to the sPINN+data method utilizing sparse data.
To comprehensively evaluate the performance of each method, we conducted comparative tests of the strategies under identical supervised data conditions, with the corresponding error results presented in
Table 4. When all methods were augmented with supervised data, both A-sPINN and AHC-PINN demonstrated significantly higher accuracy than sPINN, and the accuracy of both further improved as the number of supervised data points increased. However, after introducing supervised data, the influence of network size on the performance of all methods tended to level off due to the impact of the data loss term—a phenomenon consistent with the trend observed for sPINN+data error variations in
Table 2. Integrating the results from
Table 2 and
Table 4, AHC-PINN not only shows superior accuracy in unsupervised training, making it more suitable for scenarios where obtaining precise data is challenging in practice, but it also utilizes increases in deep neural network scale more effectively to enhance modeling performance, demonstrating favorable scalability.
To validate the generalization capability of the AHC-PINN method, this section tests the flow field prediction performance of four approaches—sPINN, A-sPINN, sPINN+data, and AHC-PINN—under the presence of obstacle structures with different shapes, as configured in
Figure 7.
Figure 8 and
Table 5 present the velocity contour results and the corresponding quantitative errors compared to CFD results for each shape. The prediction outcomes across different obstacle shapes are largely consistent with those observed for the single circular cylinder case. Under unsupervised conditions, the AHC-PINN method achieves significantly higher accuracy than the sPINN method, and its performance is close to or even surpasses that of the supervised sPINN+data method. Furthermore, by examining the velocity contours in
Figure 8, the AHC-PINN method demonstrates better physical consistency compared to the sPINN+data approach, further substantiating the importance of developing unsupervised PINN methodologies.