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

Gauge filenames #615

Merged
merged 2 commits into from
May 30, 2024
Merged

Gauge filenames #615

merged 2 commits into from
May 30, 2024

Conversation

rjleveque
Copy link
Member

This addresses #541, creating filenames in the same format as previously if the gauge number has 5 or fewer digits, e.g. gauge00012.txt, but allows up to 15 digits, e.g. gauge123456789.txt.

If this seems ok, I'll do the same thing in amrclaw.

Note that gauges are still read in fine for plotting regardless of the number of digits, with no changes needed in pyclaw.gauges.GaugeSolution.

Note that this is implemented via these two lines (where numstr is a character variable):

write (numstr,'(I0.5)') num
gauges(i)%file_name = 'gauge'//trim(numstr)//'.txt'

This is a much cleaner way to do it than the old way of starting with gaugexxxxx.txt and changing one character at a time!

We should eventually make this change also in creating filenames like fort.t0001, in valout.f90, both for cleaner code and greater flexibility if the user needs more digits than we originally planned for.

rjleveque added 2 commits May 29, 2024 17:41
If fewer than 5 digits, still add zero padding e.g. gauge00012.txt
but no longer throws an error for large gauge numbers, e.g. gauge1234567.txt
@mandli
Copy link
Member

mandli commented May 30, 2024

Works for the examples I tested.

@mandli mandli merged commit b975fef into clawpack:master May 30, 2024
1 check failed
@rjleveque
Copy link
Member Author

rjleveque commented May 30, 2024

Thanks @mandli.

In further testing I realized that the maximum gauge number is still limited by the fact that this is read in and stored as a 4-byte integer, so not larger than 2147483647. But at least it now allows any 9-digit or shorter gaugeno.

rjleveque added a commit to rjleveque/amrclaw that referenced this pull request May 30, 2024
@mandli
Copy link
Member

mandli commented May 30, 2024

I noticed that but I figured we can work out the warning/error message when added to AMRClaw where the Python data stuff is handled.

@rjleveque
Copy link
Member Author

Good idea, I'll modify the amrclaw PR I just did...

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