I want a slice plot of pressure(x, y, z = 0, t) - pressure(x, y, z = 0, t = 0). I tried using a derived field as follows:
---- # Load the initial dataset ds0 = yt.load('my t=0 dataset') p0 = initialPressure = ds0.all_data()['pressure']
# Define the derived field def _perturbationPressure(field, data): return data['pressure'] - initialPressure
# Add the derived field yt.add_field(('gas', 'perturbationPressure'), function=_perturbationPressure, units = "auto", dimensions = yt.units.dimensions.pressure)
# Load the dataset of interest ds = yt.load('my dataset') yt.SlicePlot(ds, 'z', 'perturbationPressure') ----
ValueError: operands could not be broadcast together with shapes (16,16,16) (134217728,)
I noticed the "data" in the definition of the derived field is a FieldDetector, so I'm not sure how I should define the derived field to plot the pressure difference (if using a derived field is the right approach at all!). The dataset I'm trying to plot is from FLASH, and I'm running yt 3.6.0. Thanks!