### error in definition of "mixed (product) spaces"

245

views

0

Hello,

I am trying to solve a PDE with mixed formulation (Vector Laplacian), so I should define a mixed product space as follow:

from dolfin import *

# Create mesh

mesh = UnitSquareMesh(64, 64)

# Define function spaces and mixed (product) space

NED = FunctionSpace(mesh, "N1curl", 1)

CG = FunctionSpace(mesh, "CG", 1)

W = NED * CG

But when I run this code, I see this error "TypeError: unsupported operand type(s) for * : 'FunctionSpace' and 'FunctionSpace' "

I thought the issue might stem from my dolfin version, but I have the last version of dolfin.

Thanks,

Ali

I am trying to solve a PDE with mixed formulation (Vector Laplacian), so I should define a mixed product space as follow:

from dolfin import *

# Create mesh

mesh = UnitSquareMesh(64, 64)

# Define function spaces and mixed (product) space

NED = FunctionSpace(mesh, "N1curl", 1)

CG = FunctionSpace(mesh, "CG", 1)

W = NED * CG

But when I run this code, I see this error "TypeError: unsupported operand type(s) for * : 'FunctionSpace' and 'FunctionSpace' "

I thought the issue might stem from my dolfin version, but I have the last version of dolfin.

Thanks,

Ali

Community: FEniCS Project

is your CG space for the involution term?

written
5 months ago by
Nate

I have used CG because of my weak formulation. (one of my arbitrary test function is a member of H1).

written
5 months ago by
Ali

### 1 Answer

5

Hi,

You should define a mixed finite element space and then create the desired function space, for example:

You should define a mixed finite element space and then create the desired function space, for example:

```
# Finite Element Space Definition
NED = FiniteElement('N1curl', mesh.ufl_cell(), 1)
CG = FiniteElement('CG', mesh.ufl_cell(), 1)
W = NED * CG
V = FunctionSpace(mesh, W)
```

PS: The degree of CG must be at least 1. Otherwise, you should use a discontinuous element.

Please login to add an answer/comment or follow this question.