-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Compute CouplingExpression from point data via Minimization on P0DG function space #119
Comments
I investigated this issue a bit. Main problem with FEniCS is that it does not provide the |
I tried to create a mesh myself. I will provide the example code below. Note that the example is not working. I guess it is just not that simple to have a mesh without connectivity in FEniCS. import fenics
import numpy as np
from fenics import Mesh, MeshEditor, FunctionSpace
# using https://bitbucket.org/fenics-project/dolfin/src/b55804ecca7d010ff976967af869571b56364975/dolfin/generation/IntervalMesh.cpp#lines-76:98 as template
N = 5 # we want to work with 5 vertices on the mesh
gdim = 2 # geometric dimension
tdim = 0 # topological dimension
vertices = np.random.rand(N, gdim)
mesh = Mesh() # empty mesh
editor = MeshEditor()
editor.open(mesh, type="interval", tdim=tdim, gdim=gdim) # here type="point" or type="vertex" would be a reasonable choice, but also leads to an error.
editor.init_vertices_global(N,N)
for i in range(N):
editor.add_vertex(i, vertices[i,:])
editor.close()
V = FunctionSpace(mesh, "DG", 0) Edit: Updated following advice in #119 (comment), creating the |
Note: to create a mesh of disconnected vertices (i.e. a point cloud) you need |
Neither
nor
work. Looking at the ufl package it looks like |
UFL should support vertex cells - at least I added such support to the github hosted FEniCS/ufl repository which I believe is the current UFL core and appears to be newer than the bitbucket one you pointed to. Not sure which you get when you |
Relevant PR FEniCS/ufl#30 |
@ReubenHill On the ufl side
Since I'm lacking a bit background in DolfinX and UFL, I'm not sure whether this is an issue or I'm just missing something. |
It looks like the issue you are running into is trying to get the translation from the symbolic representation of a mesh of disconnected vertices (which you should be able to create in pure UFL as a Assuming that FEniCSx makes use of the UFL domain and mesh abstractions for symbolically describing meshes then the symbolic bit is done and shouldn't need any UFL changes. Looking at what I had to do in firedrake might be instructive to see what you need to change in FEniCSx to get this numerically represented but I honestly can't say for sure since I'm not a FEniCSx developer. Hopefully the above is helpful nonetheless. |
I asked a question about this issue in the FEniCS discourse forum (https://fenicsproject.discourse.group/t/unclear-how-to-use-mesheditor-with-pointcloud/5660). @ReubenHill Thanks for the explanation! |
At FEniCS2021 @ReubenHill gave a talk on using point data in Firedrake. This might be an alternative approach to our
CustomExpression
and interpolation based approach, where theCustomExpression
just wraps an interpolating function:fenics-adapter/fenicsprecice/expression_core.py
Lines 101 to 114 in be1b49d
The text was updated successfully, but these errors were encountered: