Hi,

I have a question regarding the point-wise norm of a vector field. Let’s say we have a vector field called `d`

, which we quantified using FEniCSx and stored its values (`d.x.array[:]`

) as a numpy array. The question is how to compute the norm of `d`

at each DoF as a post-processing step.

I am unsure whether reshaping `d.x.array[:]`

will give the x, y, and z components of `d`

. Anyone ideas on this?

Hi Alireza,

The dof array is ordered by vertices, so if you have a vector \mathbf{u}=(u_x, u_y, u_z) in each vertex, then `x.array[0:3]`

will be the values of u_x, u_y, u_z in the first vertex, `x.array[3:6]`

will be the u_x, u_y, u_z values in the second vertex and so on.

So in this example case you could’ve reshaped into (for example)

```
values = d.x.array[:].reshape((int(len(d.x.array)/3), 3))
```

to get an array with 3-component vectors, which you could take the point-wise norm of.

Cheers,

Halvor

2 Likes