Newton solver in dolfinx

Hi all,

(1) How can I modify the parameters of Newton solver in dolfinx? Specifically, I want to change the maximum_iterations. I know it is easy to realize in dolfin, but I could not find the corresponding parameter in dolfinx. Also, where could I find a list of all the parameters of Newton solver in dolfinx?

(2) In addition, I received a warning when I run a code with 4-node quadrilateral elements as follows:

Number of integration points per cell is: 225. Consider using 'quadrature_degree' to reduce number.

I would like to know how to fix this problem? And is not the default number of integration points of 4-node quadrilateral elements equal to 4 in dolfinx?

I think I the answer to my first question is max_it via the testing.

Parameters can be found at: https://docs.fenicsproject.org/dolfinx/main/cpp/d9/dbf/classdolfinx_1_1nls_1_1NewtonSolver.html#a0167f7e699d15da8cbf9ad63c26aae83

Say you have a first order quadrilateral element (both as you mesh, and function space).
Then the maximal polynomial degree of a single function in that space is 2.
Thus, if you assemble a mass matrix, you can end up with a 4th order polynomial (u*v).
An unstructured quadrilateral mesh is non affine, and the Jacobian used in the pull back is no longer a constant (it becomes a linear function).
Thus, when you want to assemble a mass matrix using linear elements on a quadrilateral, your integral is at least a fifth order polynomial, and you therefore need to choose your quadrature rule with that in mind.

Note that you can set the quadrature order using

dx=ufl.Measure("dx", metadata={“quadrature_degree": 4})

as shown in:
https://jorgensd.github.io/dolfinx-tutorial/chapter2/hyperelasticity.html

Also note that I recently changed ffcx to reduce the number of quadrature points by one order:

If you want to know more about the quadrature schemes used in dolfinx, I recommend you having a look at: https://github.com/FEniCS/basix/blob/main/cpp/basix/quadrature.cpp#L851

and the subsequent functions.

1 Like

@Yingqi_Jia to add some more info, the Netwon solver in dolfin-x and the interface for non-linear solvers has been updated, see: Create Nonlinear problem and Python interface of NewtonSolver. by jorgensd · Pull Request #1478 · FEniCS/dolfinx · GitHub and the Cahn HIlliard demo for updates (I am in the process of updating the non-linear Poisson problem in the tutorial).

1 Like