From 06376157f95e312228878b1e1edd4e2cf90374dc Mon Sep 17 00:00:00 2001 From: Philipp Holl Date: Sat, 11 May 2024 15:16:49 +0200 Subject: [PATCH] [physics] Remove sph.density() --- demos/simple_sph.py | 2 +- phi/physics/sph.py | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/demos/simple_sph.py b/demos/simple_sph.py index b6a7e28df..380574e61 100644 --- a/demos/simple_sph.py +++ b/demos/simple_sph.py @@ -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 diff --git a/phi/physics/sph.py b/phi/physics/sph.py index 75694f970..be5481bc0 100644 --- a/phi/physics/sph.py +++ b/phi/physics/sph.py @@ -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):