Repository navigation
Conversation
|
Claude Code Review Head SHA: b03afff Files changed:
Findings:
Checked in step 4: the multigrid level/exchange hunks (buffer layout, send/recv offsets, |
Lines of Code
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds an all-Mach projection solver path to MFC. The method supports the 5-equation model with viscosity, surface tension, body forces, and heat conduction, modeling fluids with ideal or stiffened gas equations of state. Figures and comments are contained in "details" blocks to keep the comment from getting too long.
Method
The numerical method can be summarized as
using multigrid-preconditioned flexible conjugate gradients.
3. Correct the momentum and energy equations with
The viscous, capillary, and thermal stresses are treated explicitly. Conduction enters the pressure equation as$\partial_t p += -\nabla \cdot \mathbf{q}/\Gamma$ . Future PRs will incorporate split time-stepping of the diffusion terms to take advantage of the advective time step allowed by this method. I am currently testing immersed boundary and chemistry features in a development branch and will include them in future pull requests.
Validation
(2D) Couette flow at Re = 100, Mach = 0.01
Simulation ran on 1 A100 GPU using the `examples/2D_couette_projection/case.py` example. The error(2D) Poiseuille flow at Re = 100, Mach = 0.01
Simulation ran on 1 A100 GPU using the `examples/2D_poiseuille_projection/case.py` example. The error(2D) Lid driven cavity at Re = 5000
Simulation ran on 1 A100 GPU using the `examples/2D_lid_driven_cavity_projection/case.py` example. The centerline velocities at t = 200 match those of Ghia et al. closely.(2D) Oscillating ellipsoidal bubble
Simulation ran on 1 A100 GPU using the `examples/2D_oscillating_bubble_projection/case.py` example. The surface-tension-induced oscillation frequency matches linear theory.(2D) Laplace pressure jump
Simulation ran on 1 A100 GPU using a copy of the `examples/2D_laplace_pressure_jump/case.py` example with the projection method enabled. The pressure jump error converges with grid resolution, and spurious currents remain small.(2D) Rayleigh-Benard convection
Simulation ran on 1 A100 GPU using the `examples/2D_rayleigh_benard_projection/case.py` example. The steady-state Nusselt number at the hot and cold plates at Ra = 4e4 and Pr = 7 matches that of Waleffe et al. (Phys. Fluids 27, 051702, 2015, Fig. 1: ~3.7 at L/H = 2).(2D) Rising bubble
Simulations ran on 1 A100 GPU using the `examples/2D_rising_bubble/case.py` example. The simulation uses body forces, viscosity, and surface tension with the projection solver, and comparisons with established data from other solvers are used. Case 1 is a density ratio of 10 and Case 2 is a density ratio of 1000.(3D) Taylor-Green Vortex
Simulations performed on 1-4 A100 GPUs using the `examples/3D_TaylorGreenVortex_projection/case.py` example. The kinetic energy, kinetic energy dissipation rates, and entropy converge to the spectral DNS results of Dairay, Lamballais, Laizet & Vassilicos, J. Comput. Phys. 337, 2017.Convergence
(1D) 5-eqn
Convergence is measured using a modified copy of the `examples/1D_euler_convergence/case.py` example. The acoustic wave reduces spatial and temporal accuracy to second and first order, respectively.(1D) 5-eqn + Viscosity
Convergence is measured using a modified copy of the `examples/1D_euler_convergence/case.py` example. The acoustic wave reduces spatial and temporal accuracy to second and first order, respectively. Viscosity damps the acoustic waves, so the temporal convergence is flatter than in the previous case.(1D) 5-eqn + Conduction
Convergence is measured using a modified copy of the `examples/1D_conduction_convergence/case.py` example.(2D) 5-eqn + Viscosity
Convergence is measured using a modified copy of the `examples/2D_TaylorGreenVortex/case.py` example.(2D) 5-eqn + Conduction
Convergence is measured using a 2D extension of the `examples/1D_conduction_convergence/case.py` example.(1D) Control - Projection solver with no acoustics
When a case contains pure advection, div u = 0, and the projection step doesn't have to correct anything. In this case, we recover 5th-order spatial and 3rd-order temporal convergence.Conservation
(2D, inviscid) Mass, momentum, and energy conservation
The following figure shows mass, momentum, and energy conservation for a 2D inviscid TGV simulation run with the explicit (dashed) and projection (solid) solvers. The projection solver conserves mass slightly better than the explicit solver despite the larger time-step. Momentum conservation is nearly equivalent for both. The projection solver loses more energy than the explicit solver, but the loss converges to zero at 3rd order with resolution.(3D, viscous) Mass, momentum, and energy conservation
Mass, momentum, and energy conservation are evaluated using the 3D Taylor green vortex simulation. Momentum conservation is floating-point exact. Mass conservation is close to floating-point exact, and converges with resolution. Energy is not conserved in this test because viscous heating is not turned into thermal energy. Instead, it matches the falling kinetic energy expected in a TGV.Scaling and performance
Weak Scaling (single fluid ideal gas)
Weak scaling is performed using a tiled 3D Taylor-Green Vortex at Mach 0.01 with 300^3 grid cells per GCD on OLCF Frontier. The code was compiled with AMDFlang AFAR drop 23.2.1, and GPU-direct MPI was used where possible. The figure shows, from top to bottom, the wall time per step, the average number of pressure solve iterations, and the speedup over an explicit solve. Different lines and colors correspond to different iterative solver parameters; the "Proj. Trunc. V-Cycle" line (purple + triangles) uses the defaults and performs best. The pressure solve iteration count is constant across problem sizes for this approach, and speedup exceeds 40x through 9400 nodes.Strong Scaling (single fluid ideal gas) (coming soon)
Strong scaling was performed on OLCF Frontier with AMD Flang AFAR 24.3.0 using a 1260^3. Strong scaling isn't as important with this solver because you can run a larger problem size per device with far fewer time steps and still get the answer faster than the explicit solve.Projection vs. Explicit Cost (single fluid ideal gas)
The following table compares the per-step and wall-clock time costs of a Mach 0.01 TGV for the explicit and projection solvers on a single A100 GPU at increasing problem sizes. The projection solver has a higher per-step cost in all cases, but it takes far fewer time steps to reach the same simulation time. Speedups reach up to 51x for large problem sizes.Projection vs. explicit cost (two fluids ideal+stiffened gas) (coming soon)
The following table compares the per-step and wall-clock time costs of a contrived example in which a water droplet moves diagonally in a tri-periodic box and rotates about its center axis. This provides a near-constant Mach number and enough dynamics for the pressure projection solve to affect runtime. The projection solver takes time steps ~140x as large as the explicit solver, but is limited by the capillary cfl and not the advective CFL.