Energies and boundness (grid_dendro.energy)

Energies and boundness (grid_dendro.energy)#

grid_dendro.energy.calculate_cumulative_energies(gd, data, node)[source]#

Calculate cumulative energies as a function of radius in a given node

Parameters
  • gd (Dendrogram) – : Dendrogram object.

  • data (dict) – Dictionary containing fluid variables.

  • node (int) – Selected GRID-dendro node.

Returns

  • array – Effective radii.

  • dict – thermal, kinetic, magnetic, gravitational, and total energies integrated up to each radius.

grid_dendro.energy.find_bound_objects(gd, data, hbp=None, hbr=None, node=None)[source]#

Finds HBP and HBR

Parameters
  • gd (Dendrogram) – GRID-dendro dendrogram object.

  • data (dict) – Dictionary containing 1-D flattend fluid variables. Must contain [‘rho’, ‘vel1’, ‘vel2’, ‘vel3’, ‘prs’, ‘phi’]

  • hbp (dict, optional) – Dictionary containing HBPs. Only used internally for recursive purpose.

  • hbr (dict, optional) – Dictionary containing HBRs. Only used internally for recursive purpose.

  • node (int, optional) – ID of the selected node. Only used internally for recursive purpose.

Returns

  • hbp (dict) – Dictionary containing HBPs.

  • hbr (dict) – Dictionary containing HBRs.

Examples

>>> import pyathena as pa
>>> s = pa.LoadSim("/scratch/smoon/M5J2P0N512")
>>> ds = s.load_hdf5(50, load_method='pyathena')
>>> cs = 1.0 # isothermal sound speed
>>> gd = dendrogram.Dendrogram(ds.phigas.data)
>>> gd.construct()
>>> gd.prune()  # Remove buds
>>> data = dict(rho=ds.dens.data.flatten(),
                vel1=(ds.mom1/ds.dens).data.flatten(),
                vel2=(ds.mom2/ds.dens).data.flatten(),
                vel3=(ds.mom3/ds.dens).data.flatten(),
                prs=(cs**2*ds.dens).data.flatten(),
                phi=ds.phigas.data.flatten())
>>> hbp, hbr = find_bound_object(gd, data)