Reinstating the firedrake mailing list cc (please do keep it cc'd since others may have more useful comments, or wish to know the answer).
On 15 Sep 2020, at 10:57, Mohammad Sarraf Joshaghani <m.sarraf.j@gmail.com> wrote:
Thanks a lot for your prompt response and help.
The inner(grad(sol),n)*v in last two terms give me an error: UFL:ERROR Shapes do not match: <Grad id=4986788992> and <Zero id=4998074176>.
But the projection was okay when changed them to sol*v. Do you know where is this error coming from? (FYI: my sol Function is defined on DG1 functionspace)
I always mix up the definitions of jump(foo, n). I actually prefer just to write out what you want explicitly in terms of the restricted values.
I think I was not clear here. My code works when define F as: F = (fluxes*w)('+')*dS + fluxes*w*ds - avg(sol)*w('+')*dS - sol*w*ds‘
But when change it to a desired flux that contains grad(sol) such as below: F = (fluxes*w)('+')*dS + fluxes*w*ds - avg(inner(grad(sol), n))*w('+')*dS - inner(grad(sol), n)*w*ds
It returns error even when changing to grad(sol) only on ds term. This is the error I get: UFL:ERROR Shapes do not match: <Grad id=4986788992> and <Zero id=4998074176>.
Somehow one of the two terms was simplified to zero (perhaps n is zero)? This from firedrake import * mesh = UnitSquareMesh(1, 1) V = FunctionSpace(mesh, "DG", 1) Vt = FunctionSpace(mesh, "HDiv Trace", 0) v = TestFunction(Vt) sol = Function(V) n = FacetNormal(mesh) inner(grad(sol), n)*v*ds assemble(inner(grad(sol), n)*v*ds) works for me, but perhaps I am doing something different. Thanks, Lawrence