Piecewise defined form (conditional in ufl file?)
Hi everybody,
I need to write in a ufl file a piecewise defined functional:
L =
inner(grad(
1/normg(
2*inner(
normg() is a function that gives the norm of the gradient. I tried to use conditional(
Thanks a lot for the help!
Here is the code of the ufl file:
t1=1
t2=2
element=
w = TrialFunction(
f = Coefficient(
u = Coefficient(
# Euclidean norm of the gradient
def normg(v):
return sqrt(inner(
L = conditional( lt(normg(u),t1), inner(grad(
# L = conditional( lt(normg(u),t1), m2*normg(u), \
# conditional( lt(normg(u),t2), \
# m2*t1, \
# m1*normg(u))) \
# *inner(
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Last query:
- 2010-06-09
- Last reply:
- 2010-06-09
On 9 June 2010 19:10, Cataldo Manigrasso
<email address hidden> wrote:
> New question #114079 on DOLFIN:
> https:/
>
> Hi everybody,
>
> I need to write in a ufl file a piecewise defined functional:
>
> L =
> inner(grad(
> 1/normg(
> 2*inner(
>
> normg() is a function that gives the norm of the gradient. I tried to use conditional(
Conditionals are not supported (yet). As the error says. It is
supported in UFL, meaning that it is possible to create the form, but
the form compiler FFC does not generate any code because that has not
been implemented.
There is a blueprint for this
https:/
looks like it has been assigned to me...
However, it is not on top of my TODO list and I can't say when I'll
get around to fix it. It is possible to implement a workaround until I
fix it by handling the conditionals in main.cpp and manipulate the
values of the Coefficient u.
Kristian
> Thanks a lot for the help!
>
> Here is the code of the ufl file:
>
> t1=1
> t2=2
>
> element=
> w = TrialFunction(
> f = Coefficient(
> u = Coefficient(
> # Euclidean norm of the gradient
> def normg(v):
> return sqrt(inner(
>
> L = conditional( lt(normg(u),t1), inner(grad(
> 1/normg(
>
> # L = conditional( lt(normg(u),t1), m2*normg(u), \
> # conditional( lt(normg(u),t2), \
> # m2*t1, \
> # m1*normg(u))) \
> # *inner(
>
>
>
>
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Can you help with this problem?
Provide an answer of your own, or ask Cataldo Manigrasso for more information if necessary.