www.mooseframework.org
PetscSupport.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef PETSCSUPPORT_H
16 #define PETSCSUPPORT_H
17 
18 #include "libmesh/libmesh.h" // Real, LIBMESH_HAVE_PETSC
19 
20 #ifdef LIBMESH_HAVE_PETSC
21 
22 // MOOSE includes
23 #include "MultiMooseEnum.h"
24 
25 #include "libmesh/petsc_macro.h"
26 
27 // Forward declarations
28 class FEProblemBase;
30 class CommandLine;
31 class InputParameters;
32 
33 namespace Moose
34 {
35 namespace PetscSupport
36 {
37 
42 {
43 public:
44  PetscOptions() : flags("", "", true) {}
45 
47  std::vector<std::string> inames;
48 
50  std::vector<std::string> values;
51 
54 
56  std::string pc_description;
57 };
58 
62 void petscSetOptions(FEProblemBase & problem);
63 
67 void petscSetDefaults(FEProblemBase & problem);
68 
70 
71 PetscErrorCode petscSetupOutput(CommandLine * cmd_line);
72 
76 void outputNorm(libMesh::Real old_norm, libMesh::Real norm, bool use_color = false);
77 
81 PetscErrorCode petscLinearMonitor(KSP /*ksp*/, PetscInt its, PetscReal rnorm, void * void_ptr);
82 
86 void storePetscOptions(FEProblemBase & fe_problem, const InputParameters & params);
87 
96 
99 
102 
109 void setSinglePetscOption(const std::string & name, const std::string & value = "");
110 
112 
119 void colorAdjacencyMatrix(PetscScalar * adjacency_matrix,
120  unsigned int size,
121  unsigned int colors,
122  std::vector<unsigned int> & vertex_colors,
123  const char * coloring_algorithm);
124 }
125 }
126 
127 #endif // LIBMESH_HAVE_PETSC
128 
129 #endif // PETSCSUPPORT_H
MultiMooseEnum getCommonPetscKeys()
A helper function to produce a MultiMooseEnum with commonly used PETSc iname options (keys in key-val...
Definition: PetscSupport.C:797
std::vector< std::string > values
Values for PETSc key-value pairs.
Definition: PetscSupport.h:50
void addPetscOptionsFromCommandline()
Definition: PetscSupport.C:217
void storePetscOptions(FEProblemBase &fe_problem, const InputParameters &params)
Stores the PETSc options supplied from the InputParameters with MOOSE.
Definition: PetscSupport.C:598
void petscSetDefaults(FEProblemBase &problem)
Sets the default options for PETSc.
Definition: PetscSupport.C:560
A struct for storing the various types of petsc options and values.
Definition: PetscSupport.h:41
MultiMooseEnum flags
Single value PETSc options (flags)
Definition: PetscSupport.h:53
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
This class wraps provides and tracks access to command line parameters.
Definition: CommandLine.h:36
NonlinearSystemBase * nl
Nonlinear system to be solved.
MultiMooseEnum getCommonPetscFlags()
A helper function to produce a MultiMooseEnum with commonly used PETSc single options (flags) ...
Definition: PetscSupport.C:785
void outputNorm(libMesh::Real old_norm, libMesh::Real norm, bool use_color=false)
Helper function for outputing the norm values with/without color.
PetscErrorCode petscLinearMonitor(KSP, PetscInt its, PetscReal rnorm, void *void_ptr)
Helper function for displaying the linear residual during PETSC solve.
InputParameters getPetscValidParams()
Returns the PETSc options that are common between Executioners and Preconditioners.
Definition: PetscSupport.C:738
PetscErrorCode petscSetupOutput(CommandLine *cmd_line)
Definition: PetscSupport.C:265
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...
Definition: PetscSupport.C:831
Definition: Moose.h:84
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.
Definition: PetscSupport.h:56
void petscSetOptions(FEProblemBase &problem)
A function for setting the PETSc options in PETSc from the options supplied to MOOSE.
Definition: PetscSupport.C:235
void petscSetupDM(NonlinearSystemBase &nl)
Definition: PetscSupport.C:170
void setSinglePetscOption(const std::string &name, const std::string &value="")
A wrapper function for dealing with different versions of PetscOptionsSetValue.
Definition: PetscSupport.C:812
std::vector< std::string > inames
Keys for PETSc key-value pairs.
Definition: PetscSupport.h:47