clawpack / amrclaw

AMR version of Clawpack
http://www.clawpack.org
BSD 3-Clause "New" or "Revised" License
26 stars 45 forks source link

Does binary output need to call `bound` for ghost cells? #277

Open rjleveque opened 2 years ago

rjleveque commented 2 years ago

@mjberger: When working on https://github.com/clawpack/amrclaw/pull/275 I noticed that when doing binary output we output ghost cell values along with interior grid values, as we do in GeoClaw. But in the GeoClaw version of valout.f90 we first call bound (line 199) whereas in the amrclaw versions we do not. Should we be calling this?

mjberger commented 2 years ago

bound is called for binary output to populate the ghost cells with reasonable values that are then output in one giant read. That is because it's faster than outputting in a loop and skipping the ghost cells.

If that's what's done in amrclaw for binary output then bound should be called to. The plotting programs, as far as I know, don't actually use the ghost cells, do they? Since writing in ascii is slower, the overhead of all those calls to output is correspondingly less.

— Marsha

On Jun 2, 2022, at 8:37 PM, Randall J. LeVeque @.***> wrote:

@mjberger https://github.com/mjberger: When working on #275 https://github.com/clawpack/amrclaw/pull/275 I noticed that when doing binary output we output ghost cell values along with interior grid values, as we do in GeoClaw. But in the GeoClaw version of valout.f90 https://github.com/clawpack/geoclaw/blob/master/src/2d/shallow/valout.f90 we first call bound (line 199) whereas in the amrclaw versions we do not. Should we be calling this?

— Reply to this email directly, view it on GitHub https://github.com/clawpack/amrclaw/issues/277, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGUGC3H55JMPEH62TM765TVNFHVRANCNFSM5XW2BIXQ. You are receiving this because you were mentioned.

rjleveque commented 2 years ago

You are right that in general the ghost cell values are never used in plotting or other postprocessing, and in fact they are stripped off when using the standard pyclaw routines to read binary (in pyclaw/src/pyclaw/fileio/binary.py). So it probably doesn't matter in general whether they are correct.

However, for some purposes having the ghost cells could be useful, e.g. I have used them in computing vorticity in a postprocessing step, in which case the velocities have to be differentiated, and so having values in ghost cells on each patch allows using centered differences everywhere.

The amrclaw code is identical to geoclaw in how binary files are written, but for some reason doesn't call bound. I will go ahead and add this.