125 int npts = xc.num_elements();
127 int nq = streak->GetTotPoints();
128 Array<OneD, NekDouble> derstreak(nq);
129 Array<OneD, NekDouble> x(nq);
130 Array<OneD, NekDouble> y(nq);
131 streak->GetCoords(x,y);
133 streak->BwdTrans(streak->GetCoeffs(),streak->UpdatePhys());
140 for(i = 0; i < npts; ++i)
142 xc[i] = x_min + (x_max - x_min)*i/((
NekDouble)(npts-1));
147 int elmtid, offset,cnt;
153 Array<OneD, NekDouble> coord(2);
157 for(
int e=0; e<npts; e++)
172 while( abs(F)> 0.000000001)
175 elmtid = streak->GetExpIndex(coord,0.00001);
176 offset = streak->GetPhys_Offset(elmtid);
177 U = streak->GetExp(elmtid)->PhysEvaluate(coord, streak->GetPhys() + offset);
178 dU = streak->GetExp(elmtid)->PhysEvaluate(coord, derstreak + offset);
179 coord[1] = coord[1] - (U-cr)/dU;
181 ASSERTL0( coord[0]==xc[e],
" x coordinate must remain the same");
186 coord[1] = ytmp +0.01;
187 elmtid = streak->GetExpIndex(coord,0.00001);
188 offset = streak->GetPhys_Offset(elmtid);
189 NekDouble Utmp = streak->GetExp(elmtid)->PhysEvaluate(coord, streak->GetPhys() + offset);
190 NekDouble dUtmp = streak->GetExp(elmtid)->PhysEvaluate(coord, derstreak + offset);
191 coord[1] = coord[1] - (Utmp-cr)/dUtmp;
193 if( (abs(Utmp-cr)>abs(F))||(abs(coord[1])>1) )
195 coord[1] = ytmp -0.01;
202 ASSERTL0(abs(coord[1])<= 1,
" y value out of bound +/-1");
206 if(its>1000 && abs(F)< 0.0001)
208 cout<<
"warning streak position obtained with precision:"<<F<<endl;
213 ASSERTL0(
false,
"no convergence after 1000 iterations");
222 FILE *fp = fopen(
"interfacedat.geo",
"w");
228 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",
230 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",
232 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",
234 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",
237 for(i = 0; i < npts; ++i)
239 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",
246 fp = fopen(
"interfacedat_up.geo",
"w");
251 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",cnt++,xc[0],yc[0]+trans);
253 for(i = 1; i < npts-1; ++i)
255 norm = sqrt((xc[i+1]-xc[i-1])*(xc[i+1]-xc[i-1])+(yc[i+1]-yc[i-1])*(yc[i+1]-yc[i-1]));
256 nx = (yc[i-1]-yc[i+1])/norm;
257 ny = (xc[i+1]-xc[i-1])/norm;
259 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",
260 cnt++,xc[i]+nx*trans,yc[i]+ny*trans);
263 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",cnt++,xc[npts-1],yc[npts-1]+trans);
267 fp = fopen(
"interfacedat_dn.geo",
"w");
271 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",cnt++,xc[0],yc[0]+trans);
273 for(i = 1; i < npts-1; ++i)
275 norm = sqrt((xc[i+1]-xc[i-1])*(xc[i+1]-xc[i-1])+(yc[i+1]-yc[i-1])*(yc[i+1]-yc[i-1]));
276 nx = (yc[i-1]-yc[i+1])/norm;
277 ny = (xc[i+1]-xc[i-1])/norm;
279 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",
280 cnt++,xc[i]+nx*trans,yc[i]+ny*trans);
283 fprintf(fp,
"Point(%d)={%12.10lf,%12.10lf,0,1.0}; \n",cnt++,xc[npts-1],yc[npts-1]+trans);
#define ASSERTL0(condition, msg)
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.