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

Clarification w.r.t FillBoundary vs. FillPatch #4112

Closed
desjardi opened this issue Aug 27, 2024 · 5 comments · Fixed by #4124
Closed

Clarification w.r.t FillBoundary vs. FillPatch #4112

desjardi opened this issue Aug 27, 2024 · 5 comments · Fixed by #4124

Comments

@desjardi
Copy link

Hello,

I'm working on an amrcore-based code, taking heavy inspiration from the fortran ADVECTION_F example. In that example, the main scalar (phi) being solved is defined without ghost cells, but at each time step, a phiborder array is defined with ghost cells, and filled from phi data using FillPatch. I think that it makes sense to me: it's efficient and flexible.

I'm interested in another strategy, where phi itself is defined with some ghost cells. At the end of a time step, I can update the interior of phi, but would then need to update the ghost cells. It seems to me that FillBoundary may do that (i.e., focus on updating only the ghost cells while leaving the interior alone), but I'm not too sure how it works. I would expect it to fill ghost cells at a level based on both that level and a coarser level, and involving boundary conditions as well. Yet, the FillBoundary routine doesn't seem to be as rich as the FillPatch routine.

Basically, my question is: is there such a thing as a FillPatch routine which works only on the ghost cells? Or is there something fundamentally problematic with what I'm proposing to do?

Thanks a lot for any guidance on this!

Olivier

@WeiqunZhang
Copy link
Member

When you call filpatch (in Fortran or C++), you are allowed to have the destination multifab the same variable as one of the source multifabs. In that case, only ghost cells are filled and no extra copying of valid cells is performed.

@WeiqunZhang
Copy link
Member

In case, I was not clear in my last comment, it's perfectly fine to define phi_old and phi_new with ghost cells and call

    call amrex_fillpatch(phi_new, ...., phi_old, ..., phi_new, ...)

@desjardi
Copy link
Author

Ah, that makes sense - thank you!
If I may, I have another (hopefully) short clarification question: is averagedown useable indiscriminately on cell/nodal data? Also, does it handle ghost cells as well?

@WeiqunZhang
Copy link
Member

amrex_average_down is cell centered data only. We could add support for nodal data, if you need it. It does not touch ghost cells.

@desjardi
Copy link
Author

That would be fantastic if you could add that, as I believe that I do need it. Thank you so much!

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

Successfully merging a pull request may close this issue.

2 participants