Skip to content

Commit

Permalink
l represents particle length in uGIMP
Browse files Browse the repository at this point in the history
  • Loading branch information
KeitaNakamura committed Aug 12, 2024
1 parent c9982fd commit 2b11da6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Interpolations/gimp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ end
# The generalized interpolation material point method.
# Computer Modeling in Engineering and Sciences, 5(6), 477-496.
# boundary treatment is ignored
function value(::uGIMP, ξ::Real, l::Real) # `2l` is the particle size normalized by h
function value(::uGIMP, ξ::Real, l::Real) # `l` is the particle size normalized by h
ξ = abs(ξ)
ξ < l ? 1 - (ξ^2 + l^2) / 2l :
ξ < 1-l ? 1 - ξ :
ξ < 1+l ? (1+l-ξ)^2 / 4l : zero(ξ)
ξ < l/2 ? 1 - (4ξ^2+l^2)/4l :
ξ < 1-l/2 ? 1 - ξ :
ξ < 1+l/2 ? (1+l/2-ξ)^2 / 2l : zero(ξ)
end
@inline value(f::uGIMP, ξ::Vec, l::Real) = prod(value.((f,), ξ, l))
@inline function value(f::uGIMP, xₚ::Vec, lₚ::Real, mesh::CartesianMesh, I::CartesianIndex)
Expand Down
4 changes: 2 additions & 2 deletions test/interpolations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ end
Random.seed!(1234)
mesh = CartesianMesh(0.1, ntuple(i->(0,1), Val(dim))...)
mp = MPValue(it, mesh)
l = 0.5*spacing(mesh) / 2
l = 0.5*spacing(mesh)
@test all(1:100) do _
x = rand(Vec{dim})
update!(mp, (;x,l), mesh)
isnearbounds = any(.!(l .< x .< 1-l))
isnearbounds = any(.!(l/2 .< x .< 1-l/2))
PU = check_partition_of_unity(mp, x)
LFR = check_linear_field_reproduction(mp, x, mesh)
# uGIMP doesn't have pertition of unity when very closed to boundaries
Expand Down

0 comments on commit 2b11da6

Please sign in to comment.