22 params.
addRequiredParam<std::string>(
"mat",
"The petsc binary mat file containing the matrix");
23 params.
addParam<
Real>(
"zero_tol", 1e-8,
"The tolerance for determining zero values");
24 params.
addParam<
bool>(
"print",
false,
"Whether to print the eigensolves to the console");
30 _zero_tol(getParam<
Real>(
"zero_tol")),
31 _mat_name(getParam<
std::string>(
"mat")),
32 _print(getParam<bool>(
"print"))
39 PetscViewer matviewer;
58 PetscReal error, re, im;
59 PetscInt nconv, nev, i;
71 " Number of requested eigenvalues: %" PetscInt_FMT
"\n",
80 " Number of converged eigenpairs: %" PetscInt_FMT
"\n\n",
93 " k ||Ax-kx||/||kx||\n" 94 " ----------------- ------------------\n"));
97 for (i = 0; i < nconv; i++)
103 LibmeshPetscCallA(
_communicator.
get(), EPSGetEigenpair(
eps, i, &kr, &ki,
nullptr,
nullptr));
107 LibmeshPetscCallA(
_communicator.
get(), EPSComputeError(
eps, i, EPS_ERROR_RELATIVE, &error));
109 #if defined(PETSC_USE_COMPLEX) 110 re = PetscRealPart(kr);
111 im = PetscImaginaryPart(kr);
116 const bool zero_im = std::abs(im) <
_zero_tol;
117 const bool zero_re = std::abs(re) <
_zero_tol;
124 PETSC_COMM_WORLD,
" %9f+%9fi %12g\n", (
double)re, (
double)im, (
double)error));
128 PetscPrintf(
_communicator.
get(),
" %12f %12g\n", (double)re, (
double)error));
130 if (zero_im && zero_re)
const std::string & _mat_name
registerMooseObject("NavierStokesApp", MatrixEigenvalueCheck)
virtual void execute() override
static InputParameters validParams()
const Parallel::Communicator & _communicator
virtual Real getValue() const override
static InputParameters validParams()
Real _num_zero_eigenvalues
MatrixEigenvalueCheck(const InputParameters ¶meters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Returns the number of zero eigenvalues in a PETSc matrix.
const ConsoleStream _console
virtual void finalize() override
virtual void initialize() override