Data loading not compatibel with current default ramses

Issue #11 resolved
Tine Colman created an issue

The files can’t be read due to having different formats. Problems the I ran into so far:

  1. The sink csv file has a 2-line header which is not handled.
  2. hydro_file_descriptor doesn’t have nvar in the beginning.

Comments (23)

  1. Neil Vaytet repo owner

    I'll take a look at loading files from the default ramses as soon as I get the chance. I apologise for this, but it has not been tested extensively on different versions of Ramses.

    I do see that it should however work, at least, with the default version of Ramses.

    Thanks for reporting this

  2. Neil Vaytet repo owner

    Hi again, would you be able to share with me the output file you are trying to read?

    thanks!

  3. Neil Vaytet repo owner

    I’ve made some changes and I can now read the output but I’m getting some strange values inside my data structure, i.e. lots of NaNs.

    This is what i get for the minimum and maximum values of the variables I’m managed to read in, ignoring the NaNs (i ignored the clump files for now). Can you tell me if they look reasonable to you?

    The variables are:
    Name              Type   Group Unit    Min                    Max              
    cpu               scalar amr   [     ] 1.0                    144.0                 
    density           scalar hydro [g/cm3] -2.590814480592104e-19 9.403217825405057e-20 
    dx                scalar amr   [au   ] 12.589485263213746     201.43176421141993    
    dx_part           scalar part  [au   ] 5.8114895568847656e+32 5.8114895568847656e+32
    grav_acceleration vector grav  [cm/s2] 0.0                    0.0                   
    grav_potential    scalar grav  [     ] 0.0                    0.0                   
    leaf              scalar amr   [     ] 1.0                    1.0                   
    level             scalar amr   [     ] 8.0                    12.0                  
    log_m             scalar hydro [Msun ] -13.251771966089663    -5.888175219500674    
    log_r             scalar amr   [au   ] 2.241658588151784      4.6481987685857415    
    log_rho           scalar hydro [g/cm3] -26.390320249938537    -19.026723503349547   
    mass              scalar hydro [Msun ] -2.589355650963699e-06 1.2936737933490275e-06
    part_birth_time   scalar part  [     ] 0.007665897820163144   0.007665897820163144  
    part_family       scalar part  [     ] 3.0                    3.0                   
    part_identity     scalar part  [     ] -1.0                   -1.0                  
    part_levelp       scalar part  [     ] 8.0                    8.0                   
    part_mass         scalar part  [     ] 2.005908491097295e-08  2.005908491097295e-08 
    part_position     vector part  [     ] 44657.926383668935     44657.926383668935    
    part_tag          scalar part  [     ] 0.0                    0.0                   
    part_velocity     vector part  [cm/s ] 247824.19621764988     247824.19621764988    
    pressure          scalar hydro [     ] 0.0                    0.0                   
    r                 scalar amr   [au   ] 174.4450249362059      44483.48135873273     
    velocity          vector hydro [cm/s ] 10228.8857423029       226038493.70295852    
    x                 scalar amr   [au   ] -25758.086848535324    25758.086848535324    
    y                 scalar amr   [au   ] -25732.907878008897    25732.907878008893    
    z                 scalar amr   [au   ] -25732.907878008897    25732.907878008893
    

    The negative density (-2.59e-19) is somewhat strange… I might still have a problem with reading in the values.

  4. Neil Vaytet repo owner

    I can make a map of the AMR level around the sink particle but i’m having problems with the densities…

    The structure of the mesh looks reasonable, which tells me that usually the amr grid and the hydro variables have been read in properly. I will compare with amr2cell to see if there are also negative densities there

  5. Neil Vaytet repo owner

    I think i fixed it but it seems my picture is flipped upside down…

    This is the image

    and this is using contours that make a smoother picture

  6. Neil Vaytet repo owner

    I pushed the fixes and updated the pip package (should now be version 1.0.3). You might need to update your pip package if you installed osyris that way before.

    Could you give it a go and tell me if it works for you? This is the script I used to make the figure above:

    import osyris
    
    out14 = osyris.RamsesData(14, scale="pc", center="sink:1", verbose=True)
    
    # for the filled countours
    osyris.plot_slice(mydata.log_rho, direction="z", dx=0.02, resolution=512, fname="density_00014_contours.pdf")
    # for the classical image
    osyris.plot_slice(image=mydata.log_rho, direction="z", dx=0.02, resolution=512, interpolation="nearest", fname="density_00014_image.pdf")
    

    You can also leave out the fname argument and plot directly if you are in an interactive ipython console or a jupyter notebook.

  7. Tine Colman reporter

    It’s working, thanks!

    It doesn’t load your tutorial data anymore though. You might want to update that.

  8. Neil Vaytet repo owner

    Hi again, with osyris you can also slice at any orientation, not just along x, y, and z axes. In particular, you can use the average angular momentum vector around sink particles, to show either a disk around your sink (`top` view), or an outflow (`side` view):

    osyris.plot_slice(mydata.log_rho, direction="auto:top", dx=0.02, resolution=512, fname="top.pdf")
    osyris.plot_slice(mydata.log_rho, direction="auto:side", dx=0.02, resolution=512, fname="top.pdf")
    

    See https://osyris.readthedocs.io/en/latest/demos.html#demo-6-automatic-top-slice-orientation-according-to-angular-momentum

  9. Tine Colman reporter

    I know. That’s one of the reasons I wanted to try it out. It appears to be not so trivial in my case though.

    What should I do if I have questions rather than bug reports?

  10. Neil Vaytet repo owner

    Either email me, or I could add you to our slack workspace that I share with people from ENS Lyon & CEA Saclay who work on ramses

  11. Neil Vaytet repo owner

    Hi again, i’m still not entirely convinced the velocity vectors look right. They all seem to be pointing in the same direction, not really pointing towards or away from the sink in a symmetrical way, as is usually the case around sink particles.

  12. Tine Colman reporter

    That’s because the sink is moving. If you substract the sink velocity and plot this relative velocity, it looks more like you would expect.

  13. Tine Colman reporter

    Sending you an email proved to be more difficult than I thought. Could you give me a working email adres? The one on your homepage gave me a delivery error in danish:)

  14. Neil Vaytet repo owner

    oh, sorry i forgot about this.

    Yes my university of Copenhagen email is no longer active because I know work in a different place.

    You can use my personal address: neil.m.vaytet@gmail.com

  15. Neil Vaytet repo owner

    Ah yes indeed:

    mydata = osyris.RamsesData(nout=14, scale="au", center="sink:1", dx=2000, dy=2000, dz=2000)
    mydata.vector_field(name="vel_minus_sink",label="vel_minus_sink",
                        values_x=mydata.velocity.x.values-mydata.sinks["vx"][0]*mydata.info["unit_l"]/mydata.info["unit_t"],
                        values_y=mydata.velocity.y.values-mydata.sinks["vy"][0]*mydata.info["unit_l"]/mydata.info["unit_t"],
                        values_z=mydata.velocity.z.values-mydata.sinks["vz"][0]*mydata.info["unit_l"]/mydata.info["unit_t"])
    osyris.plot_slice(mydata.norm_dens, direction="z", vec=mydata.vel_minus_sink)            
    

  16. Log in to comment