Thanks for the quick reply , @dokken!
The purpose of my exploration of the MeshCoordinates()
was to convert the legacy DOLFIN
code to dolfinx
, which does the formula calculation for subdomains for a given mesh.
The code I was working on was similar to the code(conditional equation form) mentioned below,
and I wanted to convert this type of code to dolfinx
.
You mentioned that MeshCoordinates()
was a function that used before SpatialCoordinate()
, and after reading that post, I googled clue1(Form compilation) and clue2(conditional.py github), and based on that,
# In dolfinx env. Assuming imported the ufl library beforehand
x0, x1 = SpatialCoordinate(mesh)
p_Ex = conditional(ge(0, x0-x1), -2*(exp(x0-x1)-1)/(exp(x0-x1)-1), -(x0-x1))
I was able to get the desired result when I ran the code in the form below.
An additional question I have is,
are MeshCoordinates()
and SpatialCoordinate()
the same function?
If SpatialCoordinate()
came later, it seems like there would be some differences, then what differences have be…?