Virtual function for solve implementation.
121 Array<OneD, NekDouble> tmpworkd;
123 int nq =
m_equ[0]->UpdateFields()[0]->GetNcoeffs();
132 Array<OneD, int> ritzSelect;
133 Array<OneD, NekDouble> dr;
134 Array<OneD, NekDouble> di;
135 Array<OneD, NekDouble> workev;
136 Array<OneD, NekDouble> z;
139 Array<OneD, NekDouble> resid(n);
140 Array<OneD, NekDouble> v(n*
m_kdim);
141 Array<OneD, NekDouble> workl(lworkl, 0.0);
142 Array<OneD, NekDouble> workd(3*n, 0.0);
146 if(
m_session->DefinesFunction(
"InitialConditions"))
148 out <<
"\tInital vector : input file " << endl;
154 out <<
"\tInital vector : random " << endl;
199 ofstream pFile(name.c_str());
209 &v[0], n, iparam, ipntr, &workd[0],
210 &workl[0], lworkl, info);
214 out <<
"\rIteration " << cycle <<
", output: " << info <<
", ido=" << ido <<
" " << std::flush;
218 pFile <<
"Krylov spectrum at iteration: " << cycle << endl;
222 pFile <<
"EV Magnitude Angle Growth Frequency Residual" << endl;
226 pFile <<
"EV Real Imaginary inverse real inverse imag Residual" << endl;
230 for(
int k = 0; k <
m_kdim; ++k)
233 WriteEvs(pFile,k, workl[ipntr[5]-1+k],workl[ipntr[6]-1+k]);
237 if (ido == 99)
break;
248 m_equ[0]->TransCoeffToPhys();
256 m_equ[1]->TransCoeffToPhys();
276 m_equ[0]->TransCoeffToPhys();
278 Array<OneD, MultiRegions::ExpListSharedPtr> fields =
m_equ[0]->UpdateFields();
279 for (
int i = 0; i < fields.num_elements(); ++i)
281 fields[i]->IProductWRTBase(fields[i]->GetPhys(),
282 fields[i]->UpdateCoeffs());
290 ASSERTL0(
false,
"Unexpected reverse communication request.");
295 out<< endl <<
"Converged in " << iparam[8] <<
" iterations" << endl;
297 ASSERTL0(info >= 0,
" Error with Dnaupd");
299 ritzSelect = Array<OneD, int> (
m_kdim,0);
300 dr = Array<OneD, NekDouble> (
m_nvec+1,0.0);
301 di = Array<OneD, NekDouble> (
m_nvec+1,0.0);
302 workev = Array<OneD, NekDouble> (3*
m_kdim);
303 z = Array<OneD, NekDouble> (n*(
m_nvec+1));
321 z.get(), n, sigmar, sigmai, workev.get(), &B,
323 v.get(), n, iparam, ipntr, workd.get(),
324 workl.get(),lworkl,info);
326 ASSERTL0(info == 0,
" Error with Dneupd");
341 "Need to implement Ritz re-evaluation of" 342 "eigenvalue. Only one half of complex " 343 "value will be correct");
346 Array<OneD, MultiRegions::ExpListSharedPtr> fields =
m_equ[0]->UpdateFields();
348 out <<
"Converged Eigenvalues: " << nconv << endl;
349 pFile <<
"Converged Eigenvalues: " << nconv << endl;
353 out <<
" Magnitude Angle Growth Frequency" << endl;
354 pFile <<
" Magnitude Angle Growth Frequency" << endl;
355 for(
int i= 0; i< nconv; ++i)
360 std::string file =
m_session->GetSessionName() +
"_eig_" 361 + boost::lexical_cast<std::string>(i)
368 out <<
" Real Imaginary " << endl;
369 pFile <<
" Real Imaginary " << endl;
370 for(
int i= 0; i< nconv; ++i)
377 std::string file =
m_session->GetSessionName() +
"_eig_" 378 + boost::lexical_cast<std::string>(i)
389 for(
int j = 0; j <
m_equ[0]->GetNvariables(); ++j)
393 if (
m_comm->GetRank() == 0)
395 out <<
"L 2 error (variable " <<
m_equ[0]->GetVariable(j) <<
") : " << vL2Error << endl;
396 out <<
"L inf error (variable " <<
m_equ[0]->GetVariable(j) <<
") : " << vLinfError << endl;
Array< OneD, NekDouble > m_imag_evl
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.
#define ASSERTL0(condition, msg)
void CopyFwdToAdj()
Copy the forward field to the adjoint system in transient growth calculations.
NekDouble m_evtol
Maxmum number of iterations.
void CopyArnoldiArrayToField(Array< OneD, NekDouble > &array)
Copy Arnoldi storage to fields.
void CopyFieldToArnoldiArray(Array< OneD, NekDouble > &array)
Copy fields to Arnoldi storage.
void WriteFld(std::string file, std::vector< Array< OneD, NekDouble > > coeffs)
Write coefficients to file.
static const NekDouble kNekZeroTol
int m_nvec
Dimension of Krylov subspace.
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)
#define WARNINGL0(condition, msg)
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...
enum EvolutionOperatorType m_EvolutionOperator
Evolution Operator.
static const NekDouble kNekUnsetDouble
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
int m_nfields
interval to dump information if required.
bool m_timeSteppingAlgorithm
Period of time stepping algorithm.
static std::string ArpackProblemTypeTrans[]
Array< OneD, EquationSystemSharedPtr > m_equ
Equation system to solve.
int m_infosteps
underlying operator is time stepping
LibUtilities::CommSharedPtr m_comm
Communication object.
LibUtilities::SessionReaderSharedPtr m_session
Session reader object.
int m_nits
Number of vectors to test.