Using Project, Interpolate, and Functional #850
gatling-nrl
started this conversation in
General
Replies: 1 comment 5 replies
-
Hmm, things have gone wrong. I should have realized def plot_annotations(ax):
def _functional(w):
pts = w.x.reshape(2,-1).T
vals = w['ind_p0'].value.reshape(-1)
for p, v in zip(pts, vals):
ax.plot(p[0], p[1], 'or')
ax.annotate(f'{v:.1f}', p, size=15)
return w['ind_p1']
return skfem.Functional(_functional)
fig, ax = plt.subplots(figsize=(8,8))
skfem.visuals.matplotlib.draw(mesh, ax=ax)
skfem.visuals.matplotlib.plot(basis_p0, ind_p0, ax=ax, cmap='Blues', vmax=1.5, shading='gouraud')
skfem.asm(
plot_annotations(ax),
facet_basis_p1_s1,
ind_p1=ind_p1,
ind_p0=facet_basis_p1_s0.project(facet_basis_p0_s0.interpolate(ind_p0)),
) ind_p0 is supposed to be 0 or 1 everywhere. I understand that |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm still using Functional in unintended ways to better understand how to fit the data structures in skfem together. In this scenario I have a function that I want to project into TriP0 and TriP1. I also want these projections on CellBasis and on InteriorFacetBasis.
Things are starting to work, but the syntax is really awkward. Particularly
ind_p0 wasn't created with facet_basis_p0_s0, so why am I using it to interpolate? I think the answer is that facet_basis_p0_s0 shares basis functions with basis_p0 and it shares quadrature points with facet_basis_p1_s0 and so it has to be the bridge between them.
This kind of makes sense in retrospect, but its very awkward. Is there is a better way I'm not thinking of?
Also, do confusing things start happening if you mix the
side
argument of the facet basis in the three places (interpolation, projection, and asm argument)?Beta Was this translation helpful? Give feedback.
All reactions