Comments (7)
This is still true for most data, correct? What would need to be done to extend output to double precision? I could use this capability for some linear wave tests that I am currently running.
from athena.
For a quick hack, just changing H5T_IEEE_F32BE
to H5T_IEEE_F64BE
should do the trick, especially in the line beginning datasets_celldata[n]
. (The Python reader actually creates double precision arrays in any case, which it probably shouldn't do.) I'll work on smoothly doing this with a configure option. For small but precise tests, another workaround is to use the tab format with format specifier %24.16e
.
from athena.
- The
dtype
option ofathdf()
is defunct; should it be removed from the wiki, or will it be added soon? - After changing
H5T_IEEE_F32BE
toH5T_IEEE_F64BE
in theH5Dcreate()
calls, the resulting dataset type still appears as a 4-byte float in viewers such as HDFCompass. ShouldH5T_NATIVE_FLOAT
also be replaced withH5T_NATIVE_DOUBLE
in theH5Dwrite()
calls, @c-white?
from athena.
Also, the suggested quick hack for outputs/athena_hdf5.cpp
doesn't seem to produce the correct values to double precision when imported into Python with the athdf()
function.
E.g., the Orszag-Tang test's initial uniform density profile only agrees to 8 digits with the values I am observing internally in the code and from tab format output generated with a 16 digit format specifier.
from athena.
-
dtype
is working in the development branch. Are you using the public version? -
Changing the format in
H5Dcreate()
calls changes how the file is written, no matter what else is happening. I'm not familiar with HDFCompass, but in Python you can checkimport h5py with h5py.File('output.athdf', 'r') as f: print(f['prim'].dtype)
This should give
>f4
or>f8
for single or double precision. -
You are right that the
H5Dwrite()
calls need to be updated, but not because they specify how the data is to look in the written file, confusingly. That second argument specifies the format of the data in memory (pointed to by the last argument). In particular, one must also change the declaration ofdata_buffers
(and the corresponding coordinate buffers if one desires) fromfloat
todouble
. The unaltered code copies the doubles into float arrays (the copy is done anyway to make the active zone contiguous in memory), and it is these that are written to file. This explains why the values were only agreeing to single precision.
from athena.
The original issue here ended up being due to yt's anti-aliasing causing graphical artifacts. But I believe that the discrepancy between HDF5 files and internal code representation was still there. Also, I recommend against using HDFCompass.
I am going to close this, but I believe we still should update the H5Dwrite()
calls, so I will mark it wontfix
.
from athena.
Ok, I actually need this functionality right now, so I reopened the issue.
Do we want a user switch for switching between:
H5T_NATIVE_FLOAT
-->H5T_NATIVE_DOUBLE
H5T_IEEE_F32BE
-->H5T_IEEE_F64BE
data_buffers
allocation to doubles
and how should it be implemented? Runtime or configure-time option?
I thought about using the existing typedef float Real;
functionality, but I assume users may want to toggle the output precision independently of the solver's precision. Although it wouldnt make sense to write out double precision values if the solver is single precision.... should those settings be mutually exclusive?
I think I will go ahead with duplicating that configure-time functionality with a new H5Real
type for now.
from athena.
Related Issues (20)
- Fix convergence errors on AWS EC2 Graviton instances HOT 5
- Reduce cost of 4th order hydro EOS and flux calculations HOT 1
- Resurrect Princeton Jenkins server HOT 7
- Convert Travis CI jobs into GitHub Actions
- Fix unsafe SIMD in relativistic Riemann solvers HOT 2
- Is this pdata->pnext supposed to be pnew->pnext here?
- Merge GR radiation transport
- Remove unused DEBUG macro HOT 4
- Use a uniform convention for boundary condition input parameters HOT 4
- Errors of linear Alfven wave for RK3+PPM (xorder=3) are much smaller than those in Athena++ paper
- Leftovers from merge non-relativistic radiation transport: add more output switches, derive IMRadTaskList, etc. HOT 7
- Timestep is incorrect for some GR metrics HOT 4
- Leftover chemistry fixes HOT 2
- Inconsistency in documentation of user-defined source terms? HOT 5
- Remove extraneous DeleteAthenaArray() calls HOT 3
- Access ParameterInput instance from user boundary conditions HOT 2
- Array indexing errors in llf_mhd_rel_no_transform.cpp HOT 2
- Leftover cosmic ray transport and diffusion changes HOT 1
- MHD shearing box has artifacts with SMR HOT 3
- athena_read allocates unnecessarily large amount of memory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from athena.