Is there anyway to slice a plane or line in MultiFab? #3662
Answered
by
WeiqunZhang
zhazhajust
asked this question in
Q&A
-
For example, I want to represent the electric field with MultiFab, assuming its range is (0-100e-6, 0-100e-6, 0-100e-6), then I want to output the electric field in the plane of x = 50e-6, is there anyway in Amrex to convert it to a plane data? |
Beta Was this translation helpful? Give feedback.
Answered by
WeiqunZhang
Dec 12, 2023
Replies: 1 comment 4 replies
-
Since MultiFabs have no concept of grid spacing and physical coordinates, the short answer is no. If you do the arithmetic to find the integer of the plane you want, you can make a box with the same centering as the MultiFab, and do a copy-on-intersect. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a function that may help, but probably does not do exactly what you want because it only works on cell centered data.
https://amrex-codes.github.io/amrex/doxygen/namespaceamrex.html#a3a431197f206b148529308a7796d5039
However, it should not be hard to extend it to other index types.
There is also a function called
get_line_data
https://amrex-codes.github.io/amrex/doxygen/namespaceamrex.html#a7f08bece47186514a8d7ec979e4b87ca
One can use it to extract a line of data.
Note that both functions return a MultiFab, which is a distributed data container. That is the data might be on multiple processes.