4 #define EIGEN_USE_MKL_ALL 7 #define EIGEN_FAST_MATH 0 17 typedef complex<double>
Cd_t;
18 typedef valarray<double>
Vd_t;
19 typedef valarray<complex<double> >
Vcd_t;
23 valarray<double> Wes(20);
24 Eigen::VectorXd psd(20);
26 for (
int i = 0; i < 20; i++) {
27 Wes[i] = double(i + 1);
32 Vcd_t U(
N + 1), Uy(
N + 1), Uyy(
N + 1);
33 string flowType(
"Couette");
35 if (flowType.compare(
"Poiseuille") == 0) {
38 Uyy =
Cd_t(-2.0, 0.0);
39 }
else if (flowType.compare(
"Couette") == 0) {
44 std::cout <<
"Unknown flow type, in line " << __LINE__ <<
'\n' 49 Eigen::MatrixXd valsS(10, 2);
50 Eigen::MatrixXd valsV(10, 2);
53 for (
int i = 0; i < 10; i++) {
61 Vcd_t c(
N + 1), cy(
N + 1), cyy(
N + 1), a0(
N + 1), a1(
N + 1), a2(
N + 1),
64 Dyyyy.coef << 1.0, 0.0, 0.0, 0.0, 0.0;
65 Dyyy.coef << 1.0, 0.0, 0.0, 0.0;
66 Dyy.coef << 1.0, 0.0, 0.0;
70 c = (
ii * omega + 1.0 + (
ii * kx * We * U));
71 cy =
ii * kx * We * Uy;
72 cyy =
ii * kx * We * Uyy;
74 a4 = -beta + (-1.0 + beta)/c;
76 a3 = (-2.0*(-1.0 + beta)*(cy -
Cd_t(0.0,1.0)*c*kx*Uy*We))/
pow(c,2.0);
78 a2 = 2.0*beta*
pow(kx,2.0) - ((-1.0 + beta)*(-2.0*
pow(cy,2.0) - 4.0*kx*Uy*We*(
Cd_t(0.0,1.0)*cy + kx*Uy*We) +
79 pow(c,2.0)*kx*(2.0*kx -
Cd_t(0.0,3.0)*Uyy*We + 2.0*kx*
pow(Uy,2.0)*
pow(We,2.0)) + c*(cyy +
Cd_t(0.0,2.0)*kx*We*(Uyy + Uy*(cy +
Cd_t(0.0,1.0)*kx*Uy*We)))))/
82 a1 = (
Cd_t(0.0,-2.0)*(-1.0 + beta)*kx*(6.0*cy*U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c,4.0);
93 LinopMat<Cd_t> Amat(1, 1), B(1, 2), C(2, 1), Ctau(3, 1), Cpsi(1,1), Ctauxx(1,1), Ctauxy(1,1), Ctauyy(1,1);
94 Amat << ((a4*Dyyyy) + (a3 * Dyyy) + (a2 * Dyy) + (a1 * Dy) + a0);
101 lbc.eval.setConstant(-1.0);
102 rbc.eval.setConstant(1.0);
108 Vcd_t((kx*(
Cd_t(0.0,1.0)*c*Uyy*We + kx*(c + 2.0*(1.0 + c)*
pow(Uy,2.0)*
pow(We,2.0))))/
pow(c,2.0));
111 Vcd_t((2.0*kx*Uy*We*(
Cd_t(0.0,1.0)*c*(1.0 + 2.0*c)*Uyy*We + kx*(c + 2.0*(1.0 + c)*
pow(Uy,2.0)*
pow(We,2.0))))/
pow(c,3.0));
126 svd.
compute(Amat, B, C, lbc, rbc,10);
131 svd.
compute(Amat, B, Ctauxx, lbc, rbc, 10);
134 std::cout <<
"i = " << i <<
'\n';
139 outfile.open(
"data/Ex_13_Vel.txt");
142 outfile.open(
"data/Ex_13_Stress.txt");
BcMat will hold general Boundary conditions as LinopMats at evealuation points, as given by operator ...
valarray< complex< double > > Vcd_t
valarray< complex< double > > Vcd_t
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.
std::valarray< std::complex< SIS_TYPE > > yc(N+1)
void compute(const LinopMat< T > &A_, const BcMat< T > &Lbc_, const BcMat< T > &Rbc_, int num_vals)
Computes the singular values/functions of a Linear block matrix operator.
Eigen::Matrix< T, Eigen::Dynamic, 1 > coef
Stores the coefficients in the differential equation.
valarray< complex< T > > pow(valarray< complex< T > > base, T power)
This class computes various SingularValues of a differential block matrix operator using using it's a...
int N
Specifies number of Chebyshev polynomials, default N = 31.