Dear yt people,
I am working on a tipsy output file from a n-body simulation. My file
contains some scaled units for fields like density, coordinates, mass etc.
To make a physical sense of the data, I had to convert those fields units
to some physical units (c.g.s) and I derived new fields having cgs unit.
for example:
*dd = ds.all_data()# derive a new domain width with conversion factor
(6Mpc*current_time/hubble_constant) def _NewDomainWidth(field, data):
return
ds.domain_width*((3.086e18*6e6*0.909090893796)/(0.7))ds.add_field(('gas',
'PhysicalDomainWidth'), function=_NewDomainWidth, units="code_length")*
*# derive a new domain center with conversion factor
(6Mpc*current_time/hubble_constant) def _NewDomainCenter(field, data):
return
ds.domain_center*((3.086e18*6e6*0.909090893796)/(0.7))ds.add_field(('gas',
'PhysicalDomainCenter'), function=_NewDomainCenter, units="code_length")*
note that here "code_length" is actually in "cm". but I could not just do
dd["Gas",'Coordinates'].in_units('cm'), because this conversion does not
take into account some constant corrections and returns the wrong length
magnitude.
My goal was to make sliceplot and projectionplot of a newly derived field :
*# derive a new electron pressure fielddef _ElectronPressure(field,
data): return
data['Gas','Density']*(5.49e-7)*data['Gas','Temperature']ds.add_field(('gas',
'ElectronPressure'), function=_ElectronPressure,
units="(code_mass*K)/(code_length**3)")*
*# integration of pressure field along line of sight*
*yt.ProjectionPlot(ds, 'z', ('gas', 'ElectronPressure'), width = dd['gas',
'PhysicalDomainWidth'], center = dd['gas',
'PhysicalDomainCenter'] )*
*and it is returning me *
ValueError Traceback (most recent call
last)<ipython-input-8-fa351b6c09d1> in <module>() 1
yt.ProjectionPlot(ds, 'z', ('gas', 'ElectronPressure'), width =
dd['gas', 'PhysicalDomainWidth'], ----> 2 center =
dd['gas', 'PhysicalDomainCenter'] )
ValueError: operands could not be broadcast together with shapes
(39678,) (54608,)
Now I cannot use width =ds.domain_width and center = ds.domain_center
for the same unit error. I was wondering how I can make the
projectionplot for my newly derived field and newly derived domain
width and domain center.
Your suggestion is most welcome
Best
Tazkera