-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathh1_bubble.jl
More file actions
78 lines (64 loc) · 3.23 KB
/
h1_bubble.jl
File metadata and controls
78 lines (64 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""
````
abstract type H1BUBBLE{ncomponents} <: AbstractH1FiniteElement where {ncomponents<:Int}
````
Piecewise bubbles (=zero at boundary)
allowed element geometries:
- Edge1D (one quadratic bubble)
- Triangle2D (one cubic bubble)
- Quadrilateral2D (one quartic bubble)
- Tetrahedron3D (one cubic bubble)
"""
abstract type H1BUBBLE{ncomponents} <: AbstractH1FiniteElement where {ncomponents <: Int} end
H1BUBBLE(ncomponents::Int) = H1BUBBLE{ncomponents}
function Base.show(io::Core.IO, ::Type{<:H1BUBBLE{ncomponents}}) where {ncomponents}
return print(io, "H1BUBBLE{$ncomponents}")
end
get_ncomponents(FEType::Type{<:H1BUBBLE}) = FEType.parameters[1]
get_ndofs(::Type{<:AssemblyType}, FEType::Type{<:H1BUBBLE}, EG::Type{<:AbstractElementGeometry}) = FEType.parameters[1]
get_polynomialorder(::Type{<:H1BUBBLE}, ::Type{<:AbstractElementGeometry1D}) = 2;
get_polynomialorder(::Type{<:H1BUBBLE}, ::Type{<:Triangle2D}) = 3;
get_polynomialorder(::Type{<:H1BUBBLE}, ::Type{<:Quadrilateral2D}) = 4;
get_polynomialorder(::Type{<:H1BUBBLE}, ::Type{<:Tetrahedron3D}) = 4;
get_dofmap_pattern(FEType::Type{<:H1BUBBLE}, ::Type{CellDofs}, EG::Type{<:AbstractElementGeometry}) = "I1"
isdefined(FEType::Type{<:H1BUBBLE}, ::Type{<:AbstractElementGeometry1D}) = true
isdefined(FEType::Type{<:H1BUBBLE}, ::Type{<:Triangle2D}) = true
isdefined(FEType::Type{<:H1BUBBLE}, ::Type{<:Quadrilateral2D}) = true
isdefined(FEType::Type{<:H1BUBBLE}, ::Type{<:Tetrahedron3D}) = true
interior_dofs_offset(::Type{ON_CELLS}, ::Type{H1BUBBLE{ncomponents}}, EG::Type{<:AbstractElementGeometry}) where {ncomponents} = 0
init_interpolator!(FES::FESpace{Tv, Ti, FEType, APT}, ::Type{ON_CELLS}) where {Tv, Ti, FEType <: H1BUBBLE, APT} = MomentInterpolator(FES, ON_CELLS)
function ExtendableGrids.interpolate!(Target::AbstractArray{T, 1}, FE::FESpace{Tv, Ti, FEType, APT}, ::Type{ON_CELLS}, exact_function!; items = [], kwargs...) where {T, Tv, Ti, FEType <: H1BUBBLE, APT}
get_interpolator(FE, ON_CELLS).evaluate!(Target, exact_function!, items, kwargs...)
end
function get_basis(::Type{<:AssemblyType}, ::Type{H1BUBBLE{ncomponents}}, ::Type{<:AbstractElementGeometry1D}) where {ncomponents}
return function closure(refbasis, xref)
for k in 1:ncomponents
refbasis[k, k] = 6 * xref[1] * (1 - xref[1])
end
return
end
end
function get_basis(::Type{<:AssemblyType}, ::Type{H1BUBBLE{ncomponents}}, ::Type{<:Triangle2D}) where {ncomponents}
return function closure(refbasis, xref)
for k in 1:ncomponents
refbasis[k, k] = 60 * (1 - xref[1] - xref[2]) * xref[1] * xref[2]
end
return
end
end
function get_basis(::Type{<:AssemblyType}, ::Type{H1BUBBLE{ncomponents}}, ::Type{<:Quadrilateral2D}) where {ncomponents}
return function closure(refbasis, xref)
for k in 1:ncomponents
refbasis[k, k] = 36 * (1 - xref[1]) * (1 - xref[2]) * xref[1] * xref[2]
end
return
end
end
function get_basis(::Type{<:AssemblyType}, ::Type{H1BUBBLE{ncomponents}}, ::Type{<:Tetrahedron3D}) where {ncomponents}
return function closure(refbasis, xref)
for k in 1:ncomponents
refbasis[k, k] = 840 * (1 - xref[1] - xref[2] - xref[3]) * xref[1] * xref[2] * xref[3]
end
return
end
end