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

How to understand the periodic boundary conditions applied in Lmtx and Gmtx? #2

Open
ouening opened this issue Apr 21, 2022 · 2 comments

Comments

@ouening
Copy link

ouening commented Apr 21, 2022

Hi, thanks for your awesome work! I read your blog (https://medium.com/swlh/create-your-own-plasma-pic-simulation-with-python-39145c66578b) and the correspondign code, but I can not understand the the periodic boundary conditions applied in Lmtx and Gmtx, could you explain it in detail? By the way, the Gmtx in the blog seems uncorrect:
image

@pmocz
Copy link
Owner

pmocz commented Oct 11, 2022 via email

@ouening
Copy link
Author

ouening commented Oct 11, 2022

Thank you for the interest in my blog posts, and for catching the missing minus signs! I updated the text to reflect it. For periodic boundary conditions, the easiest way to understand it is the following: Suppose you have vertices 1,..., m The neighbors of vertex 2 are 1 and 3, there is no issue there The neighbors of vertex 1 are 0 and 2. But vertex 0 does not exist. Instead, you associate it with vertex m. Similarly, the neighbors of vertex m-1 are m-2 and m ... no issue there. The neighbors of vertex m are m-1 and m+1. But vertex m+1 does not exist. So you associate it with vertex 1. Associating vertex 0 with m and m+1 with 1 is called "periodic wrapping" When constructing the 2nd order gradient matrix, this means you place 1s in the superdiagonal and -1s in the subdiagonal, and there is one "1" and one "-1" that "wraps" over ... I updated matrix in the article, which had the mistake you pointed out, so hopefully this should clarify things Best, Philip

On Wed, Apr 20, 2022 at 8:53 PM 周文青 @.> wrote: Hi, thanks for your awesome work! I read your blog ( https://medium.com/swlh/create-your-own-plasma-pic-simulation-with-python-39145c66578b) and the correspondign code, but I can not understand the the periodic boundary conditions applied in Lmtx and Gmtx, could you explain it in detail? By the way, the Gmtx in the blog seems uncorrect: [image: image] https://user-images.githubusercontent.com/15122811/164367956-2a4ee1d6-b250-455e-9f16-313de7cda38b.png — Reply to this email directly, view it on GitHub <#2>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZESVKB4OIORMBA2LU7TLTVGDGLLANCNFSM5T55PGWA . You are receiving this because you are subscribed to this thread.Message ID: @.>

Thanks very much! The explanation is very easy to understand!

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

No branches or pull requests

2 participants