Skip to content

Commit

Permalink
[physics] Remove sph.density()
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed May 11, 2024
1 parent ed8b668 commit 0637615
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion demos/simple_sph.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
def sph_step(v: Field, dt, isotropic_exp=20., base_density=1.):
graph = sph.neighbor_graph(v.geometry, 'poly6', desired_neighbors=desired_neighbors, compute='kernel', domain=domain)
# --- compute density and pressure ---
rho = sph.density(graph) * particle_mass # this includes the density contribution from self
rho = math.sum(graph.edges['kernel'], dual) * particle_mass # this includes the density contribution from self
pressure = isotropic_exp * (rho - base_density)
nb_rho = rename_dims(rho, instance, dual)
nb_pressure = rename_dims(pressure, instance, dual) # warp re-computes this from nb_rho
Expand Down
22 changes: 11 additions & 11 deletions phi/physics/sph.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,17 @@ def evaluate_kernel(delta, distance, h, spatial_rank: int, kernel: str, types: S
return {t: result[t] for t in types} # re-order output to match input


def density(graph: Graph) -> Tensor:
"""
Sum the kernel function over all neighbors within the support radius.
Args:
graph: `Graph` with `kernel` values stored in the edges.
Returns:
Relative density, i.e. not yet scaled by particle mass.
"""
return math.sum(graph.edges['kernel'], dual)
# def density(graph: Graph) -> Tensor:
# """
# Sum the kernel function over all neighbors within the support radius.
#
# Args:
# graph: `Graph` with `kernel` values stored in the edges.
#
# Returns:
# Relative density, i.e. not yet scaled by particle mass.
# """
# return math.sum(graph.edges['kernel'], dual)


# def diffusion(u: Field):
Expand Down

0 comments on commit 0637615

Please sign in to comment.