Suppose i have a mixed function space as follows:
from dolfin import *
mesh = UnitSquareMesh(4,4)
P1 = FiniteElement('CG', triangle, 1)
P0 = FiniteElement('DG', triangle, 0)
elem = MixedElement([P1, P1, P0, P0])
W = FunctionSpace(mesh, elem)
with trial and test functions
w1, w2, w3, w4 = TestFunctions(W)
u, phi, z, alpha = TrialFunctions(W)
Now i wanted to check a condition like ActA = alpha0 + c (z0 - za) > 0 and ActB = alpha0 + c (z0 - zb) < 0 and else InAct on each cell and mark them into ActA as 1, ActB as 2 and InAct as 3, locally using
dAct = Measure('dx', subdomain_data=CellMarker)
where c, za and zb are constants and alpha0, z0 are constant interpolations in W.sub(2) and W.sub(3), respectively. So i wrote a code for it and one of the test cases gave the following outputs in terms of local degrees of freedom of P0:
ActA = [1, 2, 3, 4, 5, 6]. # marked in dAct(1)
ActB = []. # marked in dAct(2)
InAct = [0 7]. # marked in dAct(3)
The global degrees of freedom are
dofs2 = W.sub(2).dofmap().dofs()
dofs3 = W.sub(3).dofmap().dofs()
print(dofs2, dofs3)
[6, 12, 14, 18, 22, 26, 28, 32] [7, 13, 15, 19, 23, 27, 29, 33]
My questions are the following:
- How are the local and global degrees of freedom mapped. For instance if i perform an operation like
Eq0 = Constant(lam)*z*w4*dAct(1) # lam = 0.1
and print out the respective degrees of freedom from the matrix i get,
print(Eq0.array()[dofs3, dofs2])
[0.0125 0.0125 0.0125 0. 0. 0.0125 0.0125 0.0125]
In the above output if the integration is happening on dAct(1) which is the cells [1 \; 2 \; 3 \; 4 \; 5 \; 6] then why are the entries [0 \; 7] locally (i.e. enties 6 \times 7 and 32 \times 33 globally) not zero and instead the entries [3 \; 4] locally (i.e. 18 \times 19 and 22 \times 23 globally) getting zero.
- Is there a way by which i can convert the dAct marked degrees of freedom into global degrees of freedom ,i.e, directly mark it in dx .
PS: I have not given the exact code, because i thought that it would complicate things. However if you require it, then please let me know.