deal.II version GIT relicensing-6842-g793a97d2aa 2026-10-02 14:00:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
nox.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2022 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_trilinos_nox_h
14#define dealii_trilinos_nox_h
15
16#include <deal.II/base/config.h>
17
18#ifdef DEAL_II_TRILINOS_WITH_NOX
19
21
23
24# include <Teuchos_ParameterList.hpp>
25
26# include <exception>
27# include <functional>
28
29#endif
30
32
33#ifdef DEAL_II_TRILINOS_WITH_NOX
34namespace TrilinosWrappers
35{
36 // Indicate that NOXSolver has not converged.
38
39
87 template <typename VectorType>
89 {
90 public:
97 {
105 enum class NormType
106 {
110 L1,
114 L2,
118 Linfty,
119 };
120
127 enum class NormScaling
128 {
132 Unscaled,
138 Scaled
139 };
140
141 public:
145 AdditionalData(const unsigned int max_iter = 10,
146 const double abs_tol = 1.e-20,
147 const double rel_tol = 1.e-5,
148 const unsigned int threshold_nonlinear_iterations = 1,
149 const unsigned int threshold_n_linear_iterations = 0,
150 const bool reuse_solver = false,
153
157 unsigned int max_iter;
158
168 double abs_tol;
169
174
179
186 double rel_tol;
187
193
209
217 };
218
230 const Teuchos::RCP<Teuchos::ParameterList> &parameters =
231 Teuchos::rcp(new Teuchos::ParameterList));
232
237
241 void
243
248 unsigned int
249 solve(VectorType &solution);
250
263 std::function<void(const VectorType &u, VectorType &F)> residual;
264
277 std::function<void(const VectorType &current_u)> setup_jacobian;
278
296 std::function<void(const VectorType &current_u)> setup_preconditioner;
297
318 std::function<void(const VectorType &x, VectorType &y)> apply_jacobian;
319
343 std::function<
344 void(const VectorType &y, VectorType &x, const double tolerance)>
346
379 std::function<
380 int(const VectorType &y, VectorType &x, const double tolerance)>
382
402 std::function<SolverControl::State(const unsigned int i,
403 const double norm_f,
404 const VectorType &current_u,
405 const VectorType &f)>
407
427
428 private:
433
439 const Teuchos::RCP<Teuchos::ParameterList> parameters;
440
445
450
455
460
466 mutable std::exception_ptr pending_exception;
467 };
468} // namespace TrilinosWrappers
469
470#endif
471
473
474#endif
std::function< void(const VectorType &x, VectorType &y)> apply_jacobian
Definition nox.h:318
std::function< SolverControl::State(const unsigned int i, const double norm_f, const VectorType &current_u, const VectorType &f)> check_iteration_status
Definition nox.h:406
unsigned int n_residual_evaluations
Definition nox.h:444
unsigned int n_nonlinear_iterations
Definition nox.h:454
std::function< void(const VectorType &current_u)> setup_preconditioner
Definition nox.h:296
unsigned int n_last_linear_iterations
Definition nox.h:459
std::function< void(const VectorType &y, VectorType &x, const double tolerance)> solve_with_jacobian
Definition nox.h:345
std::function< bool()> update_preconditioner_predicate
Definition nox.h:426
std::function< void(const VectorType &u, VectorType &F)> residual
Definition nox.h:263
AdditionalData additional_data
Definition nox.h:432
unsigned int solve(VectorType &solution)
NOXSolver(AdditionalData &additional_data, const Teuchos::RCP< Teuchos::ParameterList > &parameters=Teuchos::rcp(new Teuchos::ParameterList))
std::function< void(const VectorType &current_u)> setup_jacobian
Definition nox.h:277
const Teuchos::RCP< Teuchos::ParameterList > parameters
Definition nox.h:439
std::exception_ptr pending_exception
Definition nox.h:466
unsigned int n_jacobian_applications
Definition nox.h:449
std::function< int(const VectorType &y, VectorType &x, const double tolerance)> solve_with_jacobian_and_track_n_linear_iterations
Definition nox.h:381
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define DeclException0(Exception0)
static ::ExceptionBase & ExcNOXNoConvergence()
AdditionalData(const unsigned int max_iter=10, const double abs_tol=1.e-20, const double rel_tol=1.e-5, const unsigned int threshold_nonlinear_iterations=1, const unsigned int threshold_n_linear_iterations=0, const bool reuse_solver=false, const NormType norm_type=NormType::L2, const NormScaling norm_scaling=NormScaling::Scaled)