← Back to team overview

dolfin team mailing list archive

Re: Extracting vector field from a tensor field

 

I want to do the opposite, assign to a subfunction.

2009/3/21, Anders Logg <logg@xxxxxxxxx>:
> On Sat, Mar 21, 2009 at 05:05:53PM +0100, Martin Sandve Alnæs wrote:
>> Hi,
>> now that we can use tensor elements in dolfin through UFL,
>> what would be the easiest way to extract a row of a tensor
>> field (Function over a TensorElement) as a vector field?
>> I think scalar subcomponents can easily be extracted,
>> but is it possible to piece these together to a vector field?
>> Something like:
>>
>> Function v(V);
>> Function a = A[0];
>> Function b = A[1];
>> v[0] = a;
>> v[0] = b;
>
> I don't understand. What is A and what dimension does v have?
>
> We already have some support for this. For any mixed space one may
> extract sub spaces and sub functions. Here's the favorite Stokes
> example:
>
> (W = V + Q)
>
> Function w(W);
>
> Function u = w[0]; // u vector-valued with d components
> Function p = w[1]; // p scalar
>
> Function ux = u[0]; // ux scalar
> Function uy = u[1]; // uy scalar
>
> --
> Anders
>

-- 
Sendt fra min mobile enhet

Martin


Follow ups

References