-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numerical Evaluation of Order 3,4,5 Lagrange Triangle Inexact #582
Comments
Can you post an MWE here? |
using Ferrite
interpolation = Lagrange{2, RefTetrahedron, 5}();
coords = Ferrite.reference_coordinates(interpolation);
Ferrite.value(interpolation, coords[4]) is already slightly inexact. Not sure what is going on. |
Ah, sorry, I see what is happening. Equidistant points for the basis functions. They are inherently broken, because they suffer from Runge's phenomenon. |
For values being inexact. I think replacing function value(ip::Lagrange2Tri345, i::Int, ξ::Vec{2})
order = getorder(ip)
i = permdof2D[order][i]
ξ_x = ξ[1]
ξ_y = ξ[2]
γ = 1. - (ξ_x + ξ_y)
i1, i2, i3 = _numlin_basis2D(i, order)
val = one(γ)
i1 ≥ 1 && (val *= prod((order * γ - j) / (j + 1) for j = 0:(i1 - 1)))
i2 ≥ 1 && (val *= prod((order * ξ_x - j) / (j + 1) for j = 0:(i2 - 1)))
i3 ≥ 1 && (val *= prod((order * ξ_y - j) / (j + 1) for j = 0:(i3 - 1)))
return val
end julia> using Ferrite
julia> interpolation = Lagrange{2, RefTetrahedron, 5}();
julia> coords = Ferrite.reference_coordinates(interpolation);
julia> Ferrite.value(interpolation, coords[4])
21-element Vector{Float64}:
0.0
-0.0
0.0
1.0
0.0
-0.0
0.0
0.0
0.0
0.0
-0.0
-0.0
0.0
-0.0
0.0
0.0
-0.0
0.0
-0.0
0.0
-0.0 What do you think? |
Turns out it's not for all nodes julia> Ferrite.value(interpolation, coords[15])
21-element Vector{Float64}:
0.0
0.0
1.1102230246251566e-17
0.0
-0.0
0.0
-0.0
-0.0
-0.0
-0.0
-0.0
-7.401486830834378e-17
2.220446049250313e-16
-4.440892098500625e-16
0.9999999999999998
0.0
-0.0
0.0
0.0
-0.0
0.0 From what I've seen the value of |
Using |
Indeed, this could already be the issue. We have automatized some of the tests regarding the interpolations, so you can check if this works by commenting in this line Ferrite.jl/test/test_interpolations.jl Line 12 in cc81e6c
|
This patche makes shape function evaluation of the Lagrange2Tri345 interpolations exact by reordering some floating point operations. Fixes #582.
At least the current implementation of the order 5 Lagrange triangle is inexact, as revealed by improved test coverage of the dirac delta property of the interpolations in #581 .
Edit: Forgot to update after some discussion with Abdulaziz.
The text was updated successfully, but these errors were encountered: