Spectral Integral Suite in C++
Ex_08.cpp
Go to the documentation of this file.
1 
13 #include <fstream>
14 #include <iostream>
15 #include <sis.hpp>
16 
17 using namespace std;
18 typedef complex<double> Cd_t;
19 typedef valarray<double> Vd_t;
20 
21 int main() {
22  using namespace sis;
23  N = 255;
24  sis_setup();
25 
26  double Re = 5772.0;
27  Cd_t ii(0.0, 1.0);
28  Linop<double> D0(0), D1(1), D2(2), D3(3), D4(4);
29  D4.coef << 1.0, 0.0, 0.0, 0.0, 0.0;
30  D3.coef << 1.0, 0.0, 0.0, 0.0;
31  D2.coef << 1.0, 0.0, 0.0; // for (1.0 * D2 + 0.0 * D1 + (0.0) )v
32  D1.coef << 1.0, 0.0;
33  D0.coef << 1.0;
34 
35  LinopMat<Cd_t> Lmat(1,1), Mmat(1,1);
36 
37  Lmat << D4 / Re - Vd_t(2.0 / Re + (1.0 - pow(y, 2.0)))*ii*D2 +
38  (D0 / Re) - (2.0 * ii*D0) + ii*(Vd_t(1.0 - pow(y, 2.0))*D0);
39 
40  Mmat << D2 - D0;
41 
42  BcMat<Cd_t> bcs(4,1);
43  bcs.L << D0,//
44  D0,//
45  D1,//
46  D1;
47  bcs.eval << 1.0,//
48  -1.0,//
49  1.0,//
50  -1.0;
51 
53  eigs.compute(Lmat, Mmat, 6, bcs);
54  std::cout << "Eigenvalues are:\n" << eigs.eigenvalues << '\n';
55 
56  return 0;
57 }
void sis_setup()
Definition: sis.hpp:954
BcMat will hold general Boundary conditions as LinopMats at evealuation points, as given by operator ...
Definition: sis.hpp:529
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > eval
Definition: sis.hpp:8832
Linop This class creates a Linear operator to solve TPBVPs.
Definition: sis.hpp:2560
Definition: sis.hpp:260
complex< double > ii(0.0, 1.0)
valarray< double > Vd_t
Definition: Ex_08.cpp:19
int main()
Definition: Ex_08.cpp:21
Eigen::Matrix< std::complex< T >, Eigen::Dynamic, 1 > eigenvalues
Definition: sis.hpp:3257
This class represents a block matrix operator. It is a matrix of operators.
Definition: sis.hpp:528
Definition: sis.hpp:461
Eigen::Matrix< T, Eigen::Dynamic, 1 > coef
Stores the coefficients in the differential equation.
Definition: sis.hpp:2569
valarray< complex< T > > pow(valarray< complex< T > > base, T power)
Definition: sis.hpp:453
LinopMat< T > L
Definition: sis.hpp:8831
void compute(Linop< T > L, Linop< T > M, int num_vals)
Call this with an input Linear operator to solve for eigenvalues and vectors. The number of Eigen val...
Definition: sis.hpp:3267
int N
Specifies number of Chebyshev polynomials, default N = 31.
Definition: sis.hpp:472
This class will solve the generalized eigenvalue problem for two linear operators. One of them can be singular.
Definition: sis.hpp:3253
complex< double > Cd_t
Definition: Ex_08.cpp:18
std::valarray< SIS_TYPE > y(N+1)
complex< double > Cd_t
Definition: Ex_05.cpp:17