70 #define SIS_USE_LAPACK 87 valarray<double>
y, Uy, U, Uyy(
N + 1);
92 U = 1.0 -
pow(
y, 2.0);
98 double k2 = kx * kx + kz * kz;
100 complex<double>
ii(0.0, 1.0);
106 Delta.
coef << 1.0, 0.0, -k2;
110 Delta2.
coef << 1.0, 0.0, -2 * k2, 0.0, k4;
121 Lmat << (-
ii * kx * U * Delta) + (
ii * kx * Uyy) + (Delta2 / Re), 0.0,
122 (-
ii * kz * Uy), (-
ii * kx * U) + (Delta / Re);
133 bc.
eval << -1.0, -1.0,
142 eigs.
compute(Lmat, Mmat, num_vals, bc);
143 eigs.keepConverged();
144 eigs.sortByLargestReal();
146 cout <<
"Eigenvalues in method 1: \n" << eigs.
eigenvalues <<
"\n";
148 outf.open(
"data/Ex_15_1.txt");
149 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> out_to_file(num_vals,
155 std::cout <<
"Done 1 :::::::" <<
'\n';
166 Mmat << 1.0, 0.0, 0.0, 0.0,
169 0.0, 0.0, 0.0, 0.0 * Delta;
172 Lmat << (-
ii * kx * U) + (Delta / Re), -Uy, 0.0, -
ii * kx,
173 0.0, (-
ii * kx * U) + (Delta / Re), 0.0, -Dy,
174 0.0, 0.0, (-
ii * kx * U) + (Delta / Re), -
ii * kz,
175 ii * kx, Dy,
ii * kz, 0.0;
185 Lbc.
L << 1.0, 0.0, 0.0, 0.0,
193 Lbc.
eval << 1.0, 0.0, 0.0, 0.0,
202 num_vals = 4 * (
N + 1);
203 eigs.
compute(Lmat, Mmat, num_vals, Lbc);
204 eigs.keepConverged();
205 eigs.sortByLargestReal();
206 cout <<
"Eigenvalues in method 2: \n" << eigs.
eigenvalues <<
"\n" << flush;
208 outf.open(
"data/Ex_15_2.txt");
209 out_to_file.resize(num_vals, 2);
217 Mmat << 1.0, 0.0, 0.0, 0.0,
223 Lbc.
L << 1.0, 0.0, 0.0, 0.0,
231 Lbc.
eval << 1.0, 0.0, 0.0, 0.0,
238 num_vals = 4 * (
N + 1);
240 eigs.
compute(Lmat, Mmat, num_vals, Lbc);
241 eigs.keepConverged();
242 eigs.sortByLargestReal();
243 cout <<
"Eigenvalues in method 3: \n" << eigs.
eigenvalues <<
"\n" << flush;
245 outf.open(
"data/Ex_15_3.txt");
246 out_to_file.resize(num_vals, 2);
BcMat will hold general Boundary conditions as LinopMats at evealuation points, as given by operator ...
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > eval
Linop This class creates a Linear operator to solve TPBVPs.
complex< double > ii(0.0, 1.0)
Eigen::Matrix< std::complex< T >, Eigen::Dynamic, 1 > eigenvalues
This class represents a block matrix operator. It is a matrix of operators.
int n
The order of the Linear differential operator.
void set()
Sets the the size of coefficient array based on the order of differential equation. Suppose order is 3, then the size of array needed is 4.
Eigen::Matrix< T, Eigen::Dynamic, 1 > coef
Stores the coefficients in the differential equation.
void setChebPts(std::valarray< T > &in)
This function sets points to evaluate a function so that a DCT will give represent the same function ...
valarray< complex< T > > pow(valarray< complex< T > > base, T power)
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...
int N
Specifies number of Chebyshev polynomials, default N = 31.
void resize(int m_, int n_)
This class will solve the generalized eigenvalue problem for two linear operators. One of them can be singular.
std::valarray< SIS_TYPE > y(N+1)
void resize(int r_, int c_)
This clears all contents in the LinopMat, and then creates a fresh LinopMat of size r_ x c_...