-
Notifications
You must be signed in to change notification settings - Fork 191
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
Conversation
There was a problem hiding this 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$ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
6c9ba04
to
cb0d5f4
Compare
f1b6669
to
82d6c7f
Compare
f0d33bd
to
08db55c
Compare
src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/Reflective.cpp
Outdated
Show resolved
Hide resolved
src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/Reflective.cpp
Outdated
Show resolved
Hide resolved
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, |
There was a problem hiding this comment.
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
tests/Unit/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/Test_Reflective.cpp
Show resolved
Hide resolved
tests/Unit/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/Test_Reflective.cpp
Outdated
Show resolved
Hide resolved
tests/Unit/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/Test_Reflective.cpp
Outdated
Show resolved
Hide resolved
tests/Unit/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/Test_Reflective.cpp
Outdated
Show resolved
Hide resolved
@@ -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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
cc85f66
to
d7b59f2
Compare
@nilsdeppe addressed the comments. Thanks! |
141bfe0
to
a43512f
Compare
@nilsdeppe addressed the last comment. |
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nilsdeppe done.
Proposed changes
Upgrade instructions
Code review checklist
make doc
to generate the documentation locally intoBUILD_DIR/docs/html
.Then open
index.html
.code review guide.
bugfix
ornew feature
if appropriate.Further comments