-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add demo for interpolating expressions #463
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I think you can remove GradExpression.py
demo. This demo is superset of it, we need to keep demos low, too many already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I found readability a little challenging in parts. I've left some suggestions to reduce the number of variables and to change some names.
@@ -0,0 +1,63 @@ | |||
# Copyright (C) 2022 Jørgen S. Dokken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the short SPDX license header.
|
||
# Define mesh | ||
cell = triangle | ||
v_el = VectorElement("Lagrange", cell, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest reducing the number of variables to improve readabilty, e.g.
mesh = Mesh(VectorElement("Lagrange", cell, 1))
# Define mixed function space | ||
el = FiniteElement("CG", cell, 2) | ||
el_int = VectorElement("Discontinuous Lagrange", cell, 1) | ||
me = MixedElement([el, el_int]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
element = MixedElement([FiniteElement("Lagrange", cell, 2), VectorElement("Discontinuous Lagrange", cell, 1)])
b_cell = basix.cell.string_to_type(cell.cellname()) | ||
|
||
# Find quadrature points for quadrature element | ||
b_rule = basix.quadrature.string_to_type(q_rule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can q_rule
and q_degree
be gotten directly from q_el
?
|
||
# Get interpolation points for output space | ||
family = basix.finite_element.string_to_family("Lagrange", cell.cellname()) | ||
b_element = basix.create_element(family, b_cell, 4, basix.LagrangeVariant.gll_warped, True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the parameter 4
?
# Get interpolation points for output space | ||
family = basix.finite_element.string_to_family("Lagrange", cell.cellname()) | ||
b_element = basix.create_element(family, b_cell, 4, basix.LagrangeVariant.gll_warped, True) | ||
interpolation_points = b_element.points |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
X = b_element.points
Superseding #453, using
basix
to obtain interpolation/quadrature points to generate integration kernels for various expressions that can be used for interpolation in C++.