Skip to content
Discussion options

You must be logged in to vote

Figured out how to fix this, you have to instead work with a test function on the mixed space $W$ and define the Cofunction on the dual of $W$.
Example code:

V = VectorFunctionSpace(mesh, "CG", 2)
Q = FunctionSpace(mesh, "CG", 1)
W = V*Q

f = Function(W)
w = TestFunction(W)

u, p = split(f)
v, q = split(w)

source_mesh = VertexOnlyMesh(mesh, [[0.5,0.5]])
V_s = VectorFunctionSpace(source_mesh, "DG", 0)
Q_s = FunctionSpace(source_mesh, "DG", 0 )
W_s = V_s * Q_s
d_s = Function(W_s)

d_s.sub(0).interpolate(1)
d_s.sub(1).interpolate(0)

source_cofunction = assemble(inner(d_s,TestFunction(W_s)) * dx)
q_s = Cofunction(W.dual()).interpolate(source_cofunction)

and include q_s * w in the functiona…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by orsonhart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant