Skip to content

Commit

Permalink
curl of lags depends on extrinsic normal
Browse files Browse the repository at this point in the history
  • Loading branch information
krcools committed Nov 15, 2023
1 parent 49d2747 commit af68d78
Show file tree
Hide file tree
Showing 14 changed files with 424 additions and 448 deletions.
4 changes: 0 additions & 4 deletions src/BEAST.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@ include("identityop.jl")
include("integralop.jl")
include("dyadicop.jl")
include("interpolation.jl")
include("quaddata.jl")

include("quadrature/quaddata.jl")
include("quadrature/quadrule.jl")

include("quadrature/doublenumqstrat.jl")
include("quadrature/doublenumsauterqstrat.jl")
Expand Down
73 changes: 39 additions & 34 deletions src/bases/local/laglocal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ function (f::LagrangeRefSpace{T,1,3})(t) where T

j = jacobian(t)
p = t.patch
σ = sign(dot(normal(t), cross(p[1]-p[3],p[2]-p[3])))
SVector(
(value=u, curl=(p[3]-p[2])/j),
(value=v, curl=(p[1]-p[3])/j),
(value=w, curl=(p[2]-p[1])/j))
(value=u, curl=σ*(p[3]-p[2])/j),
(value=v, curl=σ*(p[1]-p[3])/j),
(value=w, curl=σ*(p[2]-p[1])/j))
end


Expand All @@ -45,17 +46,18 @@ end
Compute the values of the shape functions together with their curl.
"""
function (f::LagrangeRefSpace{T,1,3})(t, ::Type{Val{:withcurl}}) where T
# Evaluete linear Lagrange elements on a triange, together with their curl
j = jacobian(t)
u,v,w, = barycentric(t)
p = t.patch
SVector(
(value=u, curl=(p[3]-p[2])/j),
(value=v, curl=(p[1]-p[3])/j),
(value=w, curl=(p[2]-p[1])/j)
)
end
# function (f::LagrangeRefSpace{T,1,3})(t, ::Type{Val{:withcurl}}) where T
# # Evaluete linear Lagrange elements on a triange, together with their curl
# j = jacobian(t)
# u,v,w, = barycentric(t)
# p = t.patch
# σ = sign(dot(normal(t), cross(p[1]-p[3],p[2]-p[3])))
# SVector(
# (value=u, curl=σ*(p[3]-p[2])/j),
# (value=v, curl=σ*(p[1]-p[3])/j),
# (value=w, curl=σ*(p[2]-p[1])/j)
# )
# end


# Evaluate constant Lagrange elements on a triangle, with their curls
Expand Down Expand Up @@ -178,30 +180,33 @@ function (f::LagrangeRefSpace{T,2,3})(t) where T
# (value=v, curl=(p[1]-p[3])/j),
# (value=w, curl=(p[2]-p[1])/j)

σ = sign(dot(normal(t), cross(p[1]-p[3],p[2]-p[3])))
SVector(
(value=u*(2*u-1), curl=(p[3]-p[2])*(4u-1)/j),
(value=v*(2*v-1), curl=(p[1]-p[3])*(4v-1)/j),
(value=w*(2*w-1), curl=(p[2]-p[1])*(4w-1)/j),
(value=4*v*w, curl=4*(w*(p[1]-p[3])+v*(p[2]-p[1]))/j),
(value=4*w*u, curl=4*(w*(p[3]-p[2])+u*(p[2]-p[1]))/j),
(value=4*u*v, curl=4*(u*(p[1]-p[3])+v*(p[3]-p[2]))/j),
(value=u*(2*u-1), curl=σ*(p[3]-p[2])*(4u-1)/j),
(value=v*(2*v-1), curl=σ*(p[1]-p[3])*(4v-1)/j),
(value=w*(2*w-1), curl=σ*(p[2]-p[1])*(4w-1)/j),
(value=4*v*w, curl=4*σ*(w*(p[1]-p[3])+v*(p[2]-p[1]))/j),
(value=4*w*u, curl=4*σ*(w*(p[3]-p[2])+u*(p[2]-p[1]))/j),
(value=4*u*v, curl=4*σ*(u*(p[1]-p[3])+v*(p[3]-p[2]))/j),
)
end

function (f::LagrangeRefSpace{T,2,3})(t, ::Type{Val{:withcurl}}) where T
# Evaluete quadratic Lagrange elements on a triange, together with their curl
j = jacobian(t)
u,v,w, = barycentric(t)
p = t.patch
SVector(
(value=u*(2*u-1), curl=(p[3]-p[2])*(4u-1)/j),
(value=v*(2*v-1), curl=(p[1]-p[3])*(4v-1)/j),
(value=w*(2*w-1), curl=(p[2]-p[1])*(4w-1)/j),
(value=4*v*w, curl=4*(w*(p[1]-p[3])+v*(p[2]-p[1]))/j),
(value=4*w*u, curl=4*(w*(p[3]-p[2])+u*(p[2]-p[1]))/j),
(value=4*u*v, curl=4*(u*(p[1]-p[3])+v*(p[3]-p[2]))/j),
)
end
# function (f::LagrangeRefSpace{T,2,3})(t, ::Type{Val{:withcurl}}) where T
# # Evaluete quadratic Lagrange elements on a triange, together with their curl
# j = jacobian(t)
# u,v,w, = barycentric(t)
# p = t.patch

# σ = sign(dot(normal(t), cross(p[1]-p[3],p[2]-p[3])))
# SVector(
# (value=u*(2*u-1), curl=σ*(p[3]-p[2])*(4u-1)/j),
# (value=v*(2*v-1), curl=σ*(p[1]-p[3])*(4v-1)/j),
# (value=w*(2*w-1), curl=σ*(p[2]-p[1])*(4w-1)/j),
# (value=4*v*w, curl=4*σ*(w*(p[1]-p[3])+v*(p[2]-p[1]))/j),
# (value=4*w*u, curl=4*σ*(w*(p[3]-p[2])+u*(p[2]-p[1]))/j),
# (value=4*u*v, curl=4*σ*(u*(p[1]-p[3])+v*(p[3]-p[2]))/j),
# )
# end

function curl(ref::LagrangeRefSpace{T,2,3} where {T}, sh, el)
#curl of lagc0d2 as combination of bdm functions
Expand Down
Loading

0 comments on commit af68d78

Please sign in to comment.