46     VortexWaveInteraction::VortexWaveInteraction(
int argc, 
char * argv[]):
    57         std::string VWICondFile(argv[argc-1]); 
    58         VWICondFile += 
"_VWI.xml"; 
    59         std::vector<std::string> VWIFilenames;
    60         VWIFilenames.push_back(meshfile);   
    61         VWIFilenames.push_back(VWICondFile);
    69         m_sessionVWI->LoadParameter(
"OuterIterationStoreSize",storesize,10);
   115         if(
m_sessionVWI->DefinesSolverInfo(
"MoveMeshToCriticalLayer"))
   147         std::string IncCondFile(argv[argc-1]); 
   148         IncCondFile += 
"_IncNSCond.xml"; 
   149         std::vector<std::string> IncNSFilenames;
   150         IncNSFilenames.push_back(meshfile);   
   151         IncNSFilenames.push_back(IncCondFile);
   157         std::string vEquation = 
m_sessionRoll->GetSolverInfo(
"SolverType");
   167         int ncoeffs = 
m_solverRoll->UpdateFields()[0]->GetNcoeffs();
   170         for(
int i = 1; i < 4; ++i)
   172             m_vwiForcing[i] = m_vwiForcing[i-1] + ncoeffs;
   182         std::string AdvDiffCondFile(argv[argc-1]); 
   183         AdvDiffCondFile += 
"_AdvDiffCond.xml"; 
   184         std::vector<std::string> AdvDiffFilenames;
   185         AdvDiffFilenames.push_back(meshfile);   
   186         AdvDiffFilenames.push_back(AdvDiffCondFile);
   193         std::string LinNSCondFile(argv[argc-1]); 
   194         LinNSCondFile += 
"_LinNSCond.xml"; 
   195         std::vector<std::string> LinNSFilenames;
   196         LinNSFilenames.push_back(meshfile);   
   197         LinNSFilenames.push_back(LinNSCondFile);
   204         std::string LZstr(
"LZ");
   206         cout << 
"Setting LZ in Linearised solver to " << LZ << endl;
   212             std::string IterationTypeStr = 
m_sessionVWI->GetSolverInfo(
"VWIIterationType");
   231         m_sessionVWI->MatchSolverInfo(
"RestartIteration",
"True",restart,
false);
   242                     if((fp = fopen(
"OuterIter.his",
"r")))
   245                         std::vector<NekDouble> Alpha, Growth, Phase;
   247                         while(fgets(buf,BUFSIZ,fp))
   249                             sscanf(buf,
"%*d:%lf%lf%lf",&alpha,&growth,&phase);
   250                             Alpha.push_back(alpha);
   251                             Growth.push_back(growth);
   252                             Phase.push_back(phase);
   259                         for(
int i = 0; i < nvals; ++i)
   270                         cout << 
" No File OuterIter.his to restart from" << endl;
   276                     string nstr =  boost::lexical_cast<std::string>(
m_iterStart);
   277                     cout << 
"Restarting from iteration " << 
m_iterStart << endl;
   279                     cout << 
"      " << rstfile << endl;
   280                     if(system(rstfile.c_str()))
   284                     std::string vwifile = 
"cp -f Save/" + m_sessionName + 
".vwi." + nstr + 
" " + m_sessionName + 
".vwi"; 
   285                     cout << 
"      " << vwifile << endl;
   286                     if(system(vwifile.c_str()))
   293                 ASSERTL0(
false,
"Unknown VWIITerationType in restart");
   300             if((fp = fopen(
"ConvergedSolns",
"r")))
   303                 std::vector<NekDouble> WaveForce, Alpha;
   305                 while(fgets(buf,BUFSIZ,fp))
   307                     sscanf(buf,
"%*d:%lf%lf",&waveforce,&alpha);
   308                     WaveForce.push_back(waveforce);
   309                     Alpha.push_back(alpha);
   315                     NekDouble min_alph = fabs(m_alpha[0]-Alpha[min_i]);
   317                     for(
int i = 1; i < Alpha.size(); ++i)
   319                         if(fabs(m_alpha[0]-Alpha[min_i]) < min_alph)
   322                             min_alph = fabs(m_alpha[0]-Alpha[min_i]);
   327                     int min_j = (min_i == 0)? 1:0;
   328                     min_alph = fabs(m_alpha[0]-Alpha[min_j]);
   329                     for(
int i = 0; i < Alpha.size(); ++i)
   333                             if(fabs(m_alpha[0]-Alpha[min_j]) < min_alph)
   336                                 min_alph = fabs(m_alpha[0]-Alpha[min_j]);
   341                     if(fabs(Alpha[min_i] - Alpha[min_j]) > 1e-4)
   361             string vEquation = 
m_sessionRoll->GetSolverInfo(
"solvertype");
   365             cout << 
"Executing Roll solver" << endl;
   366             solverRoll->DoInitialise();
   367             solverRoll->DoSolve();
   368             solverRoll->Output();
   370             for(
int g=0; g< solverRoll->GetNvariables(); ++g)
   372                 NekDouble vL2Error = solverRoll->L2Error(g,
false);
   373                 NekDouble vLinfError = solverRoll->LinfError(g);
   374                 cout << 
"L 2 error (variable " << solverRoll->GetVariable(g) << 
") : " << vL2Error << endl;
   375                 cout << 
"L inf error (variable " << solverRoll->GetVariable(g) << 
") : " << vLinfError << endl;
   382                 string vEquation = 
m_sessionRoll->GetSolverInfo(
"solvertype");
   396                     std::vector<std::string> vFieldNames = 
m_sessionRoll->GetVariables();
   397                     vFieldNames.erase(vFieldNames.end()-1);
   402                     for(
int i = 0; i < 
m_vwiForcingObj->UpdateForces().num_elements(); ++i)
   416                     for(
int i = 0; i < 
m_vwiForcingObj->UpdateForces().num_elements(); ++i)
   429             cout << 
"Executing Roll solver" << endl;
   437                 cout << 
"L 2 error (variable " << 
m_solverRoll->GetVariable(g) << 
") : " << vL2Error << endl;
   438                 cout << 
"L inf error (variable " << 
m_solverRoll->GetVariable(g) << 
") : " << vLinfError << endl;
   445         cout << 
"Executing cp -f session.fld session.rst" << endl;
   449         cout << 
"Writing data to session-Base.fld" << endl;
   451         std::vector<std::string> variables(2);
   452         variables[0] = 
"Vx";   variables[1] = 
"Vy";
   453         std::vector<Array<OneD, NekDouble> > outfield(2);
   454         outfield[0]  = 
m_solverRoll->UpdateFields()[0]->UpdateCoeffs(); 
   455         outfield[1]  = 
m_solverRoll->UpdateFields()[1]->UpdateCoeffs(); 
   458                                outfield, variables);
   466         std::string vDriverModule;
   470         solverStreak->Execute();
   478         cout << 
"Executing Streak Solver" << endl;
   479         solverStreak->DoInitialise();
   480         solverStreak->DoSolve();
   481         solverStreak->Output();
   487             for(
int g=0; g< solverStreak->GetNvariables(); ++g)
   489                 NekDouble vL2Error = solverStreak->L2Error(g,
false);
   490                 NekDouble vLinfError = solverStreak->LinfError(g);
   491                 cout << 
"L 2 error (variable " << solverStreak->GetVariable(g) << 
") : " << vL2Error << endl;
   492                 cout << 
"L inf error (variable " << solverStreak->GetVariable(g) << 
") : " << vLinfError << endl;
   497         cout << 
"Executing cp -f session.fld session_streak.fld" << endl;
   505         std::string LZstr(
"LZ");
   507         cout << 
"Setting LZ in Linearised solver to " << LZ << endl;
   511         std::string vDriverModule;
   512         m_sessionWave->LoadSolverInfo(
"Driver", vDriverModule, 
"ModifiedArnoldi");
   513         cout << 
"Setting up linearised NS sovler" << endl;
   517         cout << 
"Executing wave solution " << endl;
   518         solverWave->Execute();
   521         cout << 
"Executing cp -f session_eig_0 session_eig_0.rst" << endl;
   535             m_sessionWave->MatchSolverInfo(
"Driver",
"ModifiedArnoldi",defineshift,
true);
   574             sprintf(c_alpha,
"%f",
m_alpha[0]);    
   579                 syscall = 
"../../utilities/PostProcessing/Extras/FldCalcBCs  "   581                     "meshhalf_pos_Spen_stability_moved.fld  meshhalf_pos_Spen_advPost_moved.fld "   582                     +c_alpha +
"  > data_alpha0";
   583                 cout<<syscall.c_str()<<endl;
   584                 if(system(syscall.c_str()))
   589                 syscall = 
"cp -f meshhalf_pos_Spen_stability_moved_u_5.bc  "+
m_sessionName+
"_u_5.bc";  
   590                 cout<<syscall.c_str()<<endl;
   591                 if(system(syscall.c_str()))
   595                 syscall = 
"cp -f meshhalf_pos_Spen_stability_moved_v_5.bc  "+
m_sessionName+
"_v_5.bc";  
   596                 cout<<syscall.c_str()<<endl;
   597                 if(system(syscall.c_str()))
   604                 syscall =  
"../../utilities/PostProcessing/Extras/FldCalcBCs  "   605                     + movedmesh + 
"  " + wavefile + 
"  " + filestreak + 
"   "+c_alpha +
"  >  datasub_"+c;
   606                 cout<<syscall.c_str()<<endl;
   607                 if(system(syscall.c_str()))
   618             string wave_subalp = 
m_sessionName + 
"_wave_subalp_"+c+
".fld";
   619             syscall = 
"cp -f " + wavefile + 
"  " + wave_subalp;
   620             cout<<syscall.c_str()<<endl;
   621             if(system(syscall.c_str()))
   636             static int projectfield = -1;
   647             if(projectfield == -1)
   654                     for(
int j = 0; j < BndConds.num_elements(); ++j)
   662                     if(projectfield != -1)
   667                 if(projectfield == -1)
   669                     cout << 
"using first field to project non-linear forcing which imposes a Dirichlet condition" << endl;
   703                 cout << 
"Area: " << area << endl;
   704                 invnorm = sqrt(area/invnorm);
   728                 std::vector<std::string> variables(3);
   729                 std::vector<Array<OneD, NekDouble> > outfield(3);
   730                 variables[0] = 
"u_w"; 
   731                 variables[1] = 
"v_w"; 
   732                 variables[2] = 
"w_w"; 
   796             m_sessionVWI->MatchSolverInfo(
"Symmetrization",
"True",symm,
true);
   819                 for(i = 0; i < npts; ++i)
   821                     coord[0] = coord_x[i];
   822                     coord[1] = coord_y[i];
   830                 for(i = 0; i < npts; ++i)
   833                     coord[0] = coord_x[i];
   834                     coord[1] = coord_y[i];
   835                     der2 [i] = 
m_waveVelocities[0]->GetPlane(0)->GetExp(Eid[i])->PhysEvaluate(coord, der1 + physoffset);
   848                 for(i = 0; i < npts; ++i)
   851                     coord[0] = coord_x[i];
   852                     coord[1] = coord_y[i];
   853                     der2[i]  = 
m_waveVelocities[0]->GetPlane(0)->GetExp(Eid[i])->PhysEvaluate(coord,                                                                         der1 + physoffset);
   862                 m_waveVelocities[0]->GetPlane(0)->FwdTrans_BndConstrained(der2, m_vwiForceing[1]);
   869                 cout<<
"symmetrization is active"<<endl;              
   873                 for(i = 0; i < npts; ++i)
   877                         val[i] = 0.5*(der1[i] - der1[index[i]]);
   887                 for(i = 0; i < npts; ++i)
   891                         val[i] = 0.5*(der2[i] - der2[index[i]]);
   905             cout << 
"F_Linf: " <<  
Vmath::Vmax(npts,val,1) << endl;
   924                  for(
int j = 0; j < 2; ++j)
   928                       for(
int i = 0; i < npts; ++i)
   938             std::vector<std::string> variables(4);
   939             std::vector<Array<OneD, NekDouble> > outfield(4);
   940             variables[0] = 
"u";  variables[1] = 
"v"; 
   941             variables[2] = 
"pr"; variables[3] = 
"pi";
   954             cout << 
"int P^2: " << 
m_wavePressure->GetPlane(0)->PhysIntegral(val) << endl;
   956             cout << 
"PLinf: " <<  
Vmath::Vmax(npts,val,1) << endl;
   984         cout << 
"int P^2 " << 
m_wavePressure->GetPlane(0)->PhysIntegral(val) << endl;
   989         cout << 
"Linf: " << Linf << endl;
  1001         l2 = sqrt(norm/area);
  1003         cout << 
"L2:   " << l2 << endl;
  1005         cout << 
"Ratio Linf/L2: "<< Linf/l2 << endl;
  1010         static map<string,int> opendir;
  1012         if(opendir.find(dir) == opendir.end())
  1015             string mkdir = 
"mkdir " + dir;
  1016             ASSERTL0(system(mkdir.c_str()) == 0,
  1017                     "Failed to make directory '" + dir + 
"'");
  1022         string savefile = dir + 
"/" + file + 
"." + boost::lexical_cast<std::string>(n);
  1023         string syscall  = 
"cp -f "  + file + 
" " + 
savefile; 
  1025         ASSERTL0(system(syscall.c_str()) == 0, syscall.c_str());
  1031         static map<string,int> opendir;
  1033         if(opendir.find(dir) == opendir.end())
  1036             string mkdir = 
"mkdir " + dir;
  1037             ASSERTL0(system(mkdir.c_str()) == 0,
  1038                     "Failed to make directory '" + dir + 
"'");
  1042         string savefile = dir + 
"/" + file + 
"." + boost::lexical_cast<std::string>(n);
  1043         string syscall  = 
"mv -f "  + file + 
" " + 
savefile; 
  1045         ASSERTL0(system(syscall.c_str()) == 0, syscall.c_str());
  1052          string syscall  = 
"cp -f "  + cpfile1 + 
" " + cpfile2; 
  1054          if(system(syscall.c_str()))
  1063          fp = fopen(file.c_str(),
"a");
  1071          fp = fopen(file.c_str(),
"a");
  1105              bool skiprollstreak=
false;
  1106              if(cnt==0 && 
m_sessionVWI->GetParameter(
"rollstreakfromit")==1)
  1108                   skiprollstreak =
true;
  1109                   cout<<
"skip roll-streak at the first iteration"<<endl;
  1113              if(skiprollstreak != 
true)
  1131              string movedinterpmesh = 
m_sessionName + 
"_interp_moved.xml";
  1141              sprintf(c,
"%d",cnt);  
  1144              syscall = 
"cp -f " + 
m_sessionName+
"-Base.fld" + 
"  " + oldroll;
  1145              cout<<syscall.c_str()<<endl;
  1146              if(system(syscall.c_str()))
  1154              string filewavepressure = 
m_sessionName + 
"_wave_p_split.fld";
  1156              string interpstreak = 
m_sessionName +
"_interpstreak_"+ c +
".fld";  
  1157              string interwavepressure  = 
m_sessionName +
"_wave_p_split_interp_"+ c +
".fld";
  1158              char alpchar[16]=
"";
  1159 cout<<
"alpha = "<<
m_alpha[0]<<endl;
  1160              sprintf(alpchar, 
"%f", 
m_alpha[0]);
  1163              if( 
m_sessionVWI->GetSolverInfo(
"INTERFACE")!=
"phase" )
  1165                  cout<<
"zerophase"<<endl;
  1167                  syscall  = 
"../../utilities/PostProcessing/Extras/MoveMesh  "  1168                              + filePost +
"  "+ filestreak +
"  "+ fileinterp + 
"   "+ alpchar; 
  1170                  cout<<syscall.c_str()<<endl;
  1171                  if(system(syscall.c_str()))
  1177                  syscall  =  
"../../utilities/PostProcessing/Extras/MoveMesh  "  1178                        + filePost + 
"  " + filestreak + 
"  " + filePost + 
"    "+ alpchar;
  1179                  cout<<syscall.c_str()<<endl;
  1180                  if(system(syscall.c_str()))
  1189              syscall = 
"cp -f " + filestreak + 
"  " + oldstreak;
  1190                  cout<<syscall.c_str()<<endl;
  1191                  if(system(syscall.c_str()))
  1198                  string movedinterpmesh = 
m_sessionName + 
"_interp_moved.xml";
  1202                  syscall  =  
"../../utilities/PostProcessing/Extras/FieldToField  "  1203                       + fileinterp + 
"  " + filestreak + 
"  " + movedinterpmesh + 
"  "   1206                  cout<<syscall.c_str()<<endl;
  1207                  if(system(syscall.c_str()))
  1216                  syscall = 
"cp -f " + meshfile + 
"  " + meshold;
  1217                  cout<<syscall.c_str()<<endl;
  1218                  if(system(syscall.c_str()))
  1224              syscall = 
"cp -f " + movedmesh + 
"  " + meshfile;
  1225                  cout<<syscall.c_str()<<endl;
  1226                  if(system(syscall.c_str()))
  1232                  syscall = 
"cp -f " + interpstreak + 
"  " + filestreak;
  1233                  cout<<syscall.c_str()<<endl;
  1234                  if(system(syscall.c_str()))
  1245                  cout<<syscall.c_str()<<endl;
  1246                  if(system(syscall.c_str()))
  1253              syscall = 
"cp -f " + ujump + 
"  " + 
m_sessionName+
"_u_5.bc_"+c;
  1254                  cout<<syscall.c_str()<<endl;
  1255                  if(system(syscall.c_str()))
  1261                  syscall = 
"cp -f " + vjump + 
"  " + 
m_sessionName+
"_v_5.bc_"+c;
  1262                  cout<<syscall.c_str()<<endl;
  1263                  if(system(syscall.c_str()))
  1281                   sprintf(c1,
"%d",cnt);   
  1284                   syscall =  
"../../utilities/PostProcessing/Extras/FldCalcBCs  "  1285                         + movedmesh + 
"  " + wavefile + 
"  " + interpstreak + 
">  data"+c1;
  1286                   cout<<syscall.c_str()<<endl;
  1287                   if(system(syscall.c_str()))
  1293               syscall = 
"cp -f " + movedinterpmesh + 
"  " + fileinterp;
  1294                   cout<<syscall.c_str()<<endl;
  1295                   if(system(syscall.c_str()))
  1300               syscall = 
"cp -f " + movedmesh + 
"  " + filePost;
  1301                   cout<<syscall.c_str()<<endl;
  1302                   if(system(syscall.c_str()))
  1309              else if(  
m_sessionVWI->GetSolverInfo(
"INTERFACE")==
"phase" )
  1311 cout<<
"phase"<<endl;
  1322               syscall = 
"cp -f " + filestreak + 
"  " + oldstreak;
  1323                   cout<<syscall.c_str()<<endl;
  1324                   if(system(syscall.c_str()))
  1331                   cout<<syscall.c_str()<<endl;
  1332                   if(system(syscall.c_str()))
  1339               syscall = 
"cp -f " + meshfile + 
"  " + meshold;
  1340                   cout<<syscall.c_str()<<endl;
  1341                   if(system(syscall.c_str()))
  1349                   cout<<syscall.c_str()<<endl;
  1350                   if(system(syscall.c_str()))
  1357               syscall = 
"cp -f " + ujump + 
"  " + 
m_sessionName+
"_u_5.bc_"+c;
  1358                   cout<<syscall.c_str()<<endl;
  1359                   if(system(syscall.c_str()))
  1365                   syscall = 
"cp -f " + vjump + 
"  " + 
m_sessionName+
"_v_5.bc_"+c;
  1366                   cout<<syscall.c_str()<<endl;
  1367                   if(system(syscall.c_str()))
  1377 cout<<
"cr="<<cr_str<<endl;
  1380                   syscall  = 
"../../utilities/PostProcessing/Extras/MoveMesh  "  1381                                + filePost +
"  "+ filestreak +
"  "+ fileinterp + 
"   "+ alpchar
  1384                   cout<<syscall.c_str()<<endl;
  1385                   if(system(syscall.c_str()))
  1391                   syscall  =  
"../../utilities/PostProcessing/Extras/MoveMesh  "  1392                         + filePost + 
"  " + filestreak + 
"  " + filePost + 
"    "+ alpchar
  1394                   cout<<syscall.c_str()<<endl;
  1395                   if(system(syscall.c_str()))
  1401                   syscall  =  
"../../utilities/PostProcessing/Extras/FieldToField  "  1402                         + fileinterp + 
"  " + filestreak + 
"  " + movedinterpmesh + 
"  "   1405                   cout<<syscall.c_str()<<endl;
  1406                   if(system(syscall.c_str()))
  1412                   syscall  =  
"../../utilities/PostProcessing/Extras/SplitFld  "  1413                         + filePost + 
"  " + filewave;
  1415                   cout<<syscall.c_str()<<endl;
  1416                   if(system(syscall.c_str()))
  1421                   syscall  =  
"../../utilities/PostProcessing/Extras/FieldToField  "  1422                         + filePost + 
"  " + filewavepressure + 
"  " + movedmesh + 
"  "   1423                     + interwavepressure;
  1425                   cout<<syscall.c_str()<<endl;
  1426                   if(system(syscall.c_str()))
  1443                   sprintf(c1,
"%d",cnt);   
  1447                   syscall = 
"cp -f "+ interwavepressure +
"  "+
m_sessionName+
".fld";
  1448                   cout<<syscall.c_str()<<endl;
  1449                   if(system(syscall.c_str()))
  1456                   syscall =  
"../../utilities/PostProcessing/Extras/FldCalcBCs  "  1457                         + movedmesh + 
"  " +m_sessionName+
".fld"  + 
"  "   1458                         + interpstreak + 
">  data"+c1;
  1459                   cout<<syscall.c_str()<<endl;
  1460                   if(system(syscall.c_str()))
  1467               syscall = 
"cp -f " + movedmesh + 
"  " + meshfile;
  1468                   cout<<syscall.c_str()<<endl;
  1469                   if(system(syscall.c_str()))
  1475                   syscall = 
"cp -f " + interpstreak + 
"  " + filestreak;
  1476                   cout<<syscall.c_str()<<endl;
  1477                   if(system(syscall.c_str()))
  1482               syscall = 
"cp -f " + movedinterpmesh + 
"  " + fileinterp;
  1483                   cout<<syscall.c_str()<<endl;
  1484                   if(system(syscall.c_str()))
  1489               syscall = 
"cp -f " + movedmesh + 
"  " + filePost;
  1490                   cout<<syscall.c_str()<<endl;
  1491                   if(system(syscall.c_str()))
  1514                 char alpchar[16]=
"";
  1515                 sprintf(alpchar, 
"%f", 
m_alpha[0]);
  1520                 string filewavepressure  = 
m_sessionName + 
"_wave_p_split.fld";
  1523                 string interwavepressure = 
m_sessionName +
"_wave_p_split_interp.fld";
  1524                 syscall  = 
"../../utilities/PostProcessing/Extras/MoveMesh  "  1525                     + filePost +
"  "+ filestreak +
"  "+ fileinterp + 
"   "+ alpchar; 
  1527                 cout<<syscall.c_str()<<endl;
  1528                 if(system(syscall.c_str()))
  1534                 syscall  =  
"../../utilities/PostProcessing/Extras/MoveMesh  "  1535                     + filePost + 
"  " + filestreak + 
"  " + filePost + 
"    "+ alpchar;
  1536                 cout<<syscall.c_str()<<endl;
  1537                 if(system(syscall.c_str()))
  1544                 syscall = 
"cp -f " + filestreak + 
"  " + oldstreak;
  1545                 cout<<syscall.c_str()<<endl;
  1546                 if(system(syscall.c_str()))
  1553                 string movedinterpmesh = 
m_sessionName + 
"_interp_moved.xml";
  1557                 syscall  =  
"../../utilities/PostProcessing/Extras/FieldToField  "  1558                     + fileinterp + 
"  " + filestreak + 
"  " + movedinterpmesh 
  1559                     + 
"  "  + interpstreak;
  1561                 cout<<syscall.c_str()<<endl;
  1562                 if(system(syscall.c_str()))
  1570                 syscall = 
"cp -f " + meshfile + 
"  " + meshold;
  1571                 cout<<syscall.c_str()<<endl;
  1572                 if(system(syscall.c_str()))
  1578                 syscall = 
"cp -f " + movedmesh + 
"  " + meshfile;
  1579                 cout<<syscall.c_str()<<endl;
  1580                 if(system(syscall.c_str()))
  1586                 syscall = 
"cp -f " + interpstreak + 
"  " + filestreak;
  1587                 cout<<syscall.c_str()<<endl;
  1588                 if(system(syscall.c_str()))
  1605         static NekDouble previous_real_evl = -1.0; 
  1606         static NekDouble previous_imag_evl = -1.0; 
  1607         static int min_iter = 0;
  1611             previous_real_evl = -1.0;
  1640                 cout << 
"Warning: imaginary eigenvalue is greater than 1e-2" << endl;
  1653         bool returnval = 
false;
  1683             cout << 
"Warning: imaginary eigenvalue is greater than 1e-2" << endl;
  1721             for(i = 0; i < nstore; ++i)
  1725                 store    = WaveForce[i]; 
  1726                 WaveForce[i] = WaveForce[i+k];
  1727                 WaveForce[i+k] = store;
  1730                 Growth[i] = Growth[i+k];
  1731                 Growth[i+k] = store; 
  1735             for(i = 0; i < nstore-1; ++i)
  1737                 if(Growth[i]*Growth[i+1] < 0.0)
  1747                     wavef_new = (WaveForce[0]*Growth[1] - WaveForce[1]*Growth[0])/(Growth[1]-Growth[0]);
  1755                     int     idx = (i == 0)?1:i;
  1756                     NekDouble  da = WaveForce[idx+1] - WaveForce[idx-1];
  1757                     NekDouble  gval_m1 = Growth[idx-1],a,gval;
  1758                     NekDouble  c1 = Growth[idx-1]/(WaveForce[idx-1]-WaveForce[idx])/
  1759                         (WaveForce[idx-1]-WaveForce[idx+1]);
  1760                     NekDouble  c2 = Growth[idx]/(WaveForce[idx]-WaveForce[idx-1])/
  1761                         (WaveForce[idx]-WaveForce[idx+1]);
  1762                     NekDouble  c3 = Growth[idx+1]/(WaveForce[idx+1]-WaveForce[idx-1])/
  1763                         (WaveForce[idx+1]-WaveForce[idx]);
  1765                     for(j = 1; j < nsteps+1; ++j)
  1767                         a = WaveForce[i] + j*da/(
NekDouble) nsteps;
  1768                         gval = c1*(a - WaveForce[idx  ])*(a - WaveForce[idx+1]) 
  1769                             +  c2*(a - WaveForce[idx-1])*(a - WaveForce[idx+1])
  1770                             +  c3*(a - WaveForce[idx-1])*(a - WaveForce[idx]);
  1772                         if(gval*gval_m1 < 0.0)
  1774                             wavef_new = ((a+da/(
NekDouble)nsteps)*gval - a*gval_m1)/
  1830             int nstore = (
m_alpha.num_elements() < outeriter)? 
m_alpha.num_elements(): outeriter;
  1840             for(i = 0; i < nstore; ++i)
  1845                 Alpha[i] = Alpha[i+k];
  1849                 Growth[i] = Growth[i+k];
  1850                 Growth[i+k] = store; 
  1854             for(i = 0; i < nstore-1; ++i)
  1856                 if(Growth[i]*Growth[i+1] < 0.0)
  1866                     alp_new = (Alpha[0]*Growth[1] - Alpha[1]*Growth[0])/(Growth[1]-Growth[0]);
  1874                     int     idx = (i == 0)?1:i;
  1875                     NekDouble  da = Alpha[idx+1] - Alpha[idx-1];
  1876                     NekDouble  gval_m1 = Growth[idx-1],a,gval;
  1877                     NekDouble  c1 = Growth[idx-1]/(Alpha[idx-1]-Alpha[idx])/
  1878                         (Alpha[idx-1]-Alpha[idx+1]);
  1879                     NekDouble  c2 = Growth[idx]/(Alpha[idx]-Alpha[idx-1])/
  1880                         (Alpha[idx]-Alpha[idx+1]);
  1881                     NekDouble  c3 = Growth[idx+1]/(Alpha[idx+1]-Alpha[idx-1])/
  1882                         (Alpha[idx+1]-Alpha[idx]);
  1884                     for(j = 1; j < nsteps+1; ++j)
  1887                         gval = c1*(a - Alpha[idx  ])*(a - Alpha[idx+1]) 
  1888                             +  c2*(a - Alpha[idx-1])*(a - Alpha[idx+1])
  1889                             +  c3*(a - Alpha[idx-1])*(a - Alpha[idx]);
  1891                         if(gval*gval_m1 < 0.0)
  1893                             alp_new = ((a+da/(
NekDouble)nsteps)*gval - a*gval_m1)/
  1913         for(
int i = 
m_alpha.num_elements()-1; i > 0; --i)
  1944         bool useOnlyQuads = 
false;
  1945         if(
m_sessionVWI->DefinesSolverInfo(
"SymmetriseOnlyQuads"))
  1947             useOnlyQuads = 
true;
  1951         for(
int e = 0; e < nel; ++e)
  1960                     for(i = 0; i < e_npts; ++i)
  1968             for(i = cnt; i < cnt+e_npts; ++i)
  1970                 xnew = - coord_x[i]  + xmax;
  1971                 ynew = - coord_y[i];
  1973                 for(j = start; j >=0 ; --j)
  1975                     if((coord_x[j]-xnew)*(coord_x[j]-xnew) + (coord_y[j]-ynew)*(coord_y[j]-ynew) < tol)
  1986                     for(j = npts-1; j > start; --j)
  1989                         if((coord_x[j]-xnew)*(coord_x[j]-xnew) + (coord_y[j]-ynew)*(coord_y[j]-ynew) < tol)
  1995                     ASSERTL0(j != start,
"Failed to find matching point");
  2005           cout<<
"relaxation..."<<endl;
  2013                           *std::static_pointer_cast<MultiRegions::ExpList1D>(Iexp[reg]));
  2014           int nq = Ilayer->GetTotPoints();
  2019                 for(
int i = 1; i < 4; ++i)
  2021                       m_bcsForcing[i] = m_bcsForcing[i-1] + nq;
  2027           std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef_u;
  2028           std::vector<std::vector<NekDouble> > FieldData_u;
  2034           fld->Import(file,FieldDef_u, FieldData_u);
  2035           Ilayer->ExtractDataToCoeffs(FieldDef_u[0], FieldData_u[0], FieldDef_u[0]->m_fields[0],Ilayer->UpdateCoeffs());
  2036           Ilayer->BwdTrans_IterPerExp(Ilayer->GetCoeffs(), Ilayer->UpdatePhys());
  2060               Ilayer->FwdTrans_IterPerExp(Ilayer->GetPhys(),Ilayer->UpdateCoeffs()); 
  2061               fieldcoeffs[0] = Ilayer->UpdateCoeffs();      
  2062           std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef1  = Ilayer->GetFieldDefinitions();               
  2063               std::vector<std::vector<NekDouble> > FieldData_1(FieldDef1.size());;
  2064               FieldDef1[0]->m_fields.push_back(
"u");                    
  2065               Ilayer->AppendFieldData(FieldDef1[0], FieldData_1[0]);                    
  2066               fld->Write(file,FieldDef1,FieldData_1);
  2084           std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef_v;
  2085           std::vector<std::vector<NekDouble> > FieldData_v;
  2086           fld->Import(file,FieldDef_v, FieldData_v);
  2087           Ilayer->ExtractDataToCoeffs(FieldDef_v[0], FieldData_v[0], FieldDef_v[0]->m_fields[0],Ilayer->UpdateCoeffs());
  2088           Ilayer->BwdTrans_IterPerExp(Ilayer->GetCoeffs(), Ilayer->UpdatePhys());
  2106               Ilayer->FwdTrans_IterPerExp(Ilayer->GetPhys(),Ilayer->UpdateCoeffs()); 
  2107               fieldcoeffs[0] = Ilayer->UpdateCoeffs();      
  2108           std::vector<LibUtilities::FieldDefinitionsSharedPtr>  FieldDef2  = Ilayer->GetFieldDefinitions();         
  2109               std::vector<std::vector<NekDouble> > FieldData_2(FieldDef2.size());;      
  2110               FieldDef2[0]->m_fields.push_back(
"v");                    
  2111               Ilayer->AppendFieldData(FieldDef2[0], FieldData_2[0]);                                
  2112               fld->Write(file,FieldDef2,FieldData_2);
 static void DisableManagement(std::string whichPool="")
#define ASSERTL0(condition, msg)
LibUtilities::SessionReaderSharedPtr m_sessionRoll
MultiRegions::ExpListSharedPtr m_wavePressure
void CalcL2ToLinfPressure(void)
SpatialDomains::MeshGraphSharedPtr m_graphWave
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x) 
std::shared_ptr< IncNavierStokes > IncNavierStokesSharedPtr
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max. 
void ExecuteLoop(bool CalcWaveForce=true)
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value. 
std::string m_sessionName
Array< OneD, NekDouble > m_leading_imag_evl
< Leading real eigenvalue 
int Imin(int n, const T *x, const int incx)
Return the index of the minimum element in x. 
Array< OneD, MultiRegions::ExpListSharedPtr > m_rollField
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y 
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y 
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object. 
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton. 
bool CheckEigIsStationary(bool reset=false)
VWIIterationType GetVWIIterationType(void)
bool m_moveMeshToCriticalLayer
void SaveFile(std::string fileend, std::string dir, int n)
Array< OneD, MultiRegions::ExpListSharedPtr > m_waveVelocities
void UpdateDAlphaDWaveForceMag(NekDouble alphainit)
void MoveFile(std::string fileend, std::string dir, int n)
EquationSystemSharedPtr m_solverRoll
SolverUtils::ForcingProgrammaticSharedPtr m_vwiForcingObj
void UpdateWaveForceMag(int n)
static void EnableManagement(std::string whichPool="")
Array< OneD, NekDouble > m_leading_real_evl
NekDouble m_vwiRelaxation
NekDouble m_rollForceScale
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class. 
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey. 
Array< OneD, Array< OneD, NekDouble > > m_bcsForcing
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y. 
NekDouble m_neutralPointTol
LibUtilities::SessionReaderSharedPtr m_sessionWave
~VortexWaveInteraction(void)
const std::string VWIIterationTypeMap[]
Array< OneD, NekDouble > m_waveForceMag
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool. 
VWIIterationType m_VWIIterationType
void SaveLoopDetails(std::string dir, int i)
void Neg(int n, T *x, const int incx)
Negate x = -x. 
bool m_useLinfPressureNorm
void FileRelaxation(int reg)
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x. 
NekDouble m_waveForceMagStep
EquationSystemFactory & GetEquationSystemFactory()
Array< OneD, Array< OneD, NekDouble > > m_vwiForcing
LibUtilities::SessionReaderSharedPtr m_sessionVWI
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y. 
static std::shared_ptr< FieldIO > CreateDefault(const LibUtilities::SessionReaderSharedPtr session)
Returns an object for the default FieldIO method. 
void CalcNonLinearWaveForce(void)
NekDouble m_dAlphaDWaveForceMag
void AddForcing(const SolverUtils::ForcingSharedPtr &pForce)
int m_maxWaveForceMagIter
void CopyFile(std::string file1end, std::string file2end)
This class is the base class for Navier Stokes problems. 
SpatialDomains::MeshGraphSharedPtr m_graphRoll
DriverFactory & GetDriverFactory()
NekDouble m_deltaFcnDecay
Array< OneD, MultiRegions::ExpListSharedPtr > m_streakField
Array< OneD, NekDouble > m_alpha
< Leading imaginary eigenvalue 
Array< OneD, int > GetReflectionIndex(void)
std::shared_ptr< FieldIO > FieldIOSharedPtr
void AppendEvlToFile(std::string file, int n)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
std::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object. 
std::shared_ptr< SessionReader > SessionReaderSharedPtr
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, DomainRangeShPtr rng=NullDomainRangeShPtr, bool fillGraph=true)
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y. 
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y. 
bool CheckIfAtNeutralPoint(void)
SpatialDomains::MeshGraphSharedPtr m_graphStreak
LibUtilities::SessionReaderSharedPtr m_sessionStreak
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.