Coordinates of subspaces

Hello,

I am trying to obtain the coordinates for the subspaces, but I get an error. Please see the code below

from fenics import *
from fenics_adjoint import *
import ufl
from mshr import *
import matplotlib.pyplot as plt
import numpy as np
%matplotlib notebook

Length = 1.  
Radius = 0.1 
mesh_density = 50

domain = Rectangle(Point(0., 0.), Point(Length, Length))
mesh   = generate_mesh(domain, mesh_density)
dimens = mesh.geometry().dim() 

Vue = VectorElement('CG', mesh.ufl_cell(), 2) # displacement finite element
Vte = FiniteElement('CG', mesh.ufl_cell(), 1) # temperature finite element
V   = FunctionSpace(mesh, MixedElement([Vue, Vte]))

coord_all = V.tabulate_dof_coordinates()
coord_T   = Vte.tabulate_dof_coordinates()                      
coord_u   = Vue.tabulate_dof_coordinates()

I get the following error
AttributeError: ‘FiniteElement’ object has no attribute ‘tabulate_dof_coordinates’

The error is quite clear, you are trying to call tabulate_dof_coordinates() a function that belongs to a FunctionSpace, not a FiniteElement.
You would need to tabulate it for the collapsed sub space:

V.sub(0).collapse().tabulate_dof_coordinates()
V.sub(1).collapse().tabulate_dof_coordinates()
1 Like

Thank you very much @dokken