56 std::string VWICondFile(argv[argc-1]);
57 VWICondFile +=
"_VWI.xml";
58 std::vector<std::string> VWIFilenames;
59 VWIFilenames.push_back(meshfile);
60 VWIFilenames.push_back(VWICondFile);
67 m_sessionVWI->LoadParameter(
"OuterIterationStoreSize",storesize,10);
113 if(
m_sessionVWI->DefinesSolverInfo(
"MoveMeshToCriticalLayer"))
122 m_alpha = Array<OneD, NekDouble> (storesize);
145 std::string IncCondFile(argv[argc-1]);
146 IncCondFile +=
"_IncNSCond.xml";
147 std::vector<std::string> IncNSFilenames;
148 IncNSFilenames.push_back(meshfile);
149 IncNSFilenames.push_back(IncCondFile);
154 std::string vEquation =
m_sessionRoll->GetSolverInfo(
"SolverType");
164 int ncoeffs =
m_solverRoll->UpdateFields()[0]->GetNcoeffs();
165 m_vwiForcing = Array<OneD, Array<OneD, NekDouble> > (4);
167 for(
int i = 1; i < 4; ++i)
169 m_vwiForcing[i] = m_vwiForcing[i-1] + ncoeffs;
179 std::string AdvDiffCondFile(argv[argc-1]);
180 AdvDiffCondFile +=
"_AdvDiffCond.xml";
181 std::vector<std::string> AdvDiffFilenames;
182 AdvDiffFilenames.push_back(meshfile);
183 AdvDiffFilenames.push_back(AdvDiffCondFile);
189 std::string LinNSCondFile(argv[argc-1]);
190 LinNSCondFile +=
"_LinNSCond.xml";
191 std::vector<std::string> LinNSFilenames;
192 LinNSFilenames.push_back(meshfile);
193 LinNSFilenames.push_back(LinNSCondFile);
199 std::string LZstr(
"LZ");
201 cout <<
"Setting LZ in Linearised solver to " << LZ << endl;
207 std::string IterationTypeStr =
m_sessionVWI->GetSolverInfo(
"VWIIterationType");
226 m_sessionVWI->MatchSolverInfo(
"RestartIteration",
"True",restart,
false);
237 if((fp = fopen(
"OuterIter.his",
"r")))
240 std::vector<NekDouble> Alpha, Growth, Phase;
242 while(fgets(buf,BUFSIZ,fp))
244 sscanf(buf,
"%*d:%lf%lf%lf",&alpha,&growth,&phase);
245 Alpha.push_back(alpha);
246 Growth.push_back(growth);
247 Phase.push_back(phase);
254 for(
int i = 0; i < nvals; ++i)
265 cout <<
" No File OuterIter.his to restart from" << endl;
271 string nstr = boost::lexical_cast<std::string>(
m_iterStart);
272 cout <<
"Restarting from iteration " <<
m_iterStart << endl;
274 cout <<
" " << rstfile << endl;
275 if(system(rstfile.c_str()))
279 std::string vwifile =
"cp -f Save/" + m_sessionName +
".vwi." + nstr +
" " + m_sessionName +
".vwi";
280 cout <<
" " << vwifile << endl;
281 if(system(vwifile.c_str()))
288 ASSERTL0(
false,
"Unknown VWIITerationType in restart");
295 if((fp = fopen(
"ConvergedSolns",
"r")))
298 std::vector<NekDouble> WaveForce, Alpha;
300 while(fgets(buf,BUFSIZ,fp))
302 sscanf(buf,
"%*d:%lf%lf",&waveforce,&alpha);
303 WaveForce.push_back(waveforce);
304 Alpha.push_back(alpha);
310 NekDouble min_alph = fabs(m_alpha[0]-Alpha[min_i]);
312 for(
int i = 1; i < Alpha.size(); ++i)
314 if(fabs(m_alpha[0]-Alpha[min_i]) < min_alph)
317 min_alph = fabs(m_alpha[0]-Alpha[min_i]);
322 int min_j = (min_i == 0)? 1:0;
323 min_alph = fabs(m_alpha[0]-Alpha[min_j]);
324 for(
int i = 0; i < Alpha.size(); ++i)
328 if(fabs(m_alpha[0]-Alpha[min_j]) < min_alph)
331 min_alph = fabs(m_alpha[0]-Alpha[min_j]);
336 if(fabs(Alpha[min_i] - Alpha[min_j]) > 1e-4)
356 string vEquation =
m_sessionRoll->GetSolverInfo(
"solvertype");
360 cout <<
"Executing Roll solver" << endl;
361 solverRoll->DoInitialise();
362 solverRoll->DoSolve();
363 solverRoll->Output();
365 for(
int g=0; g< solverRoll->GetNvariables(); ++g)
367 NekDouble vL2Error = solverRoll->L2Error(g,
false);
368 NekDouble vLinfError = solverRoll->LinfError(g);
369 cout <<
"L 2 error (variable " << solverRoll->GetVariable(g) <<
") : " << vL2Error << endl;
370 cout <<
"L inf error (variable " << solverRoll->GetVariable(g) <<
") : " << vLinfError << endl;
377 string vEquation =
m_sessionRoll->GetSolverInfo(
"solvertype");
391 std::vector<std::string> vFieldNames =
m_sessionRoll->GetVariables();
392 vFieldNames.erase(vFieldNames.end()-1);
397 for(
int i = 0; i <
m_vwiForcingObj->UpdateForces().num_elements(); ++i)
411 for(
int i = 0; i <
m_vwiForcingObj->UpdateForces().num_elements(); ++i)
424 cout <<
"Executing Roll solver" << endl;
432 cout <<
"L 2 error (variable " <<
m_solverRoll->GetVariable(g) <<
") : " << vL2Error << endl;
433 cout <<
"L inf error (variable " <<
m_solverRoll->GetVariable(g) <<
") : " << vLinfError << endl;
440 cout <<
"Executing cp -f session.fld session.rst" << endl;
444 cout <<
"Writing data to session-Base.fld" << endl;
446 std::vector<std::string> variables(2);
447 variables[0] =
"Vx"; variables[1] =
"Vy";
448 std::vector<Array<OneD, NekDouble> > outfield(2);
449 outfield[0] =
m_solverRoll->UpdateFields()[0]->UpdateCoeffs();
450 outfield[1] =
m_solverRoll->UpdateFields()[1]->UpdateCoeffs();
453 outfield, variables);
461 std::string vDriverModule;
465 solverStreak->Execute();
473 cout <<
"Executing Streak Solver" << endl;
474 solverStreak->DoInitialise();
475 solverStreak->DoSolve();
476 solverStreak->Output();
482 for(
int g=0; g< solverStreak->GetNvariables(); ++g)
484 NekDouble vL2Error = solverStreak->L2Error(g,
false);
485 NekDouble vLinfError = solverStreak->LinfError(g);
486 cout <<
"L 2 error (variable " << solverStreak->GetVariable(g) <<
") : " << vL2Error << endl;
487 cout <<
"L inf error (variable " << solverStreak->GetVariable(g) <<
") : " << vLinfError << endl;
492 cout <<
"Executing cp -f session.fld session_streak.fld" << endl;
500 std::string LZstr(
"LZ");
502 cout <<
"Setting LZ in Linearised solver to " << LZ << endl;
506 std::string vDriverModule;
507 m_sessionWave->LoadSolverInfo(
"Driver", vDriverModule,
"ModifiedArnoldi");
508 cout <<
"Setting up linearised NS sovler" << endl;
512 cout <<
"Executing wave solution " << endl;
513 solverWave->Execute();
516 cout <<
"Executing cp -f session_eig_0 session_eig_0.rst" << endl;
530 m_sessionWave->MatchSolverInfo(
"Driver",
"ModifiedArnoldi",defineshift,
true);
569 sprintf(c_alpha,
"%f",
m_alpha[0]);
574 syscall =
"../../utilities/PostProcessing/Extras/FldCalcBCs "
576 "meshhalf_pos_Spen_stability_moved.fld meshhalf_pos_Spen_advPost_moved.fld "
577 +c_alpha +
" > data_alpha0";
578 cout<<syscall.c_str()<<endl;
579 if(system(syscall.c_str()))
584 syscall =
"cp -f meshhalf_pos_Spen_stability_moved_u_5.bc "+
m_sessionName+
"_u_5.bc";
585 cout<<syscall.c_str()<<endl;
586 if(system(syscall.c_str()))
590 syscall =
"cp -f meshhalf_pos_Spen_stability_moved_v_5.bc "+
m_sessionName+
"_v_5.bc";
591 cout<<syscall.c_str()<<endl;
592 if(system(syscall.c_str()))
599 syscall =
"../../utilities/PostProcessing/Extras/FldCalcBCs "
600 + movedmesh +
" " + wavefile +
" " + filestreak +
" "+c_alpha +
" > datasub_"+c;
601 cout<<syscall.c_str()<<endl;
602 if(system(syscall.c_str()))
613 string wave_subalp =
m_sessionName +
"_wave_subalp_"+c+
".fld";
614 syscall =
"cp -f " + wavefile +
" " + wave_subalp;
615 cout<<syscall.c_str()<<endl;
616 if(system(syscall.c_str()))
628 Array<OneD, NekDouble> val(npts), der1(2*npts);
629 Array<OneD, NekDouble> der2 = der1 +
npts;
630 Array<OneD, NekDouble> streak;
631 static int projectfield = -1;
635 streak = Array<OneD, NekDouble> (
npts);
642 if(projectfield == -1)
644 Array<OneD, const SpatialDomains::BoundaryConditionShPtr > BndConds;
649 for(
int j = 0; j < BndConds.num_elements(); ++j)
657 if(projectfield != -1)
662 if(projectfield == -1)
664 cout <<
"using first field to project non-linear forcing which imposes a Dirichlet condition" << endl;
698 cout <<
"Area: " << area << endl;
699 invnorm = sqrt(area/invnorm);
704 Array<OneD, NekDouble> u_real =
m_waveVelocities[0]->GetPlane(0)->UpdatePhys();
707 Array<OneD, NekDouble> u_imag =
m_waveVelocities[0]->GetPlane(1)->UpdatePhys();
710 Array<OneD, NekDouble> v_real =
m_waveVelocities[1]->GetPlane(0)->UpdatePhys();
713 Array<OneD, NekDouble> v_imag =
m_waveVelocities[1]->GetPlane(1)->UpdatePhys();
723 std::vector<std::string> variables(3);
724 std::vector<Array<OneD, NekDouble> > outfield(3);
725 variables[0] =
"u_w";
726 variables[1] =
"v_w";
727 variables[2] =
"w_w";
791 m_sessionVWI->MatchSolverInfo(
"Symmetrization",
"True",symm,
true);
798 Array<OneD, NekDouble> coord(2);
799 Array<OneD, NekDouble> coord_x(npts);
800 Array<OneD, NekDouble> coord_y(npts);
812 Array<OneD, int> Eid(npts);
814 for(i = 0; i <
npts; ++i)
816 coord[0] = coord_x[i];
817 coord[1] = coord_y[i];
825 for(i = 0; i <
npts; ++i)
828 coord[0] = coord_x[i];
829 coord[1] = coord_y[i];
830 der2 [i] =
m_waveVelocities[0]->GetPlane(0)->GetExp(Eid[i])->PhysEvaluate(coord, der1 + physoffset);
843 for(i = 0; i <
npts; ++i)
846 coord[0] = coord_x[i];
847 coord[1] = coord_y[i];
848 der2[i] =
m_waveVelocities[0]->GetPlane(0)->GetExp(Eid[i])->PhysEvaluate(coord, der1 + physoffset);
857 m_waveVelocities[0]->GetPlane(0)->FwdTrans_BndConstrained(der2, m_vwiForceing[1]);
864 cout<<
"symmetrization is active"<<endl;
868 for(i = 0; i <
npts; ++i)
872 val[i] = 0.5*(der1[i] - der1[index[i]]);
882 for(i = 0; i <
npts; ++i)
886 val[i] = 0.5*(der2[i] - der2[index[i]]);
900 cout <<
"F_Linf: " <<
Vmath::Vmax(npts,val,1) << endl;
919 for(
int j = 0; j < 2; ++j)
923 for(
int i = 0; i <
npts; ++i)
933 std::vector<std::string> variables(4);
934 std::vector<Array<OneD, NekDouble> > outfield(4);
935 variables[0] =
"u"; variables[1] =
"v";
936 variables[2] =
"pr"; variables[3] =
"pi";
939 Array<OneD,NekDouble> soln(npts,0.0);
941 outfield[2] = Array<OneD,NekDouble>(ncoeffs);
949 cout <<
"int P^2: " <<
m_wavePressure->GetPlane(0)->PhysIntegral(val) << endl;
951 cout <<
"PLinf: " <<
Vmath::Vmax(npts,val,1) << endl;
953 outfield[3] = Array<OneD,NekDouble>(ncoeffs);
975 Array<OneD, NekDouble> val(2*npts,0.0);
979 cout <<
"int P^2 " <<
m_wavePressure->GetPlane(0)->PhysIntegral(val) << endl;
984 cout <<
"Linf: " << Linf << endl;
996 l2 = sqrt(norm/area);
998 cout <<
"L2: " << l2 << endl;
1000 cout <<
"Ratio Linf/L2: "<< Linf/l2 << endl;
1005 static map<string,int> opendir;
1007 if(opendir.find(dir) == opendir.end())
1010 string mkdir =
"mkdir " + dir;
1011 system(mkdir.c_str());
1016 string savefile = dir +
"/" + file +
"." + boost::lexical_cast<std::string>(n);
1017 string syscall =
"cp -f " + file +
" " + savefile;
1019 if(system(syscall.c_str()))
1029 static map<string,int> opendir;
1031 if(opendir.find(dir) == opendir.end())
1034 string mkdir =
"mkdir " + dir;
1035 system(mkdir.c_str());
1039 string savefile = dir +
"/" + file +
"." + boost::lexical_cast<std::string>(n);
1040 string syscall =
"mv -f " + file +
" " + savefile;
1042 if(system(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;
1712 Array<OneD, NekDouble> WaveForce(nstore);
1713 Array<OneD, NekDouble> Growth(nstore);
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;
1831 Array<OneD, NekDouble> Alpha(nstore);
1832 Array<OneD, NekDouble> Growth(nstore);
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)
1928 Array<OneD, int> index(npts);
1930 Array<OneD, NekDouble> coord(2);
1931 Array<OneD, NekDouble> coord_x(npts);
1932 Array<OneD, NekDouble> coord_y(npts);
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;
2007 Array<OneD, MultiRegions::ExpListSharedPtr> Iexp
2013 *boost::static_pointer_cast<MultiRegions::ExpList1D>(Iexp[reg]));
2014 int nq = Ilayer->GetTotPoints();
2017 m_bcsForcing = Array<OneD, Array<OneD, NekDouble> > (4);
2019 for(
int i = 1; i < 4; ++i)
2021 m_bcsForcing[i] = m_bcsForcing[i-1] + nq;
2034 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef_u;
2035 std::vector<std::vector<NekDouble> > FieldData_u;
2042 fld->Import(file,FieldDef_u, FieldData_u);
2043 Ilayer->ExtractDataToCoeffs(FieldDef_u[0], FieldData_u[0], FieldDef_u[0]->m_fields[0],Ilayer->UpdateCoeffs());
2044 Ilayer->BwdTrans_IterPerExp(Ilayer->GetCoeffs(), Ilayer->UpdatePhys());
2053 Array<OneD, NekDouble> tmp_forcing(nq, 0.0);
2067 Array<OneD, Array<OneD, NekDouble> > fieldcoeffs(1);
2068 Ilayer->FwdTrans_IterPerExp(Ilayer->GetPhys(),Ilayer->UpdateCoeffs());
2069 fieldcoeffs[0] = Ilayer->UpdateCoeffs();
2070 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef1 = Ilayer->GetFieldDefinitions();
2071 std::vector<std::vector<NekDouble> > FieldData_1(FieldDef1.size());;
2072 FieldDef1[0]->m_fields.push_back(
"u");
2073 Ilayer->AppendFieldData(FieldDef1[0], FieldData_1[0]);
2074 fld->Write(file,FieldDef1,FieldData_1);
2092 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef_v;
2093 std::vector<std::vector<NekDouble> > FieldData_v;
2094 fld->Import(file,FieldDef_v, FieldData_v);
2095 Ilayer->ExtractDataToCoeffs(FieldDef_v[0], FieldData_v[0], FieldDef_v[0]->m_fields[0],Ilayer->UpdateCoeffs());
2096 Ilayer->BwdTrans_IterPerExp(Ilayer->GetCoeffs(), Ilayer->UpdatePhys());
2113 Array<OneD, Array<OneD, NekDouble> > fieldcoeffs(1);
2114 Ilayer->FwdTrans_IterPerExp(Ilayer->GetPhys(),Ilayer->UpdateCoeffs());
2115 fieldcoeffs[0] = Ilayer->UpdateCoeffs();
2116 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef2 = Ilayer->GetFieldDefinitions();
2117 std::vector<std::vector<NekDouble> > FieldData_2(FieldDef2.size());;
2118 FieldDef2[0]->m_fields.push_back(
"v");
2119 Ilayer->AppendFieldData(FieldDef2[0], FieldData_2[0]);
2120 fld->Write(file,FieldDef2,FieldData_2);