Scaling Code Units to Physical Units while loading the data from HDF5
yt users, I am using FLASH for my simulations and I am working on the Sod problem as my entry point to my research. I have successfully completed simulating the Sod problem using cartesian grids in 3D. My simulation is in code units and I am trying to plot the output in physical units with length in parsecs and density in g/cc. I tried running FLASH with physical units but the values get very small and is not recommended. So, the only logical thing to do here is to somehow do this scaling when reading the data using yt.load(). Below is what I have done so far but the output plot is blank. # Example: define code units data.unit_registry.add('code_length', 3.086e18, dimensions = yt.units.dimensions.length) # 1 parsec data.unit_registry.add('code_mass', 1.989e33, dimensions = yt.units.dimensions.mass) # 1 solar mass data.unit_registry.add('code_time', 3.154e7, dimensions = yt.units.dimensions.time) # 1 year # Derived unit: velocity data.unit_registry.add('code_velocity', 1e5, dimensions = yt.units.dimensions.velocity) # 1 km/s # Extract the data in physical units data_physical = data.all_data() # Convert the physical quantities from code units to physical units density_cgs = data_physical["gas", "density"].to("g/cm**3") velocity_kms = data_physical["gas", "velocity_magnitude"].to("km/s") position_pc = data_physical["index", "x"].to("pc") # Plot the data yt.SlicePlot(data, "z", ("gas", "density"), center="c", width=(10, "pc")).show() Can you please help me converting the units from code units to physical units using yt? Clear Skies, Sam
participants (1)
-
Sumit Banerjee