Spatial coordinate local values

Hi FEniCS family,

I wanted to know guass point coordinates used by form.

mesh=UnitCubeMesh(1,1,1)
x = SpatialCoordinate(mesh)
x.get_local()

---> 3 x.get_local()

AttributeError: 'SpatialCoordinate' object has no attribute 'get_local'

Can you tell me how I can get the guass points location of mesh.

You do you want the explicit representation of the gauss coordinates in the physical space?

Note that x = SpatialCoordinate(mesh) is a symbolic representation of the quadrature point.

The quadrature degree depends on the variational form (see: How to obtain the Gauss quadrature degree estimated by the form compiler - #2 by dokken) and thus the quadrature points will vary depending on if you look at your linear or bilinear form.

1 Like

Thanks @dokken for your response. The symfem really helps.

  1. How can we get the determinant of jacobian matrix which is multiplied during assemble operation?
    If not values, at least, I could get the formulation used by FEniCS for tetrahedron elements.
from dolfin import *
mesh=UnitCubeMesh(1,1,1)
x = SpatialCoordinate(mesh)
 assemble((x[1]*x[2])*dx)
  1. Can we make the mesh to brick element from default tetrahedron element ?
from dolfin import *
mesh=UnitCubeMesh(1,1,1)

Consider the following (works for affine cells such as triangles, tetrahedrons and affine quads/hexes)

import dolfin
from ufl import Jacobian
mesh = dolfin.UnitCubeMesh(1,1,1)
J = abs(dolfin.det(Jacobian(mesh)))

Q = dolfin.FunctionSpace(mesh, "DG", 0)
cell_jac = dolfin.project(J, Q)
print(cell_jac.vector().get_local())

When you say “brick” element, I suspect you mean: "Can we use hexahedral mesh elements.

Short answer is: This is not fully supported in legacy DOLFIN, and you are recommended to use DOLFINx if you want such elements.

Long answer: You can try to use it in DOLFIN, see: Bitbucket. However, it is not guaranteed to work (it does not for for other meshes than the “built-in” ones). You are recommended to use DOLFINx: GitHub - FEniCS/dolfinx: Next generation FEniCS problem solving environment as has full support for hexes (also non-affine hexes)

2 Likes