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

Streamlining function evaluation for simple cases #56

Open
RemDelaporteMathurin opened this issue Oct 22, 2024 · 3 comments
Open

Streamlining function evaluation for simple cases #56

RemDelaporteMathurin opened this issue Oct 22, 2024 · 3 comments

Comments

@RemDelaporteMathurin
Copy link
Contributor

While I understand the method presented here provides enough flexibility and is very robust for parallel runs, it is a bit cumbersome and lengthy and I wondered if we could provide a convenience function for simple cases.

In legacy-fenics, we could evaluate a function simply by u.eval((0, 0, 0)). This was a bit fragile in parallel of course.

Could we imagine a convenience function to add this?

@finsberg
Copy link
Member

I agree this would be nice to have. Maybe we could have

def evaluate_function(u: dolfinx.fem.Function, points: npt.NDArray[np.float64]): ...

I think it would also be nice to have a convenient way to evaluate ufl expressions, provided the user supplies an appropriate function space, i.e

def evaluate_expression(u: ufl.core.expr.Expr, V: dolfinx.fem.FunctionSpace, points: npt.NDArray[np.float64]): ...

To handle issues with parallelism we could also add a argument broadcast=True that would ensure that values are present on all processors, i.e

def evaluate_function(u: dolfinx.fem.Function, points: npt.NDArray[np.float64], broadcast: bool = True): ...

@RemDelaporteMathurin
Copy link
Contributor Author

@finsberg that would be lovely. I really like the idea of evaluation ufl expressions!!!

Not sure I understand the broadcast argument here. If True, it would run an internal check and return an error if the point is not on all procs?

@finsberg
Copy link
Member

@RemDelaporteMathurin This has now been resolved for function evaluation here: #74

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

No branches or pull requests

2 participants