dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22595
Re: [Question #152662]: diff() converts a constant to a zero
Question #152662 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/152662
Status: Open => Answered
Martin Sandve Alnæs proposed the following answer:
I found and fixed the set + tuple bug quickly, but I'm not sure if that
really solves your problem.
Why do you want a zero form? There are currently problems with
representing 0*dx in UFL that occur in other contexts as well.
Martin
On 13 April 2011 13:57, B. Emek Abali
<question152662@xxxxxxxxxxxxxxxxxxxxx>wrote:
> New question #152662 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/152662
>
> if I want to use an expression or its derivative
>
> V=VectorFunctionSpace(...)
> v=Function(V)
> z=variable(v)
> a=det(grad(v))
> Da=diff(a,z)
> form = v[i]*Da[i]*dx
>
> it is fine, but if the expresion is a constant
>
> b=10.0
> Db=diff(b,z)
> form = v[i]*Db[i]*dx
>
> the diff() returns a Zero and thus raise an error
> TypeError: unsupported operand type(s) for +: 'set' and 'tuple'
>
> How should I define the constant expression that it differentiates as a
> list with three zeros?
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help : https://help.launchpad.net/ListHelp
>
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.