YTDiskBase.
calculate_isocontour_flux
(field, value, field_x, field_y, field_z, fluxing_field=None)¶This identifies isocontours on a cell-by-cell basis, with no consideration of global connectedness, and calculates the flux over those contours.
This function will conduct marching cubes on all the cells in a given data container (grid-by-grid), and then for each identified triangular segment of an isocontour in a given cell, calculate the gradient (i.e., normal) in the isocontoured field, interpolate the local value of the “fluxing” field, the area of the triangle, and then return:
area * local_flux_value * (n dot v)
Where area, local_value, and the vector v are interpolated at the barycenter (weighted by the vertex values) of the triangle. Note that this specifically allows for the field fluxing across the surface to be different from the field being contoured. If the fluxing_field is not specified, it is assumed to be 1.0 everywhere, and the raw flux with no local-weighting is returned.
Additionally, the returned flux is defined as flux into the surface, not flux out of the surface.
Parameters: | field : string
value : float
field_x : string
field_y : string
field_z : string
fluxing_field : string, optional
|
---|---|
Returns: | flux : float
|
References
[R17] | Marching Cubes: http://en.wikipedia.org/wiki/Marching_cubes |
Examples
This will create a data object, find a nice value in the center, and calculate the metal flux over it.
>>> dd = ds.all_data()
>>> rho = dd.quantities["WeightedAverageQuantity"](
... "Density", weight="CellMassMsun")
>>> flux = dd.calculate_isocontour_flux("Density", rho,
... "velocity_x", "velocity_y", "velocity_z", "Metal_Density")