try: plt.style.use("mnras_durham") except: rcParams = { "font.serif": ["STIX", "Times New Roman", "Times"], "font.family": ["serif"], "mathtext.fontset": "stix", "font.size": 8, } plt.rcParams.update(rcParams) # See analyticSolution for params. # Read in the "solution" data and calculate those that don't exist. ref = analytic(time=sim.metadata.time.value) r_shock = ref.pop("r_shock") def get_data_dump(metadata): """ Gets a big data dump from the SWIFT metadata """ try: viscosity = metadata.viscosity_info except: viscosity = "No info" try: diffusion = metadata.diffusion_info
} square_binned = { k: stats.binned_statistic(data["x"], v**2, statistic="mean", bins=x_bin_edge)[0] for k, v in data.items() } sigma = { k: np.sqrt(v2 - v**2) for k, v2, v in zip(binned.keys(), square_binned.values(), binned.values()) } # Read in the "solution" data and calculate those that don't exist. ref, x_values_conv = analytic(time=time, return_x_positions_for_convergence=True) # We only want to plot this for the region that we actually have data for, hence the masking. mask = np.logical_and(ref["x"] < np.max(data["x"]), ref["x"] > np.min(data["x"])) ref = {k: v[mask] for k, v in ref.items()} # Now we can do the plotting. fig, ax = plt.subplots(2, 3, figsize=(6.974, 6.974 * (2.0 / 3.0))) ax = ax.flatten() # These are stored in priority order plot = dict( v="Velocity ($v_x$)", u="Internal Energy ($u$)", rho=r"Density ($\rho$)",
data = [ dict( x=sim.gas.coordinates.value[:, 0], v=sim.gas.velocities.value[:, 0], u=try_read(sim, "internal_energy"), S=try_read(sim, "entropy"), P=try_read(sim, "pressure"), rho=try_read(sim, "density"), y=sim.gas.coordinates.value[:, 1], z=sim.gas.coordinates.value[:, 2], ) for sim in sims ] ref = analytic(sims[0].metadata.time.value) # We only want to plot this for the region that we actually have data for, hence the masking. masks = [ np.logical_and(ref["x"] < np.max(d["x"]), ref["x"] > np.min(d["x"])) for d in data ] refs = [{k: v[mask] for k, v in ref.items()} for mask in masks] # Set up plotting stuff try: plt.style.use("mnras_durham") except: rcParams = { "font.serif": ["STIX", "Times New Roman", "Times"], "font.family": ["serif"],
} square_binned = { k: stats.binned_statistic(data["x"], v**2, statistic="mean", bins=x_bin_edge)[0] for k, v in data.items() } sigma = { k: np.sqrt(v2 - v**2) for k, v2, v in zip(binned.keys(), square_binned.values(), binned.values()) } # Read in the "solution" data and calculate those that don't exist. ref = analytic(time=time) # We only want to plot this for the region that we actually have data for, hence the masking. mask = np.logical_and(ref["x"] < np.max(data["x"]), ref["x"] > np.min(data["x"])) ref = {k: v[mask] for k, v in ref.items()} # Now we can do the plotting. fig, ax = plt.subplots(2, 3, figsize=(6.974, 6.974 * (2.0 / 3.0))) ax = ax.flatten() # These are stored in priority order plot = dict( v_phi="Azimuthal Velocity ($v_phi$)", u="Internal Energy ($u$)", rho=r"Density ($\rho$)",
try: plt.style.use("spheric_durham") except: rcParams = { "font.serif": ["STIX", "Times New Roman", "Times"], "font.family": ["serif"], "mathtext.fontset": "stix", "font.size": 8, } plt.rcParams.update(rcParams) # See analyticSolution for params. # Read in the "solution" data and calculate those that don't exist. ref = analytic() def get_data_dump(metadata): """ Gets a big data dump from the SWIFT metadata """ try: viscosity = metadata.viscosity_info except: viscosity = "No info" try: diffusion = metadata.diffusion_info except: