Constrains using null space in dolfinx

IMHO, @bagla0 you should have led with a bit more of context. By previous interactions, I guess that these questions are related to Mixed function space with dolfinx - how to implement an integral constraint - #6 by bagla0, but any other reader may not be aware of this.

In addition to what @dokken is saying, keep in mind that should have two rigid body motions (in 2D) associated to a translation. A basis could be (1, 0) for displacement in the x-direction and (0, 1) for displacement in the y-direction. Therefore, rather than

c.interpolate(lambda x: np.ones(x.shape[1]))

you will have to come up with a lambda function that is non-zero only on one component of the displacement. To do that, follow the suggestions above.

Not sure either. Instead, @bagla0 you definitely need to add a third (in 2D) vector in null space to prevent rigid rotations. That’s not really my field, but I guess the third element in the null space could be something like (-y, x) in 2D. Maybe @bleyerj can confirm, or fix my suggestion if it is wrong. Depending on what the third vector looks like, you may need to carry out an orthonormalization with dolfinx.la.orthonormalize before passing the three vectors to PETSc.

1 Like