Hello Turhan,I am not sure but I think this will work, you can try this...ds = yt.load("data_file_Name")grad = ds.add_gradient_fields(("gas","gravitational_potential"))grad list will have a list of new field names which representing the 3 different components of the field and the magnitude of the gradient , e.g., "gravitational_potential_gradient_x" , "gravitational_potential_gradient_y" , "gravitational_potential_gradient_z" and "gravitational_potential_gradient_magnitude"Now for getting the negative gradient of gravitational potential we can derive field as follows:####...x-component of negative of gradient of gravitational potential...def _GradientX(field, data)Gx = -1.0*data["gravitational_potential_gradient_x"]return Gxyt.add_field("Gx", function=_GradientX, take_log=False, units="code length/ code time**2")####...y-component of negative of gradient of gravitational potential...def _GradientY(field, data)Gy = -1.0*data["gravitational_potential_gradient_y"]return Gxyt.add_field("Gy", function=_GradientY, take_log=False, units="code length/ code time**2")####...z-component of negative of gradient of gravitational potential...def _GradientZ(field, data)Gz = -1.0*data["gravitational_potential_gradient_z"]return Gzyt.add_field("Gz", function=_GradientZ, take_log=False, units="code length/ code time**2")Otherwise you can do this also,grad = -1.0*ds.add_gradient_fields(("gas","gravitational_potential"))
I think this will work but this will also make the magnitude negative. But if you want to use only 3-components then this works and you can access it , e.g., data["gravitational_potential_gradient_x"] and similar for y and z component.Please let me know if this work.RegardsPrateek Gupta
_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org