# Assemble and assemble\_system

**URL:** https://fenicsproject.discourse.group/t/assemble-and-assemble-system/2157
**Category:** Uncategorized
**Created:** [January 2, 2020, 3:54am UTC](https://fenicsproject.discourse.group/t/assemble-and-assemble-system/2157 "2020-01-02T03:54:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Karl\_Banana](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/karl_banana/32/412_2.png) [@Karl\_Banana](https://fenicsproject.discourse.group/u/Karl_Banana)
#### Post date: [January 2, 2020, 3:54am UTC](https://fenicsproject.discourse.group/t/assemble-and-assemble-system/2157/1 "2020-01-02T03:54:44Z")

</div>

Hi, all.

I’m getting in-symmetric matrix after assemble and bc.apply. And I found the following comment from earlier documentation. I do not get the idea how can assemble() and bc.apply() does not preserve the symmetry of assembled matrix and still can solve the problem. As I understand, apply boundary condition is by set the boundary dof diag value to 1 and other values in the column and row to 0. However I found it not always true for assemble() and bc.apply(). Could anyone give more insight to this three functions? assemble(), assemble\_system(), bc.apply().

* * *

Assemble form(s) and apply any given boundary conditions in a symmetric fashion and return tensor(s).  
The standard application of boundary conditions does not necessarily preserve the symmetry of the assembled matrix. In order to perserve symmetry in a system of equations with boundary conditions, one may use the alternative assemble\_system instead of multiple calls to [`assemble`](https://fenicsproject.org/docs/dolfin/2017.2.0/python/programmers-reference/fem/assembling/assemble.html#dolfin.fem.assembling.assemble).

---

<div class="post-metadata">

### Author: ![volkerk](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@volkerk](https://fenicsproject.discourse.group/u/volkerk)
#### Post date: [January 8, 2020, 8:40am UTC](https://fenicsproject.discourse.group/t/assemble-and-assemble-system/2157/2 "2020-01-08T08:40:20Z")

</div>

bc.apply() only sets the rows to zero (exept diagonal value), thus symmetry is not preserved. When using assemble\_system() the columns are also set to zero, and the vector b is modified accordingly.
