[yt-users] DM density profiles

Junhwan Choi (최준환) choi.junhwan at gmail.com
Tue Jan 19 10:43:23 PST 2016


Hi yt user,

I make a simple DM and gas density profile for my enzo simulation with
following script:
======================
import matplotlib as matplotlib
matplotlib.use('Agg')
import yt
import yt.units as units
import numpy as np
import matplotlib.pyplot as plt

def _radiuspc(field, data):
    return data[('radius')].in_units('pc')
yt.add_field('radiuspc', function=_radiuspc, units="pc")

Nbin= 100
rmax = 4000
index = 60
ds = yt.load("../DD%04d/DD%04d" % (index,index))
ds.index
ad= ds.all_data()

center = ds.find_max(("gas", "density"))[1]
my_sphere = ds.sphere(center, rmax*units.pc)

rmin = max([1.0e-4,2.0*ds.index.get_smallest_dx().in_units('pc')])
profile = yt.Profile1D(my_sphere, 'radiuspc', Nbin, x_min=rmin,
x_max=rmax, x_log=True, weight_field='cell_volume')
profile.add_fields(('gas','density'))
profile.add_fields(('gas','dark_matter_density'))
profile.add_fields(('deposit','all_density'))

plt.plot(np.log10(profile.x), np.log10(profile[('gas','density')]),
label="('gas','density')", linestyle="-", color='g')
plt.plot(np.log10(profile.x),
np.log10(profile[('gas','dark_matter_density')]),
label="('gas','dark_matter_density')", linestyle="-", color='r')
plt.plot(np.log10(profile.x),
np.log10(profile[('deposit','all_density')]),
label="('deposit','all_density')", linestyle="-", color='b')

plt.legend(loc=0,prop={'size':9})
plt.savefig('DMTest')
======================

The only particle in the simulation is the dark matter so that
profile[('gas','dark_matter_density')] and
profile[('deposit','all_density')] should be same.
However, as shown in the attached figure, they are very different.
I would like to ask a few questions regarding to this plot.
1) Why do profile[('gas','dark_matter_density')] and
profile[('deposit','all_density')] show significant difference?
2) What limit the minimum r in profile[('deposit','all_density')]?
3) If I would like to make total density profile, what do I do?
    I think that profile[('deposit','all_density')] is more liable result.
    Can I add data[('gas','density')] and
data[('deposit','all_density')], two different field types, in the
derived field?

Thank you in advance,
Junhwan Choi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DMTest.png
Type: image/png
Size: 37260 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160119/29fa9a79/attachment.png>
-------------- next part --------------
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


More information about the yt-users mailing list