lanl / singularity-eos

Performance portable equations of state and mixed cell closures
https://lanl.github.io/singularity-eos/
BSD 3-Clause "New" or "Revised" License
27 stars 8 forks source link

Various robustness additions to the Davis EOS #374

Closed jhp-lanl closed 5 months ago

jhp-lanl commented 5 months ago

PR Summary

Three primary additions to the Davis Reactants and Products EOS to make them more robust:

  1. Added the robust::ratio function when dividing by density
  2. Added early returns for non-positive densities. Since the products EOS should exhibit ideal gas behavior at zero density, it makes sense to return zeros for the reference values.
  3. Maxed the density with zero in the reactants EOS. With the robust ratio this basically just returns a low density limit. I don't think there's an overflow issue, but I could be wrong.
  4. Added the correct minimum energy as a function of density

PR Checklist

If preparing for a new release, in addition please check the following:

jhp-lanl commented 5 months ago

@chadmeyer please review these changes and see if you agree with my approach

jhp-lanl commented 5 months ago

@chadmeyer I think I addressed all your comments. I'll give things another scan and make sure I didn't miss anything else silly, but I think this is good now.

jhp-lanl commented 5 months ago

FYI - I added a few more robustness additions. Mainly I added an error to the DensityEnergyFromPressureTemperature() functions if the resultant density is negative (adding a max here probably will just cause the function to not converge and produce a less informative error).

I also added a robust::ratio to where we divide by Ts. It is possible for this to underflow which might be zero.