You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Diffusion: diffuse_Ssync, FillBoundary, viscFluxReg, maxOrder, tensorMaxOrder and the computeAlphaalpha_in path are never exercised #241
Location:Source/Diffusion.cpp:1195, Source/Diffusion.cpp:1794, Source/Diffusion.cpp:149, Source/Diffusion.cpp:155, Source/Diffusion.H:136 Severity: Low — dead code that still has to be kept in sync with fixes to its live twins Category: Correctness Based on commit bb697bf5 (line numbers refer to that tree).
Problem
None of these Diffusion members has a caller anywhere in Source/, Exec/, Tutorials/ or Util/:
diffuse_Ssync (Diffusion.cpp:1195-1366, about 170 lines). The scalar sync diffusion in NavierStokes::mac_sync calls diffuse_scalar with add_old_time_divFlux=false
(NavierStokes.cpp:1630).
FillBoundary(BndryRegister&, ...) (Diffusion.cpp:1793-1826). It was left over from the
pre-MLMG boundary-register solvers.
viscFluxReg() (:148-152), maxOrder() (:154-158) and tensorMaxOrder() (:160-164).
The register is reached through NavierStokesBase::getViscFluxReg() instead.
The alpha_in branch of computeAlpha (:1386-1390). Every live caller passes alpha_in = nullptr (NavierStokes.cpp:902,1624, Diffusion.cpp:909,1130). Its check AMREX_ASSERT(alpha_in_comp < alpha.nComp()) tests the freshly defined 1-component output instead of alpha_in, so any alpha_in_comp > 0 would fail in debug builds.
diffuse_Ssync is not harmless dead code. It is a separate copy of the scalar sync solve. A reader
fixing the sync path can patch it by mistake, as the comment at Diffusion.cpp:915-916 shows: it cites diffuse_Ssync as the reference for RHS scaling. It also carries its own version of the density logic,
with computeAlpha on current-time S, an explicit rho_flag==2 rescaling and rho_half scaling of
the RHS. Nobody has checked that logic against the live path.
Impact
None at run time. These members increase the maintenance surface of a file that has needed
several correctness fixes (#200). Future audits and fixes may target the wrong copy.
Suggested fix
Delete the five members (declarations in Diffusion.H:48,136-148,166-171,180-181 and the definitions
above). Either drop the alpha_in branch or make its assert check alpha_in->nComp(). Change the comment at Diffusion.cpp:915-916 to cite only diffuse_scalar. No diff is
embedded because the removal is about 220 lines. Outside these definitions, nothing else needs to
change.
Activity
Fix issues AMReX-Fluids#241, AMReX-Fluids#240: remove unused Diffusio…