12#include "libmesh/libmesh.h"
18#include "libmesh/petsc_macro.h"
19#include "libmesh/linear_solver.h"
20#include "libmesh/petsc_linear_solver.h"
53 std::vector<std::pair<std::string, std::string>>
pairs;
103 const std::vector<SolverParams> & solver_params,
157 const std::string & prefix,
218 const std::vector<std::pair<MooseEnumItem, std::string>> & petsc_pair_options,
219 const unsigned int mesh_dimension,
266 const std::string & value =
"",
274 const std::string & name,
275 const std::string & value =
"",
313 std::vector<unsigned int> & vertex_colors,
314 const char * coloring_algorithm);
361std::unique_ptr<PetscMatrix<Number>>
364 const std::string & binary_mat_file,
365 unsigned int mat_number_to_load = 1);
367#define SNESGETLINESEARCH SNESGetLineSearch
This class wraps provides and tracks access to command line parameters.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Activates a problem's PETSc options database for the lifetime of this scope.
bool _pushed
Whether a database was pushed and therefore needs to be popped.
PetscOptionsScope & operator=(const PetscOptionsScope &)=delete
FEProblemBase & _problem
Problem whose PETSc options database is activated.
PetscOptionsScope(const PetscOptionsScope &)=delete
A struct for storing the various types of petsc options and values.
MultiMooseEnum dont_add_these_options
Flags to explicitly not set, even if they are specified programmatically.
std::string pc_description
Preconditioner description.
std::vector< std::pair< std::string, std::string > > pairs
PETSc key-value pairs.
MultiMooseEnum user_set_options
Options that are set by the user at the input level.
MultiMooseEnum flags
Single value PETSc options (flags)
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
Nonlinear system to be solved.
Base class shared by both Action and MooseObject.
void dontAddLinearConvergedReason(FEProblemBase &fe_problem)
Function to ensure that -ksp_converged_reason is not added to the PetscOptions storage object to be l...
void petscSetOptions(const PetscOptions &po, const SolverParams &solver_params, FEProblemBase *const problem=nullptr)
A function for setting the PETSc options in PETSc from the options supplied to MOOSE.
PetscErrorCode petscSetupOutput(CommandLine *cmd_line)
void petscSetDefaultKSPNormType(FEProblemBase &problem, KSP ksp)
Set norm type.
void setConvergedReasonFlags(FEProblemBase &fe_problem, std::string prefix)
Set flags that will instruct the user on the reason their simulation diverged from PETSc's perspectiv...
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...
void setMFFDTypeFromParams(FEProblemBase &fe_problem, const InputParameters ¶ms)
Sets the FE problem's matrix-free finite difference type from the input params.
void dontAddCommonSNESOptions(FEProblemBase &fe_problem)
Function to ensure that common SNES options are not added to the PetscOptions storage object to be la...
MultiMooseEnum getCommonPetscFlags()
A helper function to produce a MultiMooseEnum with commonly used PETSc single options (flags)
void dontAddPetscFlag(const std::string &flag, PetscOptions &petsc_options)
Function to ensure that a particular petsc option is not added to the PetscOptions storage object to ...
void setLinearSolverDefaults(FEProblemBase &problem, libMesh::LinearSolver< T > &linear_solver)
Set the defaults for a libMesh LinearSolver.
MultiMooseEnum getCommonKSPKeys()
A helper function to produce a MultiMooseEnum with commonly used PETSc ksp option names (keys)
void processSingletonMooseWrappedOptions(FEProblemBase &fe_problem, const InputParameters ¶ms)
Process some MOOSE-wrapped PETSc options.
bool isSNESVI(FEProblemBase &fe_problem)
check if SNES type is variational inequalities (VI) solver
void petscSetDefaults(FEProblemBase &problem)
Sets the default options for PETSc.
void dontAddCommonKSPOptions(FEProblemBase &fe_problem)
Function to ensure that common KSP options are not added to the PetscOptions storage object to be lat...
void petscSetKSPDefaults(FEProblemBase &problem, KSP ksp)
Set the default options for a KSP.
MultiMooseEnum getCommonSNESKeys()
A helper function to produce a MultiMooseEnum with commonly used PETSc snes option names (keys)
void addPetscOptionsFromCommandline(FEProblemBase *const problem=nullptr)
Insert command-line PETSc options into the active PETSc options database.
MultiMooseEnum getCommonKSPFlags()
A helper function to produce a MultiMooseEnum with commonly used PETSc ksp single options (flags)
void outputNorm(libMesh::Real old_norm, libMesh::Real norm, bool use_color=false)
Helper function for outputting the norm values with/without color.
void petscSetDefaultPCSide(FEProblemBase &problem, KSP ksp)
Setup which side we want to apply preconditioner.
InputParameters getPetscValidParams()
Returns the PETSc options that are common between Executioners and Preconditioners.
void setSinglePetscOptionIfAppropriate(const MultiMooseEnum &dont_add_these_options, const std::string &name, const std::string &value="", FEProblemBase *const problem=nullptr)
Same as setSinglePetscOption, but does not set the option if it doesn't make sense for the current si...
void registerPetscCitation(const std::string &bibtex)
Register a BibTeX entry with PETSc's citation list so that it is printed (alongside the run-specific ...
void setSinglePetscOption(const std::string &name, const std::string &value="", FEProblemBase *const problem=nullptr)
A wrapper function for dealing with different versions of PetscOptionsSetValue.
std::set< std::string > getPetscValidLineSearches()
Returns the valid petsc line search options as a set of strings.
MultiMooseEnum getCommonSNESFlags()
A helper function to produce a MultiMooseEnum with commonly used PETSc snes single options (flags)
void storePetscOptionsFromParams(FEProblemBase &fe_problem, const InputParameters ¶ms)
Stores the Petsc flags and pair options fron the input params in the given PetscOptions object.
void setSolveTypeFromParams(FEProblemBase &fe_problem, const InputParameters ¶ms)
Sets the FE problem's solve type from the input params.
void dontAddNonlinearConvergedReason(FEProblemBase &fe_problem)
Function to ensure that -snes_converged_reason is not added to the PetscOptions storage object to be ...
void storePetscOptions(FEProblemBase &fe_problem, const std::string &prefix, const ParallelParamObject ¶m_object)
Stores the PETSc options supplied from the parameter object on the problem.
MultiMooseEnum getCommonPetscKeys()
A helper function to produce a MultiMooseEnum with commonly used PETSc iname options (keys in key-val...
void setLineSearchFromParams(FEProblemBase &fe_problem, const InputParameters ¶ms)
Sets the FE problem's line search from the input params.
void addPetscFlagsToPetscOptions(const MultiMooseEnum &petsc_flags, std::string prefix, const ParallelParamObject ¶m_object, PetscOptions &petsc_options)
Populate flags in a given PetscOptions object using a vector of input arguments.
std::unique_ptr< PetscMatrix< Number > > createMatrixFromFile(const libMesh::Parallel::Communicator &comm, Mat &petsc_mat, const std::string &binary_mat_file, unsigned int mat_number_to_load=1)
Create a matrix from a binary file.
void addPetscPairsToPetscOptions(const std::vector< std::pair< MooseEnumItem, std::string > > &petsc_pair_options, const unsigned int mesh_dimension, std::string prefix, const ParallelParamObject ¶m_object, PetscOptions &petsc_options)
Populate name and value pairs in a given PetscOptions object using vectors of input arguments.
PetscErrorCode petscLinearMonitor(KSP, PetscInt its, PetscReal rnorm, void *void_ptr)
Helper function for displaying the linear residual during PETSC solve.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Tnew cast_ref(Told &oldvar)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real