Virtual function for solve implementation.
122 Array<OneD, NekDouble> tmpworkd;
124 int nq =
m_equ[0]->UpdateFields()[0]->GetNcoeffs();
133 Array<OneD, int> ritzSelect;
134 Array<OneD, NekDouble> dr;
135 Array<OneD, NekDouble> di;
136 Array<OneD, NekDouble> workev;
137 Array<OneD, NekDouble> z;
140 Array<OneD, NekDouble> resid(n);
141 Array<OneD, NekDouble> v(n*
m_kdim);
142 Array<OneD, NekDouble> workl(lworkl, 0.0);
143 Array<OneD, NekDouble> workd(3*n, 0.0);
147 if(
m_session->DefinesFunction(
"InitialConditions"))
149 out <<
"\tInital vector : input file " << endl;
155 out <<
"\tInital vector : random " << endl;
200 ofstream pFile(
name.c_str());
210 &v[0], n, iparam, ipntr, &workd[0],
211 &workl[0], lworkl, info);
215 out <<
"\rIteration " << cycle <<
", output: " << info <<
", ido=" << ido <<
" " << std::flush;
219 pFile <<
"Krylov spectrum at iteration: " << cycle << endl;
223 pFile <<
"EV Magnitude Angle Growth Frequency Residual" << endl;
227 pFile <<
"EV Real Imaginary inverse real inverse imag Residual" << endl;
231 for(
int k = 0; k <
m_kdim; ++k)
234 WriteEvs(pFile,k, workl[ipntr[5]-1+k],workl[ipntr[6]-1+k]);
238 if (ido == 99)
break;
249 m_equ[0]->TransCoeffToPhys();
257 m_equ[1]->TransCoeffToPhys();
277 m_equ[0]->TransCoeffToPhys();
279 Array<OneD, MultiRegions::ExpListSharedPtr> fields =
m_equ[0]->UpdateFields();
280 for (
int i = 0; i < fields.size(); ++i)
282 fields[i]->IProductWRTBase(fields[i]->GetPhys(),
283 fields[i]->UpdateCoeffs());
291 ASSERTL0(
false,
"Unexpected reverse communication request.");
296 out<< endl <<
"Converged in " << iparam[8] <<
" iterations" << endl;
298 ASSERTL0(info >= 0,
" Error with Dnaupd");
300 ritzSelect = Array<OneD, int> (
m_kdim,0);
301 dr = Array<OneD, NekDouble> (
m_nvec+1,0.0);
302 di = Array<OneD, NekDouble> (
m_nvec+1,0.0);
303 workev = Array<OneD, NekDouble> (3*
m_kdim);
304 z = Array<OneD, NekDouble> (n*(
m_nvec+1));
322 z.get(), n, sigmar, sigmai, workev.get(), &B,
324 v.get(), n, iparam, ipntr, workd.get(),
325 workl.get(),lworkl,info);
327 ASSERTL0(info == 0,
" Error with Dneupd");
342 "Need to implement Ritz re-evaluation of"
343 "eigenvalue. Only one half of complex "
344 "value will be correct");
347 Array<OneD, MultiRegions::ExpListSharedPtr> fields =
m_equ[0]->UpdateFields();
349 out <<
"Converged Eigenvalues: " << nconv << endl;
350 pFile <<
"Converged Eigenvalues: " << nconv << endl;
354 out <<
" Magnitude Angle Growth Frequency" << endl;
355 pFile <<
" Magnitude Angle Growth Frequency" << endl;
356 for(
int i= 0; i< nconv; ++i)
361 std::string file =
m_session->GetSessionName() +
"_eig_"
362 + boost::lexical_cast<std::string>(i)
369 out <<
" Real Imaginary " << endl;
370 pFile <<
" Real Imaginary " << endl;
371 for(
int i= 0; i< nconv; ++i)
378 std::string file =
m_session->GetSessionName() +
"_eig_"
379 + boost::lexical_cast<std::string>(i)
390 for(
int j = 0; j <
m_equ[0]->GetNvariables(); ++j)
394 if (
m_comm->GetRank() == 0)
396 out <<
"L 2 error (variable " <<
m_equ[0]->GetVariable(j) <<
") : " << vL2Error << endl;
397 out <<
"L inf error (variable " <<
m_equ[0]->GetVariable(j) <<
") : " << vLinfError << endl;
#define ASSERTL0(condition, msg)
#define WARNINGL0(condition, msg)
void CopyFwdToAdj()
Copy the forward field to the adjoint system in transient growth calculations.
void WriteFld(std::string file, std::vector< Array< OneD, NekDouble > > coeffs)
Write coefficients to file.
int m_infosteps
underlying operator is time stepping
void CopyFieldToArnoldiArray(Array< OneD, NekDouble > &array)
Copy fields to Arnoldi storage.
int m_nvec
Dimension of Krylov subspace.
bool m_timeSteppingAlgorithm
Period of time stepping algorithm.
int m_nits
Number of vectors to test.
Array< OneD, NekDouble > m_imag_evl
void CopyArnoldiArrayToField(Array< OneD, NekDouble > &array)
Copy Arnoldi storage to fields.
NekDouble m_evtol
Maxmum number of iterations.
int m_nfields
interval to dump information if required.
Array< OneD, NekDouble > m_real_evl
Operator in solve call is negated.
void WriteEvs(std::ostream &evlout, const int k, const NekDouble real, const NekDouble imag, NekDouble resid=NekConstants::kNekUnsetDouble, bool DumpInverse=true)
static std::string ArpackProblemTypeTrans[]
LibUtilities::SessionReaderSharedPtr m_session
Session reader object.
LibUtilities::CommSharedPtr m_comm
Communication object.
enum EvolutionOperatorType m_EvolutionOperator
Evolution Operator.
Array< OneD, EquationSystemSharedPtr > m_equ
Equation system to solve.
static void Dnaupd(int &ido, const char *bmat, const int &n, const char *which, const int &nev, const double &tol, double *resid, const int &ncv, double *v, const int &ldv, int *iparam, int *ipntr, double *workd, double *workl, const int &lworkl, int &info)
Top level reverse communication interface to solve real double-precision non-symmetric problems.
static void Dneupd(const int &rvec, const char *howmny, const int *select, double *dr, double *di, double *z, const int &ldz, const double &sigmar, const double &sigmai, double *workev, const char *bmat, const int &n, const char *which, const int &nev, const double &tol, double *resid, const int &ncv, double *v, const int &ldv, int *iparam, int *ipntr, double *workd, double *workl, const int &lworkl, int &info)
Post-processing routine to computed eigenvector of computed eigenvalues in Dnaupd.
static const NekDouble kNekUnsetDouble
static const NekDouble kNekZeroTol
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha - x.