Skip to content

SDC2 conducts heat when diffuse_temp is disabled #3392

Description

@zingale

Location: Source/hydro/Castro_mol_hydro.cpp:547-559.

Finding

The second-order MOL branch calls fill_temp_cond and mol_diffusive_flux
whenever DIFFUSION is compiled in. Unlike both fourth-order diffusion calls, it
does not test the runtime flag castro.diffuse_temp.

A diffusion-capable executable therefore conducts heat with diffuse_temp=0
when using SDC2. The runtime-disabled case can also lose its diffusion timestep
restriction while retaining the explicit diffusive update.

Evidence

The call is guarded only by #ifdef DIFFUSION.
Source/diffusion/diffusion_util.cpp:13-63 computes conductivity without
checking diffuse_temp, and Source/hydro/Castro_mol.cpp:317-350 adds the
resulting energy flux without checking it either. The fourth-order branch
explicitly tests diffuse_temp == 1.

A fresh 1-D debug executable also reproduced the ignored switch. With hydro
enabled to avoid report 02 and a fixed dt=1e-8, diffuse_temp=0 and
diffuse_temp=1 gave identical final printed diagnostics. Maximum temperature was
1.940592276 in both runs. Keeping diffuse_temp=0 but setting
diffuse_cond_scale_fac=0 changed that maximum to 1.940595995. README.md records
the inputs and commands.

Proposed fix

Wrap conductivity evaluation and mol_diffusive_flux in if (diffuse_temp).
Keep this independent of do_hydro, so diffusion-only runs remain supported.
The out-of-bounds zeroing in report 02 must also be fixed for that case.

Validation after fixing

Use the diffusion problem with a nonuniform temperature and zero velocity. With
hydro disabled, diffuse_temp=0 must leave energy unchanged, while
diffuse_temp=1 must diffuse. Test SDC2 and SDC4 using the same executable and
a small fixed timestep.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions