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

GaugeSolution.write format? #542

Open
rjleveque opened this issue Jun 4, 2016 · 3 comments
Open

GaugeSolution.write format? #542

rjleveque opened this issue Jun 4, 2016 · 3 comments

Comments

@rjleveque
Copy link
Member

I notice that in src/pyclaw/gauges.py, GaugeSolution.write uses different formatting than the Fortran code, e.g. producing

# gauge_id= 1 location=( 0.6 0.6 ) num_eqn= 1
# Columns: level time q(1 ... num_eqn)
2 0.0 -0.006115505
2 0.008 -0.006969357
2 0.016 -0.0079234

instead of the Fortran output:

# gauge_id=     1 location=(   0.6000000E+00   0.6000000E+00 ) num_eqn=  1
# Columns: level time q(1 ... num_eqn)
    2  0.0000000E+00 -0.6115505E-02
    2  0.8000000E-02 -0.6969357E-02
    2  0.1600000E-01 -0.7923400E-02

The Python version would potentially print more significant figures although maybe not all since %s formatting is used, e.g.

"%s" % pi

produces '3.14159265359'.

Should we use the same format in both cases? Are the 7 digits we print from Fortran always enough?

@mandli
Copy link
Member

mandli commented Jun 4, 2016

I would favor them being identical but also long. We should probably explicitly format the Python and make the Fortran longer then?

@rjleveque
Copy link
Member Author

Ideally we would make it easy to control how long. Some applications require many gauges over very many time steps and the gauge files can get huge. Ideally we would also support binary gauge output in the Fortran code. Maybe these are enhancements for the future.

For now I'm fine with leaving the pyclaw version alone unless this affects regression tests somehow, but I don't think we are using the write function in the Fortran tests.

@ketch
Copy link
Member

ketch commented Jun 6, 2016

My preferred change would be to make both of them print all the digits, as @mandli suggests.
I'm also okay with just making the pyclaw version match the fortran version for now if that seems substantially easier.

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