HARM
harm and utilities
 All Data Structures Files Functions Variables Typedefs Macros Pages
initbase.boundloop.c
Go to the documentation of this file.
1 
7 #include "decs.h"
8 
9 
10 
11 int report_bound_loop(void)
12 {
13  int inboundloop[NDIM];
14  int outboundloop[NDIM];
15  int innormalloop[NDIM];
16  int outnormalloop[NDIM];
19  int dosetbc[COMPDIM*2];
20  int ii,jj,dimen,dir;
21  int boundvartype;
22  int numbnd[NDIM],numnpr;
23 
24 
25 
26  for(boundvartype=0;boundvartype<NUMBOUNDTYPES;boundvartype++){
27 
28  trifprintf("boundvartype=%d\n",boundvartype);
29 
30  // get number of boundary cells and number of quantities bounding
31  set_numbnd(boundvartype, numbnd, &numnpr);
32 
33  trifprintf("numnpr=%d\n",numnpr);
34  DIMENLOOP(dimen){
35  trifprintf("numbnd[%d]=%d\n",dimen,numbnd[dimen]);
36  }
37 
38  set_boundloop(boundvartype, inboundloop, outboundloop, innormalloop, outnormalloop, inoutlohi, &riin, &riout, &rjin, &rjout, &rkin, &rkout, dosetbc);
39 
40  // now report
41  trifprintf("Note inout/lowhigh iter has POINTDOWN=%d and POINTUP=%d\n",POINTDOWN,POINTUP);
42  DIMENLOOP(dimen){
43  for(ii=NUMUPDOWN-1;ii>=0;ii--){
44  for(jj=NUMUPDOWN-1;jj>=0;jj--){
45  trifprintf("inoutlohi[inoutboundary=%d][lowhighrange=%d][dimen=%d]=%d\n",ii,jj,dimen,inoutlohi[ii][jj][dimen]);
46  }
47  }
48  trifprintf("inboundloop[dimen=%d]=%d outboundloop[dimen=%d]=%d\n",dimen,inboundloop[dimen],dimen,outboundloop[dimen]);
49  if(dimen==1) trifprintf("riin=%d riout=%d\n",riin,riout);
50  else if(dimen==2) trifprintf("rjin=%d rjout=%d\n",rjin,rjout);
51  else if(dimen==3) trifprintf("rkin=%d rkout=%d\n",rkin,rkout);
52  }
53  DIRLOOP(dir){
54  trifprintf("dosetbc[dir=%d]=%d\n",dir,dosetbc[dir]);
55  }
56  } // end over boundvartype
57 
58 
59  return(0);
60 
61 }
62 
63 
64 
65 
66 
67 
68 
69 // set number of boundary cells and number of quantities for boundary cells for various types of quantities
70 // sets true number of boundary cells instead of just MAXBND if dimension exists
71 void set_numbnd(int boundvartype, int *numbnd, int *numnpr)
72 {
73 
74 
75 
76  if(boundvartype==BOUNDPRIMTYPE || boundvartype==BOUNDPSTAGTYPE){
77  numbnd[1]=N1BND;
78  numbnd[2]=N2BND;
79  numbnd[3]=N3BND;
80  *numnpr = NPRBOUND;
81  }
82  else if(boundvartype==BOUNDPRIMSIMPLETYPE || boundvartype==BOUNDPSTAGSIMPLETYPE){ // simple means only 1 cell
83  // used to bound after fixups that only modify +-1 cell currently
84  numbnd[1]=NUMPFLAGBND1;
85  numbnd[2]=NUMPFLAGBND2;
86  numbnd[3]=NUMPFLAGBND3;
87  *numnpr = NPRBOUND;
88  }
89  else if(boundvartype==BOUNDINTTYPE){ // always "simple"
90  // right now only need 1 boundary cell for averaging or checking by check_solution() and fixup_utoprim()
91  numbnd[1]=NUMPFLAGBND1;
92  numbnd[2]=NUMPFLAGBND2;
93  numbnd[3]=NUMPFLAGBND3;
94  *numnpr = NUMPFLAGSBOUND;
95  }
96  else if(boundvartype==BOUNDFLUXTYPE){
97  numbnd[1]=N1BND;
98  numbnd[2]=N2BND;
99  numbnd[3]=N3BND;
100  *numnpr = NFLUXBOUND;
101  }
102  else if(boundvartype==BOUNDFLUXSIMPLETYPE){
103  // flux only defined with 1 shift
104  numbnd[1]=SHIFT1;
105  numbnd[2]=SHIFT2;
106  numbnd[3]=SHIFT3;
107  *numnpr = NFLUXBOUND;
108  }
109  else if(boundvartype==BOUNDVPOTTYPE){
110  numbnd[1]=N1BND;
111  numbnd[2]=N2BND;
112  numbnd[3]=N3BND;
113  *numnpr = NDIM;
114  }
115  else if(boundvartype==BOUNDVPOTSIMPLETYPE){
116  // vpot only defined with one shift
117  numbnd[1]=SHIFT1;
118  numbnd[2]=SHIFT2;
119  numbnd[3]=SHIFT3;
120  *numnpr = NDIM;
121  }
122  else{
123  dualfprintf(fail_file,"set_numbnd(): No such boundvartype=%d\n",boundvartype);
124  myexit(2436726);
125  }
126 
127 
128 }
129 
130 
131 
132 // uses global variables local to this file
133 // determine orthogonal direction loop ranges depending upon presence of real or MPI boundary
134 // now that bound per direction shouldn't treat real and mpi boundaries differently -- always use full loop
135 // in order to avoid accessing undefined data, but still fill corner
136 // zones, the ORDER of boundary LOOPS is as follows:
137 
138 // X1 in&out: LOOPN2 LOOPN3 LOOPBOUNDIN1 & LOOPBOUNDOUT1
139 // X2 in&out: LOOPF1 LOOPN3 LOOPBOUNDIN2 & LOOPBOUNDOUT2 // LOOPF1 ok if X1 dimension not there, then LOOPF1->LOOPN1
140 // X3 in&out: LOOPF1 LOOPF2 LOOPBOUNDIN3 & LOOPBOUNDOUT3 // as above
141 
142 // above loops replaced with LOOPX1dir LOOPX2dir, LOOPX3dir
143 
144 // the resulting shifts should include shift due to GRIDSECTION *and* due to normal boundaries
145 // so specifies really is,ie,js,je,ks,ke for normal loop
146 // boundvartype is one of NUMBOUNDTYPES in global.nondepmnemonics.h
147 // This sets up both LOOPBOUND?IN loops *and* LOOPX?dir loops
148 // Notes:
149 // 1) Assume set_boundloop() is called each time needed since BCs could change with time
150 void set_boundloop(int boundvartype, int *inboundloop, int*outboundloop, int*innormalloop, int*outnormalloop, int (*inoutlohi)[NUMUPDOWN][NDIM], int *riin, int *riout, int *rjin, int *rjout, int *rkin, int *rkout, int *dosetbc)
151 {
152  int outflowtype[COMPDIM*2];
153  int dir;
154  int shifts[NUMUPDOWN][NDIM];
155  int ii,jj;
156  int dimen;
157  int numbnd[NDIM],numnpr;
158  int shiftamount[COMPDIM*2];
159  const int NxNOT1[NDIM]={0,N1NOT1,N2NOT1,N3NOT1};
160  const int Nx[NDIM]={0,N1,N2,N3};
161 
163  //
164  // Get number of boundary cells and number of quantities bounding per cell
165  //
167 
168  set_numbnd(boundvartype, numbnd, &numnpr);
169 
171  //
172  // Determine whether shift boundaries with ACTIVEREGION for GRIDSECTIONING
173  //
175 
176  shiftamount[X1DN]=SHIFTX1DN;
177  shiftamount[X1UP]=SHIFTX1UP;
178  shiftamount[X2DN]=SHIFTX2DN;
179  shiftamount[X2UP]=SHIFTX2UP;
180  shiftamount[X3DN]=SHIFTX3DN;
181  shiftamount[X3UP]=SHIFTX3UP;
182 
183 
185  DIRLOOP(dir){
186  if(
187  BCtype[dir]==OUTFLOW
188  || BCtype[dir]==HORIZONOUTFLOW
189  || BCtype[dir]==FIXEDOUTFLOW
190  || BCtype[dir]==OUTFLOWNOINFLOW
191  || BCtype[dir]==RAMESHOUTFLOW
192  || BCtype[dir]==RESCALEOUTFLOW
193  || BCtype[dir]==FREEOUTFLOW
194  ){
195  outflowtype[dir]=1;
196  }
197  else outflowtype[dir]=0;
198  }
199 
200  // USERMARK can choose to force shifts to be always 0 instead of dependending upon BCs if user wants
201  // SUPERGODMARK: For example, should add "FIXED" types and shift for those?
202  DIRLOOP(dir){
203  if(outflowtype[dir]) shifts[POINTFROMDIR(dir)][DIMEN(dir)]=shiftamount[dir];
204  else shifts[POINTFROMDIR(dir)][DIMEN(dir)]=0;
205 
206  // do set boundary physical conditions
207  dosetbc[dir]=1;
208  }
209 
210  }
211  else{
212  // then BCs are only true BCs
213  // Then never should call COMP type loops in bounds.c
214  DIRLOOP(dir){
215  // check whether really next to X1DN boundary and need to set physical boundary conditions
216  // e.g. SHIFTX1UP*(-1)<=MAXBND [note generically SHIFTX1UP is negative since added in COMP loops] will be true if near that boundary enough for physical boundary conditions to be used in comp loops
217  if(shiftamount[dir]*(-DIRSIGN(dir))<=MAXBND) dosetbc[dir]=1;
218  else dosetbc[dir]=0;
219 
220  // define physical boundary loop range
221  if(dosetbc[dir]){
222  // standard shift for physical boundary when doing that boundary
223  shifts[POINTFROMDIR(dir)][DIMEN(dir)]=0;
224  }
225  else{
226  shifts[POINTFROMDIR(dir)][DIMEN(dir)]=shiftamount[dir];
227 
228  // below is wrong:
229  // shift so that never access interior of such boundary loops in case not using dosetbc[] to check
230  // if(DIRSIGN(dir)==-1) shifts[POINTFROMDIR(dir)][DIMEN(dir)]=totalsize[DIMEN(dir)]+MAXBND;
231  // else if(DIRSIGN(dir)==1) shifts[POINTFROMDIR(dir)][DIMEN(dir)]=-MAXBND;
232  }
233 
234  }
235 
236 
237  }
238 
239 
240 
241 
243  //
244  // For LOOPBOUND?IN/OUT loops:
245  //
247 
248  //int shifts[0=inner boundary, 1=outer boundary][0=lower loop index, 1=higher (upper) loop index][dimension];
249  if(boundvartype==BOUNDPRIMTYPE || boundvartype==BOUNDPRIMSIMPLETYPE || boundvartype==BOUNDINTTYPE){
250  // centered-like quantities
251 
252  dimen=1;
253  // IN:
254  inoutlohi[POINTDOWN][POINTDOWN][1]=INBOUNDLO1;
255  inoutlohi[POINTDOWN][POINTUP][1]=INBOUNDHI1;
256  // OUT:
257  inoutlohi[POINTUP][POINTDOWN][1]=OUTBOUNDLO1;
258  inoutlohi[POINTUP][POINTUP][1]=OUTBOUNDHI1;
259 
260  dimen=2;
261  // IN:
262  inoutlohi[POINTDOWN][POINTDOWN][2]=INBOUNDLO2;
263  inoutlohi[POINTDOWN][POINTUP][2]=INBOUNDHI2;
264  // OUT:
265  inoutlohi[POINTUP][POINTDOWN][2]=OUTBOUNDLO2;
266  inoutlohi[POINTUP][POINTUP][2]=OUTBOUNDHI2;
267 
268  dimen=3;
269  // IN:
270  inoutlohi[POINTDOWN][POINTDOWN][3]=INBOUNDLO3;
271  inoutlohi[POINTDOWN][POINTUP][3]=INBOUNDHI3;
272  // OUT:
273  inoutlohi[POINTUP][POINTDOWN][3]=OUTBOUNDLO3;
274  inoutlohi[POINTUP][POINTUP][3]=OUTBOUNDHI3;
275  }
276  else if(boundvartype==BOUNDPSTAGTYPE || boundvartype==BOUNDPSTAGSIMPLETYPE){
277  // stag-like quantities
278  // In general, say for IF3DSPCTHENMPITRANSFERATPOLE, then in transverse direction have to deal with face fields
279  // So must include transverse faces on upper edge where face really ends being active cell and where CENT would be first boundary cell
280 
281  dimen=1;
282  // IN:
283  inoutlohi[POINTDOWN][POINTDOWN][1]=INBOUNDLO1;
284  inoutlohi[POINTDOWN][POINTUP][1]=INBOUNDHI1;
285  // OUT:
286  inoutlohi[POINTUP][POINTDOWN][1]=OUTBOUNDLO1;
287  //inoutlohi[POINTUP][POINTDOWN][1]=OUTFACEBOUNDLO1;
288  inoutlohi[POINTUP][POINTUP][1]=OUTBOUNDHI1;
289 
290  dimen=2;
291  // IN:
292  inoutlohi[POINTDOWN][POINTDOWN][2]=INBOUNDLO2;
293  inoutlohi[POINTDOWN][POINTUP][2]=INBOUNDHI2;
294  // OUT:
295  inoutlohi[POINTUP][POINTDOWN][2]=OUTBOUNDLO2;
296  // inoutlohi[POINTUP][POINTDOWN][2]=OUTFACEBOUNDLO2;
297  inoutlohi[POINTUP][POINTUP][2]=OUTBOUNDHI2;
298 
299  dimen=3;
300  // IN:
301  inoutlohi[POINTDOWN][POINTDOWN][3]=INBOUNDLO3;
302  inoutlohi[POINTDOWN][POINTUP][3]=INBOUNDHI3;
303  // OUT:
304  inoutlohi[POINTUP][POINTDOWN][3]=OUTBOUNDLO3;
305  //inoutlohi[POINTUP][POINTDOWN][3]=OUTFACEBOUNDLO3;
306  inoutlohi[POINTUP][POINTUP][3]=OUTBOUNDHI3;
307  }
308  else if(boundvartype==BOUNDFLUXTYPE || boundvartype==BOUNDFLUXSIMPLETYPE){
309  // face-like quantities
310 
311  dimen=1;
312  // IN:
313  inoutlohi[POINTDOWN][POINTDOWN][1]=INFACEBOUNDLO1;
314  inoutlohi[POINTDOWN][POINTUP][1]=INFACEBOUNDHI1;
315  // OUT:
316  inoutlohi[POINTUP][POINTDOWN][1]=OUTFACEBOUNDLO1;
317  inoutlohi[POINTUP][POINTUP][1]=OUTFACEBOUNDHI1;
318 
319  // dir=2
320  // IN:
321  inoutlohi[POINTDOWN][POINTDOWN][2]=INFACEBOUNDLO2;
322  inoutlohi[POINTDOWN][POINTUP][2]=INFACEBOUNDHI2;
323  // OUT:
324  inoutlohi[POINTUP][POINTDOWN][2]=OUTFACEBOUNDLO2;
325  inoutlohi[POINTUP][POINTUP][2]=OUTFACEBOUNDHI2;
326 
327  // dir=3
328  // IN:
329  inoutlohi[POINTDOWN][POINTDOWN][3]=INFACEBOUNDLO3;
330  inoutlohi[POINTDOWN][POINTUP][3]=INFACEBOUNDHI3;
331  // OUT:
332  inoutlohi[POINTUP][POINTDOWN][3]=OUTFACEBOUNDLO3;
333  inoutlohi[POINTUP][POINTUP][3]=OUTFACEBOUNDHI3;
334  }
335  else if(boundvartype==BOUNDVPOTTYPE || boundvartype==BOUNDVPOTSIMPLETYPE){
336  // face-like quantities for certain directions (GODMARK: Needs updating for true BCs on real boundaries (i.e. non-MPI boundaries), but not used so far)
337 
338  dimen=1;
339  // IN:
340  inoutlohi[POINTDOWN][POINTDOWN][1]=INFACEBOUNDLO1;
341  inoutlohi[POINTDOWN][POINTUP][1]=INFACEBOUNDHI1;
342  // OUT:
343  inoutlohi[POINTUP][POINTDOWN][1]=OUTFACEBOUNDLO1;
344  inoutlohi[POINTUP][POINTUP][1]=OUTFACEBOUNDHI1;
345 
346  // dir=2
347  // IN:
348  inoutlohi[POINTDOWN][POINTDOWN][2]=INFACEBOUNDLO2;
349  inoutlohi[POINTDOWN][POINTUP][2]=INFACEBOUNDHI2;
350  // OUT:
351  inoutlohi[POINTUP][POINTDOWN][2]=OUTFACEBOUNDLO2;
352  inoutlohi[POINTUP][POINTUP][2]=OUTFACEBOUNDHI2;
353 
354  // dir=3
355  // IN:
356  inoutlohi[POINTDOWN][POINTDOWN][3]=INFACEBOUNDLO3;
357  inoutlohi[POINTDOWN][POINTUP][3]=INFACEBOUNDHI3;
358  // OUT:
359  inoutlohi[POINTUP][POINTDOWN][3]=OUTFACEBOUNDLO3;
360  inoutlohi[POINTUP][POINTUP][3]=OUTFACEBOUNDHI3;
361  }
362 
363 
365  //
366  // convert original MAXBND number of boundary cells to chosen number of boundary cells
367  //
369  dimen=1;
370  inoutlohi[POINTDOWN][POINTDOWN][1]=INBOUNDLO1+N1BND-numbnd[dimen];
371  inoutlohi[POINTUP][POINTUP][1]=OUTBOUNDHI1-N1BND+numbnd[dimen];
372 
373  dimen=2;
374  inoutlohi[POINTDOWN][POINTDOWN][2]=INBOUNDLO2+N2BND-numbnd[dimen];
375  inoutlohi[POINTUP][POINTUP][2]=OUTBOUNDHI2-N2BND+numbnd[dimen];
376 
377  dimen=3;
378  inoutlohi[POINTDOWN][POINTDOWN][3]=INBOUNDLO3+N3BND-numbnd[dimen];
379  inoutlohi[POINTUP][POINTUP][3]=OUTBOUNDHI3-N3BND+numbnd[dimen];
380 
381 
382 
384  //
385  // now shift the inoutlohi[inner/outer boundary][low/high range][dir] using shifts[][dir]
386  //
388  // both low/high ranges [jj] get shifted same
389  for(ii=0;ii<NUMUPDOWN;ii++){
390  for(jj=0;jj<NUMUPDOWN;jj++){
391  DIMENLOOP(dimen){
392  inoutlohi[ii][jj][dimen] += shifts[ii][dimen];
393  }
394  }
395  }
396 
397 
398 
399  // check if really setting BC
400  DIRLOOP(dir){
401  dimen=DIMEN(dir);
402  int point=POINTFROMDIR(dir); // inner and outer boundaries
403  if(point==POINTUP){
404  if(inoutlohi[point][POINTDOWN][dimen]<-numbnd[dimen] || inoutlohi[point][POINTUP][2]<0){
405  dosetbc[dir]=0;
406  }
407  }
408  else if(point==POINTDOWN){
409  if(inoutlohi[point][POINTDOWN][dimen]>Nx[dimen]-1 || inoutlohi[point][POINTUP][2]>Nx[dimen]-1+numbnd[dimen]){
410  dosetbc[dir]=0;
411  }
412  }
413  }
414 
415 
417  //
418  // Set reference locations user should use to copy boundary cells from
419  //
421 
422  *riin=inoutlohi[POINTDOWN][POINTUP][1]+SHIFT1; // gives 0 as required if no shifts
423  *rjin=inoutlohi[POINTDOWN][POINTUP][2]+SHIFT2;
424  *rkin=inoutlohi[POINTDOWN][POINTUP][3]+SHIFT3;
425 
426  if(boundvartype==BOUNDFLUXTYPE || boundvartype==BOUNDFLUXSIMPLETYPE){
427  // would be with extra -1 but defined expanded definition of OUTFACEBOUNDLO1
428  *riout=inoutlohi[POINTUP][POINTDOWN][1];
429  *rjout=inoutlohi[POINTUP][POINTDOWN][2];
430  *rkout=inoutlohi[POINTUP][POINTDOWN][3];
431  }
432  else if(boundvartype==BOUNDVPOTTYPE || boundvartype==BOUNDVPOTSIMPLETYPE){
433  // would be with extra -1 but defined expanded definition of OUTFACEBOUNDLO1
434  *riout=inoutlohi[POINTUP][POINTDOWN][1];
435  *rjout=inoutlohi[POINTUP][POINTDOWN][2];
436  *rkout=inoutlohi[POINTUP][POINTDOWN][3];
437  }
438  else{
439  *riout=inoutlohi[POINTUP][POINTDOWN][1]-SHIFT1;
440  *rjout=inoutlohi[POINTUP][POINTDOWN][2]-SHIFT2;
441  *rkout=inoutlohi[POINTUP][POINTDOWN][3]-SHIFT3;
442  }
443 
444 
446  //
447  // For LOOPX?dir loops:
448  //
450 
451  // 1|| below is forced because of how use LOOPX?dir loops in bounds
452  // as related to need to set corner zones
453  if(1||mycpupos[1]==0) inboundloop[1]=inoutlohi[POINTDOWN][POINTDOWN][1]; //INFULL1+shifts[POINTDOWN][1];
454  else inboundloop[1]=0;
455  if(1||mycpupos[1]==ncpux1-1) outboundloop[1]=inoutlohi[POINTUP][POINTUP][1]; // OUTFULL1+shifts[POINTUP][1];
456  else outboundloop[1]=N1-1;
457 
458  if(1||mycpupos[2]==0) inboundloop[2]=inoutlohi[POINTDOWN][POINTDOWN][2]; // INFULL2+shifts[POINTDOWN][2];
459  else inboundloop[2]=0;
460  if(1||mycpupos[2]==ncpux2-1) outboundloop[2]=inoutlohi[POINTUP][POINTUP][2]; // OUTFULL2+shifts[POINTUP][2];
461  else outboundloop[2]=N2-1;
462 
463  if(1||mycpupos[3]==0) inboundloop[3]=inoutlohi[POINTDOWN][POINTDOWN][3]; //INFULL3+shifts[POINTDOWN][3];
464  else inboundloop[3]=0;
465  if(1||mycpupos[3]==ncpux3-1) outboundloop[3]=inoutlohi[POINTUP][POINTUP][3]; // OUTFULL3+shifts[POINTUP][3];
466  else outboundloop[3]=N3-1;
467 
468 
469 
471  //
472  // For LOOPN? part of LOOPX?dir loops
473  //
475 
476  if(boundvartype==BOUNDPRIMTYPE || boundvartype==BOUNDPRIMSIMPLETYPE || boundvartype==BOUNDINTTYPE){
477  // centered-like quantities
478  innormalloop[1]=0+shifts[POINTDOWN][1];
479  outnormalloop[1]=N1-1+shifts[POINTUP][1];
480 
481  innormalloop[2]=0+shifts[POINTDOWN][2];
482  outnormalloop[2]=N2-1+shifts[POINTUP][2];
483 
484  innormalloop[3]=0+shifts[POINTDOWN][3];
485  outnormalloop[3]=N3-1+shifts[POINTUP][3];
486  }
487  else if(boundvartype==BOUNDPSTAGTYPE || boundvartype==BOUNDPSTAGSIMPLETYPE){
488  // stag-like quantities
489  // SHIFT1/2/3 added so that includes full staggered transverse field
490  innormalloop[1]=0+shifts[POINTDOWN][1];
491  outnormalloop[1]=N1-1+SHIFT1+shifts[POINTUP][1];
492 
493  innormalloop[2]=0+shifts[POINTDOWN][2];
494  outnormalloop[2]=N2-1+SHIFT2+shifts[POINTUP][2];
495 
496  innormalloop[3]=0+shifts[POINTDOWN][3];
497  outnormalloop[3]=N3-1+SHIFT3+shifts[POINTUP][3];
498 
499  }
500  else if(boundvartype==BOUNDFLUXTYPE || boundvartype==BOUNDFLUXSIMPLETYPE){
501  // face-like quantities
502  // centered-like quantities
503  innormalloop[1]=0+shifts[POINTDOWN][1];
504  outnormalloop[1]=N1-1+shifts[POINTUP][1];
505 
506  innormalloop[2]=0+shifts[POINTDOWN][2];
507  outnormalloop[2]=N2-1+shifts[POINTUP][2];
508 
509  innormalloop[3]=0+shifts[POINTDOWN][3];
510  outnormalloop[3]=N3-1+shifts[POINTUP][3];
511 
512  }
513  else if(boundvartype==BOUNDVPOTTYPE || boundvartype==BOUNDVPOTSIMPLETYPE){
514  // face-like quantities
515  // centered-like quantities
516  innormalloop[1]=0+shifts[POINTDOWN][1];
517  outnormalloop[1]=N1-1+shifts[POINTUP][1];
518 
519  innormalloop[2]=0+shifts[POINTDOWN][2];
520  outnormalloop[2]=N2-1+shifts[POINTUP][2];
521 
522  innormalloop[3]=0+shifts[POINTDOWN][3];
523  outnormalloop[3]=N3-1+shifts[POINTUP][3];
524 
525  }
526 
527 }
528 
529 
530 int orders_set(void)
531 {
532  int l;
533 
534  // maximum number of points *potentially* used for a given interpolation type
535  // for a point (i), we assume that the first point potentially used is:
536  // si = i - (int)(interporder/2)
537  // for WENO4, then if i=2, then si=0 and list of potentially used points is 0,1,2,3 . This is offset such that the i=2 point is correctly centered at the edge with 2 points on edge side.
538  // notice that WENO4 only gives correctly centered left state. Using WENO4, right state is found from right neighbor.
539  // WENO4 useful for avg->point at an interface, but not for point->point at different location, which requires odd WENO.
540  // for WENO5, then if i=2, then si=0 and list is 0,1,2,3,4 . Here, point is assumed to be centered of middle (2) cell.
541 
542  // default is 0 to indicate no limiter set
543  for(l=-NUMNEGINTERPS;l<NUMPOSINTERPS;l++){
544  interporder[l]=0;
545  }
546 
547 
548  // non-limiters
549  interporder[NLIM]=3;
551  interporder[NLIMUP]=3;
553 
554  interporder[DONOR]=1;
555  interporder[VANL]=3;
556  interporder[MINM]=3;
557  interporder[MC]=3;
558  interporder[PARA]=5;
560  interporder[MCSTEEP]=7;
561  interporder[CSSLOPE]=5;
562  interporder[MP5]=5;
563  interporder[EPPM]=5;
564 
565  interporder[WENO3]=3;
566  interporder[WENO4]=4;
567  interporder[WENO5]=5;
568  interporder[WENO5BND]=11; //replace the 5 for WENO5 with 11 = 5 + (2+2 for reduction) + (1+1 for dp/p reduction) to have enough boundary zones for l&r stencil reduction; also see interpline.c:slope_lim_linetype()
569  interporder[WENO5BNDPLUSMIN]=13; // added extra minimization of weights JCM
571  interporder[WENO6]=6;
572  interporder[WENO7]=7;
573  interporder[WENO8]=8;
574  interporder[WENO9]=9;
575  interporder[ENO3]=5;
576  interporder[ENO5]=9;
577 
579 
580 
581  for(l=-NUMNEGINTERPS;l<NUMPOSINTERPS;l++){
582  if(interporder[l]>MAXSPACEORDER){
583  dualfprintf(fail_file,"MAXSPACEORDER=%d while interporder[%d]=%d\n",MAXSPACEORDER,l,interporder[l]);
584  myexit(13);
585  }
586  }
587 
588  // check to make sure interpolation type is correctly set
589  // checked in flux.c from now on for each type of interpolation
590  // if(DOEXTRAINTERP){
591  // if( (VARTOINTERP!=PRIMTOINTERP_VSQ)||(RESCALEINTERP!=1) ){
592  // dualfprintf(fail_file,"Must set VARTOINTERP==PRIMTOINTERP_VSQ and RESCALEINTERP==1 in definit.h/init.h to use DOEXTRAINTERP=%d\n",DOEXTRAINTERP);
593  // myexit(77);
594  // }
595  // }
596 
597 
599  //
600  // set whether use dq
601  //
603 
604  // default is not to use dq
605  for(l=-NUMNEGINTERPS;l<NUMPOSINTERPS;l++){
606  usedqarray[l]=0;
607  }
608 
609  if(LIMADJUST){// if adjusting limiter, cannot use dq since higher order choices cannot use dq
610  // nothing to do
611  }
612  else{ // just change those that use dq
613 
614  // 2nd order or lower can/do use dq
615  usedqarray[NLIM]=1;
616  usedqarray[NLIMCENT]=1;
617  usedqarray[NLIMUP]=1;
618  usedqarray[NLIMDOWN]=1;
619  usedqarray[DONOR]=1;
620  usedqarray[VANL]=1;
621  usedqarray[MINM]=1;
622  usedqarray[MC]=1;
623  }
624 
625 
626  return(0);
627 }