FacetBasis questions #820
Replies: 3 comments 7 replies
-
Actually, |
Beta Was this translation helpful? Give feedback.
-
mesh = skfem.MeshTri().refined(1)
def is_my_facet(x):
return x[0]>-1
# return np.logical_and(
# np.isclose(x[0], 0.75),
# np.isclose(x[1], 0.75),
# )
basis_p1 = skfem.Basis(mesh, skfem.ElementTriP1())
my_facet = mesh.facets_satisfying(is_my_facet)
fbasis_p1 = skfem.FacetBasis(mesh, basis_p1.elem, facets=my_facet)
@skfem.Functional
def test1(w):
pts = w.x.reshape(2,-1)
for p, n in zip(pts.T, 0.2*w.n.reshape(2,-1).T):
plt.arrow(*p, *n, width=.0, length_includes_head=True, head_width=.025, head_length=.05, facecolor='k', fill=True)
plt.plot(pts[0], pts[1], 'or')
return w.x[0]
fig, ax = plt.subplots(figsize=(5,5))
skfem.visuals.matplotlib.draw(mesh, ax=plt.gca())
ax.set_xlabel('x[0]'); ax.set_ylabel('x[1]')
ax.set_title('test1, w.x')
skfem.asm(test1, fbasis_p1) I'm not sure how to make sense of |
Beta Was this translation helpful? Give feedback.
-
Why not just super().__init__(...) instead of and Asking because I want to make sure I'm not missing something subtle about |
Beta Was this translation helpful? Give feedback.
-
Suppose I want to integrate
along a line from
(0.5, 0)
to(0.5, 1)
. So I tryValueError: Quadrature mismatch: 'u' should have same number of integration points as the basis object.
I think this makes sense, because how could
basis_p1
andvert_line_basis_p1
have the same quadrature points... they aren't even the same dimensionality. But still there must be some way to getprojection_p1
onto the quadrature points ofvert_line_basis_p1
.So I just tried switching out the basis used to do the interpolating:
0.4999999999999999
But how is
vert_line_basis_p1
able to understand a projection created withbasis_p1
? Is it just some lucky coincidence in this toy problem? What is the right way to interpolateprojection_p1
for use in the@Functional test1
?Beta Was this translation helpful? Give feedback.
All reactions