Skip to content

Issue #9051: advective fluxes at mesh interfaces with refinement - #16744

Closed
ghaffari-eng wants to merge 1 commit into
firemodels:masterfrom
ghaffari-eng:fix-9051-mass-conservation
Closed

ghaffari-eng wants to merge 1 commit into
firemodels:masterfrom
ghaffari-eng:fix-9051-mass-conservation

Conversation

@ghaffari-eng

Copy link
Copy Markdown

Issue #9051: mass at mesh interfaces with refinement

From what I can see, at an interface between a coarse and a fine mesh the two meshes compute different face values of ρZ (the second ghost cell is a copy of the first, so each side is first order where the flow enters it), and they move different amounts of each species through the interface. Total mass in a sealed box drifts, also with UGLMAT.

The change, in each stage of the time step:

  1. Before DENSITY, each mesh sends its face values and the normal velocities DENSITY uses at the interface (MESH_EXCHANGE code 25). The mesh downstream of the interface takes the face values of the upstream mesh: the fine faces take the coarse face value where gas flows into the fine mesh, and the coarse face takes the flux-weighted average of the fine face values where gas flows into the coarse mesh. Faces with flow in both directions keep their own values.
  2. After DENSITY, each mesh sends the advective fluxes and normal velocities it used at the interface (code 24), and the coarse mesh corrects its flux in the interface cell by the area-weighted sum over the fine faces of u_fine (ρZ_fine − ρZ_coarse), with face values (a variant of the refluxing of Berger and Colella 1989). Density, mass fractions and temperature of that cell are updated before the usual exchange.

Where the coarse velocity equals the area-weighted average of the fine ones (UGLMAT), both meshes move the same mass. A difference of the normal velocities (FFT, within VELOCITY_TOLERANCE) is not moved into the coarse cell, which would then get more or less gas than its own velocity field makes room for and change its temperature. The mass error left with FFT should be the velocity difference times the face value, the same kind of error as between meshes with the same cell size; in my runs it follows VELOCITY_TOLERANCE.

New MISC parameter REFLUX_MESH_INTERFACES (default T). Not applied where meshes overlap, at PERIODIC FLOW ONLY boundaries, with GEOM or cylindrical coordinates, or where the correction would take a density out of bounds. Cases without refinement should not be affected (bit for bit the same in the cases I ran). Tech Guide (Mass chapter, flux matching) and User Guide (mesh alignment, MISC table) updated.

Results: see #9051.

Checks, master and this branch on the same machine:

  • 7 multi-mesh verification cases without refinement (species_conservation_1 to _4, simple_duct, shunn3_4mesh_64, dancing_eddies_default): output identical to master.
  • 10 cases with refined or overlapping meshes (random_meshes, obst_coarse_fine_interface, dancing_eddies_uglmat_refine, duct_flow_uglmat_refine, dancing_eddies_embed, geom_stretched_grid, ns2d_16_emb_1to2_refinement, ns2d_16_int_1to2_refinement, race_test_1, race_test_4): all run to the end. random_meshes, dancing_eddies_embed, geom_stretched_grid and ns2d_16_emb_1to2_refinement are identical to master; obst_coarse_fine_interface keeps its pressure result; race_test gives the same result with 1 and 4 threads.
  • 45 sealed boxes (UGLMAT and FFT, 1 and 2 MPI processes), a burner in a sealed box, a tracer pulse, and overlapping meshes and PERIODIC FLOW ONLY boundaries next to a refined mesh (switch on and off give the same result there): see Non-matching diffusive mass flux across mesh boundaries with refinement. #9051.

…erfaces with refinement

At an interface between a coarse and a fine mesh, the second ghost cell is
a copy of the first, so each mesh limits its face value of rho*Z with
first-order upwinding where gas flows into it, and the two meshes compute
different face values. They moved different amounts of each species
through the interface, and the total mass in a sealed box drifted, also
with UGLMAT.

In each stage of the time step:
- Before DENSITY, each mesh sends its face values and the normal
  velocities DENSITY uses at the interface (MESH_EXCHANGE code 25), and
  the mesh downstream of the interface takes the face values of the
  upstream mesh: the fine faces take the coarse face value where gas flows
  into the fine mesh, and the coarse face takes the flux-weighted average
  of the fine face values where gas flows into the coarse mesh. Faces with
  flow in both directions keep their own values.
- After DENSITY, each mesh sends the advective fluxes and normal velocities
  it used at the interface (code 24), and the coarse mesh corrects its flux
  in the interface cell by the sum over the fine faces of
  u_fine*(phi_fine - phi_coarse), weighted by area, where phi is the face
  value (a variant of the refluxing of Berger and Colella 1989). Density,
  mass fractions and temperature of that cell are updated before the usual
  exchange of species.

Where the coarse velocity equals the area-weighted average of the fine
velocities (UGLMAT), both meshes move the same mass. A difference of the
normal velocities (FFT, within VELOCITY_TOLERANCE) is not moved into the
coarse cell, which would then get more or less gas than its own velocity
field makes room for and change its temperature. The mass error left is
the velocity difference times the face value, the same kind of error as
between meshes with the same cell size, and is controlled by
VELOCITY_TOLERANCE.

New MISC parameter REFLUX_MESH_INTERFACES (default T). Not applied where
meshes overlap, at PERIODIC FLOW ONLY boundaries, with complex geometry or
cylindrical coordinates, or where the correction would take a density out
of bounds. Cases without refinement are not affected.
@rmcdermo

Copy link
Copy Markdown
Contributor

@ghaffari-eng I am going to close this PR because I don't liked PRs handing out for any length of time. However, I will use your branch to test once I get time.

@rmcdermo rmcdermo closed this Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants