[yt-users] yt for RAMSES
Nicolas Gillet
nicolas.gillet at etu.unistra.fr
Thu Jan 14 06:03:30 PST 2016
Hello,
I am Nicolas, I am a new YT user. I am working on RAMSES simulations.
- First I have noted a "bug" (or misunderstand) in the yt.load of RAMSES
data.
It takes all the times of the output as 'code_units' times, which is not
the case.
The output times are negative and I think it needs a FLRW integration to
be converted in conventional time.
Using directly the 'code_units_time' to convert in cgs time is wrong.
So all the times are false in the loaded yt data, simulation time,
particles ages ....
- My second question is link to the first point. With ramses there is a
tool (getstarlist.f90) that extract only the stars in a .txt file, with
the ages in Myr with the proper conversion.
My idea is to load those new data in yt, and creat a new field for
particles, with this correct ages.
With the example I creat a filter to isolate the stars from 'all'
particles, and it apear in the derived_field_list.
But I do not find a way to creat a new field for this filtered particles
and even for the 'all' particles.
I would like to have the possibility to have a field ad['star',
'my_own_ages'] or ad['all', 'my_own_ages'].
What I have done:
### isolate star particles
def _star(pfilter, data):
filter = data['all', 'particle_age'] < 0
return filter
add_particle_filter('star', function=_star, filtered_type='all',
requires=['particle_age','particle_identifier'])
ds.add_particle_filter('star')
### stars are correctly created ok
### create a global star_age field, not linked to 'all' or 'star'
def _star_age(field, data):
T = data['particle_age'].in_units('Myr') * 0.
selec_stars = np.where(data['particle_age'] < 0)[0]
T[selec_stars] = Stars[5,:] * yt.units.Myr
return T
ds.add_field('star_age', function=_star_age, units='Myr')
What I try:
def _star_age2(field, data):
T = data['all','particle_age'].in_units('Myr') * 0.
selec_stars = np.where(data['all','particle_age'] < 0) [0]
T[selec_stars] = Stars[5,:] * yt.units.Myr
return T
ds.add_field(('all','star_age2'), function=_star_age2, units='Myr')
### ('all','star_age2') appear in the derived_field_list but
ad['all','star_age2'] => YTFieldTypeNotFound: Could not find field 'all'
Thank you for your help,
Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160114/2fbc2b3c/attachment.htm>
-------------- 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