sxs-collaboration / spectre

SpECTRE is a code for multi-scale, multi-physics problems in astrophysics and gravitational physics.
https://spectre-code.org
Other
159 stars 189 forks source link

Fix unit conversions between SpECTRE and RotNS for non-polytropic EoS #6120

Closed ncorsobh closed 2 months ago

ncorsobh commented 3 months ago

Proposed changes

RotNS uses a special unit normalization when dealing with polytropic equations of state, which is what SpECTRE has been using so far. For any other EoS, however, it uses a different unit normalization. cf. equations 15-23 in Cook et al. (1992) with equations A1-A10 in Cook et al. (1994).

This PR allows the user to specify in the input file for the RotatingStar executable whether a polytropic EoS was used. The first commit adjusts the structure of Xcts/WrappedGr because the new structure for RotatingStar introduced in the second commit includes an Options::Alternatives that breaks the old implementation.

Upgrade instructions

If you use RotatingStar with polytropic EoSs, nothing changes for you, the input file works the same.

If you use some other EoS, instead of using the PolytropicConstant input option, you should use EquationOfState followed by the equation of state with which you would like to initialize the data.

Code review checklist

Further comments

isaaclegred commented 2 months ago

Looks good to me, please squash everything (including modification to the documentation of CstSolution)

ncorsobh commented 2 months ago

Before this PR is approved under his nose, @nilsvu should probably give the Xcts changes a look, since he seems to be mainly involved with a lot of the recent work with this section of the code.

nilsvu commented 2 months ago

I approve the first commit. Thanks for checking with me. I haven't looked at the second commit.