ffc team mailing list archive
-
ffc team
-
Mailing list archive
-
Message #03684
Re: More optimisation bugs
On 2 February 2010 10:15, Garth N. Wells <gnw20@xxxxxxxxx> wrote:
> I still have a problem with fractions + quadrature + optimisation. The
> script I sent yesterday now works, but the below scripts leads to a FFC
> error
>
> File
> "/usr/local/lib/python2.6/dist-packages/ffc/quadrature/sumobj.py",
> line 495, in reduce_vartype
> f, r = v.reduce_vartype(var_type)
> ValueError: too many values to unpack
>
> when using foo/2.0 rather than 0.5*foo.
Fixed, and the norms are even equal.
I think we should release and quickly.
Kristian
> Garth
>
>
>
>
> from dolfin import *
>
> mesh = UnitSquare(3, 3)
> n = FacetNormal(mesh)
>
> PV = VectorFunctionSpace(mesh, "CG", 1)
> P0 = FunctionSpace(mesh, "Discontinuous Lagrange", 0)
> mixed_space = MixedFunctionSpace([PV, P0])
>
> # Function spaces and functions
> r = TestFunction(P0)
> U0 = Function(mixed_space)
> u0, s0 = split(U0)
>
> U0.vector()[:] = 1.0
>
> F = 1.0/(s0**2 + 1.0)
>
> # This breaks FFC
> un = (dot(u0, n) + sqrt(dot(u0, n)*dot(u0, n)))/2.0
> un_h = (dot(u0, n) - sqrt(dot(u0, n)*dot(u0, n)))/2.0
>
> # This works
> #un = 0.5*(dot(u0, n) + sqrt(dot(u0, n)*dot(u0, n)))
> #un_h = 0.5*(dot(u0, n) - sqrt(dot(u0, n)*dot(u0, n)))
>
> L = jump(r)*(un('+')*F('+') - un('-')*F('-'))*dS
>
> param0 = {"representation": "quadrature", "optimize": False}
> param1 = {"representation": "quadrature", "optimize": True}
> print "Vec norm (no opt): ", assemble(L,
> form_compiler_parameters=param0).norm("l2")
> print "Vec norm (with opt): ", assemble(L,
> form_compiler_parameters=param1).norm("l2")
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ffc
> Post to : ffc@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ffc
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References