Ferrite.jl icon indicating copy to clipboard operation
Ferrite.jl copied to clipboard

Update some missing Lagrange docs

Open termi-official opened this issue 11 months ago • 4 comments

termi-official avatar Mar 01 '24 18:03 termi-official

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.60%. Comparing base (baf8aad) to head (4437a85).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #889   +/-   ##
=======================================
  Coverage   93.60%   93.60%           
=======================================
  Files          39       39           
  Lines        5879     5883    +4     
=======================================
+ Hits         5503     5507    +4     
  Misses        376      376           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 01 '24 19:03 codecov[bot]

I noticed that on master some things can be now done in a better way (i.e. without relying on assumptions taken between the interpolation and cell) so I updated it. Also some dispatches were missing, which I added for completeness of the API.

termi-official avatar Jun 03 '24 14:06 termi-official

I just saw that #935 has quite a bit of overlap here, so we need to decide on a merge order.

termi-official avatar Jun 03 '24 14:06 termi-official

CI failure seems to be the github CDN or CI servers choking

ERROR: LoadError: LoadError: LoadError: Operation too slow. Less than 1 bytes/sec transferred the last 20 seconds while requesting https://raw.githubusercontent.com/Ferrite-FEM/Ferrite.jl/gh-pages/assets/transient_heat.gif

termi-official avatar Jun 03 '24 15:06 termi-official

Example to be reinserted separately.

Now to a full example. Let us reconstruct the local facets of a grid boundary with the described machinery to see how everything fits together:

julia> function recompute_facetset_on_boundary(cells, global_facets)
           # Facets in 2D are edges and have two vertices
           d = Dict{NTuple{2, Int}, FacetIndex}()
           for (c, cell) in enumerate(cells) # c is global cell number
               # Grab all local facets
               local_facets = Ferrite.reference_facets(cell)
               for (f, facet) in enumerate(local_facets) # f is local facet number
                   # Translate into global nodes
                   global_facet = ntuple(i-> cell.nodes[facet[i]], length(facet))
                   d[global_facet] = FacetIndex(c, f)
               end
           end

           facets = Vector{FacetIndex}()
           for facet in global_facets
               # lookup the element, local facet combination for this facet
               push!(facets, d[facet])
           end

           return facets
       end

julia> recompute_facetset_on_boundary(cells, facets)
Vector{FacetIndex} with 2 elements:
  FacetIndex((2, 2))
  FacetIndex((4, 2))

Note that this example can be simplified by directly using Ferrite.facets:

julia> function recompute_facetset_on_boundary_alternative(cells, global_facets)
           # Facets in 2D are edges and have two vertices
           d = Dict{NTuple{2, Int}, FacetIndex}()
           for (c, cell) in enumerate(cells) # c is global cell number
               # Grab all local facets
               for (f, global_facet) in enumerate(Ferrite.facets(cell)) # f is local facet number
                   d[global_facet] = FacetIndex(c, f)
               end
           end

           facets = Vector{FacetIndex}()
           for facet in global_facets
               # lookup the element, local facet combination for this facet
               push!(facets, d[facet])
           end

           return facets
       end

julia> recompute_facetset_on_boundary_alternative(cells, facets)
Vector{FacetIndex} with 2 elements:
  FacetIndex((2, 2))
  FacetIndex((4, 2))

termi-official avatar Jul 09 '24 19:07 termi-official