167 if(argc > 6 || argc < 5)
170 "Usage: ./MoveMesh meshfile fieldfile changefile alpha cr(optional)\n");
176 = LibUtilities::SessionReader::CreateInstance(2, argv);
181 vSession->DefinesSolverInfo(
"INTERFACE")
182 && vSession->GetSolverInfo(
"INTERFACE")==
"phase" )
184 cr = boost::lexical_cast<NekDouble>(argv[argc-1]);
202 string changefile(argv[argc-2]);
206 string charalp (argv[argc-1]);
208 cout<<
"read alpha="<<charalp<<endl;
212 string fieldfile(argv[argc-3]);
213 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
214 vector<vector<NekDouble> > fielddata;
223 for(
int i=0; i<fielddata.size(); i++)
225 streak->ExtractDataToCoeffs(fielddef[i], fielddata[i], fielddef[i]->m_fields[0], streak->UpdateCoeffs());
227 streak->BwdTrans_IterPerExp(streak->GetCoeffs(), streak->UpdatePhys());
233 int nIregions, lastIregion=0;
238 int nbnd= bndConditions.size();
239 for(
int r=0; r<nbnd; r++)
241 if(bndConditions[r]->GetUserDefined()==
"CalcBC")
249 ASSERTL0(nIregions>0,
"there is any boundary region with the tag USERDEFINEDTYPE=""CalcBC"" specified");
250 cout<<
"nIregions="<<nIregions<<endl;
255 int nedges = bndfieldx[lastIregion]->GetExpSize();
256 int nvertl = nedges +1 ;
272 ( (bndfieldx[lastIregion]->GetExp(0)->as<LocalRegions::SegExp>())
277 vertex0->GetCoords(x0,y0,z0);
280 cout<<
"WARNING x0="<<x0<<endl;
286 Vids_low, v1, v2 , x_connect ,lastedge, xold_low,yold_low);
287 ASSERTL0(Vids_low[v2]!=-10,
"Vids_low[v2] is wrong");
291 cout<<
"x_conn="<<x_connect<<
" yt="<<yt<<
" zt="<<zt<<
" vid="<<Vids_low[v2]<<endl;
292 vertex->GetCoords(x_connect,yt,zt);
299 Vids_low, v1, v2 , x_connect, lastedge, xold_low, yold_low );
302 vertex->GetCoords(x_connect,yt,zt);
316 ( (bndfieldx[lastIregion]->GetExp(0)->as<LocalRegions::SegExp>())
321 vertex0->GetCoords(x0,y0,z0);
324 cout<<
"WARNING x0="<<x0<<endl;
332 Vids_up, v1, v2 , x_connect ,lastedge, xold_up, yold_up);
334 vertexU->GetCoords(x_connect,yt,zt);
341 Vids_up, v1, v2 , x_connect, lastedge, xold_up, yold_up );
345 vertex->GetCoords(x_connect,yt,zt);
357 graphShPt->GetVertex(((bndfieldx[lastIregion]->GetExp(0)
358 ->as<LocalRegions::SegExp>())->GetGeom1D())->GetVid(0));
359 vertex0->GetCoords(x0,y0,z0);
362 cout<<
"WARNING x0="<<x0<<endl;
371 Vids_c, v1, v2 , x_connect ,lastedge, xold_c, yold_c);
375 vertexc->GetCoords(x_connect,yt,zt);
382 Vids_c, v1, v2 , x_connect, lastedge, xold_c, yold_c );
386 vertex->GetCoords(x_connect,yt,zt);
395 for(
int r=0; r<nvertl; r++)
399 Deltaup[r] = yold_up[r] - yold_c[r];
400 Deltalow[r] = yold_c[r] - yold_low[r];
401 ASSERTL0(Deltaup[r]>0,
"distance between upper and layer curve is not positive");
402 ASSERTL0(Deltalow[r]>0,
"distance between lower and layer curve is not positive");
423 if(vSession->DefinesParameter(
"npedge"))
425 npedge = (int)vSession->GetParameter(
"npedge");
433 int nq= streak->GetTotPoints();
436 streak->GetCoords(x,y);
445 xold_low, yold_low, xold_c, yold_c, x_c, y_c,cr,
true);
448 for(
int q=0; q<nvertl; q++)
450 if(y_c[q] < yold_c[q])
455 Delta_c[q] =
abs(yold_c[q]-y_c[q]);
458 cout<<x_c[q]<<
" "<<y_c[q]<<endl;
463 cout<<
"Warning: the critical layer is stationary"<<endl;
486 for(
int r=0; r<nedges; r++)
489 bndSegExp = bndfieldx[lastIregion]->GetExp(r)
491 Eid = (bndSegExp->GetGeom1D())->GetGlobalID();
492 id1 = (bndSegExp->GetGeom1D())->GetVid(0);
493 id2 = (bndSegExp->GetGeom1D())->GetVid(1);
494 vertex1 = graphShPt->GetVertex(id1);
495 vertex2 = graphShPt->GetVertex(id2);
497 vertex2->GetCoords(x2,y2,z2);
500 cout<<
"edge="<<r<<
" x1="<<x1<<
" y1="<<y1<<
" x2="<<x2<<
" y2="<<y2<<endl;
503 Cpointsx[r] = x1 +(x2-x1)/2;
506 if( Cpointsx[r]>x2 || Cpointsx[r]< x1)
508 Cpointsx[r] = -Cpointsx[r];
510 for(
int w=0; w< npedge-2; w++)
513 Addpointsx[r*(npedge-2) +w] = x1 +((x2-x1)/(npedge - 1))*(w+1);
514 if( Addpointsx[r*(npedge-2) +w] > x2 || Addpointsx[r*(npedge-2) +w] < x1)
516 Addpointsx[r*(npedge-2) +w] = -Addpointsx[r*(npedge-2) +w];
519 Addpointsy[r*(npedge-2) +w] = y_c[r] + ((y_c[r+1]-y_c[r])/(x_c[r+1]-x_c[r]))*(Addpointsx[r*(npedge-2) +w]-x1);
522 Addpointsx[r*(npedge-2) +w], Addpointsy[r*(npedge-2) +w], streak, dU,cr);
535 Cpointsx[r] = x2+ (x1-x2)/2;
537 if( Cpointsx[r] > x1 || Cpointsx[r] < x2)
539 Cpointsx[r] = -Cpointsx[r];
541 for(
int w=0; w< npedge-2; w++)
543 Addpointsx[r*(npedge-2) +w] = x2 +((x1-x2)/(npedge - 1))*(w+1);
544 if( Addpointsx[r*(npedge-2) +w] > x1 || Addpointsx[r*(npedge-2) +w] < x2)
546 Addpointsx[r*(npedge-2) +w] = -Addpointsx[r*(npedge-2) +w];
550 Addpointsy[r*(npedge-2) +w] = y_c[r+1] + ((y_c[r]-y_c[r+1])/(x_c[r]-x_c[r+1]))*(Addpointsx[r*(npedge-2) +w]-x2);
554 Addpointsx[r*(npedge-2) +w], Addpointsy[r*(npedge-2) +w], streak, dU,cr);
565 ASSERTL0(
false,
"point not generated");
584 for(
int a=0; a<nedges; a++)
587 xcPhys[a*npedge+0] = x_c[a];
588 ycPhys[a*npedge+0] = y_c[a];
590 xcPhys[a*npedge+npedge-1] = x_c[a+1];
591 ycPhys[a*npedge+npedge-1] = y_c[a+1];
593 for(
int b=0; b<npedge-2; b++)
595 xcPhys[a*npedge +b+1] = Addpointsx[a*(npedge-2)+b];
596 ycPhys[a*npedge +b+1] = Addpointsy[a*(npedge-2)+b];
600 cout<<
"xc,yc before tanevaluate"<<endl;
601 for(
int v=0; v< xcPhys.size(); v++)
603 cout<<xcPhys[v]<<
" "<<ycPhys[v]<<endl;
616 MappingEVids(xold_up, yold_up, xold_low, yold_low, xold_c, yold_c, Vids_c,
617 graphShPt,streak, V1, V2, nlays, lay_Eids, lay_Vids);
621 cout<<
"nlays="<<nlays<<endl;
625 for(
int g=0; g<nlays; g++)
638 if(vSession->DefinesParameter(
"Delta"))
640 Delta0 = vSession->GetParameter(
"Delta");
652 int nVertTot = graphShPt->GetNvertices();
668 for(
int i=0; i<nVertTot; i++)
673 vertex->GetCoords(x,y,z);
683 if(x==0 && y< yold_low[0]
689 if(x== xold_c[nvertl-1] && y> yold_up[nvertl-1]
695 if(x==xold_c[nvertl-1] && y<yold_low[nvertl-1]
701 if(x== 0 && y> yold_up[0]
707 for(
int j=0; j<nvertl; j++)
709 if((xold_up[j]==x)&&(yold_up[j]==y))
713 ynew[i] = y_c[j] +Delta0;
717 if((xold_low[j]==x)&&(yold_low[j]==y))
721 ynew[i] = y_c[j] -Delta0;
725 if((xold_c[j]==x)&&(yold_c[j]==y))
736 for(
int k=0; k<nvertl; k++)
738 if(
abs(x-xold_up[k]) < diff)
740 diff =
abs(x-xold_up[k]);
744 if( y>yold_up[qp_closer] && y< 1)
752 ynew[i] = y_c[qp_closer] +(y-yold_c[qp_closer])*
753 (1-y_c[qp_closer])/(1-yold_c[qp_closer]);
759 else if(y<yold_low[qp_closer] && y> -1)
767 ynew[i] = y_c[qp_closer] + (y-yold_c[qp_closer] )*
768 (-1-y_c[qp_closer])/(-1-yold_c[qp_closer]);
772 else if ( y>yold_c[qp_closer] && y < yold_up[qp_closer])
779 else if (y<yold_c[qp_closer] && y > yold_low[qp_closer])
781 if(x==0){ cntlow++; }
786 else if( y==1 || y==-1)
793 if( (ynew[i]>1 || ynew[i]<-1)
794 && ( y>yold_up[qp_closer] || y<yold_low[qp_closer]) )
796 cout<<
"point x="<<xnew[i]<<
" y="<<y<<
" closer x="<<xold_up[qp_closer]<<
" ynew="<<ynew[i]<<endl;
797 ASSERTL0(
false,
"shifting out of range");
807 int nqedge = streak->GetExp(0)->GetNumPoints(0);
808 int nquad_lay = (nvertl-1)*nqedge;
813 int np_lay = (nvertl-1)*npedge;
823 if( move_norm==
true )
835 cout<<
"nquad per edge="<<nqedge<<endl;
836 for(
int l=0; l<2; l++)
838 Edge_newcoords[l] = bndfieldx[lastIregion]->GetExp(0)
863 bndfieldx[lastIregion]->GetCoords(xcQ, ycQ, zcQ);
872 for(
int l=0; l< xcQ.size(); l++)
882 xcQ[l],4,closex,closey );
895 Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffsy);
896 Cont_y->BwdTrans_IterPerExp( coeffsy, Cont_y->UpdatePhys());
899 cout<<
"xcQ, ycQ"<<endl;
900 for(
int s=0; s<xcQ.size(); s++)
902 cout<<xcQ[s]<<
" "<<ycQ[s]<<endl;
905 bool evaluatetan=
false;
909 for(
int k=0; k<nedges; k++)
914 Edge_newcoords[0]->StdPhysDeriv(xcedgeQ,txedgeQ);
915 Edge_newcoords[1]->StdPhysDeriv(ycedgeQ,tyedgeQ);
919 Vmath::Vvtvp(nqedge,tyedgeQ,1,tyedgeQ,1,normsQ,1,normsQ,1);
934 for(
int u=0; u<nqedge-1; u++)
936 incratio = (ycedgeQ[u+1]- ycedgeQ[u])/(xcedgeQ[u+1]- xcedgeQ[u]);
937 cout<<
"incratio="<<incratio<<endl;
938 if(
abs(incratio)> 4.0 && evaluatetan==false )
940 cout<<
"wrong="<<wrong<<endl;
942 ASSERTL0(wrong<2,
"number edges to change is too high!!");
950 cout<<
"tan bef"<<endl;
951 for(
int e=0; e< nqedge; e++)
953 cout<<xcedgeQ[e]<<
" "<<ycedgeQ[e]<<
" "<<txedgeQ[e]<<endl;
961 Vmath::Vcopy(npedge, &xcPhysMOD[k*npedge+0],1,&xPedges[0],1);
962 Vmath::Vcopy(npedge, &ycPhysMOD[k*npedge+0],1,&yPedges[0],1);
964 PolyFit(polyorder,nqedge, xcedgeQ,ycedgeQ, coeffsinterp, xPedges,yPedges, npedge);
966 Vmath::Vcopy(npedge, &xPedges[0],1, &xcPhysMOD[k*npedge+0],1);
967 Vmath::Vcopy(npedge, &yPedges[0],1, &ycPhysMOD[k*npedge+0],1);
974 Vmath::Vcopy(nqedge, &(txedgeQ[0]), 1, &(txQ[nqedge*k]),1);
975 Vmath::Vcopy(nqedge, &(tyedgeQ[0]), 1, &(tyQ[nqedge*k]),1);
980 for(
int w=0; w< fz.size(); w++)
982 txQ[w] = cos(atan(fz[w]));
983 tyQ[w] = sin(atan(fz[w]));
984 cout<<xcQ[w]<<
" "<<ycQ[w]<<
" "<<fz[w]<<endl;
990 Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffsy);
991 Cont_y->BwdTrans_IterPerExp( coeffsy, Cont_y->UpdatePhys());
995 Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffsy);
996 Cont_y->BwdTrans_IterPerExp( coeffsy, Cont_y->UpdatePhys());
1008 for(
int q=0; q<2; q++)
1010 edgebef = edgeinterp[q]-1;
1011 incbefore = (txQ[edgebef*nqedge+nqedge-1]-txQ[edgebef*nqedge])/
1012 (xcQ[edgebef*nqedge+nqedge-1]-xcQ[edgebef*nqedge]);
1013 inc = (txQ[edgeinterp[q]*nqedge+nqedge-1]-txQ[edgeinterp[q]*nqedge])/
1014 (xcQ[edgeinterp[q]*nqedge+nqedge-1]-xcQ[edgeinterp[q]*nqedge]);
1015 int npoints = 2*nqedge;
1021 cout<<
"inc="<<inc<<
" incbef="<<incbefore<<endl;
1022 if( (inc/incbefore)>0. )
1024 cout<<
"before!!"<<edgebef<<endl;
1027 Vmath::Vcopy(npoints, &xcQ[edgebef*nqedge+0],1,&xQedges[0],1);
1028 Vmath::Vcopy(npoints, &ycQ[edgebef*nqedge+0],1,&yQedges[0],1);
1029 Vmath::Vcopy(npoints, &txQ[edgebef*nqedge+0],1,&txQedges[0],1);
1030 Vmath::Vcopy(npoints, &tyQ[edgebef*nqedge+0],1,&tyQedges[0],1);
1034 coeffsinterp, xQedges,txQedges, npoints);
1037 Vmath::Vcopy(npoints,&txQedges[0],1, &txQ[edgebef*nqedge+0],1);
1041 coeffsinterp, xQedges,tyQedges, npoints);
1044 Vmath::Vcopy(npoints,&tyQedges[0],1, &tyQ[edgebef*nqedge+0],1);
1049 cout<<
"after!!"<<endl;
1052 Vmath::Vcopy(npoints, &xcQ[edgeinterp[q]*nqedge+0],1,&xQedges[0],1);
1053 Vmath::Vcopy(npoints, &ycQ[edgeinterp[q]*nqedge+0],1,&yQedges[0],1);
1054 Vmath::Vcopy(npoints, &txQ[edgeinterp[q]*nqedge+0],1,&txQedges[0],1);
1055 Vmath::Vcopy(npoints, &tyQ[edgeinterp[q]*nqedge+0],1,&tyQedges[0],1);
1060 coeffsinterp, xQedges,txQedges, npoints);
1063 Vmath::Vcopy(npoints,&txQedges[0],1, &txQ[edgeinterp[q]*nqedge+0],1);
1067 coeffsinterp, xQedges,tyQedges, npoints);
1070 Vmath::Vcopy(npoints,&tyQedges[0],1, &tyQ[edgeinterp[q]*nqedge+0],1);
1079 Vmath::Vcopy(nquad_lay, tyQ,1, Cont_y->UpdatePhys(),1);
1080 Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffstmp);
1081 Cont_y->BwdTrans_IterPerExp( coeffstmp, Cont_y->UpdatePhys());
1084 Vmath::Vcopy(nquad_lay, txQ,1, Cont_y->UpdatePhys(),1);
1085 Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffstmp);
1086 Cont_y->BwdTrans_IterPerExp( coeffstmp, Cont_y->UpdatePhys());
1089 for(
int k=0; k<nedges; k++)
1097 Vmath::Vcopy(nqedge, &(txQ[nqedge*k]),1, &(txedgeQ[0]), 1);
1098 Vmath::Vcopy(nqedge, &(tyQ[nqedge*k]),1, &(tyedgeQ[0]), 1);
1100 Vmath::Vdiv(nqedge, txedgeQ,1,tyedgeQ,1,tx_tyedgeQ,1);
1101 Vmath::Vmul(nqedge, tx_tyedgeQ,1,tx_tyedgeQ,1,tx_tyedgeQ,1);
1107 Vmath::Vcopy(nqedge, &(nxedgeQ[0]),1, &(nxQ[nqedge*k]),1);
1109 Vmath::Vmul(nqedge, nxedgeQ,1,nxedgeQ,1,nyedgeQ,1);
1115 Vmath::Vcopy(nqedge, &(nyedgeQ[0]), 1, &(nyQ[nqedge*k]),1);
1118 cout<<
"edge:"<<k<<endl;
1119 cout<<
"tan/normal"<<endl;
1120 for(
int r=0; r<nqedge; r++)
1122 cout<<xcQ[k*nqedge+r]<<
" "<<txedgeQ[r]<<
" "<<tyedgeQ[r]<<
" "
1123 <<nxedgeQ[r]<<
" "<<nyedgeQ[r]<<endl;
1129 Vmath::Vcopy(nquad_lay, nyQ,1, Cont_y->UpdatePhys(),1);
1131 Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffstmp);
1132 Cont_y->BwdTrans_IterPerExp( coeffstmp, Cont_y->UpdatePhys());
1136 Vmath::Zero(Cont_y->GetNcoeffs(),Cont_y->UpdateCoeffs(),1);
1137 Vmath::Vcopy(nquad_lay, nxQ,1, Cont_y->UpdatePhys(),1);
1138 Cont_y->FwdTrans_IterPerExp(Cont_y->GetPhys(), coeffstmp);
1139 Cont_y->BwdTrans_IterPerExp( coeffstmp, Cont_y->UpdatePhys());
1143 for(
int k=0; k<nedges; k++)
1149 nyQ[(k-1)*nqedge+nqedge-1]=
1154 nxQ[(k-1)*nqedge+nqedge-1]=
1163 cout<<
"nx,yQbefore"<<endl;
1164 for(
int u=0; u<xcQ.size(); u++)
1166 cout<<xcQ[u]<<
" "<<nyQ[u]<<
" "<<txQ[u]<<endl;
1172 cout<<
"nx,yQ"<<endl;
1173 for(
int u=0; u<x_tmpQ.size(); u++)
1175 cout<<x_tmpQ[u]<<
" "<<tmpnyQ[u]<<endl;
1179 for(
int k=0; k<nedges; k++)
1182 for(
int a=0; a<npedge; a++)
1186 nxPhys[k*npedge +a]= nxQ[k*nqedge +0];
1187 nyPhys[k*npedge +a]= nyQ[k*nqedge +0];
1190 else if(a== npedge-1)
1192 nxPhys[k*npedge +a]= nxQ[k*nqedge +nqedge-1];
1193 nyPhys[k*npedge +a]= nyQ[k*nqedge +nqedge-1];
1217 nyPhys[k*npedge +a]=
1227 nxPhys[k*npedge +a]= -
sqrt(
abs(1- nyPhys[k*npedge +a]*nyPhys[k*npedge +a]));
1243 nyPhys[(k-1)*npedge+npedge-1]=
1248 nxPhys[(k-1)*npedge+npedge-1]=
1253 cout<<
"xcPhys,,"<<endl;
1254 for(
int s=0; s<np_lay; s++)
1257 cout<<xcPhysMOD[s]<<
" "<<ycPhysMOD[s]<<
" "<<nxPhys[s]<<
" "<<nyPhys[s]<<endl;
1270 for(
int m=0; m<nlays; m++)
1277 delta[m] = -(cntlow+1-m)*Delta0/(cntlow+1);
1281 delta[m] = ( m-(cntlow) )*Delta0/(cntlow+1);
1288 for(
int h=0; h< nvertl; h++)
1295 if(move_norm==
false)
1297 ynew[lay_Vids[m][h] ]= y_c[h] +delta[m];
1298 xnew[lay_Vids[m][h] ]= x_c[h];
1302 if(h==0 || h==nvertl-1 )
1304 ynew[lay_Vids[m][h] ]= y_c[h] +delta[m];
1305 xnew[lay_Vids[m][h] ]= x_c[h];
1309 ynew[lay_Vids[m][h] ]= y_c[h] +delta[m]*
abs(nyPhys[h*npedge+0]);
1310 xnew[lay_Vids[m][h] ]= x_c[h] +delta[m]*
abs(nxPhys[h*npedge+0]);
1313 cout<<
"Vid x="<<xnew[lay_Vids[m][h] ]<<
" y="<<ynew[lay_Vids[m][h] ]<<endl;
1318 cout<<
"edge=="<<h<<endl;
1321 ASSERTL0( nyPhys[h*npedge+0]==nyPhys[(h-1)*npedge+npedge-1],
" normaly wrong");
1322 ASSERTL0( nxPhys[h*npedge+0]==nxPhys[(h-1)*npedge+npedge-1],
" normalx wrong");
1325 if(move_norm==
false)
1328 layers_y[m][h*npedge +0] = y_c[h] +delta[m];
1329 layers_x[m][h*npedge +0] = xnew[lay_Vids[m][h] ];
1331 layers_y[m][h*npedge +npedge-1] = y_c[h+1] +delta[m];
1332 layers_x[m][h*npedge +npedge-1] = xnew[lay_Vids[m][h+1] ];
1334 for(
int d=0; d< npedge-2; d++)
1336 layers_y[m][h*npedge +d+1]= ycPhysMOD[h*npedge +d+1] +delta[m];
1338 layers_x[m][h*npedge +d+1]= xcPhysMOD[h*npedge +d+1];
1347 tmpy_lay[h*npedge +0] = y_c[h] +delta[m];
1348 tmpx_lay[h*npedge +0] = xnew[lay_Vids[m][h] ];
1350 tmpy_lay[h*npedge +npedge-1] =
1351 y_c[h+1] +delta[m]*
abs(nyPhys[h*npedge +npedge-1]);
1352 tmpx_lay[h*npedge +npedge-1] =
1353 x_c[h+1] +delta[m]*
abs(nxPhys[h*npedge +npedge-1]);
1355 else if(h==nedges-1)
1358 tmpy_lay[h*npedge +0] =
1359 y_c[h] +delta[m]*
abs(nyPhys[h*npedge +0]);
1360 tmpx_lay[h*npedge +0] =
1361 x_c[h] +delta[m]*
abs(nxPhys[h*npedge +0]);
1363 tmpy_lay[h*npedge +npedge-1] = y_c[h+1] +delta[m];
1364 tmpx_lay[h*npedge +npedge-1] = xnew[lay_Vids[m][h+1] ];
1369 tmpy_lay[h*npedge +0] =
1370 y_c[h] +delta[m]*
abs(nyPhys[h*npedge +0]);
1371 tmpx_lay[h*npedge +0] =
1372 x_c[h] +delta[m]*
abs(nxPhys[h*npedge +0]);
1374 tmpy_lay[h*npedge +npedge-1] =
1375 y_c[h+1] +delta[m]*
abs(nyPhys[h*npedge +npedge-1]);
1376 tmpx_lay[h*npedge +npedge-1] =
1377 x_c[h+1] +delta[m]*
abs(nxPhys[h*npedge +npedge-1]);
1381 for(
int d=0; d< npedge-2; d++)
1384 tmpy_lay[h*npedge +d+1] = ycPhysMOD[h*npedge +d+1] +
1385 delta[m]*
abs(nyPhys[h*npedge +d+1]);
1388 tmpx_lay[h*npedge +d+1]= xcPhysMOD[h*npedge +d+1] +
1389 delta[m]*
abs(nxPhys[h*npedge +d+1]);
1406 for(
int s=0; s<np_lay; s++)
1408 cout<<tmpx_lay[s]<<
" "<<tmpy_lay[s]<<endl;
1411 cout<<
"fisrt interp"<<endl;
1412 for(
int s=0; s<np_lay; s++)
1414 cout<<tmpx_lay[s]<<
" "<<tmpy_lay[s]<<endl;
1426 NekDouble boundright = xcPhysMOD[np_lay-1];
1427 bool outboundleft=
false;
1428 bool outboundright=
false;
1429 if(tmpx_lay[1]< boundleft )
1431 outboundleft =
true;
1433 if(tmpx_lay[np_lay-2] > boundright )
1435 outboundright =
true;
1443 for(
int r=0; r< nedges; r++)
1446 if(tmpx_lay[r*npedge + npedge-1]< boundleft && outboundleft==
true )
1454 if( tmpx_lay[(r+1)*npedge + npedge-1]> boundleft )
1456 for(
int s=0; s<npedge-2; s++)
1458 if(tmpx_lay[(r+1)*npedge + s+1]< boundleft)
1468 if(tmpx_lay[r*npedge + 0]> boundright && outboundright==
true )
1476 if( tmpx_lay[(r-1)*npedge + 0]< boundright )
1478 for(
int s=0; s<npedge-2; s++)
1480 if(tmpx_lay[(r-1)*npedge + s+1]> boundright)
1492 outcount = outvert*npedge+1+ outmiddle;
1494 int replacepointsfromindex=0;
1495 for(
int c=0; c<nedges; c++)
1498 if(xcPhysMOD[c*npedge+npedge-1] <= tmpx_lay[c*(npedge-(npedge-2)) +2] && outboundright==
true)
1500 replacepointsfromindex = c*(npedge-(npedge-2))+2;
1505 if(xcPhysMOD[(nedges-1 -c)*npedge+0] >= tmpx_lay[np_lay-1 -(c*(npedge-(npedge-2)) +2)] && outboundleft==
true)
1507 replacepointsfromindex = np_lay-1 -(c*(npedge-(npedge-2)) +2);
1523 if( outboundright==
true)
1525 pstart = replacepointsfromindex;
1526 shift = np_lay-outcount;
1527 increment = (xcPhysMOD[np_lay-outcount]-xcPhysMOD[pstart])/(outcount+1);
1528 outcount = outcount-1;
1529 ASSERTL0(tmpx_lay[np_lay-outcount]>xcPhysMOD[(nedges-1)*npedge+0],
"no middle points in the last edge");
1535 increment = (xcPhysMOD[replacepointsfromindex]-xcPhysMOD[pstart])/(outcount+1);
1536 ASSERTL0(tmpx_lay[pstart]<xcPhysMOD[0*npedge +npedge-1],
"no middle points in the first edge");
1553 NekDouble xctmp,ycinterp,nxinterp,nyinterp;
1555 for(
int v=0; v<outcount;v++)
1557 xctmp = xcPhysMOD[pstart]+(v+1)*increment;
1570 xctmp,4,closex,closeny );
1573 nxinterp =
sqrt(
abs(1-nyinterp*nyinterp));
1580 replace_x[v] = xctmp +delta[m]*
abs(nxinterp);
1581 replace_y[v] = ycinterp +delta[m]*
abs(nyinterp);
1582 tmpx_lay[ v+shift ] = replace_x[v];
1583 tmpy_lay[ v+shift ] = replace_y[v];
1604 int closepoints = 4;
1611 for(
int q=0; q<np_lay; q++)
1613 for(
int e=0; e<nedges; e++)
1615 if(tmpx_lay[q]<= x_c[e+1] && tmpx_lay[q]>= x_c[e])
1619 if(q == e*npedge +npedge-1 && pointscount!=npedge )
1624 else if(q == e*npedge +npedge-1)
1644 lay_Vids[m], layers_x[m], layers_y[m],xnew,ynew);
1727 int npoints = npedge;
1730 for(
int f=0; f<nedges; f++)
1736 Vmath::Vcopy(npoints, &layers_x[m][(f)*npedge+0],1,&xPedges[0],1);
1737 Vmath::Vcopy(npoints, &layers_y[m][(f)*npedge+0],1,&yPedges[0],1);
1741 coeffsinterp, xPedges,yPedges, npoints);
1744 Vmath::Vcopy(npoints,&yPedges[0],1, &layers_y[m][(f)*npedge+0],1);
1747 layers_y[m][f*npedge+0]= ynew[lay_Vids[m][f]];
1748 layers_y[m][f*npedge+npedge-1]= ynew[lay_Vids[m][f+1]];
1751 cout<<
" xlay ylay lay:"<<m<<endl;
1752 for(
int l=0; l<np_lay; l++)
1755 cout<<std::setprecision(8)<<layers_x[m][l]<<
" "<<layers_y[m][l]<<endl;
1789 cout<<
"lay="<<m<<endl;
1791 " different layer ymin val");
1793 " different layer ymax val");
1795 " different layer xmin val");
1797 " different layer xmax val");
1807 layers_x[0], layers_y[0], layers_x[nlays-1], layers_y[nlays-1],nxPhys, nyPhys,xnew, ynew);
1889 lay_Vids, x_c, y_c, Down, Up, xnew, ynew, layers_x, layers_y);
1900 cout<<std::setprecision(8)<<
"xmin="<<
Vmath::Vmin(nVertTot, xnew,1)<<endl;
1902 " different xmin val");
1904 " different ymin val");
1906 " different xmax val");
1908 " different ymax val");
1914 Replacevertices(changefile, xnew , ynew, xcPhys, ycPhys, Eids, npedge, charalp, layers_x,layers_y, lay_Eids, curv_lay);
void GenerateMapEidsv1v2(MultiRegions::ExpListSharedPtr field, Array< OneD, int > &V1, Array< OneD, int > &V2)
void MoveLayerNnormpos(int nvertl, int npedge, Array< OneD, NekDouble > xcPhys, Array< OneD, NekDouble > tmpx_lay, Array< OneD, NekDouble > tmpy_lay, Array< OneD, int > Vids, Array< OneD, NekDouble > &xlay, Array< OneD, NekDouble > &ylay, Array< OneD, NekDouble > &xnew, Array< OneD, NekDouble > &ynew)
void EvaluateTangent(int npoints, Array< OneD, NekDouble > xcQedge, Array< OneD, NekDouble > coeffsinterp, Array< OneD, NekDouble > &txQedge, Array< OneD, NekDouble > &tyQedge)
NekDouble LagrangeInterpolant(NekDouble x, int npts, Array< OneD, NekDouble > xpts, Array< OneD, NekDouble > funcvals)
void Computestreakpositions(int nvertl, MultiRegions::ExpListSharedPtr streak, Array< OneD, NekDouble > xold_up, Array< OneD, NekDouble > yold_up, Array< OneD, NekDouble > xold_low, Array< OneD, NekDouble > yold_low, Array< OneD, NekDouble > xold_c, Array< OneD, NekDouble > yold_c, Array< OneD, NekDouble > &xc, Array< OneD, NekDouble > &yc, NekDouble cr, bool verts)
void Replacevertices(string filename, Array< OneD, NekDouble > newx, Array< OneD, NekDouble > newy, Array< OneD, NekDouble > xcPhys, Array< OneD, NekDouble > ycPhys, Array< OneD, int >Eids, int Npoints, string s_alp, Array< OneD, Array< OneD, NekDouble > > x_lay, Array< OneD, Array< OneD, NekDouble > > y_lay, Array< OneD, Array< OneD, int > >lay_eids, bool curv_lay)
void Cutrepetitions(int nedges, Array< OneD, NekDouble > inarray, Array< OneD, NekDouble > &outarray)
void MoveOutsidePointsNnormpos(int npedge, SpatialDomains::MeshGraphSharedPtr mesh, Array< OneD, NekDouble > xcold, Array< OneD, NekDouble > ycold, Array< OneD, NekDouble > xolddown, Array< OneD, NekDouble > yolddown, Array< OneD, NekDouble > xoldup, Array< OneD, NekDouble > yoldup, Array< OneD, NekDouble > xlaydown, Array< OneD, NekDouble > ylaydown, Array< OneD, NekDouble > xlayup, Array< OneD, NekDouble > ylayup, Array< OneD, NekDouble > nxPhys, Array< OneD, NekDouble > nyPhys, Array< OneD, NekDouble > &xnew, Array< OneD, NekDouble > &ynew)
void MappingEVids(Array< OneD, NekDouble > xoldup, Array< OneD, NekDouble > yoldup, Array< OneD, NekDouble > xolddown, Array< OneD, NekDouble > yolddown, Array< OneD, NekDouble > xcold, Array< OneD, NekDouble > ycold, Array< OneD, int > Vids_c, SpatialDomains::MeshGraphSharedPtr mesh, MultiRegions::ExpListSharedPtr streak, Array< OneD, int > V1, Array< OneD, int > V2, int &nlays, Array< OneD, Array< OneD, int > > &Eids_lay, Array< OneD, Array< OneD, int > > &Vids_lay)
void CheckSingularQuads(MultiRegions::ExpListSharedPtr Exp, Array< OneD, int > V1, Array< OneD, int > V2, Array< OneD, NekDouble > &xnew, Array< OneD, NekDouble > &ynew)
void Orderfunctionx(Array< OneD, NekDouble > inarray_x, Array< OneD, NekDouble > inarray_y, Array< OneD, NekDouble > &outarray_x, Array< OneD, NekDouble > &outarray_y)
void OrderVertices(int nedges, SpatialDomains::MeshGraphSharedPtr graphShPt, MultiRegions::ExpListSharedPtr &bndfield, Array< OneD, int > &Vids, int v1, int v2, NekDouble x_connect, int &lastedge, Array< OneD, NekDouble > &x, Array< OneD, NekDouble > &y)
void PolyFit(int polyorder, int npoints, Array< OneD, NekDouble > xin, Array< OneD, NekDouble > fin, Array< OneD, NekDouble > &coeffsinterp, Array< OneD, NekDouble > &xout, Array< OneD, NekDouble > &fout, int npout)
void GenerateAddPointsNewtonIt(NekDouble xi, NekDouble yi, NekDouble &xout, NekDouble &yout, MultiRegions::ExpListSharedPtr function, Array< OneD, NekDouble > derfunction, NekDouble cr)
void MoveLayersvertically(int nlays, int nvertl, int cntlow, int cntup, Array< OneD, Array< OneD, int > > lay_Vids, Array< OneD, NekDouble > xc, Array< OneD, NekDouble > yc, Array< OneD, int > Down, Array< OneD, int > Up, Array< OneD, NekDouble > &xnew, Array< OneD, NekDouble > &ynew, Array< OneD, Array< OneD, NekDouble > > &layers_x, Array< OneD, Array< OneD, NekDouble > > &layers_y)
void GenerateNeighbourArrays(int index, int neighpoints, Array< OneD, NekDouble > xArray, Array< OneD, NekDouble > yArray, Array< OneD, NekDouble > &Neighbour_x, Array< OneD, NekDouble > &Neighbour_y)
int DetermineclosePointxindex(NekDouble x, Array< OneD, NekDouble > xArray)
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
void GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2=NullNekDouble1DArray, Array< OneD, NekDouble > &coords_3=NullNekDouble1DArray)
this function returns the physical coordinates of the quadrature points of the expansion
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > &ElementIDs)
This function allows for data to be imported from an FLD file when a session and/or communicator is n...
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< SegExp > SegExpSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< ContField > ContFieldSharedPtr
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::shared_ptr< PointGeom > PointGeomSharedPtr
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
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.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
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
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/y.
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
void Zero(int n, T *x, const int incx)
Zero vector.
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
scalarT< T > sqrt(scalarT< T > in)