Kristian Oelgaard wrote: > > > On 3 February 2010 09:48, Garth Wells <gn...@cam.ac.uk> wrote: >> Bug was in FFC, marking as invalid. >> >> ** Changed in: ufl >> Status: Confirmed => Invalid > > I would call this a bug in UFL. > > from ufl.algorithms import propagate_restrictions > cell = triangle > V = FiniteElement("DG", cell, 1) > u = Coefficient(V) > flux2 = variable(grad(u)) > > e = avg(flux2) > print e > print propagate_restrictions(e) > > produces: > > { A | A_{i_8} = 0.5 * ((((var0(grad(w_0)))('-')) + > ((var0(grad(w_0)))('+')))[i_8]) } > { A | A_{i_8} = 0.5 * (({ A | A_{i_9} = 2 * > ((var0(grad((w_0)('-'))))[i_9]) })[i_8]) } > > I don't see why UFL shouldn't be able to handle that. >
Reply to the bug report so we can track the discussion. Garth > Kristian > >> -- >> variable + facet restriction broken >> https://bugs.launchpad.net/bugs/512425 >> You received this bug notification because you are a member of UFL Core >> Team, which is the registrant for UFL. >> >> Status in Unified Form Language: Invalid >> >> Bug description: >> UFL is doing something wrong when a Function which is made into a >> 'variable', e.g. u = variable(u), is used for a facet integral. The >> below code demonstrates the error. >> >> >> >> from dolfin import * >> from numpy import random >> >> mesh = UnitSquare(24, 24) >> n = FacetNormal(mesh) >> V = FunctionSpace(mesh, "DG", 1) >> v = TestFunction(V) >> u = Function(V) >> >> # Fill vector with some numbers >> random.seed(2) >> u.vector().set_local( random.rand(u.vector().size()) ) >> >> # Define flux. One without, and one with 'variable' >> flux1 = grad(u) >> flux2 = variable(grad(u)) >> >> # Define linear forms >> L0 = dot(jump(v, n), avg(grad(u)))*dS >> L1 = dot(jump(v, n), avg(flux1))*dS >> L2 = dot(jump(v, n), avg(flux2))*dS >> L3 = dot(jump(v, n), flux2('+'))*dS >> L4 = dot(jump(v, n), flux2('-'))*dS >> >> print "Testing matrix norms. All should be equal." >> print "Norm case 0: ", assemble(L0).norm("l2") >> print "Norm case 1: ", assemble(L1).norm("l2") >> print "Norm case 2 (using variable): ", assemble(L2).norm("l2") >> print "Norm case 3 (using variable): ", assemble(L3).norm("l2") >> print "Norm case 4 (using variable): ", assemble(L4).norm("l2") >> >> >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > Mailing list: https://launchpad.net/~ffc > Post to : ffc@lists.launchpad.net > Unsubscribe : https://launchpad.net/~ffc > More help : https://help.launchpad.net/ListHelp _______________________________________________ Mailing list: https://launchpad.net/~ffc Post to : ffc@lists.launchpad.net Unsubscribe : https://launchpad.net/~ffc More help : https://help.launchpad.net/ListHelp