<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Hi Junhwan,<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 19, 2016 at 12:43 PM, Junhwan Choi (최준환) <span dir="ltr"><<a href="mailto:choi.junhwan@gmail.com" target="_blank">choi.junhwan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi yt user,<br>
<br>
I make a simple DM and gas density profile for my enzo simulation with<br>
following script:<br>
======================<br>
import matplotlib as matplotlib<br>
matplotlib.use('Agg')<br>
import yt<br>
import yt.units as units<br>
import numpy as np<br>
import matplotlib.pyplot as plt<br>
<br>
def _radiuspc(field, data):<br>
    return data[('radius')].in_units('pc')<br>
yt.add_field('radiuspc', function=_radiuspc, units="pc")<br>
<br>
Nbin= 100<br>
rmax = 4000<br>
index = 60<br>
ds = yt.load("../DD%04d/DD%04d" % (index,index))<br>
ds.index<br>
ad= ds.all_data()<br>
<br>
center = ds.find_max(("gas", "density"))[1]<br>
my_sphere = ds.sphere(center, rmax*units.pc)<br>
<br>
rmin = max([1.0e-4,2.0*ds.index.get_smallest_dx().in_units('pc')])<br>
profile = yt.Profile1D(my_sphere, 'radiuspc', Nbin, x_min=rmin,<br>
x_max=rmax, x_log=True, weight_field='cell_volume')<br>
profile.add_fields(('gas','density'))<br>
profile.add_fields(('gas','dark_matter_density'))<br>
profile.add_fields(('deposit','all_density'))<br>
<br>
plt.plot(np.log10(profile.x), np.log10(profile[('gas','density')]),<br>
label="('gas','density')", linestyle="-", color='g')<br>
plt.plot(np.log10(profile.x),<br>
np.log10(profile[('gas','dark_matter_density')]),<br>
label="('gas','dark_matter_density')", linestyle="-", color='r')<br>
plt.plot(np.log10(profile.x),<br>
np.log10(profile[('deposit','all_density')]),<br>
label="('deposit','all_density')", linestyle="-", color='b')<br>
<br>
plt.legend(loc=0,prop={'size':9})<br>
plt.savefig('DMTest')<br>
======================<br>
<br>
The only particle in the simulation is the dark matter so that<br>
profile[('gas','dark_matter_density')] and<br>
profile[('deposit','all_density')] should be same.<br>
However, as shown in the attached figure, they are very different.<br>
I would like to ask a few questions regarding to this plot.<br>
1) Why do profile[('gas','dark_matter_density')] and</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
profile[('deposit','all_density')] show significant difference?<br></blockquote><div><br></div><div>I can't say for sure, but note that in many areas they do agree.  They're generated differently; one comes from Enzo, one from yt.  Where they disagree, I would suspect there is lacking data.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) What limit the minimum r in profile[('deposit','all_density')]?<br></blockquote><div><br></div><div>Probably the grid size, or the cell size at which there're particles.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
3) If I would like to make total density profile, what do I do?<br>
    I think that profile[('deposit','all_density')] is more liable result.<br>
    Can I add data[('gas','density')] and<br>
data[('deposit','all_density')], two different field types, in the<br>
derived field?<br></blockquote><div><br></div><div>Yes, those two can be added.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thank you in advance,<br>
Junhwan Choi<br>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.spacepope.org_listinfo.cgi_yt-2Dusers-2Dspacepope.org&d=BQMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=hgcBC3x6dKFoTrmFmMYYbKNfiHZlGLKliIidd1LwmHI&m=7_-nNqJF8Kn8IcA2fL8cWupsoi0Txbvh73zvY6g2Kpo&s=gxHcjYKcCF6UkzxfXdbDA1QWg2hM0WxnJ51gMC2a3c0&e=" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>