Subject: Re: [Ufl] [Question #192523]: Define a Form using max

From: Anders Logg <[email-masked]>
Date: Wed, 4 Apr 2012 14:33:57 +0200

On Tue, Apr 03, 2012 at 02:50:58PM -0000, Knut Erik wrote:
> New question #192523 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/192523
>
> Say that I want to define a Form which describes the following equation:
>
> u(x) = u(1-u)*max(0,u-0.5)
>
> How would you go about defining this in UFL?

Try something like

  conditional(ge(u, 0.5), u - Constant(0.5), 0.0)

I haven't tested this and have never really used the conditionals
myself.

Note to Martin and others: would it be possible to add max, min to UFL
as simple shortcuts?

--
Anders