This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

DG: dot product with jump

0 votes

Hello:
I would want to make a dot product when there are one vector (1,1) and another vector jump(q,n) (q is a scalar field, n = FacetNormal(mesh)). Also I have an scalar jump(sigma,n) because of sigma is an vector field.
However I have problems to do it.

 mesh = UnitSquare(22, 22)
V2 = VectorFunctionSpace(mesh, "DG", 2)
V0 = FunctionSpace(mesh, "DG", 1)
W = MixedFunctionSpace([V0, V2, V2])

(p, s1, sigma) = TrialFunctions(W)
(q, t, tau) = TestFunctions(W)

...
auxv = Vector(2)
auxv[1] = 1.0
auxv[0] = 1.0
a = ... + dot(jump(sigma,n)*auxv, jump(q,n))*dS 

Thanks for your attention
Jesus

asked Jul 11, 2013 by jesus FEniCS Novice (300 points)

1 Answer

+1 vote
 
Best answer
auxv = as_vector((1.0, 1.0))

or

auxv  = Constant((1.0, 1.0))

The latter enables you to change values of auxv without a need to recompile the form.

answered Jul 11, 2013 by Jan Blechta FEniCS Expert (51,420 points)
selected Jul 12, 2013 by Jan Blechta

Thanks a lot for your rapid answer.
The solution has been correct
auxv = Constant((1.0, 1.0))
The other option auxv = as_vector((1.0, 1.0)) when solves the system goes out

ufl.log.UFLException: Form argument must be restricted.

Thanks another time.

ufl.log.UFLException: Form argument must be restricted.

You need to use auxv('+'), auxv('-') or avg(auxv) instead of avg in interior facet integrals.

...