31 #include "libmesh/equation_systems.h" 32 #include "libmesh/linear_implicit_system.h" 33 #include "libmesh/nonlinear_implicit_system.h" 34 #include "libmesh/petsc_linear_solver.h" 35 #include "libmesh/petsc_matrix.h" 36 #include "libmesh/petsc_nonlinear_solver.h" 37 #include "libmesh/petsc_preconditioner.h" 38 #include "libmesh/petsc_vector.h" 39 #include "libmesh/sparse_matrix.h" 43 #include <petscsnes.h> 62 PetscVector<Number> & petsc_vec =
static_cast<PetscVector<Number> &
>(vector);
63 VecView(petsc_vec.vec(), 0);
69 PetscMatrix<Number> & petsc_mat =
static_cast<PetscMatrix<Number> &
>(mat);
70 MatView(petsc_mat.mat(), 0);
76 PetscVector<Number> & petsc_vec =
78 VecView(petsc_vec.vec(), 0);
84 PetscMatrix<Number> & petsc_mat =
86 MatView(petsc_mat.mat(), 0);
91 namespace PetscSupport
142 switch (solver_params.
_type)
180 DM dm = LIBMESH_PETSC_NULLPTR;
189 SNES snes = petsc_solver->
snes();
191 ierr = SNESGetDM(snes, &dm);
195 ierr = PetscObjectTypeCompare((PetscObject)dm, DMMOOSE, &ismoose);
202 ierr = DMSetFromOptions(dm);
206 ierr = SNESSetDM(snes, dm);
208 ierr = DMDestroy(&dm);
229 PetscGetArgs(&argc, &args);
230 #if PETSC_VERSION_LESS_THAN(3, 7, 0) 231 PetscOptionsInsert(&argc, &args, NULL);
233 PetscOptionsInsert(LIBMESH_PETSC_NULLPTR, &argc, &args, NULL);
241 #if PETSC_VERSION_LESS_THAN(3, 7, 0) 244 PetscOptionsClear(LIBMESH_PETSC_NULLPTR);
250 for (
const auto & flag : po.
flags)
254 for (
auto & option : po.
pairs)
263 char code[10] = {45, 45, 109, 111, 111, 115, 101};
264 const std::vector<std::string> argv = cmd_line->
getArguments();
265 for (
const auto & arg : argv)
267 if (arg.compare(code) == 0)
282 SNESConvergedReason * reason,
288 PetscErrorCode
ierr = 0;
300 ierr = SNESGetTolerances(snes, &atol, &rtol, &stol, &maxit, &maxf);
304 PetscReal divtol = 0.;
305 #if !PETSC_VERSION_LESS_THAN(3, 8, 0) 306 ierr = SNESGetDivergenceTolerance(snes, &divtol);
312 ierr = SNESGetNumberFunctionEvals(snes, &nfuncs);
317 #if !PETSC_VERSION_LESS_THAN(3, 8, 4) 318 PetscBool force_iteration = PETSC_FALSE;
319 ierr = SNESGetForceIteration(snes, &force_iteration);
327 ierr = SNESSetForceIteration(snes, PETSC_TRUE);
335 PetscBool domainerror;
336 ierr = SNESGetFunctionDomainError(snes, &domainerror);
340 *reason = SNES_DIVERGED_FUNCTION_DOMAIN;
364 if (msg.length() > 0)
365 #
if !PETSC_VERSION_LESS_THAN(3, 17, 0)
366 PetscInfo(snes,
"%s", msg.c_str());
368 PetscInfo(snes, msg.c_str());
371 switch (moose_reason)
374 *reason = SNES_CONVERGED_ITERATING;
378 *reason = SNES_CONVERGED_FNORM_ABS;
382 *reason = SNES_CONVERGED_FNORM_RELATIVE;
386 #if !PETSC_VERSION_LESS_THAN(3, 8, 0) // A new convergence enum in PETSc 3.8 387 *reason = SNES_DIVERGED_DTOL;
392 *reason = SNES_CONVERGED_SNORM_RELATIVE;
396 *reason = SNES_DIVERGED_FUNCTION_COUNT;
400 *reason = SNES_DIVERGED_FNORM_NAN;
404 *reason = SNES_DIVERGED_LINE_SEARCH;
408 *reason = SNES_DIVERGED_LOCAL_MIN;
438 return KSP_NORM_NONE;
440 return KSP_NORM_PRECONDITIONED;
442 return KSP_NORM_UNPRECONDITIONED;
444 return KSP_NORM_NATURAL;
446 return KSP_NORM_DEFAULT;
448 mooseError(
"Unknown KSP norm type requested.");
479 auto & es = problem.
es();
481 PetscReal rtol = es.parameters.get<
Real>(
"linear solver tolerance");
482 PetscReal atol = es.parameters.get<
Real>(
"linear solver absolute tolerance");
488 PetscReal maxits = es.parameters.get<
unsigned int>(
"linear solver maximum iterations");
491 KSPSetTolerances(ksp, rtol, atol, 1e100, maxits);
507 SNES snes = petsc_solver->
snes();
509 auto ierr = SNESGetKSP(snes, &ksp);
512 ierr = SNESSetMaxLinearSolveFailures(snes, 1000000);
515 ierr = SNESSetCheckJacobianDomainError(snes, PETSC_TRUE);
537 KSP ksp = petsc_solver->
ksp();
549 const std::string & solve_type = params.
get<
MooseEnum>(
"solve_type");
550 fe_problem.
solverParams().
_type = Moose::stringToEnum<Moose::SolveType>(solve_type);
559 Moose::stringToEnum<Moose::LineSearchType>(line_search);
564 NonlinearImplicitSystem * nl_system =
dynamic_cast<NonlinearImplicitSystem *
>(
567 mooseError(
"You've requested a line search but you must be solving an EigenProblem. " 568 "These two things are not consistent.");
569 PetscNonlinearSolver<Real> * petsc_nonlinear_solver =
570 dynamic_cast<PetscNonlinearSolver<Real> *
>(nl_system->nonlinear_solver.get());
571 if (!petsc_nonlinear_solver)
572 mooseError(
"Currently the MOOSE line searches all use Petsc, so you " 573 "must use Petsc as your non-linear solver.");
574 petsc_nonlinear_solver->linesearch_object =
575 std::make_unique<ComputeLineSearchObjectWrapper>(fe_problem);
588 const auto & petsc_pair_options =
589 params.
get<
MooseEnumItem, std::string>(
"petsc_options_iname",
"petsc_options_value");
606 for (
const auto & option : petsc_flags)
614 if (option ==
"-log_summary" || option ==
"-log_view")
615 mooseError(
"The PETSc option \"-log_summary\" or \"-log_view\" can only be used on the " 616 "command line. Please " 617 "remove it from the input file");
623 std::string help_string;
624 if (option ==
"-snes" || option ==
"-snes_mf" || option ==
"-snes_mf_operator")
625 help_string =
"Please set the solver type through \"solve_type\".";
626 else if (option ==
"-ksp_monitor")
627 help_string =
"Please use \"Outputs/print_linear_residuals=true\"";
629 if (help_string !=
"")
632 " should not be used directly in a MOOSE input file. ",
643 processPetscPairs(
const std::vector<std::pair<MooseEnumItem, std::string>> & petsc_pair_options,
644 const unsigned int mesh_dimension,
649 std::array<std::pair<bool, std::string>, 2> reason_flags = {
650 {std::make_pair(
false,
"-snes_converged_reason"),
651 std::make_pair(
false,
"-ksp_converged_reason")}};
653 for (
auto & reason_flag : reason_flags)
656 reason_flag.first =
true;
659 bool boomeramg_found =
false;
660 bool strong_threshold_found =
false;
661 #
if !PETSC_VERSION_LESS_THAN(3, 7, 0)
662 bool superlu_dist_found =
false;
663 bool fact_pattern_found =
false;
664 bool tiny_pivot_found =
false;
666 std::string pc_description =
"";
667 #if !PETSC_VERSION_LESS_THAN(3, 12, 0) 669 bool hmg_found =
false;
670 bool matptap_found =
false;
671 bool hmg_strong_threshold_found =
false;
673 #if !PETSC_VERSION_LESS_THAN(3, 19, 2) 675 bool options_left_set =
false;
677 std::vector<std::pair<std::string, std::string>> new_options;
679 for (
const auto & option : petsc_pair_options)
686 #if !PETSC_VERSION_LESS_THAN(3, 9, 0) 687 if (option.first ==
"-pc_factor_mat_solver_package")
688 new_options.emplace_back(
"-pc_factor_mat_solver_type", option.second);
690 if (option.first ==
"-pc_factor_mat_solver_type")
691 new_options.push_back(
"-pc_factor_mat_solver_package", option.second);
695 if (option.first ==
"-pc_type" || option.first ==
"-pc_sub_type" ||
696 option.first ==
"-pc_hypre_type")
697 pc_description += option.second +
' ';
699 #if !PETSC_VERSION_LESS_THAN(3, 12, 0) 700 if (option.first ==
"-pc_type" && option.second ==
"hmg")
709 #if !PETSC_VERSION_LESS_THAN(3, 17, 0) 710 if (hmg_found && (option.first ==
"-matptap_via" || option.first ==
"-matmaijptap_via" ||
711 option.first ==
"-matproduct_ptap_via"))
712 new_options.emplace_back(
"-mat_product_algorithm", option.second);
713 #elif !PETSC_VERSION_LESS_THAN(3, 13, 0) 714 if (hmg_found && (option.first ==
"-matptap_via" || option.first ==
"-matmaijptap_via"))
715 new_options.emplace_back(
"-matproduct_ptap_via", option.second);
717 if (hmg_found && (option.first ==
"-matproduct_ptap_via"))
719 new_options.emplace_back(
"-matptap_via", option.second);
720 new_options.emplace_back(
"-matmaijptap_via", option.second);
724 if (option.first ==
"-matptap_via" || option.first ==
"-matmaijptap_via" ||
725 option.first ==
"-matproduct_ptap_via" || option.first ==
"-mat_product_algorithm")
726 matptap_found =
true;
729 if (option.first ==
"-hmg_inner_pc_hypre_boomeramg_strong_threshold")
730 hmg_strong_threshold_found =
true;
733 if (option.first ==
"-pc_hypre_type" && option.second ==
"boomeramg")
734 boomeramg_found =
true;
735 if (option.first ==
"-pc_hypre_boomeramg_strong_threshold")
736 strong_threshold_found =
true;
737 #if !PETSC_VERSION_LESS_THAN(3, 7, 0) 738 if ((option.first ==
"-pc_factor_mat_solver_package" ||
739 option.first ==
"-pc_factor_mat_solver_type") &&
740 option.second ==
"superlu_dist")
741 superlu_dist_found =
true;
742 if (option.first ==
"-mat_superlu_dist_fact")
743 fact_pattern_found =
true;
744 if (option.first ==
"-mat_superlu_dist_replacetinypivot")
745 tiny_pivot_found =
true;
748 #if !PETSC_VERSION_LESS_THAN(3, 19, 2) 749 if (option.first ==
"-options_left")
750 options_left_set =
true;
753 if (!new_options.empty())
754 std::copy(new_options.begin(), new_options.end(), std::back_inserter(po.
pairs));
756 po.
pairs.push_back(option);
760 for (
unsigned int j = 0; j < po.
pairs.size(); j++)
761 if (option.first == po.
pairs[j].first)
762 po.
pairs[j].second = option.second;
766 #if !PETSC_VERSION_LESS_THAN(3, 14, 0) 767 for (
const auto & reason_flag : reason_flags)
770 if (!reason_flag.first && (std::find_if(po.
pairs.begin(),
772 [&reason_flag](
auto & pair) {
773 return pair.first == reason_flag.second;
774 }) == po.
pairs.end()))
775 po.
pairs.emplace_back(reason_flag.second,
"::failed");
780 if (boomeramg_found && !strong_threshold_found && mesh_dimension == 3)
782 po.
pairs.emplace_back(
"-pc_hypre_boomeramg_strong_threshold",
"0.7");
783 pc_description +=
"strong_threshold: 0.7 (auto)";
786 #if !PETSC_VERSION_LESS_THAN(3, 12, 0) 787 if (hmg_found && !hmg_strong_threshold_found && mesh_dimension == 3)
789 po.
pairs.emplace_back(
"-hmg_inner_pc_hypre_boomeramg_strong_threshold",
"0.7");
790 pc_description +=
"strong_threshold: 0.7 (auto)";
795 if (hmg_found && !matptap_found)
797 #if !PETSC_VERSION_LESS_THAN(3, 17, 0) 798 po.
pairs.emplace_back(
"-mat_product_algorithm",
"allatonce");
799 #elif !PETSC_VERSION_LESS_THAN(3, 13, 0) 800 po.
pairs.emplace_back(
"-matproduct_ptap_via",
"allatonce");
802 po.
pairs.emplace_back(
"-matptap_via",
"allatonce");
803 po.
pairs.emplace_back(
"-matmaijptap_via",
"allatonce");
808 #if !PETSC_VERSION_LESS_THAN(3, 7, 0) 811 if (superlu_dist_found && !fact_pattern_found)
813 po.
pairs.emplace_back(
"-mat_superlu_dist_fact",
814 #
if PETSC_VERSION_LESS_THAN(3, 7, 5)
815 "SamePattern_SameRowPerm");
816 pc_description +=
"mat_superlu_dist_fact: SamePattern_SameRowPerm ";
819 pc_description +=
"mat_superlu_dist_fact: SamePattern ";
824 if (superlu_dist_found && !tiny_pivot_found)
826 po.
pairs.emplace_back(
"-mat_superlu_dist_replacetinypivot",
"1");
827 pc_description +=
" mat_superlu_dist_replacetinypivot: true ";
835 #if !PETSC_VERSION_LESS_THAN(3, 19, 2) 836 if (!options_left_set && !po.
flags.
contains(
"-options_left"))
837 po.
pairs.emplace_back(
"-options_left",
"0");
841 std::set<std::string>
844 return {
"default",
"shell",
"none",
"basic",
"l2",
"bt",
"cp"};
852 MooseEnum solve_type(
"PJFNK JFNK NEWTON FD LINEAR");
855 "PJFNK: Preconditioned Jacobian-Free Newton Krylov " 856 "JFNK: Jacobian-Free Newton Krylov " 857 "NEWTON: Full Newton Solve " 858 "FD: Use finite differences to compute Jacobian " 859 "LINEAR: Solving a linear problem");
864 "Specifies the finite differencing type for " 865 "Jacobian-free solve types. Note that the " 866 "default is wp (for Walker and Pernice).");
872 params.
addParam<std::vector<std::string>>(
873 "petsc_options_value",
874 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\"");
886 "-dm_moose_print_embedding -dm_view -ksp_converged_reason -ksp_gmres_modifiedgramschmidt " 887 "-ksp_monitor -ksp_monitor_snes_lg-snes_ksp_ew -ksp_snes_ew -snes_converged_reason " 888 "-snes_ksp -snes_ksp_ew -snes_linesearch_monitor -snes_mf -snes_mf_operator -snes_monitor " 889 "-snes_test_display -snes_view",
897 return MultiMooseEnum(
"-ksp_atol -ksp_gmres_restart -ksp_max_it -ksp_pc_side -ksp_rtol " 898 "-ksp_type -mat_fd_coloring_err -mat_fd_type -mat_mffd_type " 899 "-pc_asm_overlap -pc_factor_levels " 900 "-pc_factor_mat_ordering_type -pc_hypre_boomeramg_grid_sweeps_all " 901 "-pc_hypre_boomeramg_max_iter " 902 "-pc_hypre_boomeramg_strong_threshold -pc_hypre_type -pc_type -snes_atol " 903 "-snes_linesearch_type " 904 "-snes_ls -snes_max_it -snes_rtol -snes_divergence_tolerance -snes_type " 905 "-sub_ksp_type -sub_pc_type",
917 PetscGetArgs(&argc, &args);
919 std::vector<std::string> cml_arg;
920 for (
int i = 0; i < argc; i++)
921 cml_arg.push_back(args[i]);
925 std::find(cml_arg.begin(), cml_arg.end(),
"vinewtonssls") == cml_arg.end() &&
926 std::find(cml_arg.begin(), cml_arg.end(),
"vinewtonrsls") == cml_arg.end())
937 #if PETSC_VERSION_LESS_THAN(3, 7, 0) 938 ierr = PetscOptionsSetValue(
name.c_str(),
value ==
"" ? LIBMESH_PETSC_NULLPTR :
value.c_str());
942 ierr = PetscOptionsSetValue(
943 LIBMESH_PETSC_NULLPTR,
name.c_str(),
value ==
"" ? LIBMESH_PETSC_NULLPTR :
value.c_str());
956 std::vector<unsigned int> & vertex_colors,
957 const char * coloring_algorithm)
961 MatCreate(MPI_COMM_SELF, &A);
962 MatSetSizes(A, size, size, size, size);
963 MatSetType(A, MATSEQDENSE);
965 MatSeqDenseSetPreallocation(A, adjacency_matrix);
966 MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY);
967 MatAssemblyEnd(A, MAT_FINAL_ASSEMBLY);
972 #
if PETSC_VERSION_LESS_THAN(3, 7, 0)
979 ISColoring iscoloring;
981 MatColoringCreate(A, &mc);
982 MatColoringSetType(mc, coloring_algorithm);
983 MatColoringSetMaxColors(mc, static_cast<PetscInt>(colors));
986 MatColoringSetDistance(mc, 1);
987 MatColoringSetFromOptions(mc);
988 MatColoringApply(mc, &iscoloring);
992 #if PETSC_RELEASE_LESS_THAN(3, 12, 0) 993 ISColoringGetIS(iscoloring, &nn, &
is);
995 ISColoringGetIS(iscoloring, PETSC_USE_POINTER, &nn, &
is);
998 if (nn > static_cast<PetscInt>(colors))
999 throw std::runtime_error(
"Not able to color with designated number of colors");
1001 for (
int i = 0; i < nn; i++)
1004 const PetscInt * indices;
1005 ISGetLocalSize(
is[i], &isize);
1006 ISGetIndices(
is[i], &indices);
1007 for (
int j = 0; j < isize; j++)
1009 mooseAssert(indices[j] < static_cast<PetscInt>(vertex_colors.size()),
"Index out of bounds");
1010 vertex_colors[indices[j]] = i;
1012 ISRestoreIndices(
is[i], &indices);
1016 MatColoringDestroy(&mc);
1017 ISColoringDestroy(&iscoloring);
1025 petsc_options.
flags.
erase(
"-snes_converged_reason");
1027 auto & pairs = petsc_options.pairs;
1029 if (it != pairs.end())
1038 petsc_options.
flags.
erase(
"-ksp_converged_reason");
1040 auto & pairs = petsc_options.pairs;
1042 if (it != pairs.end())
std::string name(const ElemQuality q)
MultiMooseEnum getCommonPetscKeys()
A helper function to produce a MultiMooseEnum with commonly used PETSc iname options (keys in key-val...
bool isSNESVI(FEProblemBase &fe_problem)
check if SNES type is variational inequalities (VI) solver
Moose::PetscSupport::PetscOptions & getPetscOptions()
Retrieve a writable reference the PETSc options (used by PetscSupport)
KSPNormType getPetscKSPNormType(Moose::MooseKSPNormType kspnorm)
void addPetscOptionsFromCommandline()
void storePetscOptions(FEProblemBase &fe_problem, const InputParameters ¶ms)
Stores the PETSc options supplied from the InputParameters with MOOSE.
SolverParams & solverParams()
Get the solver parameters.
static void petscSetupOutput()
Output string for setting up PETSC output.
virtual NonlinearSolver< Number > * nonlinearSolver()=0
virtual std::size_t numNonlinearSystems() const override
std::set< std::string > getPetscValidLineSearches()
Returns the valid petsc line search options as a set of strings.
void petscSetupDM(NonlinearSystemBase &nl, const std::string &dm_name)
Setup the PETSc DM object.
Moose::LineSearchType _line_search
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
void petscSetDefaults(FEProblemBase &problem)
Sets the default options for PETSc.
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
A struct for storing the various types of petsc options and values.
MultiMooseEnum flags
Single value PETSc options (flags)
C::iterator findPair(C &container, const M1 &first, const M2 &second)
Find a specific pair in a container matching on first, second or both pair components.
const Parallel::Communicator & comm() const
void petscSetDefaultKSPNormType(FEProblemBase &problem, KSP ksp)
Set norm type.
Solving a linear problem.
void petscSetKSPDefaults(FEProblemBase &problem, KSP ksp)
Set the default options for a KSP.
std::vector< std::pair< std::string, std::string > > pairs
PETSc key-value pairs.
virtual MooseNonlinearConvergenceReason checkNonlinearConvergence(std::string &msg, const PetscInt it, const Real xnorm, const Real snorm, const Real fnorm, const Real rtol, const Real divtol, const Real stol, const Real abstol, const PetscInt nfuncs, const PetscInt max_funcs, const Real div_threshold)
Check for convergence of the nonlinear solution.
void petscSetOptions(const PetscOptions &po, const SolverParams &solver_params)
A function for setting the PETSc options in PETSc from the options supplied to MOOSE.
MffdType
Type of the matrix-free finite-differencing parameter.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
auto max(const L &left, const R &right)
This class wraps provides and tracks access to command line parameters.
virtual EquationSystems & es() override
MooseKSPNormType
Norm type for converge test.
Nonlinear system to be solved.
PCSide getPetscPCSide(Moose::PCSideType pcs)
bool contains(const std::string &value) const
Contains methods for seeing if a value is in the MultiMooseEnum.
Use whatever we have in PETSc.
void setSolverOptions(const SolverParams &solver_params)
MultiMooseEnum getCommonPetscFlags()
A helper function to produce a MultiMooseEnum with commonly used PETSc single options (flags) ...
Moose::MffdType _mffd_type
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
LineSearchType
Type of the line search.
void MooseMatView(SparseMatrix< Number > &mat)
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
Use whatever we have in PETSc.
Jacobian-Free Newton Krylov.
void disableNonlinearConvergedReason(FEProblemBase &fe_problem)
disable printing of the nonlinear convergence reason
void processPetscPairs(const std::vector< std::pair< MooseEnumItem, std::string >> &petsc_pair_options, const unsigned int mesh_dimension, PetscOptions &petsc_options)
Populate name and value pairs in a given PetscOptions object using vectors of input arguments...
PetscErrorCode DMCreateMoose(MPI_Comm comm, NonlinearSystemBase &nl, const std::string &dm_name, DM *dm)
Create a MOOSE DM.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
PetscErrorCode PetscInt const PetscInt IS * is
Use finite differences to compute Jacobian.
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
void erase(const std::string &names)
Un-assign a value.
void setNonlinearForcedIterations(const unsigned int nl_forced_its)
method setting the minimum number of nonlinear iterations before performing divergence checks ...
LinearSystem & getLinearSystem(unsigned int sys_num)
Get non-constant reference to a linear system.
void processPetscFlags(const MultiMooseEnum &petsc_flags, PetscOptions &petsc_options)
Populate flags in a given PetscOptions object using a vector of input arguments.
MooseNonlinearConvergenceReason
Enumeration for nonlinear convergence reasons.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
InputParameters getPetscValidParams()
Returns the PETSc options that are common between Executioners and Preconditioners.
PetscErrorCode petscSetupOutput(CommandLine *cmd_line)
Class for containing MooseEnum item information.
virtual System & system() override
Get the reference to the libMesh system.
std::string stringify(const LineSearchType &t)
void push_back(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
void colorAdjacencyMatrix(PetscScalar *adjacency_matrix, unsigned int size, unsigned int colors, std::vector< unsigned int > &vertex_colors, const char *coloring_algorithm)
This method takes an adjacency matrix, and a desired number of colors and applies a graph coloring al...
IntRange< T > make_range(T beg, T end)
virtual MooseMesh & mesh() override
PCSideType
Preconditioning side.
SolverSystem & getSolverSystem(unsigned int sys_num)
Get non-constant reference to a solver system.
Linear system to be solved.
Preconditioned Jacobian-Free Newton Krylov.
virtual std::size_t numLinearSystems() const override
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
std::string pc_description
Preconditioner description.
static const struct MooseUtils::AnyType Any
PetscErrorCode petscNonlinearConverged(SNES snes, PetscInt it, PetscReal xnorm, PetscReal snorm, PetscReal fnorm, SNESConvergedReason *reason, void *ctx)
Moose::MooseKSPNormType getMooseKSPNormType()
Get the norm in which the linear convergence is measured.
void MooseVecView(NumericVector< Number > &vector)
PetscErrorCode DMMooseRegisterAll()
LinearImplicitSystem & linearImplicitSystem()
Return a reference to the stored linear implicit system.
virtual std::size_t numSolverSystems() const override
void setSinglePetscOption(const std::string &name, const std::string &value="")
A wrapper function for dealing with different versions of PetscOptionsSetValue.
const std::vector< std::string > & getArguments()
Return the raw argv arguments as a vector.
Moose::PCSideType getPCSide()
Get the current preconditioner side.
void petscSetDefaultPCSide(FEProblemBase &problem, KSP ksp)
Setup which side we want to apply preconditioner.
unsigned int getNonlinearForcedIterations() const
method returning the number of forced nonlinear iterations
void disableLinearConvergedReason(FEProblemBase &fe_problem)
disable printing of the linear convergence reason