Hello,
I’m new to yt so this maybe solved easily, though it puzzled me for quite some time and I still don’t understand what is going on.
I try to create derived fields to analyze a simulation using AMR, from an output from CHOMBO. I define the following derived fields:
def _VRA(field,data):
return data['Cylsin']*data['Vx2']
def _VRB(field,data):
return data['Cylcos']*data['Vx1']
def _VVR(field,data):
return data['VRA']+data['VRB']
Then I add them to my yt object:
ds=yt.load(file)
ds.index
ds.add_field(('chombo','VRA'),function=_VRA,units='cm/s',take_log=False)
ds.add_field(('chombo','VRB'),function=_VRB,units='cm/s',take_log=False)
ds.add_field(('chombo','VVR'),function=_VVR,units='cm/s',take_log=False)
and everything goes on smoothly (they are the only variables named this way). Now, If I try to slice VRA and VRB I obtain the (correct) attached plots. Both VRA and VRB are strictly positive. If I try to slice VVR which is the sum VRA+VRB, I obtained the third attached plot which does not correspond to the expected sum (there are even negative values)! I suspect something went odd in the slice function, but I used the exact same lines of code to generate the three plots.
I must be missing something here but I really don’t get it. Many thanks in advance for your help!
Antoine
Antoine STRUGAREK
-------------------------------------------------------------------
Webpage
Département de physique, Université de Montréal
strugarek(a)astro.umontreal.ca
(+1) 514 343 7077
--------------------------------------------------------------------
DSM/IRFU/SAp/LDEE CEA Saclay
DSM/IRFM/SCCP CEA Cadarache
antoine.strugarek(a)cea.fr
--------------------------------------------------------------------