← Back to team overview

dolfin team mailing list archive

Re: [Question #128351]: making a vector fields withprevious solution

 

On Friday October 8 2010 08:39:14 Sungick Kim wrote:
> Question #128351 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/128351
> 
>     Status: Answered => Open
> 
> Sungick Kim is still having a problem:
> Thank you very much for your replies, Anders and Johan.
> 
> Q = FunctionSpace(mesh, "DG", 1)
> u1 = Function(Q)
> u =  u1('-')
> velocity = Expression(('u','0','0'))
> 
> As you can see above, 'u' is not a scalar but a scalar field. In this
> case, how can I create an expression for the velocity vector? I intend
> to use 'grad(velocity)' for later formulation.

If I am not totaly off you should be able to do:

  velocity = as_vector(u, 0, 0)

Btw you can take a look in 

  demo/undocumented/tensor-weighted-poisson/python

to get a better feeling for the as_vector/as_matrix funtion.

Johan



Follow ups

References