Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement FaceQuadratureRule for RefPrism and RefPyramid #779

Merged
merged 30 commits into from
Aug 29, 2023

Conversation

AbdAlazezAhmed
Copy link
Collaborator

@AbdAlazezAhmed AbdAlazezAhmed commented Jul 30, 2023

Closes #772
Changes the transformations used in create_face_quad_rule to use the ones in FerriteViz as they're beneficial for optimizing #743 and IIUC make more sense in general as they respect the normals directions.
Also, the transformation is separated into its own functions such that they can be reused as in #743.
Edit: test coverage should improve with interface test, because it covers face->cell transformations

…ment it out then forget to delete it and make a new commit for deleting it and get embarassed
@codecov-commenter
Copy link

codecov-commenter commented Jul 30, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.71% 🎉

Comparison is base (d474caf) 91.88% compared to head (73650a3) 92.59%.
Report is 6 commits behind head on master.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #779      +/-   ##
==========================================
+ Coverage   91.88%   92.59%   +0.71%     
==========================================
  Files          33       33              
  Lines        4916     4942      +26     
==========================================
+ Hits         4517     4576      +59     
+ Misses        399      366      -33     
Files Changed Coverage Δ
src/FEValues/face_integrals.jl 100.00% <100.00%> (+5.43%) ⬆️
src/Grid/grid.jl 92.36% <100.00%> (-0.07%) ⬇️
src/Quadrature/quadrature.jl 97.14% <100.00%> (+11.70%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@KnutAM KnutAM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!
I just took a quick look through and shared some thoughts (but couldn't look longer as my laptop is running out of battery:)

src/Grid/grid.jl Outdated Show resolved Hide resolved
src/Quadrature/quadrature.jl Outdated Show resolved Hide resolved
src/interpolations.jl Outdated Show resolved Hide resolved
test/test_facevalues.jl Outdated Show resolved Hide resolved
test/test_interpolations.jl Outdated Show resolved Hide resolved
Copy link
Member

@fredrikekre fredrikekre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transfer_point_face_to_cell could perhaps be called reference_face_to_face or something?

src/interpolations.jl Outdated Show resolved Hide resolved
src/Grid/grid.jl Outdated Show resolved Hide resolved
src/FEValues/face_integrals.jl Outdated Show resolved Hide resolved
docs/src/devdocs/elements.md Show resolved Hide resolved
src/FEValues/face_integrals.jl Outdated Show resolved Hide resolved
src/FEValues/face_integrals.jl Outdated Show resolved Hide resolved
src/FEValues/face_integrals.jl Outdated Show resolved Hide resolved
src/FEValues/face_integrals.jl Outdated Show resolved Hide resolved
src/FEValues/face_integrals.jl Outdated Show resolved Hide resolved
test/test_interpolations.jl Outdated Show resolved Hide resolved
@lijas
Copy link
Collaborator

lijas commented Aug 24, 2023

Nice work on this PR. Before this PR, the spatial coordinate evaluated on "cell-level" was not always the same as the coordinate evaluated on "face level" In other words, we just took the parametric coordinate on e.g. on a RefLine (say \xi=[0.123]) and transformed in to the Quadrilateral (say to local faceid 4 \xi = [-1, 0.123), however, this would not always correspond to the same spatial coordiante due to the permutation of the face-nodes. This PR seems to fix that.

Is it worth adding test for this (I can do it in that case)?

Somethink like:

using Ferrite

grid = generate_grid(Ferrite.Pyramid, (3,3,3))
dim = Ferrite.getdim(grid)

cellid = 3
cell = grid.cells[cellid]
ccoords = getcoordinates(grid, cellid)
Vec_t = Vec{3,Float64}
Vec_face_t = Vec{2,Float64}

lfaceid = 2
facenodes = Ferrite.faces(cell)[lfaceid]
fcoords = zeros(Vec_t, length(facenodes))
for (i,nodeid) in enumerate(facenodes)
    x = grid.nodes[nodeid].x
    fcoords[i] = x
end

refshape =  Ferrite.getrefshape(cell)
ipcell = Lagrange{refshape,1}()
ipface = Lagrange{RefTriangle,1}()

ξface = rand(Vec_face_t)/4
ξcell = Ferrite.face_to_element_transformation(ξface, refshape, lfaceid)

xface = zero(Vec_t)
for i in 1:getnbasefunctions(ipface)
    xface += Ferrite.shape_value(ipface, ξface, i) * fcoords[i]
end

xcell = zero(Vec_t)
for i in 1:getnbasefunctions(ipcell)
    xcell += shape_value(ipcell, ξcell, i) * ccoords[i]
end

@test xcell == xface

Edit: I noticed that you mentioned this in #743 "syncing/transforming quadrature points"

@AbdAlazezAhmed
Copy link
Collaborator Author

Thanks @lijas ! I'll work on adding the test 😄

@fredrikekre fredrikekre merged commit 6731c5d into Ferrite-FEM:master Aug 29, 2023
6 checks passed
@AbdAlazezAhmed AbdAlazezAhmed deleted the Pyramid-Prism-qr branch December 6, 2023 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

Implement FaceQuadratureRule for RefPrism and RefPyramid
6 participants