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

Ghost zone handling #1

Open
pgrete opened this issue Sep 15, 2021 · 5 comments
Open

Ghost zone handling #1

pgrete opened this issue Sep 15, 2021 · 5 comments

Comments

@pgrete
Copy link
Collaborator

pgrete commented Sep 15, 2021

Bug report

Bug summary

Gradient fields in 2D simulations depend on the extends of the the third dimension.
Example data is a 2D magnetic field loop (density and velocities are uniform, but there's a circular magnetic field configuration in the center of the domain).
2D data with 128x64x1 grid points. They only differ in the defined "z" extends (which, according to my expectation, should not matter in this 2D setup).

Dataset A: http://use.yt/upload/4fd39e12 (z extends going from -0.0078125 to 0.0078125)
Dataset B: http://use.yt/upload/90ac4d9b (z extends going from -1 to 1)

Code for reproduction

import yt
ds = yt.load("/mnt/home/gretephi/src/athenapk/build/parthenon.out0.00000.phdf")
ds.add_gradient_fields("magnetic_field_x")
yt.SlicePlot(ds, "z", "magnetic_field_x_gradient_x")

Actual outcome
(dataset A)

image

# If applicable, paste the console output here
#
#

Expected outcome
(dataset B)

image

Version Information

  • Operating System: CentOS 7.8.2003
  • Python Version: Python 3.8.2
  • yt version: main with parthenon-frontend branch here
  • Other Libraries (if applicable):
@neutrinoceros
Copy link

neutrinoceros commented Sep 15, 2021

I was able to reproduce with the a001930 (second most recent commit of the parthenon-frontend branch) but the latest version fails with the following traceback

Unroll
ReferenceError: weakly-referenced object no longer exists
---------------------------------------------------------------------------
ReferenceError                            Traceback (most recent call last)
~/.pyenv/versions/3.9.7/envs/yt_parthenon/lib/python3.9/site-packages/IPython/core/formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

~/dev/yt-project/yt_parthenon/yt/visualization/plot_container.py in newfunc(*args, **kwargs)
    104             # it is the responsibility of _setup_plots to
    105             # call args[0].run_callbacks()
--> 106             args[0]._setup_plots()
    107         rv = f(*args, **kwargs)
    108         return rv

~/dev/yt-project/yt_parthenon/yt/visualization/plot_window.py in _setup_plots(self)
   1172                 raise YTCannotParseUnitDisplayName(f, colorbar_label, str(err))
   1173 
-> 1174             self.plots[f].cb.set_label(colorbar_label)
   1175 
   1176             # x-y axes minorticks

~/dev/yt-project/yt_parthenon/yt/visualization/plot_container.py in __getitem__(self, item)
    219     def __getitem__(self, item):
    220         return defaultdict.__getitem__(
--> 221             self, self.data_source._determine_fields(item)[0]
    222         )
    223 

~/dev/yt-project/yt_parthenon/yt/data_objects/data_containers.py in _determine_fields(self, fields)
   1427 
   1428     def _determine_fields(self, fields):
-> 1429         if str(fields) in self.ds._determined_fields:
   1430             return self.ds._determined_fields[str(fields)]
   1431         explicit_fields = []

ReferenceError: weakly-referenced object no longer exists

edit: this failure appears to be random, looks like a race condition involving the garbage collector?

@neutrinoceros
Copy link

This is really puzzling. I suspect this may not even be a bug in your frontend, and I want to try to reproduce this with a different, well established frontend (possibly by hacking it so that every datasets look like they have a much thinner dimension), but I'll do that tomorrow.

@neutrinoceros
Copy link

One thing I was able to elucidate is why your example plots have code length in the axis labels even after you changed the default unit system from code to cgs. The answer is because ParthenonDataset._set_code_unit_attributes starts with this

        if "length_unit" not in self.units_override:
            self.no_cgs_equiv_length = True

which forces "code" units unless it is explicitly overiden. This pattern is uncommon enough that I didn't know about it. It's fine that you're using it as long as you understand the repercussions :)

@forrestglines
Copy link
Owner

        if "length_unit" not in self.units_override:
            self.no_cgs_equiv_length = True

I don't know what this code does either, it's a hold over from the Athena++ frontend. Athena++ had no concept of units using code units everywhere, Parthenon (or at least AthenaPK) uses code units internally but allows defining a unit system for the sake of setting constants. I suspect that this parameter in our yt frontend is not desired.

@neutrinoceros
Copy link

I suspect that this parameter in our yt frontend is not desired.

Yes, sounds like you don't need it

pgrete pushed a commit that referenced this issue Feb 2, 2023
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