24 cout <<
"=== EVP: Temporal spectra of the Orr-Sommerfeld eqn =\n";
25 cout <<
"=== with a matrix problem assembled by hand.\n";
30 const std::size_t nodes( 301 );
32 const std::size_t N( 2 * nodes );
34 const double left = -1.0;
35 const double right = 1.0;
37 const double d = ( right - left ) / ( nodes - 1 );
44 const double alpha ( 1.02 );
45 const double Re ( 5772.2 );
54 for ( std::size_t i = 1; i <= nodes - 2; ++i )
57 const double y = left + i * d;
59 const double U = ( 1.0 - y * y );
60 const double Udd = -2.0;
63 std::size_t row = 2 * i;
64 a( row, row ) = -2.0 / ( d * d ) - alpha * alpha;
65 a( row, row - 2 ) = 1.0 / ( d * d );
66 a( row, row + 2 ) = 1.0 / ( d * d );
67 a( row, row + 1 ) = -1.0;
71 a( row, row ) = -2.0 / ( d * d ) - alpha * alpha - I * alpha * Re *
U;
72 a( row, row - 2 ) = 1.0 / ( d * d );
73 a( row, row + 2 ) = 1.0 / ( d * d );
74 a( row, row - 1 ) = I * alpha * Re * Udd;
76 b( row, row ) = - I * alpha * Re;
79 a( N - 2, N - 2 ) = 1.5 / d;
80 a( N - 2, N - 4 ) = -2.0 / d;
81 a( N - 2, N - 6 ) = 0.5 / d;
82 a( N - 1, N - 2 ) = 1.0;
91 catch (
const std::runtime_error &error )
93 cout <<
" \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
101 double min_growth_rate( lambdas[ 0 ].imag() );
103 const double tol = 1.e-3;
105 std::string dirname(
"./DATA");
106 mkdir( dirname.c_str(), S_IRWXU );
108 spectrum.
push_ptr( &lambdas,
"evs" );
110 if ( std::abs( min_growth_rate ) < tol )
112 cout <<
"\033[1;32;48m * PASSED \033[0m\n";
116 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
117 cout <<
" Final error = " << min_growth_rate <<
"\n";
A shorter bundled include file for ODE_EVP and general eigenvalue problems.
A linear Nth-order generalised eigensystem class.
DenseVector< D_complex > get_tagged_eigenvalues() const
Get the the tagged eigenvalues.
void eigensolve()
Solve the matrix linear eigensystem.
void tag_eigenvalues_upper(const int &val)
Tag those eigenvalues that are in the upper half-plane above a specified point.
A matrix class that constructs a DENSE matrix as a row major std::vector of DenseVectors.
An DenseVector class – a dense vector object.
void set_shift(const D_complex &z)
Set the shift value to be used in tagging.
void push_ptr(double *scalar, std::string desc="")
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...
std::complex< double > D_complex
A complex double precision number using std::complex.