Combining two function spaces for electromagnetic waveguide analysis

4 months ago by
Hi, all,

I am trying to repeat the electromagnetic waveguide analysis example on Page 629-642 in Chapter 34 in the FEM book, but I encountered an error message using the existing codes in the book, here is the  first a few lines of my program:
from dolfin import *
import numpy as np

#the mesh used for the rectangular hollow guides
a = 1.0
b = 0.5

#create a rectangular mesh with origin(0,0) extending to (a,b) with 8 edges along the 
#long side and 4 elements along the short side
mesh = RectangleMesh(Point(0.0, 0.0), Point(a, b), 8, 4)
print("Plotting a RectangleMesh")
plot(mesh, title="Rectangle")

#define the orders of the function spaces for vector and nodal basis functions
vector_order = 2
nodal_order = 3

#define the functions spaces
vector_space = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", vector_order)
nodal_space = FunctionSpace(mesh, "Lagrange", nodal_order)
combined_space = vector_space*nodal_space​

the last line gives me the following error:

TypeError: unsupported operand type(s) for *: 'FunctionSpace' and 'FunctionSpace'

I am a novice to FEniCS, Can anyone kindly show me some hints how to debug this?

Thanks in advance.

Jianan Zhang

Community: FEniCS Project
you can define mixed element like this: 
vector_space = FiniteElement("Nedelec 1st kind H(curl)", mesh.ufl_cell(), vector_order)    
nodal_space = FiniteElement("CG", mesh.ufl_cell(), nodal_order)
element = MixedElement([vector_space, nodal_space])​
written 4 months ago by hirshikesh  
Thanks a lot for you help. It works now.  
written 4 months ago by Junling Li  
Just realize that I used the wrong account to reply you ^_^. Thanks for the help.
written 4 months ago by Jianan Zhang  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »