Assume the domain is given as follows: How to define the H(div) finite element space on a subdomain. I define it as “V4 = HDiv(mesh, order=order, dirichlet=“gammaSD”, definedon = [2])”, I find it has more degrees of freedom. I don’t know what caused it?

geometry = SplineGeometry()

# point coordinates …

pnts = [ (0,0), (1,0), (1,0.5), (1,1), (0,1), (0, 0.5)]

pnums = [geometry.AppendPoint(*p) for p in pnts]

# start-point, end-point, boundary-condition, domain on left side, domain on right side:

lines = [ (pnums[0],pnums[1],“gammaDd”,2,0), (pnums[1],pnums[2],“gammaDd”,2,0),

(pnums[2],pnums[3],“gammaS”,1,0), (pnums[3],pnums[4],“gammaS”,1,0),

(pnums[4],pnums[5],“gammaS”,1,0),

(pnums[5],pnums[0],“gammaDd”,2,0), (pnums[5],pnums[2],“gammaSD”,1,2)]

for p1,p2,bc,left,right in lines:

geometry.Append( [“line”, p1, p2], bc=bc, leftdomain=left, rightdomain=right)

return geometry