Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
PharmCat committed Feb 27, 2024
1 parent 7d8cc59 commit 5c09706
Show file tree
Hide file tree
Showing 7 changed files with 402 additions and 110 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/CompatHelper.yml

This file was deleted.

7 changes: 7 additions & 0 deletions docs/src/details.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ J. Monaghan, Smoothed Particle Hydrodynamics, “Annual Review of Astronomy and

### Density diffusion term

```math
\frac{\partial \rho_i}{\partial t} = \sum m_j \textbf{v}_{ij} \cdot \nabla_i W_{ij} + \delta_{\Phi} h c_0 \sum \Psi_{ij} \cdot \nabla_i W_{ij} \frac{m_j}{\rho_j}
```


### XSPH correction

Expand Down
6 changes: 4 additions & 2 deletions examples/profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ sphprob.dpc_l₀ = 0.01
s = 0.01
stepsolve!(sphprob, 1)

@profile stepsolve!(sphprob, 10000)
@benchmark stepsolve!(sphprob, 1000)

@profile timesolve!(sphprob; batch = 300, timeframe = 0.2)
@profile stepsolve!(sphprob, 100)

@profile timesolve!(sphprob; batch = 300, timeframe = 0.001)

pprof()

Expand Down
18 changes: 14 additions & 4 deletions src/celllist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ end
Full update cell grid.
"""
@noinline function update!(c::GPUCellList)
@noinline function update!(c::GPUCellList, fillzero::Bool = true)
#cellmap_2d!(c.pcell, c.points, (c.cs[2], c.cs[2]), c.offset)

fill!(c.cellpnum, zero(Int32))
Expand All @@ -126,7 +126,7 @@ Full update cell grid.
if c.pairsn > length(c.pairs) || c.pairsn < length(c.pairs) * 0.6 # if current number of pairs more than pair list or too small - then resize
CUDA.unsafe_free!(c.pairs)
c.pairs = CUDA.fill((zero(Int32), zero(Int32)), Int(ceil(c.pairsn/0.8)))
else
elseif fillzero
fill!(c.pairs, (zero(Int32), zero(Int32)))
end

Expand All @@ -153,13 +153,13 @@ Full update cell grid.
end

"""
partialupdate!(c::GPUCellList)
partialupdate!(c::GPUCellList, fillzero::Bool = true)
Update only distance
"""
@noinline function partialupdate!(c::GPUCellList)
fill!(c.cnt, zero(Int32))
fill!(c.pairs, (zero(Int32), zero(Int32)))
if fillzero fill!(c.pairs, (zero(Int32), zero(Int32))) end
neib_internal_2d!(c.pairs, c.cnt, c.cellpnum, c.points, c.celllist, c.dist)
neib_external_2d!(c.pairs, c.cnt, c.cellpnum, c.points, c.celllist, (1, -1), c.dist)
neib_external_2d!(c.pairs, c.cnt, c.cellpnum, c.points, c.celllist, (0, 1), c.dist)
Expand All @@ -177,6 +177,16 @@ function neighborlist(c::GPUCellList)
c.pairs
end

"""
neighborlistview(c::GPUCellList)
List of pairs with distance.
"""
function neighborlistview(c::GPUCellList)
view(c.pairs, 1:c.pairsn)
end



function Base.show(io::IO, c::GPUCellList)
println(io, " Cell List")
Expand Down
Loading

0 comments on commit 5c09706

Please sign in to comment.