Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hydro speeds in GRMHD HLL where magnetic field is zero #5788

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

nilsdeppe
Copy link
Member

Proposed changes

With taggedtuple support in pypp the boundary condition python files can be cleaned up, but I don't have the energy right now to do that huge refactor...

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments


for (size_t i = 0; i < get(rest_mass_density).size(); i++) {
if (get(rest_mass_density)[i] < 1.e-08) {
double alpha = 0.0; // get(rest_mass_density)[i]/1.e-08;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confusion... why is alpha 0 and then we are doing math with alpha?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ffoucart do we still need this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used to be necessary for stability of the atmosphere. Effectively, it makes the code use the speed of light as characteristic speed at low density. I have not tried to remove that correction though, and it's probably not a great idea to keep the hard-coded 1.e-8 in the final version.
My preference, if possible, would be to get rid of the alpha, just set the speeds to the speed of light at low density, and have the density threshold as an specifiable input that we can test on merger simulations and maybe lower / remove at a later time if it proves unnecessary.

@ffoucart
Copy link
Contributor

The only difference with what I used for BNS mergers seems to be that the sound speed is now calculated within the equation of state class. Assuming that this was already reviewed separately, I'm good with this PR (up to the discussion above on the treatment of low-density regions).

@ffoucart
Copy link
Contributor

ffoucart commented Feb 21, 2024

If you want me to try some simulations with different thresholds for the low-density regions, let me know.

@nilsdeppe
Copy link
Member Author

Okay, great! I'm making a few other minor cleanup changes. I'll add a parameter for the density cutoff for atmosphere and will just use the light speeds there. Then we can test disabling it if we want but can re-enable later.

@nilsdeppe
Copy link
Member Author

I pushed fixups. @ffoucart I changed the calculation, it didn't agree with what was in the Rezzolla book as far as I could tell

@ffoucart
Copy link
Contributor

ffoucart commented Feb 22, 2024 via email

@nilsdeppe
Copy link
Member Author

nilsdeppe commented Feb 22, 2024

Here's the tex for the equations I switched to: https://spectre-code.org/namespaceRelativisticEuler_1_1Valencia.html#a8a63b3bfe1b17683401ba9abd4d6f7f4

Could this be related to grid vs. inertial frame solves?

// Compute v_dot_normal, v^i n_i
dot_product(make_not_null(&v_dot_normal), spatial_velocity,
normal_covector);
get(v_dot_normal) *= get(lapse);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our two original formulae are the same, but you are having additional lapse factors by multiplying v_dot_normal here (giving you my v0), then still multiplying, but using this as v_n in the discriminant and still multiplying by the lapse in the final expression. In your formulation, I think you don't want L147. Then you should get an expression equivalent to mine, if I am not mistaken.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I've removed this!

ffoucart
ffoucart previously approved these changes Feb 22, 2024
Copy link
Contributor

@ffoucart ffoucart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. As a sanity check, you could run the first few hours of evolution of the lowest resolution BNS system, e.g. on wheeler:
/panfs/ds09/sxs/ffoucart/Runs/Spectre/BNS_Gamma2/ConvergenceTest/5Points
The maximum density in particular is quite sensitive to the HLL solver, so checking that you get the same result as me would be a good way to verify consistency of the new implementation.

// Compute v^2=v^i v_i
dot_product(make_not_null(&v_squared), spatial_velocity,
spatial_velocity_one_form);
get(v_squared) = clamp(get(v_squared), 0.0, 1.0 - 1.0e8);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait what? e-08?

}
}

// Correct for mesh velocity
if (normal_dot_mesh_velocity.has_value()) {
get(*packaged_largest_outgoing_char_speed) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason not to use -=?

kidder
kidder previously approved these changes Mar 4, 2024
@kidder
Copy link
Member

kidder commented May 20, 2024

@nilsdeppe is there a reason this didn't get merged? If not, it needs a rebase...

@knelli2
Copy link
Contributor

knelli2 commented Aug 21, 2024

@nilsdeppe will look into this

@nilsdeppe
Copy link
Member Author

I've rebased this and made sure it agrees with the paper. Here's an image of the inspiral trajectories from a few different runs I've done trying to improve the domain decomposition and tuning other parameters. The point is they all agree.
image

@kidder kidder merged commit c92badd into sxs-collaboration:develop Nov 26, 2024
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants