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

Add a reflective boundary condition #5624

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

jyoo1042
Copy link
Contributor

Proposed changes

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

Copy link
Contributor

@yoonso0-0 yoonso0-0 left a comment

Choose a reason for hiding this comment

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

Before looking further into the code I think these point needs to be discussed :)

*
* All primitive variables at the boundary are copied into ghost zone except :
*
* - If \f$n_iv^i \leq 0\f$ where \f$v^i\f$ is spatial velocity and \f$n_i\f$
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I understood the Shiokawa paper, this boundary condition flips the normal component of velocity and the whole magnetic field regardless of whether n_iv^i > 0 or n_i B^i > 0. Here it looks like a slight variation of the soft BC in that it does not invert normal velocity when flow is pointing inward. I'm not sure how this affects the quality of simulation along the polar boundary, but if that works okay, it should be mentioned here that this is not exactly same as the one presented in Shiokawa paper.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, the same treatment of normal magnetic field based on the criteria n_i B^i > 0 seems not so trivial to me. Have you tried always inverting the normal component of B field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added an option to reflect both outgoing and incoming normal components of spatial velocity and magnetic field.

if (direction.sign() > 0.0) {
get<LorentzFactorTimesSpatialVelocity>(outermost_prim_vars).get(i) =
get(get_boundary_val(interior_lorentz_factor)) *
min(normal_spatial_velocity_at_boundary,
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why there's this min call

@@ -180,6 +180,7 @@ void test_boundary_condition_with_python_impl(
const BoundaryCondition& boundary_condition,
const Index<FaceDim>& face_points,
const db::DataBox<DbTagsList>& box_of_volume_data,
std::optional<const bool> member_bool,
Copy link
Member

Choose a reason for hiding this comment

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

If I'm understanding correctly, this is literally the point of the ExtraTagsForPythonFromDataBox. Why can't you use that?

Copy link
Member

Choose a reason for hiding this comment

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

ping

@jyoo1042 jyoo1042 force-pushed the BC_PR branch 2 times, most recently from cc85f66 to d7b59f2 Compare March 15, 2024 18:47
@jyoo1042
Copy link
Contributor Author

@nilsdeppe addressed the comments. Thanks!

@jyoo1042 jyoo1042 force-pushed the BC_PR branch 2 times, most recently from 141bfe0 to a43512f Compare April 16, 2024 16:10
@jyoo1042
Copy link
Contributor Author

@nilsdeppe addressed the last comment.

Copy link
Member

@nilsdeppe nilsdeppe 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! Please rebase and squash

@@ -37,10 +37,15 @@ void test_stuffs(const bool reflect_both) {
make_not_null(&gen), used_for_size);
const auto sqrt_det_spatial_metric = determinant(spatial_metric);

struct RandomBool : db::SimpleTag {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe name this ReflectBoth instead of RandomBool? "random" means something in CS, and it does not appear the value of this bool is randomly generated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nilsdeppe done.

@nilsdeppe nilsdeppe added the auto-merge GitHub's auto-merge has been enabled for this PR. label Apr 19, 2024
@nilsdeppe nilsdeppe merged commit 6645460 into sxs-collaboration:develop Apr 19, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge GitHub's auto-merge has been enabled for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants