Implementing the periodic boundary condition manually #427
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Definitely don't use |
Beta Was this translation helpful? Give feedback.
-
Thanks, Kyle! I'll try and understand some more of the pgen files and get back to you. |
Beta Was this translation helpful? Give feedback.
-
Your implementation copies the boundaries within one MeshBlock, so it does not work when you have more than one MeshBlocks in the periodic direction even if you fix Kyle's point. When you have more than one MeshBlocks, Periodic boundary conditions are implemented as inter-MeshBlock communications and cannot be implemented as a user-defined boundary function. If you really want to implement what you are thinking of, you have to hack into the code. Perhaps the easiest way is to apply v2 reflecting condition after normal periodic boundary communications are completed. It is not impossible, but not trivial. At least the code does not provide such an interface. I would rather suggest you to reconsider if you really need this boundary condition - for example, can't you do that just with reflecting or outflowing boundary conditions, or whatever you can set locally without communication? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply, Tomida-san and Kyle! I think it should be possible to get around this exotic boundary condition. In fact, when I set resistivity to 0, the velocity in the bracketed region does go to zero as shown in the GIF below. |
Beta Was this translation helpful? Give feedback.
Your implementation copies the boundaries within one MeshBlock, so it does not work when you have more than one MeshBlocks in the periodic direction even if you fix Kyle's point. When you have more than one MeshBlocks, Periodic boundary conditions are implemented as inter-MeshBlock communications and cannot be implemented as a user-defined boundary function.
If you really want to implement what you are thinking of, you have to hack into the code. Perhaps the easiest way is to apply v2 reflecting condition after normal periodic boundary communications are completed. It is not impossible, but not trivial. At least the code does not provide such an interface. I would rather suggest you to re…