cashocs.nonlinear_solvers.ts.ts_pseudo_solve#
- cashocs.nonlinear_solvers.ts.ts_pseudo_solve(nonlinear_form: ufl.Form, u: fenics.Function, bcs: fenics.DirichletBC | list[fenics.DirichletBC], derivative: ufl.Form | None = None, petsc_options: _typing.KspOption | None = None, shift: ufl.Form | None = None, rtol: float | None = None, atol: float | None = None, max_iter: int | None = None, A_tensor: fenics.PETScMatrix | None = None, b_tensor: fenics.PETScVector | None = None, preconditioner_form: ufl.Form | None = None, excluded_from_time_derivative: list[int] | None = None) fenics.Function [source]#
Solve a nonlinear PDE problem with PETSc TS and pseudo time stepping.
An overview over possible PETSc command line options for the TS can be found at https://petsc.org/release/manualpages/TS/
- Parameters:
nonlinear_form (ufl.Form) – The variational form of the nonlinear problem to be solved by Newton’s method.
u (fenics.Function) – The sought solution / initial guess. It is not assumed that the initial guess satisfies the Dirichlet boundary conditions, they are applied automatically. The method overwrites / updates this Function.
bcs (fenics.DirichletBC | list[fenics.DirichletBC]) – A list of DirichletBCs for the nonlinear variational problem.
derivative (ufl.Form | None, optional) – The Jacobian of nonlinear_form, used for the Newton method. Default is None, and in this case the Jacobian is computed automatically with AD.
petsc_options (_typing.KspOption | None, optional) – The options for PETSc TS object. Defaults to None.
shift (ufl.Form | None, optional) – A shift term, if the right-hand side of the nonlinear problem is not zero, but shift. Defaults to None.
rtol (float | None, optional) – Relative tolerance of the solver. If this is set to a float, the float is used as relative tolerance. If this is set to None, then the relative tolerance of the SNES object is used, which can be defined with the petsc options snes_rtol rtol. Defaults to None.
atol (float | None, optional) – Absolute tolerance of the solver. If this is set to a float, the float is used as absolute tolerance. If this is set to None, then the absolute tolerance of the SNES object is used, which can be defined with the petsc options snes_atol atol. Defaults to None.
max_iter (int | None, optional) – Maximum number of iterations carried out by the method. Overrides the specification in the petsc_options. Defaults to None.
A_tensor (fenics.PETScMatrix | None, optional) – A fenics.PETScMatrix for storing the left-hand side of the linear sub-problem. Defaults to None.
b_tensor (fenics.PETScVector | None, optional) – A fenics.PETScVector for storing the right-hand side of the linear sub-problem. Defaults to None.
preconditioner_form (ufl.Form | None, optional) – A UFL form which defines the preconditioner matrix. Defaults to None.
excluded_from_time_derivative (list[int] | None, optional) – A list of indices for those components that are not included in the time derivative. Example: The pressure for incompressible Navier-Stokes. Default is None, so that all components are included for the time derivative.
- Returns:
The solution in form of a FEniCS Function.
- Return type:
fenics.Function