Skip to content

Commit

Permalink
methods for assembly (Id,GWP,GWP) added
Browse files Browse the repository at this point in the history
  • Loading branch information
krcools committed Oct 10, 2024
1 parent 68aa02f commit 5b52e37
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ AbstractTrees = "0.4.4"
BlockArrays = "0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 1"
CollisionDetection = "0.1.6"
Combinatorics = "0.7, 1"
CompScienceMeshes = "0.8.2"
CompScienceMeshes = "0.8.3"
Compat = "2, 3, 4"
ConvolutionOperators = "0.4"
ExtendableSparse = "1.4"
Expand Down
11 changes: 3 additions & 8 deletions examples/mfie_gwp2.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using CompScienceMeshes, BEAST

# Γ = readmesh(joinpath(dirname(pathof(BEAST)),"../examples/sphere2.in"))
Γ = meshsphere(radius=1.0, h=0.1)
# X, Y = raviartthomas(Γ), buffachristiansen(Γ)
# X = brezzidouglasmarini(Γ)
# Y = brezzidouglasmarini(Γ)
# X = raviartthomas(Γ)
# Y = raviartthomas(Γ)
X = BEAST.gwpdiv(Γ; order=2)
Y = BEAST.gwpdiv(Γ; order=2)
Γ = meshsphere(radius=1.0, h=0.2)
X = BEAST.gwpdiv(Γ; order=3)
Y = BEAST.gwpdiv(Γ; order=3)

ϵ, μ, ω = 1.0, 1.0, 1.0; κ = ω * *μ)
# κ = 3.0
Expand Down
35 changes: 8 additions & 27 deletions src/bases/local/gwplocal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function (ϕ::GWPCurlRefSpace{T,Deg})(dom::CompScienceMeshes.ReferenceSimplex{Di
nd3 = point(T, -v, u)

P = SVector{2,T}
vals = Vector{P}(undef,NF)
crls = Vector{T}(undef,NF)
NT = @NamedTuple{value::P, curl::T}
nts = Vector{NT}(undef, NF)
idx = 1

i = 0
Expand All @@ -50,10 +50,7 @@ function (ϕ::GWPCurlRefSpace{T,Deg})(dom::CompScienceMeshes.ReferenceSimplex{Di
dv = Rᵢ*dRⱼ*Rₖ - Rᵢ*Rⱼ*dRₖ
curl = (du*nd1[2] - dv*nd1[1]) + 2*Rᵢ*Rⱼ*Rₖ

vals[idx] = Rᵢ*Rⱼ*Rₖ*nd1
crls[idx] = curl
# push!(vals, Rᵢ*Rⱼ*Rₖ*nd1)
# push!(crls, curl)
nts[idx] = (value=Rᵢ*Rⱼ*Rₖ*nd1, curl=curl)
idx += 1
end

Expand All @@ -71,11 +68,7 @@ function (ϕ::GWPCurlRefSpace{T,Deg})(dom::CompScienceMeshes.ReferenceSimplex{Di
dv = Rᵢ*dRⱼ*Rₖ - Rᵢ*Rⱼ*dRₖ
curl = (du*nd2[2] - dv*nd2[1]) + 2*Rᵢ*Rⱼ*Rₖ

# push!(vals, Rᵢ*Rⱼ*Rₖ*nd2)
# push!(crls, curl)

vals[idx] = Rᵢ*Rⱼ*Rₖ*nd2
crls[idx] = curl
nts[idx] = (value=Rᵢ*Rⱼ*Rₖ*nd2, curl=curl)
idx += 1
end

Expand All @@ -93,12 +86,8 @@ function (ϕ::GWPCurlRefSpace{T,Deg})(dom::CompScienceMeshes.ReferenceSimplex{Di
du = dRᵢ*Rⱼ*Rₖ - Rᵢ*Rⱼ*dRₖ
dv = Rᵢ*dRⱼ*Rₖ - Rᵢ*Rⱼ*dRₖ
curl = (du*nd3[2] - dv*nd3[1]) + 2*Rᵢ*Rⱼ*Rₖ

# push!(vals, Rᵢ*Rⱼ*Rₖ*nd3)
# push!(crls, curl)

vals[idx] = Rᵢ*Rⱼ*Rₖ*nd3
crls[idx] = curl
nts[idx] = (value=Rᵢ*Rⱼ*Rₖ*nd3, curl=curl)
idx += 1
end

Expand Down Expand Up @@ -135,22 +124,14 @@ function (ϕ::GWPCurlRefSpace{T,Deg})(dom::CompScienceMeshes.ReferenceSimplex{Di
dv = Rsᵢ*dRsⱼ*Rₖ - Rsᵢ*Rsⱼ*dRₖ
curlS3 = du*nd3[2] - dv*nd3[1] + 2*Rsᵢ*Rsⱼ*Rₖ

# push!(vals, S2-S3)
# push!(crls, curlS2 - curlS3)
vals[idx] = S2-S3
crls[idx] = curlS2 - curlS3
nts[idx] = (value=S2-S3, curl=curlS2 - curlS3)
idx += 1

# push!(vals, S3-S1)
# push!(crls, curlS3 - curlS1)
vals[idx] = S3-S1
crls[idx] = curlS3 - curlS1
nts[idx] = (value=S3-S1, curl=curlS3 - curlS1)
idx += 1
end end

# NF = length(vals)
SVector{NF}([(value=f, curl=c) for (f,c) in zip(vals, crls)])
# [(value=f, curl=c) for (f,c) in zip(vals, crls)]
return SVector{NF}(nts)
end


Expand Down
15 changes: 15 additions & 0 deletions src/identityop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ function quaddata(op::LocalOperator, g::LagrangeRefSpace{T,Deg,4} where {T,Deg},
end


defaultquadstrat(::LocalOperator, ::GWPDivRefSpace{<:Real,D1},
::GWPDivRefSpace{<:Real,D2}) where {D1,D2} = SingleNumQStrat(7)


function quaddata(op::LocalOperator, g::GWPDivRefSpace, f::GWPDivRefSpace,
tels::Vector, bels::Vector,
qs::SingleNumQStrat)

u, w = trgauss(qs.quad_rule)
qd = [(w[i],SVector(u[1,i],u[2,i])) for i in 1:length(w)]
A = _alloc_workspace(qd, g, f, tels, bels)
return qd, A
end


function quadrule(op::LocalOperator, ψ::RefSpace, ϕ::RefSpace, τ, (qd,A), qs::SingleNumQStrat)
for i in eachindex(qd)
q = qd[i]
Expand Down

0 comments on commit 5b52e37

Please sign in to comment.