Repository navigation
Conversation
…bled) Port of the all-regime GRU scheme (Glimm Random Upwind, "ghost GRU", https://hal.science/hal-05315640) of the branch implem-gru (solver godunov_five_eq of canoP 2.x: GRUUtils.h, GRUFunctors.h, GodunovImplemGRU, the GRU parts of ConvertToPrimitivesVariablesFunctor, FillOutside and SolverGodunovFiveEq) to the generic solver, for the models that give a physics/<model>/gru.py. The scheme keeps the colour of a material interface strictly 0 or 1. It is first order: space_order and time_order are set to 1. A time step (Simulation::gru_time_step): - ghost cells; with gravity, those copied from a coarser neighbor get the hydrostatic pressure of their own centre before the MPI exchange (gru_ghosts_kernel); - interface states of every face (gru_faces_kernel, gru_star of the model): u*, p*, p* u*, g rho*, g rho* u*; at a reflective or no-slip wall, the mirror state with the hydrostatic pressure of its centre; - upwind transport of every owned cell (gru::UpdateFunctor), a positive combination of the cell and of its incoming donors; at a face shared with finer blocks the donors are the fine cells adjacent to the face, each with the u* of its own face. When an incoming donor has the other colour, the cell takes the state of one donor (or keeps its own), drawn with one global sample per time step; - end of the update (gru_finish_kernel, gru_finish of the model): sharp colour of the drawn cells, non-conservative upwind transport of the colour in the others, pressure work and gravity, averaged over the fine faces at coarse/fine faces. After the remap of an AMR cycle (gru::RemapFunctor): a refined cell copies its parent; with gru_coarsen a coarsened cell whose children have both colours takes the state of one child, drawn coherently (gru::coherent_pick) with one sample per cycle; with gravity the moved states get the hydrostatic pressure of their new position (gru_shift_kernel). The samples are Weyl sequences (golden ratio, sqrt(2) - 1), the same on every MPI rank. Options ([simulation], the keys of settings_twophase5eq_gru_square.ini, which were not read): gru_enabled, gru_coarsen (default: gru_enabled), gru_omega0, gru_omega0_amr. physics.source must be none with GRU (the gravity is in the scheme). The kernels of GRU are compiled only when it is enabled. The two square_transport regression cases, which run this settings file, keep the all-regime flux: NO_GRU. Differences from implem-gru: - the colour follows c + sum_k a_k (c_k - c) instead of the conservative transport plus c dt div(u*): a uniform colour stays exactly 0 or 1 (in implem-gru it drifts from 1 by a few 1e-15, accumulating); - the coherent draw in the coarse ghost cells facing finer blocks is not ported: the transport does not read them; - the cells outside the domain (time step only) hold the mirror states without hydrostatic shift: dt differs by about 6e-5 in relative value. From the same initial state (multi-mode Rayleigh-Taylor, gravity, walls), one time step gives the time derivatives of implem-gru to 1.8e-12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What the model gives to the GRU scheme (simulation.gru_enabled = 1):
- COLOUR = "ag": the colour of a cell is 1 (gas) when ag >= 0.5;
- gru_star: the all-regime acoustic solver of implem-gru (compute_star_state),
along the normal of the face, with one impedance a = K max(mL cL, mR cR):
u* = (uL + uR)/2 - (PR - PL - m* g h)/(2a), m* = (mL + mR)/2
P* = (PL + PR)/2 - theta a (uR - uL)/2,
theta = min(|u*| / max(cL, cR), 1) with param.lowmach_correction_enabled;
with the source dt g m* of the momentum at the faces, the discrete
hydrostatic equilibrium PR - PL = m* g h at rest is exactly preserved;
- gru_gravity: param.gravity_x, _y, _z;
- gru_hydrostatic: P += m g.dx for a state moved by dx;
- gru_finish: a drawn state gets ag = 0 or 1 and the partial densities of
the same density (enforce_binary_color of implem-gru); otherwise ag + the
upwind transport of the colour, clipped to [0, 1], non-negative partial
densities; then the pressure work and the gravity.
param.K (default 1.1), read but not used until now, is the factor of the
impedance (impedance_factor of implem-gru). The low Mach correction keeps the
default of the model (0): implem-gru turned it on by default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- user guide: the GRU scheme in the models (equations of the interface solver, draw at the interface, AMR, well-balanced gravity, CFL condition, restart), gru_enabled in the section [simulation]; - physics guide: gru.py of a model and its functions, kernels of GRU assembled only when it is enabled; - architecture: the time step of GRU (scheme/GRU.h); - CHANGELOG: the GRU scheme and its options; the settings file settings_twophase5eq_gru_square.ini, whose gru_enabled = 1 was ignored, now runs with GRU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- regression cases twophase5eq_gru_square (2D, uniform mesh), twophase5eq_gru_square_amr (2D, AMR) and twophase5eq_gru_square_amr_3d (a cube, AMR), references produced by canoP 61f2e57; they are the same with 2 and 4 threads, and with 1 and 4 MPI processes; - physics check gru (ctest -L physics): the square of gas in liquid at a uniform velocity and pressure, with AMR, keeps ag exactly 0 or 1, P and V uniform to 1e-13, the area of the gas exactly, and its centroid within one cell of the exact translation (the interface moves by whole cells). The kernels of GRU are compiled by these cases: 53 kernels in the CI cache. The draw on coarsening (gru_coarsen) is not exercised: with ag_gradient, a block crossed by the interface is never coarsened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #6.
All-regime GRU scheme (Glimm Random Upwind, "ghost GRU", https://hal.science/hal-05315640), ported from the branch
implem-gruof canoP 2.x, for the modeltwophase5eq:simulation.gru_enabled = 1. The gas volume fractionagstays exactly 0 or 1.Scheme (
src/scheme/GRU.h, independent of the model)space_orderandtime_orderare set to 1.gru_coarsen), so that straight interfaces stay straight.physics.sourcemust benone.gru_enabled,gru_coarsen,gru_omega0,gru_omega0_amrin[simulation]. The kernels of GRU are compiled only when it is enabled.The parts that depend on the model (interface states, end of the update, hydrostatic shifts) are pykokkos kernels. The donor update, the AMR remap and the draw need the connectivity of the mesh and the time loop, which are in C++, as the flux update of the standard scheme.
Model (
physics/twophase5eq/gru.py)ag >= 0.5.a = K max(mL cL, mR cR)(param.K), optional low Mach correction, hydrostatic termm* g h.Validation
implem-gruto 1.8e-12.twophase5eq_gru_square(2D),twophase5eq_gru_square_amr(2D, AMR) andtwophase5eq_gru_square_amr_3d(3D, AMR), references by canoP 2dd78eb6. They are the same with 2 and 4 threads, and with 1 and 4 MPI processes.gru: the square of gas transported with AMR keepsagexactly 0 or 1, P and V uniform to 1e-13, the area of the gas exactly, and its centroid within one cell of the exact translation.Differences from
implem-gruc + sum_k a_k (c_k - c): a uniform colour stays exactly 0 or 1 (it drifts by a few 1e-15 inimplem-gru).implem-gruturned it on by default.Not covered by the tests
gru_coarsen): withag_gradient, a block crossed by the interface is never coarsened.🤖 Generated with Claude Code