### How to assemble matrix and vector without node reordering

270

views

1

Hi,

It came to my attention that, the FEniCS assembly and solve routines are optimized for speed by

For example: Printed soution after solving Poisson's problem for a small mesh:

U = [ 0. 0. -0.24479167 0. -0.47916667 -0.27604167 0. -0.24479167 0. -0.27604167 0. 0. 0.]

And when I open "poisson000000.vtu" it is reordered to assign outputs to appropriate nodes:

U = [ 0. 0. 0. 0. 0. 0. 0. 0. -0.47916667 -0.27604167 -0.24479167 -0.24479167 -0.27604167].

Is there a way to

Or a way to reorder the assembled matrix and vector to the original nodal orders?

I am interested in calling assembly routines from FEniCS and then use the in-house domain decomposition methods (DDM solver) to solve the system. To do that, I need to export the assembly matrix and vector in its original nodal order.

Thanks,

-A

It came to my attention that, the FEniCS assembly and solve routines are optimized for speed by

**changing the nodes ordering**. After solving, the solution vector is changed to the original node ordering for visualization.For example: Printed soution after solving Poisson's problem for a small mesh:

U = [ 0. 0. -0.24479167 0. -0.47916667 -0.27604167 0. -0.24479167 0. -0.27604167 0. 0. 0.]

And when I open "poisson000000.vtu" it is reordered to assign outputs to appropriate nodes:

U = [ 0. 0. 0. 0. 0. 0. 0. 0. -0.47916667 -0.27604167 -0.24479167 -0.24479167 -0.27604167].

Is there a way to

**get the assembly matrix and vector****without node reordering**, even if it is slow?Or a way to reorder the assembled matrix and vector to the original nodal orders?

I am interested in calling assembly routines from FEniCS and then use the in-house domain decomposition methods (DDM solver) to solve the system. To do that, I need to export the assembly matrix and vector in its original nodal order.

Thanks,

-A

Community: FEniCS Project

### 2 Answers

3

0

I would use "vertex_to_dof_map" to get the ordering indices. For example:

```
mesh = UnitSquareMesh(2**5, 2**5)
V = FunctionSpace(mesh, 'CG', 1)
order = vertex_to_dof_map(V)
```

Please login to add an answer/comment or follow this question.