Differences between parts of mixed FEM and single FEM
I am wondering, why I get different sizes and entries in the system matrices when I assemble them
1.) as a submatrix of a mixed FEM ansatz
2.) directly using the same single test/trial spaces
Or do I something fundamentally wrong.
Please consider the following example in python.
For example, the length of the right hand side vector differs when changing the parameter mixed = True, False
from dolfin import *
from scipy.sparse import csr_matrix
import numpy as np
parameters.
mixed = False
mesh = UnitSquareMesh(2, 2)
if mixed is True:
# Define mixed FEM function spaces
V = VectorFunctionS
Q = FunctionSpace(mesh, "CG", 1)
W = V * Q
(u, p) = TrialFunctions(W)
(v, q) = TestFunctions(W)
else:
# Define FEM function spaces
V = VectorFunctionS
u = TrialFunction(V)
v = TestFunction(V)
# define Form
aa = inner(grad(u), grad(v))*dx
# Assemble system
A = assemble(aa)
# righthandside
fvhomo = Constant((1,2))
Lvh = inner(fvhomo,v)*dx
b = assemble(Lvh)
## Convert DOLFIN representation to numpy arrays
rows, cols, values = A.data()
Aa = csr_matrix((values, cols, rows))
ba = b.array()
ba = ba.reshape(len(ba), 1)
print ba.shape
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Jan Blechta
- Solved:
- Last query:
- Last reply: