-
Notifications
You must be signed in to change notification settings - Fork 33
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
Fixed the momentum exchange method in the JAX backend. #101
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ class D3Q19(VelocitySet): | |
|
||
def __init__(self, precision_policy, backend): | ||
# Construct the velocity vectors and weights | ||
c = np.array([ci for ci in itertools.product([-1, 0, 1], repeat=3) if np.sum(np.abs(ci)) <= 2]).T | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to make this consistant, pls make sure that D2Q9 is similar. But overall, again this could change in the future, as you have store them symmetrically and avoid storing values for opp index. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is consistent for all 3 lattices. |
||
c = np.array([ci for ci in itertools.product([0, -1, 1], repeat=3) if np.sum(np.abs(ci)) <= 2]).T | ||
w = np.zeros(19) | ||
for i in range(19): | ||
if np.sum(np.abs(c[:, i])) == 0: | ||
|
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.
Why is this removed?
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.
was not needed for ExtrapolationOutflow BC. that BC directly uses _f_post_collision to put all the necessary ingredients.
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 am not sure. We created reconstruction originally for this BC!:
If you don[t recover, you'll 100% overwrite this data...
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 have changed those comments since then. I can remove this part and add it to another PR if that helps you understand why but this BC assembles all the information and stores it directly in _f_post_collision which is then recovered when we write in f_1 (not f_0 as in bc_recovery). Just like how halfway bc uses post-collision values in the opposite direction taken from f_0, this BC also takes "post-collision" values taken from f_0 which are hand crafted earlier inside a function that is called "update_bc_auxilary_data".
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 have to think about this more to make sure it is correct. We're rushing PR merges for no reason and we're reverting them back or fix them almost immedately a few days later. I'll check this next week.
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.
We are not reverting anything! There are minor things that have been missed in the reivews or unknown new bugs that are discovered.
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.
Hi Hesam. I took a look at this. I agree that it is not needed. Pls make this change only now that you're at it:
Pls use underline for _f_pre... for the register values in bc_extrapolation_outflow.py
Thanks