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

Add fgout grid capability and support for output_format binary32 #533

Merged
merged 53 commits into from
Jul 11, 2022

Conversation

rjleveque
Copy link
Member

This (together with fgmax grids) replaces the old fixedgrid capability of GeoClaw, which has now been removed as an option.

This PR requires related PRs on visclaw, and pyclaw in order for the visualizations to work in the example provided in examples/tsunami/chile2010_fgmax-fgout.

Some documentation will soon appear in the dev branch at https://www.clawpack.org/dev/fgout.html.

This is still being actively tested and there may be more updates.

When checking times include relative buffer of 1d-13 to avoid rounding error issues
in which grids at some levels get updated but not other levels at the same time.
This gave some spurious looking results.

Note: many debug write statements still included to help understand flow, and will
be useful for further cleaning up and refactoring, then should be removed.
fg%output_arrival_time and fg%output_surface_max no longer supported.
Use fgmax grids instead for these capabilities
Now based on v5.8.1 and renamed fgout for new development.

* fixedgrid_output:
  fix comment in f90
  remove debug write statements
  move fgrid_out to tick.f and remove deprecated max options
  Fix some things with fixedgrid output to make more robust
…able names

Making fgout more similar to fgmax.  Still need to split up module into
separate subroutines and improve input/output formats.
only supports point_style==2, i.e. uniform 2d grid of points so far.
…ting

Requires fgout branch of clawutil, pyclaw, visclaw
no need to define iaddqeta function as was done in valout.f
add new fgout%output_times array
grid is now cell centered, not points, to conform to output,
interpolate by pw const in space by default (method=0), still need to fix up
pw bilinear (method=1) near shore.
fix 2x2 arrays passed in to interpolate, may have been wrong order
still has problems at some fgout times coincident with frame times
Made FGOUT_ttol larger (1e-13 to 1e-6) and changed to use this uniformly
in several routines so that fgout is properly updated at all levels just
before an output frame time.  This tolerance may need more thought.
…exception

Many old setrun files instantiated but didn't use this capability,
in which case only a warning is issued.  But if len(self.fixedgrids)>0
i.e. the user is trying to use it, an exception is raised.
@rjleveque rjleveque changed the title WIP: Add fgout grid capability to output soln on fixed grid at frequent times Add fgout grid capability to output soln on fixed grid at frequent times Apr 18, 2022
@rjleveque
Copy link
Member Author

I still plan to add some more examples, but I think this is working well enough to merge after others review.

@mandli
Copy link
Member

mandli commented May 31, 2022

@rjleveque I was attempting to test this and am running into problems with the bowl_slosh test. It looks like it may have an update issue?

* master:
  add support for binary32 gauge output
  revert code that prints gauges in critical section
  update claw_git_status for tests/dtopo1
  redo tests/dtopo1 so binary gauge data produced is compared with archived ascii data for portability
  added binary gauge output to tests/dtopo1
  support binary gauge output in gauges_module.f90
  declare variable that should be integer
  change a comment about gauge critical section
  put print_gauges in critical block and use same output unit number for all
@rjleveque rjleveque changed the title Add fgout grid capability to output soln on fixed grid at frequent times Add fgout grid capability and support for output_format binary32 Jun 2, 2022
@rjleveque
Copy link
Member Author

This PR has been updated to also include support for specifying output_format = 'binary32' to write binary files with 4-byte/float32 values instead of the full 8-byte/float64 values that we compute with. This results in files that are half the size but still have 8 significant figures, sufficient for all cases I have been working with, I believe. When making lots of frames for an animation, this can be a significant reduction in storage.

In the process, I also added support for writing the standard output frames (all AMR grids) using binary32 as well, which again cuts the file size in half and can be significant if writing many frames, or if doing many simulations.

In setrun.py you can now specify clawdata.output_format = 'binary32', or 'binary64'. For backward compatibility, if you specify 'binary' you get 'binary64'. Of course you can also still specify 'ascii' to get even larger files (but sometimes useful for debugging purposes).

An additional change is that the fort.txxxx files produced for each frame now includes a new final line with the output_format, so that when reading in the frames the proper format is used. This avoids the need to set the format in setplot.py or to try to auto-detect it as in clawpack/visclaw#222, and also fixes issues such as clawpack/visclaw#275.

These changes to frame output are mixed in with the PR for new fgout capabilities because the same tools are used to read them in. For fgout grids the files produced are called fgout.txxxx, fgout.qxxxx and for binary output, fgout.bxxxx. Some fixes to allow the proper file_prefix were also required in the other PRs listed below.

To test this PR, you also need:

@mandli, the tests in tests/bowl_slosh work for me, but only when these other repos are properly checked out.

@mandli
Copy link
Member

mandli commented Jun 15, 2022

The multilayer test is failing as are the examples. I think it should be an easy fix as it looks like the Makefile just needs to be adjusted as the error during compilation is

/Users/mandli/Dropbox/src/clawpack/geoclaw/src/2d/shallow/multilayer/stepgrid.f:34:10:

   34 |       use fixedgrids_module
      |          1
Fatal Error: Cannot open module file 'fixedgrids_module.mod' for reading at (1): No such file or directory

that occurs in both the test and the examples.

@rjleveque
Copy link
Member Author

@mandli: the Makefile was already fixed to include fgout_module instead of fixedgrids_module, but I need to update stepgrid.f to use it properly. Stay tuned.

@rjleveque
Copy link
Member Author

@mandli, please see if this looks ok now.

@mandli mandli merged commit 466573e into clawpack:master Jul 11, 2022
@rjleveque rjleveque deleted the fgout branch July 11, 2022 14:15
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 this pull request may close these issues.

2 participants