From 2b11da6e03cb138ca6335a36231fad0d7e17be00 Mon Sep 17 00:00:00 2001 From: Keita Nakamura Date: Mon, 12 Aug 2024 13:35:04 +0900 Subject: [PATCH] `l` represents particle length in `uGIMP` --- src/Interpolations/gimp.jl | 8 ++++---- test/interpolations.jl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Interpolations/gimp.jl b/src/Interpolations/gimp.jl index 00ec1a58..ddbcb9b1 100644 --- a/src/Interpolations/gimp.jl +++ b/src/Interpolations/gimp.jl @@ -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) diff --git a/test/interpolations.jl b/test/interpolations.jl index 5011fddf..bd8d221d 100644 --- a/test/interpolations.jl +++ b/test/interpolations.jl @@ -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