defining Expression as a product

Asked by shriram on 2013-02-18

Suppose,
v0 = Expression(('sin(pi*x[0])*sin(pi*x[1])*(exp(t) -1)', 'cos(pi*x[0])*cos(pi*x[1])*(exp(t) -1)'), t=0.1)
 p0 = Expression('x[0]*(x[0] - 1)*x[1]*(x[1] - 1)*cos(pi*t)', t=0.1)
In the above expressions, the term (exp(t)-1) is a common factor in v0 while cos(pi*t) is so in p0. Is there any way to write these terms as product of 2 expressions. When I try doing that, I get an error when I define DirichletBC for V.
Thanks,
Shriram

Question information

Language:
English Edit question
Status:
Answered
For:
FEniCS Project Edit question
Assignee:
No assignee Edit question
Last query:
2013-02-18
Last reply:
2013-02-18
Johan Hake (johan-hake) said : #1

Not without writing a complex C++ Expression. Look at the doc string of
Expression for hints of how to do this.
Johan
On Feb 18, 2013 5:41 AM, "shriram" <email address hidden>
wrote:

> New question #222168 on FEniCS Project:
> https://answers.launchpad.net/fenics/+question/222168
>
> Suppose,
> v0 = Expression(('sin(pi*x[0])*sin(pi*x[1])*(exp(t) -1)',
> 'cos(pi*x[0])*cos(pi*x[1])*(exp(t) -1)'), t=0.1)
> p0 = Expression('x[0]*(x[0] - 1)*x[1]*(x[1] - 1)*cos(pi*t)', t=0.1)
> In the above expressions, the term (exp(t)-1) is a common factor in v0
> while cos(pi*t) is so in p0. Is there any way to write these terms as
> product of 2 expressions. When I try doing that, I get an error when I
> define DirichletBC for V.
> Thanks,
> Shriram
>
> --
> You received this question notification because you are a member of
> FEniCS Team, which is an answer contact for FEniCS Project.
>

Can you help with this problem?

Provide an answer of your own, or ask shriram for more information if necessary.

To post a message you must log in.