Skip to content

Commit

Permalink
Merge pull request #1005 from gridap/fix_nedelec_get_face_dofs
Browse files Browse the repository at this point in the history
Changes required to have a proper definition for get_face_dofs() for Nedelec FEs
  • Loading branch information
amartinhuertas authored May 2, 2024
2 parents 632d695 + 55f5d66 commit 88d34bf
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- Bugfix in `get_face_dofs` for Nedelec GenericRefFE. Since PR[#1005](https://github.com/gridap/Gridap.jl/pull/1005).

## [0.18.1] - 2024-04-12

### Changed
Expand Down
35 changes: 34 additions & 1 deletion src/ReferenceFEs/NedelecRefFEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,42 @@ function Conformity(reffe::GenericRefFE{Nedelec},sym::Symbol)
end

function get_face_own_dofs(reffe::GenericRefFE{Nedelec}, conf::CurlConformity)
get_face_dofs(reffe)
reffe.face_dofs # For Nedelec, this member variable holds the face owned dofs
end

function get_face_own_dofs(reffe::GenericRefFE{Nedelec}, conf::L2Conformity)
face_own_dofs=[Int[] for i in 1:num_faces(reffe)]
face_own_dofs[end]=collect(1:num_dofs(reffe))
face_own_dofs
end

function get_face_dofs(reffe::GenericRefFE{Nedelec,Dc}) where Dc
face_dofs=[Int[] for i in 1:num_faces(reffe)]
face_own_dofs=get_face_own_dofs(reffe)
p = get_polytope(reffe)
for d=1:Dc # Starting from edges, vertices do not own DoFs for Nedelec
first_face = get_offset(p,d)
nfaces = num_faces(reffe,d)
for face=first_face+1:first_face+nfaces
for df=1:d-1
face_faces = get_faces(p,d,df)
first_cface = get_offset(p,df)
for cface in face_faces[face-first_face]
cface_own_dofs = face_own_dofs[first_cface+cface]
for dof in cface_own_dofs
push!(face_dofs[face],dof)
end
end
end
for dof in face_own_dofs[face]
push!(face_dofs[face],dof)
end
end
end
face_dofs
end


function _Nedelec_nodes_and_moments(::Type{et}, p::Polytope, order::Integer) where et

@notimplementedif !( is_n_cube(p) || (is_simplex(p) ) )
Expand Down
20 changes: 19 additions & 1 deletion test/ReferenceFEsTests/NedelecRefFEsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,25 @@ test_reference_fe(reffe)
@test Conformity(reffe) == CurlConformity()
dof_basis = get_dof_basis(reffe)

face_odofs = get_face_own_dofs(reffe)
face_odofs_L2 = get_face_own_dofs(reffe,L2Conformity())

@test face_odofs_L2 == [Int64[], Int64[], Int64[], Int64[],
Int64[], Int64[], Int64[], Int64[], Int64[], Int64[], Int64[], Int64[], Int64[], Int64[],
collect(1:20)]

face_odofs = get_face_own_dofs(reffe)
face_cdofs = get_face_dofs(reffe)

@test face_odofs == [Int64[], Int64[], Int64[], Int64[],
[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], [17, 18], [19, 20],
Int64[]]

@test face_cdofs == [Int64[], Int64[], Int64[], Int64[],
[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12],
[1, 2, 3, 4, 5, 6, 13, 14], [1, 2, 7, 8, 9, 10, 15, 16], [3, 4, 7, 8, 11, 12, 17, 18], [5, 6, 9, 10, 11, 12, 19, 20],
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]]


#display(face_odofs)

using Gridap.Geometry
Expand Down

0 comments on commit 88d34bf

Please sign in to comment.