← Back to team overview

ufl team mailing list archive

Re: Patch to coefficient derivative of conditional

 

Hi Jan, looks good. Have you signed the copyright consent form?
http://fenicsproject.org/contributing/contributing_code.html

Martin


On 3 October 2012 22:55, Jan Blechta <blechta@xxxxxxxxxxxxxxxxxx> wrote:
> Hello,
> I suggest change in ForwardAD algorithm for conditional. Let us
> calculate derivative of conditional this way
>   op = conditional(c[0], 1, 0)*t[1] + conditional(c[0], 0, 1)*f[1]
> rather than like that
>   op = conditional(c[0], t[1], f[1])
>
> I think this patch enables other ffc/ufl algorithms to see linearity of
> this derivative in variation and enables compiling of this example:
>   elem = FiniteElement("CG", triangle, 1)
>   u  = Coefficient(elem)
>   v  = TestFunction(elem)
>   du = TrialFunction(elem)
>   F = conditional(ge(u, 0), u*u, 0)*v*dx
>   J = derivative(F, u, du)
>
> Best regards,
> Jan Blechta
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ufl
> Post to     : ufl@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ufl
> More help   : https://help.launchpad.net/ListHelp
>


References