AMReX-Codes / amrex

AMReX: Software Framework for Block Structured AMR
https://amrex-codes.github.io/amrex
Other
530 stars 343 forks source link

Periodicity with multiple layers of ghost nodes #4045

Open bsrunnels opened 1 month ago

bsrunnels commented 1 month ago

Right now periodicity is not possible if there are two or more ghost nodes (i.e. if FabArrayBase::m_multi_ghost is true) - per

https://github.com/AMReX-Codes/amrex/blob/930e75ea9d02a46278a802ea886d950f4c8d1a90/Src/Base/AMReX_FabArrayBase.cpp#L879

Is it possible to update FabArrayBase to allow for periodicity with multiple layers of ghost nodes?

WeiqunZhang commented 1 month ago

Sorry for taking me so long to reply. The issue is this line

https://github.com/AMReX-Codes/amrex/blame/b6ed5237987e1d5babda45a606baa6074e426272/Src/Base/AMReX_FabArrayBase.cpp#L705

complementIn is used to remove all the valid points from B ox dst_bx_ng. But the function does not take periodic boundaries into account. It's possible to do that. So let's keep this issue open. I will try to implement it. Meanwhile, you could achieve it by calling FillBoundary twice. First with multi_ghost=true and no periodic boundaries, and then with multi_ghost=false and periodic boundaries.

bsrunnels commented 1 month ago

Thanks @WeiqunZhang. I'll keep an eye on the issue, but will implement your temporary fix when/if we need periodicity working quickly.