Skip to content

Commit

Permalink
Make sure scale names propagate
Browse files Browse the repository at this point in the history
  • Loading branch information
kburns committed Jul 31, 2022
1 parent 8de2b1e commit 7933b46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
8 changes: 4 additions & 4 deletions dedalus/core/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,13 @@ def setup_file(self, file):
# Scales
file.create_group('scales')
file['scales'].create_dataset(name='constant', data=np.zeros(1), dtype=np.float64)
file['scales']['constant'].make_scale()
file['scales']['constant'].make_scale('constant')
for name in ['sim_time', 'timestep', 'world_time', 'wall_time']:
file['scales'].create_dataset(name=name, shape=(0,), maxshape=(self.max_writes,), dtype=np.float64) # shape[0] = 0 to chunk across writes
file['scales'][name].make_scale()
file['scales'][name].make_scale(name)
for name in ['iteration', 'write_number']:
file['scales'].create_dataset(name=name, shape=(0,), maxshape=(self.max_writes,), dtype=int) # shape[0] = 0 to chunk across writes
file['scales'][name].make_scale()
file['scales'][name].make_scale(name)
# Tasks
file.create_group('tasks')
for task in self.tasks:
Expand Down Expand Up @@ -533,7 +533,7 @@ def setup_file(self, file):
lookup = f"{sn}_hash_{scale_hash}"
if lookup not in file['scales']:
file['scales'].create_dataset(name=lookup, data=data)
file['scales'][lookup].make_scale()
file['scales'][lookup].make_scale(sn)
scale = file['scales'][lookup]
dset.dims[1 + rank + axis].label = sn
dset.dims[1 + rank + axis].attach_scale(scale)
Expand Down
28 changes: 9 additions & 19 deletions docs/notebooks/dedalus_tutorial_4.ipynb

Large diffs are not rendered by default.

0 comments on commit 7933b46

Please sign in to comment.