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

Compute global quantities from AMR grid patches of solution #207

Open
rjleveque opened this issue Feb 21, 2017 · 4 comments
Open

Compute global quantities from AMR grid patches of solution #207

rjleveque opened this issue Feb 21, 2017 · 4 comments
Assignees

Comments

@rjleveque
Copy link
Member

A user requested a post-processing tool to help compute a global quantity (e.g. the total mass) from each frame of AMR output.

Not sure if this would go in visclaw, amrclaw, or pyclaw?

One way to do this might be:

  • For each grid patch define a boolean array finest of the same size, initialized to True everywhere.
  • Loop over patches from coarsest to finest. If a patch at level L covers some rectangular region of a patch at level L-1 then set finest = False in that portion of the level L-1 patch.
  • Loop over all patches a second time, accumulating the desired value, e.g. adding in rho(i,j)*dx*dy for each grid cell (i,j) for which finest = True.
@ketch
Copy link
Member

ketch commented Feb 21, 2017

We have a hook for this functionality in Pyclaw; see http://www.clawpack.org/pyclaw/output.html#outputting-functionals (although the example code there doesn't make sense). A working example is in pyclaw/examples/psystem_2d/psystem_2d.py; see the function total energy. Of course, that is coded for a single patch which makes things very simple.

@mjberger
Copy link

mjberger commented Feb 21, 2017 via email

@rjleveque
Copy link
Member Author

@mjberger: Sorry, I was using mass computation as a simple example but the actual problem is to compute e.g. potential energy of a tsunami, which requires summing eta**2 * dx*dy over all wet cells, where eta = h + B. Since this is a nonlinear function of the solution, computing it on the coarse level is not sufficient. It has to be done using the finest patch available at each point.

@rjleveque
Copy link
Member Author

This could be incorporated in the gridtools.py module I am working on to deal with AMR data.

@rjleveque rjleveque self-assigned this Feb 23, 2019
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

No branches or pull requests

3 participants