HARM
harm and utilities
 All Data Structures Files Functions Variables Typedefs Macros Pages
superdefs.h
Go to the documentation of this file.
1 
30 // SUPERNOTE: Ensure that name always starts with "BASEMAC??()" so can easily recall that these are the original arrays
31 // SUPERNOTE: Arrays should always have order: N1M,N2M,N3M -- these are remapped using the macro
32 
33 // OPTMARK: Note that while clustering some arrays to be per (i,j,k) point may have benefits due to spatial-temporal localization, if that variable is later interpolated or differenced, then lose benefit since that procedure has to pull out a single object out of the built-up structure.
34 // OPTMARK:
35 // OPTMARK: Reasonable things to pull together (balance of above issues):
36 // 1) pk,unewglobal,ulastglobal,uinitialglobal,dUgeomarray,upointglobal
37 // 2) pleft,pright,prc, dq1,dq2,dq3 [maybe]
38 // 3) gp_l gp_r
39 // 4) ptemp utemp
40 // 5) pstagglobal pvcorninterp pbcorninterp
41 // 6) dxdxpstore, idxdxpstore, Xstore, Vstore
42 // 7) conn, conn2, idxvol
43 //
44 // Things not reasonable to put together because treated separately:
45 // 1) F1,F2,F3,F1EM,F2EM,F3EM
46 // 2) fluxstate, fluxstatecent
47 // 3) compgeom and anything
48 // 4) Bhatglobal pstagglobal [maybe]
49 // Anything related to p, pstagglobal, emf
50 // Useless: wspeed, fluxvectemp, Fa,Fb,stencilvarptemp, geomcornglobal
51 
52 
54 #include "kazfulleos.superdefs.h"
55 
56 
58 FTYPE BASEMACP0A1(pglobal,N1M,N2M,N3M,NPR); /* space for primitive vars */
59 
61 #if(ANALYTICMEMORY)
62 FTYPE BASEMACP0A1(panalytic,N1M,N2M,N3M,NPR); /* space for primitive vars */
63 #if(FIELDSTAGMEM)
64 FTYPE BASEMACP0A1(pstaganalytic,N1M,N2M,N3M,NPR); /* space for primitive vars */
65 #endif
66 #endif
67 
69 #if(NUMPOTHER>0)
70 FTYPE BASEMACP1A0(pother,NUMPOTHER,N1M,N2M,N3M); /* space for primitive vars */
71 #endif
72 
74 FTYPE BASEMACP0A1(ptemparray,N1M,N2M,N3M,NPR);
75 
77 FTYPE BASEMACP0A1(utemparray,N1M,N2M,N3M,NPR);
78 
79 #if(DOEVOLVEMETRIC)
80 FTYPE BASEMACP0A1(ucumformetric,N1M,N2M,N3M,NPR);
81 #endif
82 
83 
85 FTYPE BASEMACP1A0(emf,NDIM*NUMTRUEEOMSETS,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3); /* space for emf and temp vars -- hence why NDIM*NUMTRUEEOMSETS */
86 
87 #if(STOREFLUXSTATE)
89 struct of_state BASEMACP0A0(fluxstatecent,N1M,N2M,N3M); // pb-like (not pi-like)
90 #endif
91 
92 #if(FIELDTOTHMEM)
93 
94 
95 FTYPE BASEMACP0A1(vconemf,N1M,N2M,N3M,NDIM-1); /* used for Athena EMFs */
96 #endif
97 
98 #if(MODIFYEMFORVPOT==MODIFYVPOT || TRACKVPOT>0 || EVOLVEWITHVPOT>0)
99 
101 #if(ANALYTICMEMORY)
103 #endif
104 #endif
105 
106 
108 #if(PERCELLDT)
110 #endif
111 
112 
113 #if(STOREWAVESPEEDS>0)
114 
115 FTYPE BASEMACP1A1(wspeedtemp,NUMEOMSETS,N1M,N2M,N3M,NUMCS); // temporarily store wspeed in case not just copying but averaging before putting into wspeed array
116 FTYPE BASEMACP3A0(wspeed,NUMEOMSETS,COMPDIM,NUMCS,N1M,N2M,N3M); // wave speeds (left/right)
117 #endif
118 
119 
120 #if(STORESHOCKINDICATOR)
121 
122 FTYPE BASEMACP1A0(shockindicatorarray,NUMSHOCKPLS,N1M,N2M,N3M);
123 #endif
124 
125 
126 
127 
129 //
130 // TIME-STEPPING
131 //
133 
135 FTYPE BASEMACP1A1(pk,MAXITERDTSTAGES,N1M,N2M,N3M,NPR); /* next-step primitives */
137 FTYPE BASEMACP0A1(unewglobal,N1M,N2M,N3M,NPR); // used across substeps and across full time steps
138 FTYPE BASEMACP0A1(ulastglobal,N1M,N2M,N3M,NPR); // used across substeps but not across full time steps
139 FTYPE BASEMACP0A1(uinitialglobal,N1M,N2M,N3M,NPR); // used across substeps but not across full time steps
140 FTYPE BASEMACP0A1(dUgeomarray,N1M,N2M,N3M,NPR); // assume not used across substeps so can use as temp var
141 
142 #if(HIGHERORDERMEM||FIELDSTAGMEM)
143 
144 FTYPE BASEMACP0A1(upointglobal,N1M,N2M,N3M,NPR);
145 FTYPE BASEMACP0A1(upointglobaluf,N1M,N2M,N3M,NPR);
146 FTYPE BASEMACP0A1(oldufstore,N1M,N2M,N3M,NPR);
147 #endif
148 
149 
150 
151 
153 //
154 // SPATIAL INTERPOLATION
155 //
157 
160 #if(N1>1)
161 
163 #endif
164 #if(N2>1)
165 
167 #endif
168 #if(N3>1)
169 
171 #endif
172 
173 #if(SPLITMAEMMEM)
174 #if(N1>1)
175 
177 #endif
178 #if(N2>1)
179 
181 #endif
182 #if(N3>1)
183 
185 #endif
186 #endif
187 
188 
189 #if(SPLITNPR||FIELDSTAGMEM)
190 
191 FTYPE BASEMACP1A1(gp_l,NDIM-1,N1M,N2M,N3M,NPR2INTERP);
192 FTYPE BASEMACP1A1(gp_r,NDIM-1,N1M,N2M,N3M,NPR2INTERP);
193 #endif
194 
195 FTYPE BASEMACP0A1(pleft,N1M,N2M,N3M,NPR2INTERP); /* for parabolic interpolation */
196 FTYPE BASEMACP0A1(pright,N1M,N2M,N3M,NPR2INTERP); /* for parabolic interpolation */
198 FTYPE BASEMACP0A1(prc,N1M,N2M,N3M,NPR2INTERP); /* rescaled primitives, also used for temporary storage in fixup_utoprim() */
199 
200 
201 
202 #if(FIELDSTAGMEM)
203 
204 
205 
206 
207 
208 
209 
210 
211 //FTYPE BASEMACP2A0(wspeedcorn,COMPDIM,NUMCS,N1M,N2M,N3M); // wave speeds (left/right) at corner (not true corner)
212 FTYPE BASEMACP0A1(pstagglobal,N1M,N2M,N3M,NPR); // for interpolate_pfield_face2cent() -- only contains fields
214 //FTYPE BASEMACP3A0(pbcorninterp,COMPDIM,COMPDIM,NUMCS,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3); // holds field corner interpolations
215 FTYPE BASEMACP1A3(pvbcorninterp,COMPDIM,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3,COMPDIM,NUMCS+1,NUMCS); // holds velocity corner interpolations (NUMCS+1) has +1 part that holds old pbcorninterp
216 FTYPE BASEMACP1A0(geomcornglobal,COMPDIM,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3); // really for merged method with FLUXCTSTAG
217 
218 #if(HIGHERORDERMEM)
219 
220 FTYPE BASEMACP0A1(Bhatglobal,N1M,N2M,N3M,NPR);
221 FTYPE BASEMACP0A1(Bhatanalytic,N1M,N2M,N3M,NPR);
222 #endif
223 
224 // below is used to store de-averaged field in each direction for UNSPLIT scheme or 2D
225 // used in general, but only different if FV method
226 // first 3 are directions orthogonal to field given by B1,B2,B3 in NDIM
227 //FTYPE BASEMACP1A1(pb1davg,3,N1M,N2M,N3M,3);
228 
229 #endif
230 
231 
232 
234 //
235 // OLD SPATIAL INTERPOLATION
236 //
238 
239 
240 #if(DODQMEMORY)
241 #if(N1>1)
242 // below is used within substeps but not across
243 FTYPE BASEMACP0A1(dq1,N1M,N2M,N3M,NPR2INTERP); /* slopes */
244 #endif
245 #if(N2>1)
246 // below is used within substeps but not across
247 FTYPE BASEMACP0A1(dq2,N1M,N2M,N3M,NPR2INTERP); /* slopes */
248 #endif
249 #if(N3>1)
250 // below is used within substeps but not across
251 FTYPE BASEMACP0A1(dq3,N1M,N2M,N3M,NPR2INTERP); /* slopes */
252 #endif
253 #endif
254 
255 
256 
258 //
259 // HIGHER ORDER STUFF
260 //
262 
263 #if(HIGHERORDERMEM)
264 
265 // termporary storage for flux
266 FTYPE BASEMACP0A1(fluxvectemp,N1M,N2M,N3M,NPR+NSPECIAL);
267 
268 FTYPE BASEMACP0A1(Fa,N1M,N2M,N3M,NPR+NSPECIAL); /* fluxes */
269 FTYPE BASEMACP0A1(Fb,N1M,N2M,N3M,NPR+NSPECIAL); /* fluxes */
270 
271 FTYPE BASEMACP0A1(stencilvartemp,N1M,N2M,N3M,NPR);
272 
273 #endif
274 
275 
276 
277 
278 
279 
280 
281 
282 
283 
284 
285 
286 
287 
289 //
290 // DEBUG STUFF USUALLY OFF
291 //
293 
294 #if(DOENODEBUG)
295 // 3: 1,2,3 directions
296 // 5: c2e on P, a2c on U, c2a for U, c2a for Fperp1, c2a for Fperp2
297 CTYPE BASEMACP0A4(enodebugarray,N1M,N2M,N3M,3-1,NUMENOINTERPTYPES,NPR-4,NUMENODEBUGS);// space for debugging eno
298 #endif
299 
300 #if(FLUXDUMP)
302 #endif
303 
304 
306 //
307 // DEBUG STUFF USUALLY ON
308 //
310 
311 PFTYPE BASEMACP0A1(pflag,N1M,N2M,N3M,NUMPFLAGS); /* space for flag */
312 
313 PFTYPE BASEMACP0A1(pflagfailorig,N1M,N2M,N3M,NUMFAILPFLAGS); /* used to keep original pflag so don't induce order-dependence when doing fixup_utoprim() and changing pflag */
314 
315 /* for debug */
316 #if(DODEBUG)
317 CTYPE BASEMACP0A3(failfloorcount,N1M,N2M,N3M,2,NUMTSCALES,NUMFAILFLOORFLAGS); // number of failures and floor adjustments for each zone
318 #endif
319 
320 /* for debug */
321 #if(DOFLOORDIAG)
322 FTYPE BASEMACP0A1(failfloordu,N1M,N2M,N3M,NPR); // change in conserved quantities due to number of failures and floor adjustments for each zone
323 #endif
324 
325 #if(DODISSMEASURE)
326 FTYPE BASEMACP0A1(dissmeasurearray,N1M,N2M,N3M,NSPECIAL+1+3*2); // change in conserved quantities due to number of failures and floor adjustments for each zone
327 #endif
328 
330 //
331 // other diagnostics
332 //
334 
335 
336 #if(DODISS)
337 FTYPE BASEMACP0A1(dissfunpos,N1M,N2M,N3M,NUMDISSFUNPOS); // storage for dissipation function
338 #endif
339 
340 #if(CALCFARADAYANDCURRENTS)
341 // current density stuff
342 // below 3 are used within and across substeps and full steps (for diagnostics)
346 #endif
347 
348 
350 //
351 // AVG diagnostics
352 //
354 #if(DOAVG)
355 // time average stuff
356 FTYPE BASEMACP0A1(normalvarstavg,N1M,N2M,N3M,NUMNORMDUMP);
357 FTYPE BASEMACP0A1(anormalvarstavg,N1M,N2M,N3M,NUMNORMDUMP);
358 
359 #if(CALCFARADAYANDCURRENTS)
360 FTYPE BASEMACP0A1(jcontavg,N1M,N2M,N3M,NDIM);
361 FTYPE BASEMACP0A1(jcovtavg,N1M,N2M,N3M,NDIM);
362 FTYPE BASEMACP0A1(ajcontavg,N1M,N2M,N3M,NDIM);
363 FTYPE BASEMACP0A1(ajcovtavg,N1M,N2M,N3M,NDIM);
364 #endif
365 
366 FTYPE BASEMACP0A1(massfluxtavg,N1M,N2M,N3M,NDIM);
367 FTYPE BASEMACP0A1(amassfluxtavg,N1M,N2M,N3M,NDIM);
368 
369 FTYPE BASEMACP0A1(othertavg,N1M,N2M,N3M,NUMOTHER);
370 FTYPE BASEMACP0A1(aothertavg,N1M,N2M,N3M,NUMOTHER);
371 
372 #if(CALCFARADAYANDCURRENTS)
377 #endif
378 
381 #endif
382 
383 
384 
386 //
387 // grid functions (+1 size larger so can have geometry at upper corners -- say for vector potential or whatever)
388 //
390 
391 #if(NEWMETRICSTORAGE)
392 
393 // below used for cases when need gdet or eomfunc[] at multiple grid locations: Created to avoid cache misses with flux_ct()
394 struct of_gdetgeom BASEMETMACP0A1(gdetgeom,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3,NPG);
395 
396 // below created for simple gdet calls since faster to have storage like this sometimes
397 struct of_gdetgeom BASEMETMACP1A0(gdetgeomnormal,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3);
398 
399 // new memory-local way (avoids major cache misses)
400 struct of_compgeom BASEMETMACP1A0(compgeom,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3);
401 
402 #if(DOEVOLVEMETRIC)
403 struct of_compgeom BASEMETMACP1A0(compgeomlast,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3);
404 #endif
405 
406 #else
407 // grid functions that exist at multiple locations within a cell
410 FTYPE BASEMETMACP1A1(gcovpert,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3,NDIM);
411 FTYPE BASEMETMACP1A0(gdet,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3);
412 #if(WHICHEOM!=WITHGDET)
413 FTYPE BASEMETMACP1A1(eomfunc,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3,NPR);
414 #endif
415 #if(GDETVOLDIFF)
416 FTYPE BASEMETMACP1A0(gdetvol,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3); // for volume regularization of CENT quantities only
417 #endif
418 FTYPE BASEMETMACP1A0(alphalapse,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3);
419 FTYPE BASEMETMACP1A0(betasqoalphasq,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3);
420 FTYPE BASEMETMACP1A1(beta,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3,NDIM);
421 
422 #if(DOEVOLVEMETRIC)
423 // used to evolve metric in time, so that connection has terms due to dg/dt
424 FTYPE BASEMETMACP1A1(gcovlast,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3,SYMMATRIXNDIM);
425 FTYPE BASEMETMACP1A1(gcovpertlast,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3,NDIM);
426 FTYPE BASEMETMACP1A0(alphalapselast,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3);
427 #endif
428 #endif // end if old way
429 
430 
431 
432 #if(DOSTOREPOSITIONDATA)
433 FTYPE BASEMETMACP1A2(dxdxpstore,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3,NDIM,NDIM);
434 FTYPE BASEMETMACP1A2(idxdxpstore,NPG,N1M+SHIFT1,N2M+SHIFT2,N3M+SHIFT3,NDIM,NDIM);
435 // the belo2 Xstore and Vstore exist on +-1 larger domain than even stored metric/etc., since metric requires +-1 in differencing coordinates (e.g. to determine dxdxp's or metric)
438 #endif
439 
440 // rest of grid functions always at center
441 FTYPE BASEMETMACP0A3(conn,N1M,N2M,N3M,NDIM,NDIM,NDIM);
442 FTYPE BASEMETMACP0A1(conn2,N1M,N2M,N3M,NDIM);
443 #if(VOLUMEDIFF)
444 FTYPE BASEMETMACP0A1(idxvol,N1M,N2M,N3M,NDIM); // volume regularization 1/dx for each direction
445 #endif
446 
447 
448 
449 #include "superdefs.rad.h"
450 
451 
452 
453