yt-project / yt

Main yt repository
http://yt-project.org
Other
467 stars 277 forks source link

Fields should be invalidated upon change in field_parameter they are depending on #983

Open yt-fido opened 9 years ago

yt-fido commented 9 years ago

Originally reported by: Benjamin Thompson (Bitbucket: cosmosquark, GitHub: cosmosquark)


Hello.

I am unable to apply the bulk velocity to any of the

This code snippit uses the RAMSES data sample from http://yt-project.org/data/output_00101.tar.gz

#!python

import yt

snap = yt.load("output_00101/info_00101.txt")
sphere = snap.sphere([0.5,0.5,0.5],0.2)

print "before computing bulk velocity"
print "particle radius velocity"
print sphere["particle_velocity_spherical_radius"]
print "particle velocity"
print sphere["particle_velocity"]
print "computing bulk velocity"

bv = sphere.quantities.bulk_velocity(use_gas=False, use_particles=True)
sphere.set_field_parameter("bulk_velocity", bv)
print sphere.get_field_parameter("bulk_velocity")

print "this is the bulk velocity"
print bv.in_units("cm/s")

print "after computing bulk velocity"
print "particle radius velocity"
print sphere["particle_velocity_spherical_radius"]
print "particle velocity"
print sphere["particle_velocity"]

~                                         

returns

#!python

before computing bulk velocity

particle radius velocity

[-4904001.04478042 -4850145.59562514 -5245200.82227371 ...,
 -5308002.16118477 -3474150.43461513 -2560989.26448071] cm/s
particle velocity

[[  375143.87142169  4449624.46653107 -5939392.73122383]
 [  693342.05441321  4867673.65578726 -6069314.31980608]
 [ -546256.2416473   3099174.82697246 -5789393.45967595]
 ..., 
 [-2263824.46491509  5770892.05101378 -5026856.53298975]
 [-1444468.64358441  3118951.75012212 -3210344.90141574]
 [   98723.4967001   4930414.62757032 -3058135.04183148]] cm/s

computing bulk velocity

[-3685465.39929448  6064592.07936983 -4474664.90077166] cm/s

this is the bulk velocity

[-3685465.39929448  6064592.07936983 -4474664.90077166] cm/s

after computing bulk velocity

particle radius velocity

[-4904001.04478042 -4850145.59562514 -5245200.82227371 ...,
 -5308002.16118477 -3474150.43461513 -2560989.26448071] cm/s

particle velocity

[[  375143.87142169  4449624.46653107 -5939392.73122383]
 [  693342.05441321  4867673.65578726 -6069314.31980608]
 [ -546256.2416473   3099174.82697246 -5789393.45967595]
 ..., 
 [-2263824.46491509  5770892.05101378 -5026856.53298975]
 [-1444468.64358441  3118951.75012212 -3210344.90141574]
 [   98723.4967001   4930414.62757032 -3058135.04183148]] cm/s

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


This is still an issue, but it will be difficult to fix this, so I'm punting to 3.4. If anyone feels like taking this on for 3.3, they should feel free.

yt-fido commented 9 years ago

Original comment by Benjamin Thompson (Bitbucket: cosmosquark, GitHub: cosmosquark):


So it looks like it is setting the parameter fine, but not applying the parameter to the fields (e.g it's not included in the computation of the velocity or angular momentum)