<div dir="ltr">Hi Junhwan,<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 20, 2016 at 12:23 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">Please read below after you comments:<br>
<div><div class="h5"><br>
On Tue, Jan 19, 2016 at 2:25 PM, Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>> wrote:<br>
> Hi Junhwan,<br>
><br>
> On Tue, Jan 19, 2016 at 12:43 PM, Junhwan Choi (최준환)<br>
> <<a href="mailto:choi.junhwan@gmail.com">choi.junhwan@gmail.com</a>> wrote:<br>
>><br>
>> 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<br>
>><br>
>> profile[('deposit','all_density')] show significant difference?<br>
><br>
><br>
> I can't say for sure, but note that in many areas they do agree.  They're<br>
> generated differently; one comes from Enzo, one from yt.  Where they<br>
> disagree, I would suspect there is lacking data.<br>
><br>
>><br>
>> 2) What limit the minimum r in profile[('deposit','all_density')]?<br>
><br>
><br>
> Probably the grid size, or the cell size at which there're particles.<br>
><br>
</div></div>Is there any document to control the deposit fields?<br>
There are 2+1 issues maybe regarding the deposit fields:<br>
1) "rmin" in the figure for profile[('deposit','all_density')],<br>
smallest r with non-zero profile[('deposit','all_density')],<br>
is 100 times larger than smallest grid-size for the particle force<br>
resolution and several order larger than minimum<br>
AMR of the output (see gas density profile). It looks like there is a<br>
parameter control the rmin of the profile[('deposit','all_density')].<br></blockquote><div><br></div><div>Yes, this sounds likely.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) When I try to make the same profile with output which maximum ARM<br>
is high, the script crash with memory error.<br></blockquote><div><br></div><div>This shouldn't happen.  I don't know why.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
For test I change ('deposit','all_density') to<br>
('gas','dark_matter_density'), the code work fine, with incorrect<br>
value.<br>
I would like to get rid of this memory error. To do so, I need<br>
understand how deposit field work.<br></blockquote><div><br></div><div>For grids, it's quite simple -- the particles simply get deposited into empty grids.  It shouldn't take any more memory than if you're depositing gas.  What happens if you try to deposit a *bunch* of grid fields?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
3) Is there any accumulation method when I use yt.Profile1D?<br>
<span class=""><br></span></blockquote><div><br></div><div>No, you have to manually do that, I believe.  I thought we added the ability to do that in the constructor but I don't see it now.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
>><br>
>> 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>
><br>
><br>
> Yes, those two can be added.<br>
><br>
</span>Thank you, it works!!!<br>
<div class="HOEnZb"><div class="h5"><br>
>><br>
>><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="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
>><br>
><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="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><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="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</div></div></blockquote></div><br></div></div>