FFC

Does FFC support exponentiation

Asked by Patrick Riesen

Dear all

I did not use dolfin/ffc for quite a time, but i want to upgrade my code to the lastet releases.

is it now possible to use exponentiation, can ffc handle an expression like (grad(v)+grad(v).T)**a with exponent 'a' ?

thanks for your help,
patrick

Question information

Language:
English Edit question
Status:
Solved
For:
FFC Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Blechta
Solved:
Last query:
Last reply:
Revision history for this message
Jan Blechta (blechta) said :
#1

What does power of tensor mean? You can take power of scalars.

Revision history for this message
Patrick Riesen (priesen) said :
#2

yes, sorry i should be more precise, i want to exponentiate an expression which gives a scalar,

if i have

def A1(r):
    return (grad(r) + grad(r).T)

i want to take the power 'n' of the expression:

tr(dot(A1(r),A1(r)))**n

in a form.

so can 'n' be a coefficient like

n = Coefficient(ScalarElement)

which i can set arbitrarily in my code?

Revision history for this message
Best Jan Blechta (blechta) said :
#3

On Sun, 24 Mar 2013 18:56:02 -0000
Patrick Riesen <email address hidden> wrote:
> Question #225019 on FFC changed:
> https://answers.launchpad.net/ffc/+question/225019
>
> Status: Answered => Open
>
> Patrick Riesen is still having a problem:
> yes, sorry i should be more precise, i want to exponentiate an
> expression which gives a scalar,
>
> if i have
>
> def A1(r):
> return (grad(r) + grad(r).T)
>
> i want to take the power 'n' of the expression:
>
> tr(dot(A1(r),A1(r)))**n
>
> in a form.
>
> so can 'n' be a coefficient like
>
> n = Coefficient(ScalarElement)
>
> which i can set arbitrarily in my code?
>

UFL definitely supports it. Try compiling it. But you may nead to tweak
quadrature degree because if b is not integer UFL estimates polynomial
degree of a**b as 2*polynomial_degree(a).

Revision history for this message
Martin Sandve Alnæs (martinal) said :
#4

Yes. Just try it!

Martin
Den 24. mars 2013 19:56 skrev "Patrick Riesen" <
<email address hidden>> følgende:

> Question #225019 on FFC changed:
> https://answers.launchpad.net/ffc/+question/225019
>
> Status: Answered => Open
>
> Patrick Riesen is still having a problem:
> yes, sorry i should be more precise, i want to exponentiate an
> expression which gives a scalar,
>
> if i have
>
> def A1(r):
> return (grad(r) + grad(r).T)
>
> i want to take the power 'n' of the expression:
>
> tr(dot(A1(r),A1(r)))**n
>
> in a form.
>
> so can 'n' be a coefficient like
>
> n = Coefficient(ScalarElement)
>
> which i can set arbitrarily in my code?
>
> --
> You received this question notification because you are a member of FFC
> Team, which is an answer contact for FFC.
>

Revision history for this message
Patrick Riesen (priesen) said :
#5

OK, sounds nice. I will see if i can adapt my forms and get this to work.

Thanks a lot for your responses.

patrick

Revision history for this message
Patrick Riesen (priesen) said :
#6

Thanks Jan Blechta, that solved my question.