cholla-hydro / cholla

A GPU-based hydro code
https://github.com/cholla-hydro/cholla/wiki
MIT License
60 stars 32 forks source link

Default density_floor warning does not trigger if density_floor absent from parameter file. #372

Closed brantr closed 4 months ago

brantr commented 4 months ago

In global.cpp, there is a warning that looks intended to alert the user that they are using the default density_floor=0. However, as written, this will only trigger if density_floor is defined in the parameter file:

#ifdef DENSITY_FLOOR
  } else if (strcmp(name, "density_floor") == 0) {
    parms->density_floor = atof(value);
    if (parms->density_floor == 0) {
      chprintf(
          "WARNING: density floor is set to its default value (zero)! It can be set to a different value in the input "
          "parameter file.\n");
    }
#endif

If density_floor doesn't appear in the parameter file, theelse if()doesn't get executed.

I'm checking to see whether this was intended (warning the user they have set the density floor to zero), or whether a general warning about using density_floor=0 was intended (regardless of the declaration of density_floor in the parameter file).

brantr commented 4 months ago

I have verified that setting density_floor=0 in the parameter file triggers the warning.

evaneschneider commented 4 months ago

It should be the case that not setting the density floor parameter in the input file still triggers the warning, since it is given a default value of zero in the parameter struct header where it is declared. If not, we should fix it. The intended behavior is to warn the user if they have compiled with the density floor flag but haven’t set their desired floor in the input file. If this is unclear, we can work on the wording in the warning.

-- Evan Schneider Assistant Professor of Physics and Astronomy University of Pittsburgh 520-822-6294 pronouns: she/they I support the Union of Pitt Facultyhttps://www.pittfaculty.org/

On Feb 6, 2024, at 5:23 PM, Brant Robertson @.***> wrote:



I have verified that setting density_floor=0 in the parameter file triggers the warning.

— Reply to this email directly, view it on GitHubhttps://github.com/cholla-hydro/cholla/issues/372#issuecomment-1930867457, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA2F4XDVGSOEN32UIKX3ZXDYSKUNVAVCNFSM6AAAAABC4YHFAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZQHA3DONBVG4. You are receiving this because you are subscribed to this thread.Message ID: @.***>

evaneschneider commented 4 months ago

@helenarichie Can you take a look at this?

evaneschneider commented 4 months ago

Fixed in PR #373