betaFeedback

WorksPhysics and Astronomy

Physics Informed Neural Network for Multi-dimensional Turbulent Self-gravitating Flows

Abstract

Molecular clouds exhibit complex, multi-scale dynamics driven by the interplay of turbulence, self-gravity, and gas pressure. Modelling these systems with conventional grid-based methods becomes increasingly expensive as spatial resolution and dimensionality increase. Physics-Informed Neural Networks (PINNs) offer a mesh-free alternative by incorporating the governing equations directly into the training objective, but their ability to model realistic turbulent self-gravitating flows remains largely unexplored. We apply PINNs to isothermal molecular clouds initialized with astrophysically motivated turbulent velocity fields, considering subsonic and supersonic evolution in two and three dimensions. We benchmark the predicted density and velocity fields against the finite-volume code Athena++. PINNs accurately recover the global evolution of the flow over multiple free-fall times across turbulent realizations, Mach numbers, and dimensionalities. Their training cost also exhibits weak dependence on spatial resolution, increasing by less than 25% from 128^3 to 1024^3 in our experiments. These results demonstrate that PINNs can model substantially more realistic self-gravitating turbulent flows than previously explored and provide a promising complementary framework for studying these systems.

Introduction

Molecular clouds are the sites of star formation and are characterized by the interplay of self-gravity, gas pressure, and turbulent motions. Highly structured, multi-scale gas flows shaped by the interplay between self-gravity and turbulence exist in these systems. Observations reveal substantial velocity structure across a broad range of spatial scales, while numerical studies show that supersonic turbulence can strongly influence the formation and evolution of dense structures [8, 13]. Capturing the coupled evolution of density, velocity, and gravitational potential in such flows therefore provides a stringent test for numerical methods, particularly when the dynamics become strongly nonlinear and span multiple spatial scales.

Grid-based methods provide a well-established framework for solving self-gravitating hydrodynamics and have been successfully applied to turbulent molecular-cloud simulations. However, resolving a broad range of spatial scales can require increasingly fine computational meshes, with the associated cost becoming particularly significant in three dimensions. These considerations motivate the exploration of alternative numerical formulations that do not rely on a fixed spatial discretization.

Physics-informed neural networks (PINNs) provide one such formulation [17]. Instead of representing the solution on a prescribed mesh, a neural network can represent the physical fields as continuous functions of space and time, while the governing differential equations are incorporated directly into the training objective through automatic differentiation. This approach allows the equations themselves to provide the physical constraints during training and does not require a labelled solution dataset. PINNs have therefore attracted increasing interest in astrophysical applications [12], although their ability to represent strongly nonlinear, turbulent, self-gravitating flows remains comparatively unexplored.

The application of PINNs to self-gravitating hydrodynamics was introduced in the Gravity-Informed Neural Network (GRINN) framework of S. Auddy et al. [2]. GRINN demonstrated that a physics-informed neural network could reproduce the evolution of isothermal self-gravitating gas in up to three dimensions. In that work, the initial conditions consisted of controlled sinusoidal perturbations imposed on an otherwise uniform background. These initial conditions provided a useful setting for testing the method against analytic linear solutions and conventional numerical calculations, and established a baseline for applying PINNs to self-gravitating astrophysical flows. However, a sinusoidal perturbation primarily probes a prescribed spatial mode and does not capture the broadband, stochastic structure characteristic of turbulent molecular-cloud flows.

In this work, we extend the GRINN framework from controlled perturbations to broadband turbulent initial conditions. We consider an idealized, isothermal, self-gravitating gas with turbulent velocity fields containing power across a range of spatial scales, and compare the resulting PINN solutions with calculations performed using Athena++ (J. M. Stone et al. [19]). We examine subsonic and supersonic flows in two dimensions and subsonic flows in three dimensions, while also testing multiple turbulent realizations and reference-grid resolutions. This provides a more stringent test of whether a relatively simple physics-informed formulation can retain predictive capability when the initial conditions contain multi-scale structure and the subsequent evolution becomes nonlinear.

We find that the PINN reproduces the dominant density structure and large-scale flow organization across a substantial portion of the parameter space, including turbulent flows in both two and three dimensions. At fixed neural network architecture, optimization budget, and collocation-point budget, the PINN training cost also shows comparatively weak dependence on the resolution of the reference grid. The most strongly supersonic three-dimensional case, however, exposes a clear limitation of the present formulation, with substantially larger discrepancies from the reference solution during gravitational collapse. Rather than replacing established grid-based methods, these results demonstrate that physics-informed neural networks can capture meaningful aspects of complex self-gravitating astrophysical flows while also revealing specific regimes in which more expressive architectures and improved training strategies are needed. We view this as a step toward developing physics-informed machine-learning methods capable of incorporating increasingly realistic astrophysical physics.

Physical model

Hydrodynamic system

We consider an isothermal, self-gravitating gas, an approximation commonly adopted for cold molecular-cloud gas, when radiative cooling is sufficiently efficient to maintain approximately constant temperature ([3, 4]). The gas dynamics are governed by the continuity, momentum, and Poisson equations,

∂tρ+∇⋅(ρv)=0,(1)\partial_t \rho+ \nabla\cdot(\rho\mathbf{v}) = 0, \tag*{(1)}
ρ[∂tv+(v⋅∇)v]=−∇P+ρg,(2)\rho[\partial_t \mathbf{v} + (\mathbf{v} \cdot\nabla)\mathbf{v}] = -\nabla P + \rho\mathbf{g}, \tag*{(2)}
∇2ϕ=4πGρ,(3)\nabla^2 \phi= 4\pi G\rho, \tag*{(3)}

where g=−∇ϕ\mathbf{g} = -\nabla\phi is the gravitational field, GG is the gravitational constant, and the pressure closes the system via the isothermal relation P=cs2ρP = c_s^2\rho, where cs=(kT/m)1/2c_s = (kT/m)^{1/2} is the isothermal sound speed. We impose periodic boundary conditions throughout.

We adopt the set of units in [2], setting cs=ρ0=4πG=1c_s = \rho_0 = 4\pi G = 1. The corresponding characteristic units of length and time are

L0=cs4πGρ0,t0=14πGρ0.(4)L_0 = \frac{c_s}{\sqrt{4\pi G\rho_0}}, \qquad t_0 = \frac{1}{\sqrt{4\pi G\rho_0}}. \tag*{(4)}

All lengths and times quoted below are in units of L0L_0 and t0t_0, respectively. With this normalization, the thermal Jeans wavenumber is kJ=1k_J = 1, giving a Jeans wavelength λJ=2πL0\lambda_J = 2\pi L_0. Our computation domain has a side length L=14L0L = 14L_0, corresponding to L/λJ≃2.2L/\lambda_J \simeq2.2 and hence containing gravitationally unstable modes. Unlike the single-mode perturbation used in ([2]), our turbulent initial conditions are broadband, with a velocity power spectrum Pv(k)∝k−4P_v(k) \propto k^{-4}, so no single perturbation wavelength characterizes the initial velocity field.

Initial conditions

The gas is initialized with uniform density ρ(x,0)=ρ0\rho(\mathbf{x}, 0) = \rho_0 and zero gravitational potential Φ(x,0)=0\Phi(\mathbf{x}, 0) = 0. The velocity field is seeded by a turbulent realization,

v(x,0)=vturb(x),(5)\mathbf{v}(\mathbf{x}, 0) = \mathbf{v}_{\mathrm{turb}}(\mathbf{x}), \tag*{(5)}

generated from a Gaussian random field with a prescribed Fourier-space power spectrum

Pv(k)∝k−4,(6)P_v(k) \propto k^{-4}, \tag*{(6)}

characteristic of highly compressible, shock-dominated turbulence that is widely adopted in molecular-cloud simulations ([1 M.-M. Mac Low &] R. S. Klessen 2004. The field is synthesised by drawing independent white-noise realisations for each velocity component (C. Federrath et al. [6]), filtering them in Fourier space with the power-law amplitude ∣v~(k)∣∝k−2\lvert\tilde{\mathbf{v}}(\mathbf{k})\rvert\propto k^{-2} (so that Pv∝∣v~∣2∝k−4P_v \propto\lvert\tilde{\mathbf{v}}\rvert^2 \propto k^{-4}), and transforming back to physical space. The k=0\mathbf{k}=0 mode is set to zero, ensuring each component has zero spatial mean and hence no net bulk flow. Each component is then rescaled so that its spatial root-mean-square equals acsa c_s exactly, giving the target per-component Mach number. All density structure that develops during the simulation therefore arises self-consistently from turbulent compression and gravitational instability. The same turbulent realisation initialises both the PINN and the Athena++ reference simulation: the velocity field is generated once on a regular Cartesian grid and bilinearly interpolated to both the finite-volume cell centres and the PINN collocation points, so that differences in the resulting solutions arise solely from the numerical framework (details in Appendix § 8.§ 1).

Image not extracted

Figure 1. Schematic of the PINN training pipeline. Spatial coordinates are mapped to periodic features while time is passed to the network unchanged; the MLP then predicts the transformed density field, velocity, and gravitational potential (§ 3; Appendices § 8.§ 2 and § 8.§ 3). Automatic differentiation evaluates the governing-equation residuals, while the initial-condition and PDE residuals define the training loss (Appendix § 8.§ 5). Training proceeds sequentially with Adam and L-BFGS. The initial-condition maps show the turbulent velocity components (for 2D cases) and the initially uniform density; the initial gravitational potential is zero everywhere (Appendix § 8.§ 1).

The perturbation amplitude aa is defined through the one-dimensional RMS velocity dispersion,

σvi=acs,(7)\sigma_{v_i}=a c_s, \tag*{(7)}

giving a total RMS Mach number Mrms=d a\mathcal{M}_{\mathrm{rms}}=\sqrt{d}\,a, where dd is the number of spatial dimensions. Subsonic cases satisfy a<1a<1 and supersonic cases a>1a>1.

PINN

We represent the density, velocity, and gravitational potential of the self-gravitating flow as continuous functions of space and time using a physics-informed neural network (PINN). The network parameters are determined by minimizing the residuals of the governing hydrodynamic and Poisson equations at collocation points distributed throughout the spatio-temporal domain. Because the solution is represented as a continuous function, the trained network can be evaluated at arbitrary spatial and temporal coordinates within the training domain. Automatic differentiation (R. E. Wengert [22]) is used to evaluate the derivatives of the network outputs required by the PDE residuals. Unlike data-driven surrogate models, the PINN is trained without labelled solution data: the Athena++ solutions are used only for post-training validation and do not enter the training loss.

The PINN takes as input the spatial coordinates and time. Because the simulation domain is periodic, each spatial coordinate is mapped to periodic Fourier features before being supplied to the network. This representation enforces periodicity by construction, so no explicit boundary-condition loss is required. Details of the Fourier feature construction are given in Appendix § 8.§ 2.

The network predicts the velocity components and gravitational potential, together with a transformed representation of the density. We parametrize the physical density exponentially, such that ρ>0\rho> 0 for all network outputs. The same parametrization also enforces the uniform initial density ρ(x,0)=ρ0\rho(\mathbf{x}, 0) = \rho_0 exactly as a hard constraint, rather than requiring the network to learn this condition through a loss term. The prescribed turbulent velocity field is imposed through the initial-condition loss. Further details of the density parametrization and initial-condition enforcement are given in Appendix § 8.§ 3 and Appendix § 8.§ 5.

At the start of the calculation, the turbulent velocity perturbation is imposed instantaneously while the initially uniform density has not yet responded to the resulting velocity field. We therefore introduce a short startup interval Δts=0.1t0\Delta t_s = 0.1t_0 before enforcing the PDE residuals. This allows the initial velocity perturbation to develop a consistent density response before the full hydrodynamic constraints are applied (Appendix § 8.§ 4).

Training proceeds in two sequential phases. In the first phase, the Adam optimizer ([24]) is first used to bring the network to a converged representation of the flow. In the second phase, the L-BFGS optimizer ([10]) refines the solution to higher precision. We use sine activation functions throughout, which provides better gradient flow and training stability than saturating activations such as sigmoid G. Parascandolo et al. [15]. The full loss formulation and implementation details are given in Appendix § 8.§ 5.

Computational implementation

The PINN training was performed on a single NVIDIA H100 GPU using a 3g.40GB MIG partition. Athena++ was compiled with MPI support and executed using distributed MPI parallelism. The Athena++ MeshBlock size was fixed at 64364^3 cells for all runs. This configuration allows the computational domain to be distributed over an increasing number of MeshBlocks while maintaining a fixed local problem size.

caption: Same as Figure 2, but with a=1.1a = 1.1, representing a supersonic turbulence in the system.

Image not extracted

Figure 2. Comparison of the PINN and Athena++ solutions for the 2D subsonic case (a=0.1a = 0.1) at t=3.00 t0t = 3.00\,t_0. The top row shows the density field, and the bottom row shows the velocity magnitude, ∣v∣=vx2+vy2|\mathbf{v}| = \sqrt{v_x^2 + v_y^2}. In each row, the left and middle panels show the PINN and Athena++ solutions, respectively, while the right panel shows the pixel-wise logarithmic ratio, log⁡2(fG/fA)\log_2(f_G/f_A), where ff denotes the density or velocity magnitude, and subscripts GG and AA denote the PINN and Athena++ solutions, respectively. The annotations report the mean signed log-ratio, its RMS, and the maximum absolute log-ratio; the colour scale is clipped at the 99th percentile of the absolute log-ratio. Arrows indicate the velocity direction.

Results

We assess PINN performance against Athena++ using the pixel-wise signed log-ratio,

δ=log⁡2(fGfA),\delta= \log_{2}\left(\frac{f_G}{f_A}\right),

where ff denotes either the density ρ\rho or the velocity magnitude ∣v∣|\mathbf{v}|, and the subscripts GG and AA denote the PINN and Athena++ solutions, respectively. A value of δ=0\delta= 0 indicates perfect agreement; ∣δ∣=1|\delta| = 1 corresponds to a factor-of-two discrepancy. Since δ\delta is logarithmic, an RMS value δRMS\delta_{\mathrm{RMS}} corresponds to a characteristic multiplicative discrepancy of 2δRMS−12^{\delta_{\mathrm{RMS}}} - 1; thus, δRMS=0.15\delta_{\mathrm{RMS}} = 0.15 corresponds to a characteristic discrepancy of approximately 11%. The mean signed bias ⟨δ⟩\langle\delta\rangle, its RMS, and the maximum absolute error are annotated on each panel; the colorbar is clipped at the 99th percentile of ∣δ∣|\delta|. For 3D runs, each panel is a three-dimensional box rendering of the computational domain, showing three orthogonal faces of the cube: the top, front and right. Beside each bias panel we report the mean, RMS and maximum absolute error evaluated on the XY plane at the instantaneous density maximum, with the PINN evaluated at the native Athena++ grid points on that plane.

Case 1: Subsonic perturbations in 2D

Figure 2 shows the performance of our model for a=0.1a = 0.1. We see that the PINN captures the broad density distribution and associated velocity field with close visual agreement to Athena++ at both early and late times. At t=3.00t = 3.00, the density RMS log-ratio is 0.229, corresponding to a characteristic multiplicative discrepancy of approximately 17%. The errors concentrate around the small-scale, high-gradient structures, while the large-scale density organization remains consistent between the two solutions.

Case 2: Supersonic perturbations in 2D

We next investigate a supersonic case in Figure 3 with a=1.1a = 1.1. The temporal range of comparison is shorter here as gravitational collapse proceeds faster at higher Mach numbers. The PINN is still able to reproduce the main density and velocity morphology seen in Athena++. At t=1.00t = 1.00, the density RMS log-ratio remains 0.155, corresponding to a characteristic multiplicative discrepancy of approximately 11%. The agreement is strongest in the large-scale flow organization, while discrepancies are more visible in localized shocked or filamentary regions, where sharper gradients and smaller-scale structures are more prominent. The error maps show that the remaining differences are not spatially uniform, but instead track the most nonlinear parts of the flow.

The grid-based result and under-represents some of the finer vortical or compressive features. Thus across all benchmark cases, the PINN consistently reproduces the global density and velocity structure of the self-gravitating flow, with the remaining differences concentrated in localized fine-scale features.

Case 3: Subsonic perturbations in 3D

To assess whether the network can learn the dynamics of a 3D system, we compare PINN and Athena++ performance in a similar way as 2D for a=0.1a = 0.1, shown in Figure 4. For the 3D subsonic case, the density RMS log-ratio is 0.061, corresponding to a characteristic multiplicative discrepancy of approximately 4.3%. The comparison confirms that the PINN generalizes beyond 2D and remains capable of tracking the dominant gravitationally driven evolution in three dimensions. The largest discrepancies again occur in smaller-scale structures, where the PINN solution is smoother than the

Image not extracted

Figure 4. Comparison for PINN vs Athena++ in a 2D subsonic perturbed (a=0.1a = 0.1) system. The display value at the title represents the resolution value of the IC field supplied to the PINN and Athena++ (details in A.1). The values in the box at the right show the zz coordinate value of the collapsing core, while the metrics below show the comparison between PINN and Athena++ in the plane z=zpeakz = z_{\rm peak}

Computational Scaling

Figure 5 (left) shows normalized runtime as a function of spatial resolution for all of the above shown three cases, each normalized to its own 128-resolution baseline. Athena++ costs grow steeply with resolution: the 3D subsonic case requires ≈76×\approx76\times longer at resolution 1024 than at 128, while the 2D cases show 40–76× increases. In contrast, PINN training time increases by less than 25% over the same resolution range.

Image not extracted

Figure 5. (Left) Normalized runtime of PINN and Athena++ as a function of spatial resolution for the 2D subsonic, 2D supersonic, and 3D subsonic cases, each normalised to its own 128-resolution baseline. The inset provides a magnified view of the PINN curves. (Right) Runtime ratio T3D/T2DT_{3\mathrm{D}}/T_{2\mathrm{D}} for PINN and Athena++ at each resolution, computed from the subsonic runs. PINN’s dimensional overhead remains nearly constant near 2×2\times, while Athena++’s grows from ≈6×\approx6\times to ≈12×\approx12\times with increasing resolution.

Because the collocation-point budget NrN_r is independent of the reference-grid resolution, we tested whether fixing it could bias the scaling comparison. Varying NrN_r by factors of 2–6 in the 2D supersonic 2562256^2 case produces errors within the range of the benchmark suite, indicating that the fixed-budget choice does not qualitatively affect the scaling result (Appendix § 9).

Figure 5 (right) quantifies the additional computational cost of increasing the spatial dimensionality. For each resolution, we compute the ratio T3D/T2DT_{\mathrm{3D}}/T_{\mathrm{2D}} for the subsonic runs. For Athena++, this ratio grows from ≈6× at 128 to ≈12× at 1024, reflecting the rapid growth in the number of grid cells and associated computational workload. For the PINN, the corresponding ratio remains nearly constant near 2×. Thus, although the present PINN implementation has substantially higher absolute training cost (see next paragraph), its computational scaling is markedly weaker than that of the grid-based solver. This difference becomes increasingly important as resolution and dimensionality grow, and motivates further optimization of PINN training for large-scale applications.

These comparisons concern scaling rather than absolute wall-clock efficiency: at the 1283128^3 3D subsonic baseline, Athena++ requires approximately 235 s, whereas PINN training requires 392 min. Thus, the present implementation remains substantially slower in absolute terms, while exhibiting markedly weaker growth in computational cost with resolution and dimensionality.

Robustness across turbulent initial conditions

The nonlinear evolution of a self-gravitating molecular cloud is highly sensitive to its turbulent initial conditions, with different realizations producing distinct morphologies including filaments, sheets, and compact collapsing cores. It is therefore important to assess whether the performance of the PINN depends strongly on the particular realization or remains consistent across a diverse set of turbulent flows. To this end, we evaluate the framework on twelve different configurations, with various combinations of random seed, mach number, and resolution.

Table 1 summarises the mean logarithmic bias and RMS density error across all twelve configurations. The mean bias remains small throughout with no systematic over- or under-estimation, and the RMS error stays within the same order regardless of Mach number, resolution, or dimensionality. These results confirm that the performance shown in the preceding subsections is representative of broadband turbulent self-gravitating flows rather than specific to a single realization.

2D subsonic
SeedMach No.ResolutionMean δρ\delta_\rhoRMS δρ\delta_\rho
820.052560.0120.170
820.102560.0390.229
820.152560.0560.205
820.202560.1170.324
2D supersonic
SeedMach No.ResolutionMean δρ\delta_\rhoRMS δρ\delta_\rho
821.11280.0980.235
821.12560.0450.146
821.15120.0420.135
821.110240.0780.209
3D subsonic
SeedMach No.ResolutionMean δρ\delta_\rhoRMS δρ\delta_\rho
90.12560.0150.062
380.1256-0.0040.068
670.1256-0.0130.066
820.1256-0.0260.062

Table 1. Performance across different initializations. NOTE—δρ=log⁡2(ρPINN/ρAthena++)\delta_\rho= \log_2(\rho_{\mathrm{PINN}}/\rho_{\mathrm{Athena++}}); mean and RMS are computed over the full spatial domain at the final output time.

Discussion

The results presented in this work demonstrate that physics-informed neural networks can reproduce the dominant evolution of turbulent, self-gravitating flows across a range of Mach numbers, resolutions, and spatial dimensions. The agreement with Athena++ across independent turbulent realizations indicates that the method is not restricted to a particular initial morphology. At the same time, the experiments reveal limitations as the flow becomes increasingly nonlinear and develops structure over a broad range of spatial and temporal scales. We discuss these limitations and possible directions for extending the work below.

Limitations

Figure 6 shows the PINN versus Athena++ comparison for the strongly supersonic three-dimensional case (a=1.1a = 1.1), which provides a useful stress test of the present formulation. This case combines three-dimensional structure, supersonic compression, and rapidly developing gravitational collapse. At early times, the PINN captures the large-scale density and velocity organization seen in Athena++, reproducing the dominant flow morphology. Its accuracy, however, decreases as the flow develops increasingly dense and compact structures, with the density RMS log-ratio increasing to 0.518 by t=0.70t = 0.70. The PINN therefore retains the large-scale character of the evolution but progressively loses fidelity in the most nonlinear stages of the collapse. The smoother PINN solutions around sharp density gradients are consistent with the spectral bias of neural networks, which favours lower-frequency components over high-frequency structure [21], limiting the recovery of small-scale shocks and filamentary features as gravitational collapse generates progressively finer spatial structure.

A related difficulty is that PINN accuracy degrades as the solution becomes more rapidly evolving — a feature common to all four cases presented here rather than specific to the 3D supersonic run. As gravitational collapse proceeds and density growth rates increase, errors accumulate at late times regardless of Mach number or dimensionality; the onset simply occurs later in the subsonic cases where the dynamics accelerate more gradually. The 3D supersonic case represents the most extreme instance, with growth rates large enough that the PINN loses substantial fidelity within the training window.

Finally, the present implementation remains substantially more expensive in absolute wall-clock time than Athena++. The scaling experiments show much weaker growth of PINN training cost with spatial resolution and dimensionality, but the current implementation does not provide a computational speed advantage for the problem sizes considered here. The scaling result should therefore be interpreted as a potentially favourable scaling property rather than as a demonstration of computational superiority.

Future Directions

The limitations identified above suggest several directions for extending the current work to more strongly nonlinear and multi-scale flows. The degradation in the 3D supersonic stress test motivates architectures that can represent localized structure more effectively. Domain-decomposition approaches such as XPINNs and multiscale formulations such as FBPINNs provide natural possibilities, allowing different parts of the solution to be represented locally rather than relying on a single global network [18, 14]. These approaches may be particularly relevant for separating the large-scale turbulent flow from localized shocked and collapsing structures.

The increasing difficulty at late times also motivates a more adaptive treatment of the space–time domain. Rather than representing the entire evolution with a single global network, future formulations could employ temporal decomposition [12] or progressively refined training as gravitational collapse accelerates. Adaptive collocation could provide a complementary mechanism for concentrating training effort in regions where the solution becomes difficult to represent, although its effectiveness in the strongly nonlinear regime remains to be established.

The computational cost of the present implementation provides a further motivation for distributed training. Multi-GPU and domain-decomposition strategies could reduce the training time required for larger collocation sets and higher-dimensional calculations, while retaining the physics-informed formulation (K. Shukla et al. [18]). Finally, extending beyond isothermal hydrodynamics to include non-isothermal thermodynamics, magnetic fields, radiation, and chemistry would provide a path toward increasingly realistic models of star-forming environments.

Image not extracted

Figure 6. Same as Figure 4, but with a=1.1a=1.1, representing a supersonic turbulence in the system

State-space-model-based architectures, such as PIN-NMamba (C. Xu et al. 2025), offer another promising direction for improving the representation of spatiotemporal dependencies in PINNs.

Summary and Conclusions

We have demonstrated that physics-informed neural networks can model turbulent, self-gravitating molecular-cloud flows substantially beyond the controlled perturbations considered in GRINN. Using broadband turbulent velocity fields with a k−4k^{-4} power spectrum, we tested isothermal self-gravitating gas across subsonic and supersonic regimes, two- and three-dimensional geometries, multiple resolutions, and independent turbulent realizations. The PINN consistently reproduced the dominant density and velocity evolution obtained with Athena++, with characteristic density discrepancies of approximately 5–17% for the principal benchmark cases. The method also retained comparable performance across independent turbulent realizations, indicating that its behaviour is not tied to a particular initial morphology.

The calculations also reveal an important distinction between the scaling and the absolute computational cost of the present approach. Although PINN training is substantially more expensive in wall-clock time for the problem sizes considered here, its training cost increases by less than 25% between the lowest and highest resolutions tested, in contrast to the much steeper scaling of the grid-based calculations. This suggests that the mesh-free formulation offers favourable scaling properties as problem resolution and dimensionality increase, while emphasizing that substantial optimization is still required before PINNs become computationally competitive with established grid-based methods. The strongly supersonic three-dimensional stress test further identifies a clear limitation of the present formulation. As shocks and gravitational collapse produce increasingly dense, fine-scale, and rapidly evolving structure, the PINN progressively loses fidelity relative to Athena++. This result highlights the difficulty of representing strongly nonlinear, multi-scale evolution over extended time intervals and provides a concrete target for future methodological improvements.

Overall, these results establish PINNs as a complementary framework for modeling turbulent self-gravitating flows and extend physics-informed modeling substantially beyond previously studied controlled perturbations. Future progress will require improved representations of multi-scale structure, more effective training strategies, and extensions of the physical model toward the richer physics of realistic star-forming environments.

AI tools were used to assist with manuscript editing and refinement, as well as with development of the related code. ChatGPT, Claude, and Gemini were used for manuscript-related assistance; Cursor and Antigravity were used primarily for code development and documentation. All AI-assisted content and code used in the work were reviewed by the authors, who take full responsibility for the accuracy and integrity of the manuscript.

The code used in this work is publicly available on GitHub at https://github.com/Tirthankar4/CC-PINN and archived on Zenodo at [5].

Acknowledgements

This research was enabled in part by support provided by Compute Ontario and the Digital Research Alliance of Canada. S. B. was supported by a Discovery Grant from the National Sciences and Engineering Research Council of Canada.

Software: Athena++ ([19]), PyTorch ([16]), NumPy ([7]), SciPy ([20]), Matplotlib ([9]), h5py 3.16.0 https://www.h5py.org/

PINN Implementation Details

Turbulent Initial-Condition Field Generation

Synthesis algorithm.—Each Cartesian velocity component viv_i (i=x,yi = x,y in 2-D; i=x,y,zi = x,y,z in 3-D) is synthesised independently from a separate white-noise draw using the following pipeline:

  1. A real-valued white-noise field ξ(x)\xi(\boldsymbol{x}) is drawn from a standard normal distribution on a regular Cartesian grid covering the periodic domain [0,L]d[0,L]^d.

  1. The field is transformed to Fourier space via a real fast Fourier transform, giving ξ~(k)\tilde{\xi}(\boldsymbol{k}) with Hermitian symmetry by construction, so that the inverse transform is purely real.

  1. A power-law filter is applied in Fourier space,

v~i(k)={k−2ξ~(k)k>0,0k=0,(8)\tilde{v}_i(\boldsymbol{k}) = \begin{cases} k^{-2}\tilde{\xi}(\boldsymbol{k}) & k > 0, \\ 0 & k = 0, \end{cases} \tag*{(8)}

where k=∣k∣k = \lvert\boldsymbol{k}\rvert is the isotropic wavenumber. Setting the k=0\boldsymbol{k} = \boldsymbol{0} mode to zero enforces zero spatial mean and hence zero net momentum in each component.

  1. The filtered spectrum is transformed back to physical space via an inverse real FFT, yielding a real field vi(x)v_i(\boldsymbol{x}) with power spectrum Pvi(k)∝k−4P_{v_i}(k) \propto k^{-4}.

  1. The field is rescaled so that std⁡(vi)=acs\operatorname{std}(v_i) = a c_s exactly, matching the target per-component RMS Mach number.

Because each component is drawn from an independent white-noise realisation, the resulting velocity field is statistically isotropic in expectation, with no preferred direction imposed by the synthesis procedure.

Shared-field protocol.—To guarantee that the PINN and Athena++ start from identical initial conditions, the velocity arrays are generated once on a regular Cartesian grid and shared between both solvers. For Athena++, the grid values are assigned directly to the finite-volume cell centres. For the PINN, the grid values are bilinearly interpolated to arbitrary collocation-point coordinates using a RegularGridInterpolator (P. Virtanen et al. [20]) at training time, whenever the IC loss LIC\mathcal{L}_{\mathrm{IC}} (Appendix § 8.§ 5) is evaluated. The IC generation grid is matched to the Athena++ resolution for each experiment, so the interpolation to PINN collocation points introduces negligible error relative to the finite-volume truncation error.

Reproducibility.—The entire field is determined by a single integer random seed passed to NumPy’s default random generator (C. R. Harris et al. [7]). For each experiment, the random seed is held fixed when generating the shared realization used by both solvers.

Periodic Feature Embedding

Rather than feeding raw spatial coordinates into the network, each spatial coordinate u∈[umin⁡,umax⁡]u \in[u_{\min},u_{\max}] is first mapped to a set of periodic features. For harmonic index k=1,…,Hk = 1,\ldots,H, the embedding is

ϕk(u)=1k[sin⁡(kθ)cos⁡(kθ)],θ=2π(u−umin⁡)L,(9)\phi_k(u) = \frac{1}{\sqrt{k}} \begin{bmatrix} \sin(k\theta) \\ \cos(k\theta) \end{bmatrix}, \qquad \theta= \frac{2\pi(u-u_{\min})}{L}, \tag*{(9)}

where L=umax⁡−umin⁡L = u_{\max} - u_{\min} is the domain length and HH is the number of harmonics. The time coordinate is passed through unchanged. The periodic sine/cosine basis is exactly consistent with the periodic boundary conditions imposed on the domain, satisfying them by construction without penalty terms in the loss. The 1/k1/\sqrt{k} factor rescales the amplitude of higher harmonics at the network input, mildly reducing the scale of higher harmonics at the network input by a factor of about 1.7 between k=1k = 1 and k=3k = 3. It is a heuristic conditioning choice rather than a constraint: it reduces the initial contribution of high-wavenumber features to the first-layer pre-activations and slows their effective learning rate, biasing early training toward smooth, low-wavenumber solutions.

Exponential Density Parameterisation

The network does not output physical density ρ\rho directly. Instead, it outputs a raw field ρ^\hat{\rho}, and the physical density is recovered via

ρ(x,t)=ρ0exp⁡ ⁣(clamp⁡(teffρ^,−4,4)),teff=max⁡(t−Δts,0),(10)\rho(\mathbf{x},t)=\rho_0\exp\!\left(\operatorname{clamp}(t_{\mathrm{eff}}\hat{\rho},-4,4)\right),\qquad t_{\mathrm{eff}}=\max(t-\Delta t_s,0), \tag*{(10)}

where Δts\Delta t_s is the startup delay described in Appendix § 8.§ 4. This parameterisation enforces two physical constraints as hard constraints, independent of the network weights:

  1. Strict positivity. Because exp⁡(⋅)>0\exp(\cdot)>0 for all real arguments, the density is guaranteed positive for any network output, eliminating the need for a positivity penalty in the loss.

  1. Uniform-density initial condition. At t=0t=0, teff=0t_{\mathrm{eff}}=0 and ρ(x,0)=ρ0exp⁡(0)=ρ0\rho(\mathbf{x},0)=\rho_0\exp(0)=\rho_0 exactly, regardless of ρ^\hat{\rho}.

The exponential form is also convenient for representing multiplicative density growth: the network effectively learns the logarithm of the density relative to its initial value. The clamp bounds −4,4-4,4 prevent loss blowup at initialization, when the product teffρ^t_{\mathrm{eff}}\hat{\rho} can be large before training has converged; they correspond to density ratios of e−4≈0.018e^{-4}\approx0.018 and e4≈55e^4\approx55 relative to ρ0\rho_0, safely bracketing the range of densities encountered in the simulations.

PDE Enforcement Startup Delay

We introduce a fixed startup delay Δts=0.1t0\Delta t_s=0.1t_0, during which the PDE residuals are not enforced. This is implemented in two complementary ways.

Collocation point sampling.—Residual collocation points are drawn uniformly from the time interval [Δts,tmax⁡][\Delta t_s,t_{\max}]. No PDE residual is evaluated at any t<Δtst<\Delta t_s, so the network develops its internal representation of the flow during this interval without being penalised against the governing equations.

Density mask.—The effective time teff=max⁡(t−Δts,0)t_{\mathrm{eff}}=\max(t-\Delta t_s,0) in the exponential parametrisation (Appendix § 8.§ 3) evaluates to zero for t<Δtst<\Delta t_s, freezing the density exactly at ρ0\rho_0 as a hard constraint. For t≥Δtst\ge\Delta t_s, the density evolves freely according to the learned growth-rate field.

This treatment is motivated by the causal development of the initial velocity perturbation. The imposed velocity field propagates and drives the subsequent density response at finite characteristic speeds. Allowing a short interval before enforcing the fully coupled PDE system therefore provides a controlled way for the initially imposed velocity field to begin developing before density evolution is constrained by the PDE residuals. The startup delay is a training strategy introduced for the present problem, rather than a physical modification of the hydrodynamic evolution.

Loss Function

The general PINN loss formulation, including the explicit forms of the PDE residuals for the continuity, momentum, and Poisson equations, follows S. Auddy et al. [2], to which we refer the reader for a detailed derivation. Here we describe only the modifications introduced in the present work.

Boundary-condition loss: eliminated by hard constraint.—In S. Auddy et al. [2], periodic boundary conditions were enforced as a soft penalty term (MSEbMSE_b) in the training loss. In the present work this term is absent entirely: the periodic feature embedding (Appendix § 8.§ 2) maps each spatial coordinate onto a periodic sine/cosine basis, so the resulting network representation is periodic by construction and no explicit boundary-condition penalty is required. The total training loss therefore reduces to

L=LIC+LPDE,(11)\mathcal{L}=\mathcal{L}_{\mathrm{IC}}+\mathcal{L}_{\mathrm{PDE}}, \tag*{(11)}

compared with MSEPDE+MSEb+MSE0MSE_{\mathrm{PDE}}+MSE_b+MSE_0 in S. Auddy et al. [2].

Initial-condition loss.—The density initial condition ρ(x,0)=ρ0\rho(\mathbf{x},0)=\rho_0 is enforced as a hard constraint via the exponential parametrisation (Appendix § 8.§ 3), contributing no loss term. The velocity initial conditions, which now encode a broadband turbulent field rather than a sinusoidal mode, are enforced as a soft constraint,

LIC=1N0∑j=1N0∑i=1d[vi(x(j),0)−vi,turb(x(j))]2,(12)\mathcal{L}_{\mathrm{IC}}=\frac{1}{N_0}\sum_{j=1}^{N_0}\sum_{i=1}^{d}\left[v_i(\mathbf{x}^{(j)},0)-v_{i,\mathrm{turb}}(\mathbf{x}^{(j)})\right]^2, \tag*{(12)}

where N0N_0 is the number of IC collocation points and vi,turbv_{i,\mathrm{turb}} is the prescribed turbulent velocity field.

PDE residual loss. —The PDE residuals of Eqs. (1)–(3) are evaluated at NrN_r collocation points sampled from [Δts,tmax⁡][\Delta t_s,t_{\max}] (Appendix § 8.§ 4) via automatic differentiation,

LPDE=1Nr∑j=1Nr[rρ2+∑i=1drvi2+rϕ2](j),(13)\mathcal{L}_{\mathrm{PDE}}=\frac{1}{N_r}\sum_{j=1}^{N_r}\left[r_{\rho}^{2}+\sum_{i=1}^{d}r_{v_i}^{2}+r_{\phi}^{2}\right]^{(j)}, \tag*{(13)}

where rρr_{\rho}, rvir_{v_i}, and rϕr_{\phi} are the pointwise residuals of the continuity, momentum, and Poisson equations respectively (see S. Auddy et al. [2], Eqs. 6–8, for their explicit forms).

During Adam training, gradients are clipped to unit norm before each parameter update to prevent gradient explosions early in training. During L-BFGS, the same collocation batch is cached and reused across all line-search function evaluations within a single optimizer step, ensuring a consistent loss landscape required for convergence.

Network Hyperparameters

Table 2 summarises the hyperparameters used for all runs reported in this paper. The same architecture and optimizer settings were applied uniformly across all cases, with no tuning to individual Mach numbers, spatial resolutions, or turbulent realizations. The consistent performance of PINN across the full benchmark suite (§ 4.5) therefore reflects the behaviour of a fixed model configuration rather than one optimized separately for each case.

Collocation-Point Budget

To verify that the near-constant PINN training cost across spatial resolutions is not an artefact of holding the collocation-point budget NrN_r fixed, we ran the 2D supersonic 2562256^2 case (seed 82) at reduced budgets while keeping all other hyperparameters identical to Table 2. The baseline uses Nr=780,000N_r = 780{,}000 collocation points, while the reduced-budget runs use Nr=390,000N_r = 390{,}000 and 130,000130{,}000.

ParameterSymbolValue
Architecture
Hidden layersNℓN_{\ell}7
Neurons per layerNhN_h128
HarmonicsHH3
Density parameterisation—Exponential
Collocation points
IC pointsN0N_0130 000
PDE residual pointsNrN_r780 000
Batch size—130 000
Optimisation
Adam iterations—6 001
Adam learning rateη\eta10−310^{-3}
Adam gradient clip norm—1.0
L-BFGS iterations—251
L-BFGS line search—Strong Wolfe
Startup delayΔts\Delta t_s0.1

Table 2. PINN hyperparameters used in all experiments.

The resulting mean and RMS density errors (⟨δρ⟩\langle\delta_{\rho}\rangle, RMS⁡[δρ]\operatorname{RMS}[\delta_{\rho}]) are (0.106, 0.266), (0.106, 0.286), and (0.045, 0.146) for Nr=130,000N_r = 130{,}000, 390,000390{,}000, and 780,000780{,}000, respectively. The errors remain within the range found across the benchmark suite, with no systematic monotonic degradation as NrN_r is reduced. The lower RMS error at the baseline budget indicates some sensitivity to NrN_r in this realization, but the results provide no evidence that fixing the collocation budget qualitatively biases the resolution-scaling comparison. We therefore retain a fixed NrN_r across resolutions.

Power Spectrum Comparison

Figure 7 shows the radially averaged power spectra of the density field Pρ(k)P_{\rho}(k) and velocity magnitude P∣v∣(k)P_{\lvert v\rvert}(k) for the 2D subsonic baseline case at t≃1.0t0t \simeq1.0t_0 and t=3.00t0t = 3.00t_0, comparing the PINN and Athena++ solutions.

Image not extracted

Figure 7. Radially averaged power spectra of the density field Pρ(k)P_{\rho}(k) (left) and velocity magnitude P∣v∣(k)P_{\lvert v\rvert}(k) (right) for the 2D subsonic baseline case at t≃1.0t0t \simeq1.0t_0 (top) and t=3.00t0t = 3.00t_0 (bottom). Solid orange: Athena++; dashed blue: PINN; dotted black: k−4k^{-4} reference slope. The PINN and Athena++ solutions show similar large-scale spectral behaviour, while the PINN increasingly underestimates high-kk density power as gravitational collapse develops finer-scale structure. The velocity-magnitude spectra remain in closer agreement over a broader range of scales.

At large scales, the PINN and Athena++ spectra show similar overall behavior, with the velocity-magnitude spectra remaining particularly close in both shape and slope. The dotted line indicates a k−4k^{-4} reference slope corresponding to the spectral form used to initialize the turbulent velocity field; it is not an expected slope for the evolved density spectrum. The density power increases substantially as gravitational collapse develops, while the PINN retains the same overall large-scale evolution but with reduced power.

The main discrepancy appears at higher wavenumbers, where the PINN underestimates density power relative to Athena++. This deficit is more pronounced at later times, when gravitational collapse produces increasingly fine-scale density structure. The result is consistent with the tendency of the PINN solution toward smoother, lower-frequency structure discussed in § 5.1, and with the finite spatial bandwidth of the H=3H = 3 harmonic embedding (Appendix § 8.§ 2). In contrast, the velocity-magnitude spectra remain in closer agreement over a broader range of wavenumbers, indicating that the loss of small-scale spectral power is more pronounced for density than for velocity over the simulated interval.

References

  1. [1]Auddy, S., Basu, S., & Kudoh, T. 2018, Monthly Notices of the Royal Astronomical Society, 474, 400
  2. [2]Auddy, S., Dey, R., Turner, N. J., & Basu, S. 2024, Machine Learning: Science and Technology, 5, 025014
  3. [3]Banerjee, R., Pudritz, R. E., & Holmes, L. 2004, Monthly Notices of the Royal Astronomical Society, 355, 248
  4. [4]Chevance, M., Kruijssen, J. D., Vazquez-Semadeni, E., et al. 2020, Space Science Reviews, 216, 50
  5. [5]De, T. 2026, Tirthankar4/CC-PINN: v1.0.0, v1.0.0 Zenodo, doi: 10.5281/zenodo.23294396
  6. [6]Federrath, C., Roman-Duval, J., Klessen, R. S., Schmidt, W., & Mac Low, M.-M. 2010, Astronomy & Astrophysics, 512, A81
  7. [7]Harris, C. R., Millman, K. J., Van Der Walt, S. J., et al. 2020, nature, 585, 357
  8. [8]Heyer, M. H., & Brunt, C. M. 2004, ApJL, 615, L45, doi: 10.1086/425978DOI
  9. [9]Hunter, J. D. 2007, Computing in science & engineering, 9, 90
  10. [10]Liu, D. C., & Nocedal, J. 1989, Mathematical programming, 45, 503
  11. [12]Mao, S., Wang, W., Wang, S., et al. 2025, The Astrophysical Journal Letters, 992, L20
  12. [13]McKee, C. F., & Ostriker, E. C. 2007, ARA&A, 45, 565, doi: 10.1146/annurev.astro.45.051806.110602DOI
  13. [14]Moseley, B., Markham, A., & Nissen-Meyer, T. 2023, Advances in Computational Mathematics, 49, 62
  14. [15]Parascandolo, G., Huttunen, H., & Virtanen, T. 2017, Taming the waves: sine as activation function in deep neural networks, https://openreview.net/forum?id=Sks3zF9eg
  15. [16]Paszke, A., Gross, S., Massa, F., et al. 2019, Advances in neural information processing systems, 32
  16. [17]Raissi, M., Perdikaris, P., & Karniadakis, G. E. 2019, Journal of Computational physics, 378, 686
  17. [18]Shukla, K., Jagtap, A. D., & Karniadakis, G. E. 2021, Journal of Computational Physics, 447, 110683
  18. [19]Stone, J. M., Tomida, K., White, C. J., & Felker, K. G. 2020, The Astrophysical Journal Supplement Series, 249, 4, doi: 10.3847/1538-4365/ab929b
  19. [20]Virtanen, P., Gommers, R., Oliphant, T. E., et al. 2020, Nature methods, 17, 261
  20. [21]Wang, S., Yu, X., & Perdikaris, P. 2022, Journal of Computational Physics, 449, 110768
  21. [22]Wengert, R. E. 1964, Communications of the ACM, 7, 463
  22. [24]Zhang, Z. 2018, in 2018 IEEE/ACM 26th international symposium on quality of service (IWQoS), Ieee, 1–2

Paper details

vlnc:W_8t9zsck4
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 10

downloads · 1

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents