Solve the eigen problem.
Use ARPACK to solve an eigen problem that is assembled by elements in a mesh in a Problem object.
90 int iparam[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
92 int ipntr[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
98 n = problem_pt->ndof();
108 std::ostringstream warning_stream;
109 warning_stream <<
"Number of requested eigenvalues " << nev <<
"\n"
110 <<
"is greater than the number of Arnoldi vectors:" << ncv
119 warning_stream <<
"Increasing number of Arnoldi vectors to " << ncv
120 <<
"\n but you may want to increase further using\n"
121 <<
"ARPACK::narnoldi()\n"
122 <<
"which will also get rid of this warning.\n";
129 int lworkl = 3 * ncv * ncv + 6 * ncv;
132 double**
v =
new double*;
133 *
v =
new double[ncv *
n];
138 double* resid =
new double[
n];
140 double* workd =
new double[3 *
n];
142 double* workl =
new double[lworkl];
175 std::ostringstream error_stream;
177 <<
"Spectrum is set to an invalid value. It must be 0, 1 or -1\n"
208 LinearAlgebraDistribution dist(problem_pt->communicator_pt(),
n,
false);
217 problem_pt->get_eigenproblem_matrices(
M, AsigmaM, sigmar);
224 bool LOOP_FLAG =
true;
274 for (
int i = 0;
i <
n;
i++)
276 x[
i] = workd[ipntr[0] - 1 +
i];
294 for (
int i = 0;
i <
n;
i++)
296 workd[ipntr[1] - 1 +
i] = rhs[
i];
305 for (
int i = 0;
i <
n;
i++)
307 rhs[
i] = workd[ipntr[2] - 1 +
i];
322 for (
int i = 0;
i <
n;
i++)
324 workd[ipntr[1] - 1 +
i] = rhs[
i];
332 for (
int i = 0;
i <
n;
i++)
334 x[
i] = workd[ipntr[0] - 1 +
i];
338 for (
int i = 0;
i <
n;
i++)
340 workd[ipntr[1] - 1 +
i] = rhs[
i];
351 oomph_info <<
"Not enough memory " << std::endl;
371 oomph_info <<
"Maximum number of iterations reached." << std::endl;
375 oomph_info <<
"No shifts could be applied during implicit Arnoldi "
376 <<
"update, try increasing NCV. " << std::endl;
388 int nconv = iparam[4];
403 double* eval_real =
new double[nconv + 1];
405 double* eval_imag =
new double[nconv + 1];
408 double* workev =
new double[3 * ncv];
410 double** z =
new double*;
411 *z =
new double[(nconv + 1) *
n];
456 oomph_info <<
"Error with _neupd, info = " << ierr << std::endl;
462 eigenvalue.resize(nconv);
463 for (
int j = 0;
j < nconv;
j++)
466 std::complex<double> eigen(eval_real[
j], eval_imag[
j]);
468 eigenvalue[
j] = eigen;
474 eigenvector.resize(nconv);
475 for (
int j = 0;
j < nconv;
j++)
478 for (
int i = 0;
i <
n;
i++)
480 eigenvector[
j][
i] = z[0][
j *
n +
i];
486 eigenvector.resize(0);
494 oomph_info <<
" Size of the matrix is " <<
n << std::endl;
495 oomph_info <<
" The number of Ritz values requested is " << nev
497 oomph_info <<
" The number of Arnoldi vectors generated (NCV) is "
499 oomph_info <<
" What portion of the spectrum: " << which << std::endl;
500 oomph_info <<
" The number of converged Ritz values is " << nconv
503 <<
" The number of Implicit Arnoldi update iterations taken is "
504 << iparam[2] << std::endl;
505 oomph_info <<
" The number of OP*x is " << iparam[8] << std::endl;
506 oomph_info <<
" The convergence criterion is " << tol << std::endl;
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
#define DNEUPD(RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI, WORKEV, BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, IPNTR, WORKD, WORKL, LWORKL, INFO)
Definition: arpack.h:125
#define DNAUPD(IDO, BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, IPNTR, WORKD, WORKL, LWORKL, INFO)
Matrix< RealScalar, Dynamic, Dynamic > M
Definition: bench_gemm.cpp:50
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
Definition: linear_algebra_distribution.h:457
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
Definition: linear_algebra_distribution.h:507
double Sigma_real
Definition: eigen_solver.h:65
virtual void solve(Problem *const &problem_pt, DoubleVector &result)=0
virtual void enable_resolve()
Definition: linear_solver.h:135
virtual void resolve(const DoubleVector &rhs, DoubleVector &result)
Definition: linear_solver.h:225
void disable_doc_time()
Disable documentation of solve times.
Definition: linear_solver.h:116
virtual void disable_resolve()
Definition: linear_solver.h:144
int info
Definition: level2_cplx_impl.h:39
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
list x
Definition: plotDoE.py:28
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2