Initialize solver for a Newton solver. Args: F: The PDE residual F(u, v). u: The unknown. bcs: List of Dirichlet boundary conditions. J: UFL representation of the Jacobian (optional) form_compiler_options: Options used in FFCx
(
self,
F: ufl.form.Form,
u: _Function,
bcs: Sequence[DirichletBC] | None = None,
J: ufl.form.Form = None,
form_compiler_options: dict | None = None,
jit_options: dict | None = None,
)
| 1437 | """ # noqa: D301 |
| 1438 | |
| 1439 | def __init__( |
| 1440 | self, |
| 1441 | F: ufl.form.Form, |
| 1442 | u: _Function, |
| 1443 | bcs: Sequence[DirichletBC] | None = None, |
| 1444 | J: ufl.form.Form = None, |
| 1445 | form_compiler_options: dict | None = None, |
| 1446 | jit_options: dict | None = None, |
| 1447 | ): |
| 1448 | """Initialize solver for a Newton solver. |
| 1449 | |
| 1450 | Args: |
| 1451 | F: The PDE residual F(u, v). |
| 1452 | u: The unknown. |
| 1453 | bcs: List of Dirichlet boundary conditions. |
| 1454 | J: UFL representation of the Jacobian (optional) |
| 1455 | form_compiler_options: Options used in FFCx |
| 1456 | compilation of this form. Run ``ffcx --help`` at the |
| 1457 | command line to see all available options. |
| 1458 | jit_options: Options used in CFFI JIT compilation of C |
| 1459 | code generated by FFCx. See ``python/dolfinx/jit.py`` |
| 1460 | for all available options. Takes priority over all other |
| 1461 | option values. |
| 1462 | |
| 1463 | Example:: |
| 1464 | |
| 1465 | problem = NonlinearProblem(F, u, [bc0, bc1]) |
| 1466 | """ |
| 1467 | warnings.warn( |
| 1468 | ( |
| 1469 | "dolfinx.nls.petsc.NewtonSolver is deprecated. " |
| 1470 | + "Use dolfinx.fem.petsc.NonlinearProblem, " |
| 1471 | + "a high level interface to PETSc SNES, instead." |
| 1472 | ), |
| 1473 | DeprecationWarning, |
| 1474 | ) |
| 1475 | |
| 1476 | self._L = _create_form( |
| 1477 | F, form_compiler_options=form_compiler_options, jit_options=jit_options |
| 1478 | ) |
| 1479 | |
| 1480 | # Create the Jacobian matrix, dF/du |
| 1481 | if J is None: |
| 1482 | V = u.function_space |
| 1483 | du = ufl.TrialFunction(V) |
| 1484 | J = ufl.derivative(F, u, du) |
| 1485 | |
| 1486 | self._a = _create_form( |
| 1487 | J, form_compiler_options=form_compiler_options, jit_options=jit_options |
| 1488 | ) |
| 1489 | self.bcs = bcs |
| 1490 | |
| 1491 | @property |
| 1492 | def L(self) -> Form: |
nothing calls this directly
no test coverage detected