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

Update Mode.plot_component #178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mpasson
Copy link

@mpasson mpasson commented Oct 9, 2024

Plotting 'abs' func with field component 'x' or 'y' shows some problems #170.

This is my attempt to solve it. Please fell free to disregard if I missed something in the fix.
Best,

Copy link
Owner

@HelgeGehring HelgeGehring left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

I think this solves the problem, but I'm not sure if that's actually the clean way.
It works I think as we projected on linear lagrange which makes projection and applying such a function almost exchangable

I would somehow expect (especially for anything higher order), that we'd need to

  • interpolate -> apply the function -> project
    That way we'd need to apply it to the values at the interpolation points instead of on the degrees of freedom 🤔

I made a proposal, but I think it's a little more complicated - the function would need to be applied on each component (once we interpolated, we have a three dimensional vector (with another dimension over the quadrature points)) - don't know if numpy would do it like this 🤔

Could you give it a try?

I.e. apply the function somewhere between interpolate and project?

(otherwise, we could also merge this as it's better than what we do right now. But I'd guess we're close to having it completely correct)

@@ -329,8 +329,9 @@ def plot_component(

if component == "x" or component == "y":
plot_basis = mfield_t_basis.with_element(ElementVector(ElementDG(ElementTriP1())))
mfield_xy = plot_basis.project(mfield_t_basis.interpolate(conv_func(mfield_t)))
mfield_xy = plot_basis.project(mfield_t_basis.interpolate(mfield_t))
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
mfield_xy = plot_basis.project(mfield_t_basis.interpolate(mfield_t))
mfield_xy = plot_basis.project(conv_func(mfield_t_basis.interpolate(mfield_t)))

would this solve the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants