yt-project / yt

Main yt repository
http://yt-project.org
Other
460 stars 276 forks source link

RADMC-3D with RAMSES #1472

Open cphyc opened 7 years ago

cphyc commented 7 years ago

Bug report

When trying to export to RADMC-3D RAMSES dataset, an error is raised saying that RAMSESIndex has no grids.

Code for reproduction

dust_to_gas = 0.01
def _DustDensity(field, data):
    return dust_to_gas*data["density"]
yt.add_field("DustDensity", function=_DustDensity)

ds = yt.load('output_00001/info_00001.txt')
writer = RadMC3DWriter(ds)
writer.write_amr_grid()
writer.write_dust_file("DustDensity", "dust_density.inp")

Actual outcome

/…/.virtualenvs/astro/lib/python3.6/site-packages/yt-3.4.dev0-py3.6-linux-x86_64.egg/yt/fields/local_fields.py:46: UserWarning: Because 'sampling_type' not specified, yt will assume a cell 'sampling_type'
  warnings.warn("Because 'sampling_type' not specified, yt will "

yt : [INFO     ] 2017-06-29 14:21:33,759 Parameters: current_time              = 0.0
yt : [INFO     ] 2017-06-29 14:21:33,760 Parameters: domain_dimensions         = [32 32 32]
yt : [INFO     ] 2017-06-29 14:21:33,761 Parameters: domain_left_edge          = [ 0.  0.  0.]
yt : [INFO     ] 2017-06-29 14:21:33,762 Parameters: domain_right_edge         = [ 1.  1.  1.]
yt : [INFO     ] 2017-06-29 14:21:33,763 Parameters: cosmological_simulation   = 0
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-64-85b7f4c1c783> in <module>()
----> 1 writer = RadMC3DWriter(ds)
      2 writer.write_amr_grid()
      3 writer.write_dust_file("DustDensity", "dust_density.inp")

~/.virtualenvs/astro/lib/python3.6/site-packages/yt-3.4.dev0-py3.6-linux-x86_64.egg/yt/analysis_modules/radmc3d_export/RadMC3DInterface.py in __init__(self, ds, max_level)
    146         self.cell_count += np.product(ds.domain_dimensions)
    147 
--> 148         sorted_grids = sorted(ds.index.grids, key=lambda x: x.Level)
    149         for grid in sorted_grids:
    150             if grid.Level <= self.max_level:

AttributeError: 'RAMSESIndex' object has no attribute 'grids'

Version Information

ngoldbaum commented 7 years ago

@cphyc yeah right now the radmc3d exporter only works for block AMR data. A long time ago @atmyers opened a pull request to add support for octree data but it never went anywhere: https://bitbucket.org/yt_analysis/yt/pull-requests/1688/wip-adding-support-for-octree-style-output/diff. Maybe that pull request could be resurrected?

cphyc commented 7 years ago

Would it be possible to re-import the PR onto github so that people can work on it?

ngoldbaum commented 7 years ago

Yes, you can do it yourself using hg-git. If you look on the dev mailing list archives Matt posted instructions on how to export pull requests during the transition to git.

asoulain commented 5 years ago

Hi, I ask here if the problem is still unresolved? I don't know if it's possible to contact someone to discuss of this issue, but no doubt that this problem need to be resolved and shared will all RAMSES users.

ngoldbaum commented 5 years ago

As far as I know this is still an issue. The best place to start is probably to resurrect the old bitbucket pull request I linked to earlier.