Hi yt-users! So I want to calculate the turbulent energy in a stripped tail of gas. This tail is moving with a bulk flow in the z-direction, which varies as a function of z, and is rotating, and v_theta will also likely change as a function of z (and while I am at it, might as well check v_r). So I would like to do something like this: def _Eturb(field,data): vrmean = value I calculate in the code vthetamean = value I calculate in the code vzmean = value I calculate in the code return(pow(data["cyl_RadialVelocity"]-vrmean,2) + pow(data["cyl_TangentialVelocity"]-vthetamean,2) + pow(data["z-velocity"]-vzmean,2)) add_field("Eturb",function=_Eturb,units="velocityunits") totalEturb = np.zeros(100,float) pf = load("id0/rps."+outstring[i]+" .vtk",parameters={"TimeUnits":9.78262,"LengthUnits":26.,"DensityUnits":9.999e-30,"VelocityUnits":2.6e8}) alld = pf.h.all_data() i = 0 while i < 100: disk = pf.h.disk([0.0,0.0,i*0.385/2.],[0.0,0.0,1.0],1.0,0.385) vrmean = disk.quantities["WeightedAverageQuantity"]("cyl_RadialVelocity","Ones") vthetamean = disk.quantities["WeightedAverageQuantity"]("cyl_TangentialVelocity","Ones") vzmean = disk.quantities["WeightedAverageQuantity"]("z-velocity","Ones") totalEturb[i] = disk.quantities["TotalQuantity"]["Eturb"] i = i+1 I am not sure if/how I can make the def statement read in vrmean, vthetamean, and vzmean? Thanks! Stephanie
participants (2)
-
David Collins
-
Stephanie Tonnesen