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

Unexpected stars´angular momentum after defining the normal parameter #5029

Open
V-Nathir opened this issue Oct 23, 2024 · 1 comment
Open

Comments

@V-Nathir
Copy link
Contributor

Bug report

Bug summary

I am using the following version: VersionTuple(major=4, minor=4, micro=0, releaselevel='alpha', serial=0) for RAMSES.

When I create a YTSphere, setting a new normal parameter set_field_parameter('normal', J), the computed angular momentum quantities.angular_momentum_vector() using only star particles differs significantly if I do not define a new normal parameter. This is not the case if I repeat the process using gas. The angular momentum by gas is the same if the normal parameter is redefine or not.

It looks like the system of reference is different for stars than gas after a new definition of the normal direction of the sphere.

Code for reproduction

sp = data.sphere(center = CM_, radius = r200*0.2);  
sp.set_field_parameter('center', CM_)
sp.set_field_parameter('radius', r200*0.2)
sp.set_field_parameter('bulk_velocity',sp_core.quantities.bulk_velocity(use_gas = True, use_particles = True , particle_type ="star" ))

# J_norm = np.array([1, 0, 0])
sp.set_field_parameter('normal', J_norm)

j_star = sp.quantities.angular_momentum_vector(use_gas=False, use_particles=True, particle_type="star").to("kpc * km/s")
j_gas= sp.quantities.angular_momentum_vector(use_gas=True, use_particles=False, particle_type="star").to("kpc * km/s")

Actual outcome

#Output setting the normal parameter
Angular Momentum by:
Stars:  [0.02387764 0.2226668  0.97460215] km*kpc/s
Gas:  [-0.51331007 -0.71361703 -0.47672163] km*kpc/s

Expected outcome

# Output without setting the normal parameter
Angular Momentum by:
Stars:  [-0.35564213 -0.8186425  -0.45093584] km*kpc/s
Gas:  [-0.51331007 -0.71361703 -0.47672163] km*kpc/s

The vector (angular momentum) given by gas remains the same but the one given by stars is completely shifted.

Version Information

  • Operating System: Linux
  • Python Version: 3.11.5
  • yt version: 4.4.0
  • Other Libraries (if applicable):
@chrishavlin
Copy link
Contributor

Hi @V-Nathir ! One quick idea: this looks related to #4872 which was merged to main back in April. If you're seeing this behavior in an environment you set up before April, can you try using the latest version of main? If your install already includes it we'll have to look elsewhere...

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

2 participants