[yt-users] DM density profiles

Junhwan Choi (최준환) choi.junhwan at gmail.com
Wed Jan 20 10:23:49 PST 2016


Please read below after you comments:

On Tue, Jan 19, 2016 at 2:25 PM, Matthew Turk <matthewturk at gmail.com> wrote:
> Hi Junhwan,
>
> On Tue, Jan 19, 2016 at 12:43 PM, Junhwan Choi (최준환)
> <choi.junhwan at gmail.com> wrote:
>>
>> 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?
>
>
> 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.
>
>>
>> 2) What limit the minimum r in profile[('deposit','all_density')]?
>
>
> Probably the grid size, or the cell size at which there're particles.
>
Is there any document to control the deposit fields?
There are 2+1 issues maybe regarding the deposit fields:
1) "rmin" in the figure for profile[('deposit','all_density')],
smallest r with non-zero profile[('deposit','all_density')],
is 100 times larger than smallest grid-size for the particle force
resolution and several order larger than minimum
AMR of the output (see gas density profile). It looks like there is a
parameter control the rmin of the profile[('deposit','all_density')].
2) When I try to make the same profile with output which maximum ARM
is high, the script crash with memory error.
For test I change ('deposit','all_density') to
('gas','dark_matter_density'), the code work fine, with incorrect
value.
I would like to get rid of this memory error. To do so, I need
understand how deposit field work.
3) Is there any accumulation method when I use yt.Profile1D?


>>
>> 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?
>
>
> Yes, those two can be added.
>
Thank you, it works!!!

>>
>>
>> Thank you in advance,
>> Junhwan Choi
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
_______________________________________________
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