From 35defbd423407b2650a5fb95dfc116c5bdce5012 Mon Sep 17 00:00:00 2001 From: Stefano Zampini Date: Sat, 22 Apr 2023 21:40:38 +0300 Subject: [PATCH] Minor adaptions to TS and SNES classes --- include/deal.II/lac/petsc_snes.h | 6 ++++-- include/deal.II/lac/petsc_ts.h | 10 ++++++---- include/deal.II/lac/petsc_ts.templates.h | 2 +- source/lac/petsc_ts.cc | 2 +- tests/petsc/petsc_ts_02.cc | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/deal.II/lac/petsc_snes.h b/include/deal.II/lac/petsc_snes.h index ebae3fa4da..c91df7e0fe 100644 --- a/include/deal.II/lac/petsc_snes.h +++ b/include/deal.II/lac/petsc_snes.h @@ -203,8 +203,8 @@ namespace PETScWrappers * ./myApp -snes_type newtontr -ksp_type cg * @endcode * in case the user wants to change the default nonlinear solver to - * a trust region solver and iterate on the tangent system with CG, - * still using NonlinearSolver::solve_with_jacobian as a preconditioner. + * a trust region solver and iterate on the matrix-free tangent system with + * CG, still using NonlinearSolver::solve_with_jacobian as a preconditioner. * * The first approach has instead the advantage that only the matrix assembly * procedure has to be provided, thus allowing quicker implementations and @@ -213,6 +213,8 @@ namespace PETScWrappers * @code * ./myApp -ksp_type cg -pc_type gamg * @endcode + * See NonlinearSolver::set_matrix and NonlinearSolver::set_matrices for + * additional details. * * In case the nonlinear equations are derived from energy minimization * arguments, it may be beneficial to perform linesearch or test trust-region diff --git a/include/deal.II/lac/petsc_ts.h b/include/deal.II/lac/petsc_ts.h index 3dc726407f..1ca9a58568 100644 --- a/include/deal.II/lac/petsc_ts.h +++ b/include/deal.II/lac/petsc_ts.h @@ -61,7 +61,7 @@ namespace PETScWrappers * * Error parameters: * - * @param tsadapttype The string indicating the PETSc time step adaptor type. + * @param ts_adapt_type The string indicating the PETSc time step adaptor type. * @param minimum_step_size Minimum step size allowed. * @param maximum_step_size Maximum step size allowed. * @param absolute_tolerance Absolute error tolerance. @@ -89,7 +89,7 @@ namespace PETScWrappers const int max_steps = -1, const bool match_step = false, // Error parameters - const std::string &tsadapttype = "none", + const std::string &ts_adapt_type = "none", const real_type minimum_step_size = -1.0, const real_type maximum_step_size = -1.0, const real_type absolute_tolerance = -1.0, @@ -102,7 +102,7 @@ namespace PETScWrappers , initial_step_size(initial_step_size) , max_steps(max_steps) , match_step(match_step) - , tsadapttype(tsadapttype) + , ts_adapt_type(ts_adapt_type) , minimum_step_size(minimum_step_size) , maximum_step_size(maximum_step_size) , absolute_tolerance(absolute_tolerance) @@ -158,7 +158,7 @@ namespace PETScWrappers /** * PETSc time step adaptor type. */ - std::string tsadapttype; + std::string ts_adapt_type; /** * Minimum allowed step size for adaptive time stepping. @@ -283,6 +283,8 @@ namespace PETScWrappers * @code * ./myApp -ksp_type cg -pc_type gamg * @endcode + * See TimeStepper::set_matrix and TimeStepper::set_matrices for + * additional details. * * @ingroup PETScWrappers */ diff --git a/include/deal.II/lac/petsc_ts.templates.h b/include/deal.II/lac/petsc_ts.templates.h index 91d3268c64..61ac4d3b99 100644 --- a/include/deal.II/lac/petsc_ts.templates.h +++ b/include/deal.II/lac/petsc_ts.templates.h @@ -178,7 +178,7 @@ namespace PETScWrappers // Adaptive time stepping TSAdapt tsadapt; AssertPETSc(TSGetAdapt(ts, &tsadapt)); - AssertPETSc(TSAdaptSetType(tsadapt, data.tsadapttype.c_str())); + AssertPETSc(TSAdaptSetType(tsadapt, data.ts_adapt_type.c_str())); // As of 3.19, PETSc does not propagate options prefixes to the // adaptors. diff --git a/source/lac/petsc_ts.cc b/source/lac/petsc_ts.cc index f54cdc0b20..823379263b 100644 --- a/source/lac/petsc_ts.cc +++ b/source/lac/petsc_ts.cc @@ -57,7 +57,7 @@ namespace PETScWrappers prm.enter_subsection("Error control"); prm.add_parameter("adaptor type", - tsadapttype, + ts_adapt_type, "The string for the TSAdapt type."); prm.add_parameter("minimum step size", minimum_step_size, diff --git a/tests/petsc/petsc_ts_02.cc b/tests/petsc/petsc_ts_02.cc index 43315dc92f..2c9dc4429d 100644 --- a/tests/petsc/petsc_ts_02.cc +++ b/tests/petsc/petsc_ts_02.cc @@ -35,9 +35,9 @@ public: { // Customize solver: use BDF and basic adaptive time stepping PETScWrappers::TimeStepperData data; - data.ts_type = "bdf"; - data.final_time = 1.0; - data.tsadapttype = "basic"; + data.ts_type = "bdf"; + data.final_time = 1.0; + data.ts_adapt_type = "basic"; reinit(data); // Here we solve the two variables system: -- 2.39.5