Actual source code: macros.h

  1: #ifndef MACROS_H_
  2: #define MACROS_H_

  4: /*E
  5:   LogLevel - Logging level.

  7:   STDOUT (writes to standard output), INFO (writes input parameters,
  8:   properties, boundary conditions, convergence, ...) and DEBUG
  9:   (debug purposes).

 11:   Level: developer
 12: E*/
 13: typedef enum {
 14:   STDOUT, INFO, DEBUG
 15: } LogLevel;

 17: /*M
 18:   WEST - Macro for identifying the computational molecule:
 19:   west neighbour node.

 21:   Level: advanced
 22: M*/
 23: #define WEST 0
 24: /*M
 25:   EAST - Macro for identifying the computational molecule:
 26:   east neighbour node.

 28:   Level: advanced
 29: M*/
 30: #define EAST 1
 31: /*M
 32:   SOUTH - Macro for identifying the computational molecule:
 33:   south neighbour node.

 35:   Level: advanced
 36: M*/
 37: #define SOUTH 2
 38: /*M
 39:   NORTH - Macro for identifying the computational molecule:
 40:   north neighbour node.

 42:   Level: advanced
 43: M*/
 44: #define NORTH 3
 45: /*M
 46:   LOW - Macro for identifying the computational molecule:
 47:   low neighbour node.

 49:   Level: advanced
 50: M*/
 51: #define LOW 4
 52: /*M
 53:   HIGH - Macro for identifying the computational molecule:
 54:   high neighbour node.

 56:   Level: advanced
 57: M*/
 58: #define HIGH 5
 59: /*M
 60:   NODEP - Macro for identifying the computational molecule:
 61:   node itself.

 63:   Level: advanced
 64: M*/
 65: #define NODEP (2 * Input.ndim)

 67: /*M
 68:   XDIR - Macro for axis: X direction.

 70:   Level: advanced
 71: M*/
 72: #define XDIR 0
 73: /*M
 74:   YDIR - Macro for axis: Y direction.

 76:   Level: advanced
 77: M*/
 78: #define YDIR 1
 79: /*M
 80:   ZDIR - Macro for axis: Z direction.

 82:   Level: advanced
 83: M*/
 84: #define ZDIR 2

 86: /*M
 87:   GREAT - Constant for a great double value (1e08).

 89:   Level: advanced
 90: M*/
 91: #define GREAT 1.0E8
 92: /*M
 93:   TINY - Constant for a tiny double value (1e-15).

 95:   Level: advanced
 96: M*/
 97: #define TINY 1.0E-15

 99: /*M
100:   L - Grid length (X direction).

102:   Level: advanced
103: M*/
104: #define L (Grid.Xnode[XDIR][Grid.Nnode[XDIR] - 1])
105: /*M
106:   H - Grid height (Y direction).

108:   Level: advanced
109: M*/
110: #define H (Grid.Xnode[YDIR][Grid.Nnode[YDIR] - 1] )
111: /*M
112:   REYNOLDS - Reynolds number.

114:   Option database keys:
115: + \-rho - RHO value.
116: . \-uref - Constant value por the U direction inlet.
117: - \-mu - MU value.

119:   Level: advanced
120: M*/
121: #define REYNOLDS (Input.rho * H * Input.uref / Input.mu)

123: /*M
124:   MIN3 - Macro for the minimum value among three values

126:   Input parameters:
127: . a, b, c - Values to get the minimum.

129:   Level: intermediate
130: M*/
131: #define MIN3(a, b, c) (MIN(MIN(a, b), c))

133: /*E
134:   TransientOrder - Transient order.

136:   Values are: ZERO (for steady flows), EUL1 (first order Euler), EUL2
137:   (second order Euler), ADM2 (second order Adams-Moulton), ADM3
138:   (third order Adams-Moulton).

140:   Level: advanced
141: E*/
142: typedef enum {
143:   ZERO, EUL1, EUL2, ADM2, ADM3
144: } TransientOrder;

146: /*E
147:   ktypeProp - Property type.

149:   Defines if the property depends on time (TRAN), the variable values
150:   (VARI), the geometry (GEOM) or nothing (CONS).

152:   Level: advanced
153: E*/
154: typedef enum {
155:   CONS, GEOM, VARI, TRAN
156: } ktypeProp;

158: /*E
159:   StorageType - Storage type.

161:   Defines if the property should be stored as a single real number (SCALAR)
162:   or an array of real numbers (ARRAY).

164:   Level: advanced
165: E*/
166: typedef enum {
167:   SCALAR, ARRAY
168: } StorageType;

170: /*E
171:   ktypeGrid - Grid type.

173:   Values are: RECT (rectangular grids) and CYLI (cylindrical grids).

175:   Level: advanced
176: E*/
177: typedef enum {
178:   RECT, CYLI
179: } ktypeGrid;

181: /*E
182:   ktypeIp - Interpolation type for the values in the cell faces.

184:   Values can be: NIP, UPWIND, CDS, HYBRID, QUIKC, CUI, SMART, MUSCL,
185:   NOTABLE and VAN_LEER. TODO document me!! (explain values)

187:   Level: advanced
188: E*/
189: typedef enum {
190:   NIP, UPWIND, CDS, HYBRID, QUICK, CUI, SMART, MUSCL,
191:   NOTABLE, VAN_LEER
192: } ktypeIp;

194: /*E
195:   ktypeIp - Boundary condition type.

197:   Boundary condition can be: wall (WALL), moving wall (MOVING_WALL),
198:   inlet (INLET), outlet (OUTFLOW), newman outlet pressure
199:   (OUTPRESS_NEWMAN), extrapolation outlet pressure (OUTPRESS_EXTRAP),
200:   outconv? (OUTCONV), symmetry (SYMMETRY) and a fix value (FIX_VALUE).
201:   TODO document me!! (outconv)

203:   Level: advanced
204: E*/
205: typedef enum {
206:   NONE, WALL, MOVING_WALL, INLET, OUTFLOW, OUTPRESS_NEWMAN,
207:   OUTPRESS_EXTRAP, OUTCONV, SYMMETRY, FIX_VALUE
208: } BcondType;

210: /*E
211:   contEqType - Type of continuity equation.

213:   Option database keys:
214: . \-cont_eq - Continuity equation solving method

216:   Level: advanced
217: E*/
218: typedef enum {
219:   POISSON, SIMPLE, SIMPLEC, SIMPLER
220: } contEqType;

222: /*E
223:   InletFunction - Function for the inlet boundary conditions.

225:   Option database keys:
226: . \-inlet - Inlet function

228:   Level: advanced
229: E*/
230: typedef enum {
231:   INLET_U, INLET_F, INLET_RHO
232: } InletFunction;

234: /*E
235:   RestartType - Restarting option.

237:   Values are: RESTART_NONE (no results restarted), RESTART_VARIABLES 
238:   (restart only values for the unknowns), RESTART_INSTANT_MEANS 
239:   (restart the instant means, but not the variance means), 
240:   RESTART_VARIANCE_MEANS (restart all the values).

242:   Level: advanced
243: E*/
244: typedef enum {
245:   RESTART_NONE, RESTART_VARIABLES, RESTART_INSTANT_MEANS,
246:   RESTART_VARIANCE_MEANS
247: } RestartType;

249: /*M
250:   U - Index of the U variable (X direction velocity).

252:   Level: advanced
253: M*/
254: #define U (varU->index)
255: /*M
256:   V - Index of the V variable (Y direction velocity).

258:   Level: advanced
259: M*/
260: #define V (varV->index)
261: /*M
262:   W - Index of the W variable (Z direction velocity).

264:   Level: advanced
265: M*/
266: #define W (varW->index)
267: /*M
268:   P - Index of the P variable (pressure).

270:   Level: advanced
271: M*/

273: #define P (varP->index)
274: /*M
275:   T - Index of the T variable (temperature).

277:   Level: advanced
278: M*/

280: #define T (varT->index)
281: /*M
282:   KE - Index of the KE variable TODO document me!!

284:   Level: advanced
285: M*/
286: #define KE (varKE->index)
287: /*M
288:   EP - Index of the EP variable TODO document me!!

290:   Level: advanced
291: M*/
292: #define EP (varEP->index)

294: /*M
295:   U_NAME - Name of the U variable (X direction velocity).

297:   Level: advanced
298: M*/
299: #define U_NAME "U"
300: /*M
301:   V_NAME - Name of the V variable (Y direction velocity).

303:   Level: advanced
304: M*/
305: #define V_NAME "V"
306: /*M
307:   W_NAME - Name of the W variable (Z direction velocity).

309:   Level: advanced
310: M*/
311: #define W_NAME "W"
312: /*M
313:   P_NAME - Name of the P variable (pressure).

315:   Level: advanced
316: M*/
317: #define P_NAME "P"
318: /*M
319:   T_NAME - Name of the T variable (temperature).

321:   Level: advanced
322: M*/
323: #define T_NAME "T"
324: /*M
325:   KE_NAME - Name of the KE variable TODO document me!!

327:   Level: advanced
328: M*/
329: #define KE_NAME "KE"
330: /*M
331:   EP_NAME - Name of the EP variable TODO document me!!

333:   Level: advanced
334: M*/
335: #define EP_NAME "EP"

337: /*M
338:   LOCAL_CELL - Calculates the index of a cell in a processor (the local
339:   index) from its coordinates.

341:   Input parameters:
342: . i, j, k - Global coordinates of the cell.

344:   Level: advanced
345: M*/
346: #define LOCAL_CELL(i, j, k) \
347:   ((k - Local.ghostMeshRegion.lowerCorner[ZDIR]) * \
348:       Local.ghostMeshRegion.nCells[XDIR] * \
349:       Local.ghostMeshRegion.nCells[YDIR] + \
350:   (j - Local.ghostMeshRegion.lowerCorner[YDIR]) * \
351:       Local.ghostMeshRegion.nCells[XDIR] + \
352:   (i - Local.ghostMeshRegion.lowerCorner[XDIR]))

354: /*M
355:   PATCH_CELL - Calculates the index of a cell in a patch
356:   from its coordinates.

358:   Input parameters:
359: + i, j, k - Global coordinates of the cell.
360: - patch - Patch to calculate the index.

362:   Level: advanced
363: M*/
364: #define PATCH_CELL(i, j, k, patch, info) \
365:   ((k - (patch->z + info.gzs)) * info.gxm * info.gym + \
366:    (j - (patch->y + info.gys)) * info.gxm + \
367:    (i - (patch->x + info.gxs)))

369: /*M
370:   BEGIN_LOCAL_LOOP - Begins a loop over the local cells of the given patch.

372:   Input parameters:
373: + patch - The patch with the cells to iterate.
374: . info - DALocalInfo object associated with the patch's DA.
375: - I - 3D iterator.

377:   Level: advanced
378: M*/
379: #define BEGIN_LOCAL_LOOP(patch, info, I) \
380: for(I[ZDIR] = patch->z + info.zs; I[ZDIR] < patch->z + info.zs + info.zm; I[ZDIR]++) \
381: for(I[YDIR] = patch->y + info.ys; I[YDIR] < patch->y + info.ys + info.ym; I[YDIR]++) \
382: for(I[XDIR] = patch->x + info.xs; I[XDIR] < patch->x + info.xs + info.xm; I[XDIR]++)

384: /*M
385:   IDIR - Determines the direction of the neighbor.

387:   Input parameters:
388: . ineighb - Neighbor index.

390:   Level: advanced

392: .seealso WEST, EAST, NORTH, SOUTH, LOW, HIGH
393: M*/
394: #define IDIR(ineighb) (ineighb / 2)
395: /*M
396:   STEP - Determines the "step" of the neighbor, i.e if the neighbor is
397:   forwards (step > 0) or backwards (step < 0).

399:   Input parameters:
400: . ineighb - Neighbor index.

402:   Level: advanced

404: .seealso WEST, EAST, NORTH, SOUTH, LOW, HIGH
405: M*/
406: #define STEP(ineighb) (2 * (ineighb % 2) - 1)

408: /*M
409:   LOCAL_CELL_NEIGHB_EXISTS - Determines if the specified neighbour is
410:   in the local subdomain.

412:   Input parameters:
413: + I - Index of the local cell.
414: . idir - Index direction of the neighbor to evaluate.
415: - step - Step of the neighbor to evaluate.

417:   Level: advanced

419: .seealso IDIR, STEP
420: M*/
421: #define LOCAL_CELL_NEIGHB_EXISTS(I, idir, step) \
422:   (I[idir] + step <= Grid.Nnode[idir] - 1 && I[idir] + step >= 0)

424: /*M
425:   PTR_SYS - Gets the system (coupled or segregated) associated with the
426:   given variable.

428:   Input parameters:
429: . ivar - Variable index.

431:   Level: advanced
432: M*/
433: #define PTR_SYS(ivar) ((ivar < Input.ncoupvar) ? \
434:     &CoupledSys : &SegregatedSys)

436: /*M
437:   ROW - The row of the system corresponding to the specified cell and
438:   equation.

440:   Input parameters:
441: + Sys - Pointer to the evaluating system.
442: . ieq - Equation index.
443: - icell - Local cell index.

445:   Level: advanced
446: M*/
447: #define ROW(Sys, ieq, icell) (Sys->ltog[icell * Sys->ndof \
448:                                         + (ieq - Sys->ivar)])

450: /*M
451:   LINEAR_BACKW - Gets the value of the linear backwards interpolation
452:   for the given cell and direction.

454:   Input parameters:
455: + idir - Direction index.
456: - icell - Cell index.

458:   Level: advanced
459: M*/
460: #define LINEAR_BACKW(idir, icell) (Interp.linear[idir][icell])
461: /*M
462:   UPWIND_BACKW - Gets the value of the upwind backwards interpolation
463:   for the given cell and direction.

465:   Input parameters:
466: + idir - Direction index.
467: - icell - Cell index.

469:   Level: advanced
470: M*/
471: #define UPWIND_BACKW(idir, icell) (Interp.upwind[idir][icell])
472: /*M
473:   ICELL_UPW_BACKW - Gets the index of the upwind backwards cell
474:   for the given cell and direction.

476:   Input parameters:
477: + idir - Direction index.
478: - icell - Cell index.

480:   Level: advanced
481: M*/
482: #define ICELL_UPW_BACKW(idir, icell) (Interp.icell_upw[idir][icell])
483: /*M
484:   ICELL_UUPW_BACKW - Gets the index of the up-upwind backwards cell
485:   for the given cell and direction.

487:   Input parameters:
488: + idir - Direction index.
489: - icell - Cell index.

491:   Level: advanced
492: M*/
493: #define ICELL_UUPW_BACKW(idir, icell) (Interp.icell_uupw[idir][icell])
494: /*M
495:   ICELL_DOW_BACKW - Gets the index of the downwind backwards cell
496:   for the given cell and direction.

498:   Input parameters:
499: + idir - Direction index.
500: - icell - Cell index.

502:   Level: advanced
503: M*/
504: #define ICELL_DOW_BACKW(idir, icell) (Interp.icell_dow[idir][icell])

506: /*M
507:   LINEAR_FORW - Gets the value of the linear forwards interpolation
508:   for the given cell and direction.

510:   Input parameters:
511: + idir - Direction index.
512: - icell - Cell index.

514:   Level: advanced
515: M*/
516: #define LINEAR_FORW(idir, icell) \
517:   (1 - Interp.linear[idir][Local.icell_neighb[2 * idir + 1][icell]])
518: /*M
519:   UPWIND_FORW - Gets the value of the upwind forwards interpolation
520:   for the given cell and direction.

522:   Input parameters:
523: + idir - Direction index.
524: - icell - Cell index.

526:   Level: advanced
527: M*/
528: #define UPWIND_FORW(idir, icell) \
529:   (1 - Interp.upwind[idir][Local.icell_neighb[2 * idir + 1][icell]])
530: /*M
531:   ICELL_UPW_FORW - Gets the index of the upwind forwards cell
532:   for the given cell and direction.

534:   Input parameters:
535: + idir - Direction index.
536: - icell - Cell index.

538:   Level: advanced
539: M*/
540: #define ICELL_UPW_FORW(idir, icell) \
541:   (Interp.icell_upw[idir][Local.icell_neighb[2 * idir + 1][icell]])
542: /*M
543:   ICELL_UUPW_FORW - Gets the index of the up-upwind forwards cell
544:   for the given cell and direction.

546:   Input parameters:
547: + idir - Direction index.
548: - icell - Cell index.

550:   Level: advanced
551: M*/
552: #define ICELL_UUPW_FORW(idir, icell) \
553:   (Interp.icell_uupw[idir][Local.icell_neighb[2 * idir + 1][icell]])
554: /*M
555:   ICELL_DOW_FORW - Gets the index of the downwind forwards cell
556:   for the given cell and direction.

558:   Input parameters:
559: + idir - Direction index.
560: - icell - Cell index.

562:   Level: advanced
563: M*/
564: #define ICELL_DOW_FORW(idir, icell) \
565:   (Interp.icell_dow[idir][Local.icell_neighb[2 * idir + 1][icell]])

567: /*M
568:   LINEAR - Gets the value of the linear interpolation
569:   for the given cell and neighbor.

571:   Input parameters:
572: + ineighb - Neighbor index.
573: - icell - Cell index.

575:   Level: advanced
576: M*/
577: #define LINEAR(ineighb, icell) \
578:   (STEP(ineighb) < 0 ? LINEAR_BACKW(IDIR(ineighb), icell) : \
579:       LINEAR_FORW(IDIR(ineighb), icell))
580: /*M
581:   ICELL_UPW - Gets the index of the upwind cell
582:   for the given cell and neighbor.

584:   Input parameters:
585: + ineighb - Neighbor index.
586: - icell - Cell index.

588:   Level: advanced
589: M*/
590: #define ICELL_UPW(ineighb, icell) \
591:   (STEP(ineighb) < 0 ? ICELL_UPW_BACKW(IDIR(ineighb), icell) : \
592:       ICELL_UPW_FORW(IDIR(ineighb), icell))
593: /*M
594:   ICELL_UUPW - Gets the index of the up-upwind cell
595:   for the given cell and neighbor.

597:   Input parameters:
598: + ineighb - Neighbor index.
599: - icell - Cell index.

601:   Level: advanced
602: M*/
603: #define ICELL_UUPW(ineighb, icell) \
604:   (STEP(ineighb) < 0 ? ICELL_UUPW_BACKW(IDIR(ineighb), icell) : \
605:       ICELL_UUPW_FORW(IDIR(ineighb), icell))
606: /*M
607:   ICELL_DOW - Gets the index of the downwind cell
608:   for the given cell and neighbor.

610:   Input parameters:
611: + ineighb - Neighbor index.
612: - icell - Cell index.

614:   Level: advanced
615: M*/
616: #define ICELL_DOW(ineighb, icell) \
617:   (STEP(ineighb) < 0 ? ICELL_DOW_BACKW(IDIR(ineighb), icell) : \
618:       ICELL_DOW_FORW(IDIR(ineighb), icell))

620: /*M
621:   VALUE - Gets the value of the variable in the given cell.

623:   Input parameters:
624: + var - Pointer to the variable to evaluate.
625: - icell - Cell index.

627:   Level: advanced
628: M*/
629: #define VALUE(var, icell) (var->Array[icell])
630: /*M
631:   VALUE_FACE_IVAR_UPW_BACKW - Gets the value of the variable in the
632:   upwind backwards neighbor in the given direction.

634:   Input parameters:
635: + var - Pointer to the variable to evaluate.
636: . idir - Direction index.
637: - icell - Cell index.

639:   Level: advanced
640: M*/
641: #define VALUE_FACE_IVAR_UPW_BACKW(var, idir, icell) \
642:   (VALUE(var, ICELL_UPW_BACKW(idir, icell)))
643: /*M
644:   VALUE_FACE_IVAR_UPW_FORW - Gets the value of the variable in the
645:   upwind forwards neighbor in the given direction.

647:   Input parameters:
648: + var - Pointer to the variable to evaluate.
649: . idir - Direction index.
650: - icell - Cell index.

652:   Level: advanced
653: M*/
654: #define VALUE_FACE_IVAR_UPW_FORW(var, idir, icell) \
655:   (VALUE(var, ICELL_UPW_FORW(idir, icell)))
656: /*M
657:   VALUE_FACE_IVAR_LINEAR - Gets the value of the variable in the
658:   face (linear interpolation) between the given cell and the
659:   specified neighbor.

661:   Input parameters:
662: + var - Pointer to the variable to evaluate.
663: . ineighb - Neighbor index.
664: - icell - Cell index.

666:   Level: advanced
667: M*/
668: #define VALUE_FACE_IVAR_LINEAR(var, ineighb, icell) \
669:   (LINEAR(ineighb,icell) * VALUE(var, Local.icell_neighb[ineighb][icell]) + \
670:       (1 - LINEAR(ineighb, icell)) * VALUE(var, icell))

672: /*M
673:   VALUE_PROP - Gets the value of a property (constant or not) in a cell.

675:   Input parameters:
676: + prop - Property to evaluate.
677: - icell - Cell index.

679:   Level: advanced
680: M*/
681: #define VALUE_PROP(prop, icell) \
682:   (prop->ktype == CONS ? prop->value : prop->array[icell])

684: /*M
685:   CONV_BACKW - Gets the value of the Conv property in the given cell
686:   with the porosity backwards in the specified direction.

688:   Level: advanced

690: .seealso Conv
691: M*/
692: #define CONV_BACKW(idir, icell) (-PROP_BACKW(Conv, idir, icell))
693: /*M
694:   CONV_FORW - Gets the value of the Conv property in the given cell
695:   with the porosity forwards in the specified direction.

697:   Level: advanced

699: .seealso Conv
700: M*/
701: #define CONV_FORW(idir,icell) PROP_FORW(Conv, idir, icell)

703: /*M
704:   DIFF_BACKW - Gets the value of the Diff property in the given cell
705:   with the porosity backwards in the specified direction.

707:   Level: advanced

709: .seealso Diff
710: M*/
711: #define DIFF_BACKW(idir,icell) PROP_BACKW(Diff, idir, icell)
712: /*M
713:   DIFF_FORW - Gets the value of the Diff property in the given cell
714:   with the porosity forwards in the specified direction.

716:   Level: advanced

718: .seealso Diff
719: M*/
720: #define DIFF_FORW(idir,icell) PROP_FORW(Diff, idir, icell)
721: /*M
722:   MICORR_BACKW - Gets the value of the MICorr property in the given cell
723:   with the porosity backwards in the specified direction.

725:   Level: advanced

727: .seealso MICorr
728: M*/
729: #define MICORR_BACKW(idir,icell) PROP_BACKW(MICorr, idir, icell)
730: /*M
731:   MICORR_FORW - Gets the value of the MICorr property in the given cell
732:   with the porosity forwards in the specified direction.

734:   Level: advanced

736: .seealso MICorr
737: M*/
738: #define MICORR_FORW(idir,icell) PROP_FORW(MICorr, idir, icell)
739: /*M
740:   MIPRESCONT_BACKW - Gets the value of the MIPresCont property in the
741:   given cell with the porosity backwards in the specified direction.

743:   Level: advanced

745: .seealso MIPresCont
746: M*/
747: #define MIPRESCONT_BACKW(idir,icell) PROP_BACKW(MIPresCont, idir, icell)
748: /*M
749:   MIPRESCONT_FORW - Gets the value of the MIPresCont property in the
750:   given cell with the porosity forwards in the specified direction.

752:   Level: advanced

754: .seealso MIPresCont
755: M*/
756: #define MIPRESCONT_FORW(idir,icell) PROP_FORW(MIPresCont, idir, icell)

758: /*M
759:   PROP_BACKW - Gets the value of a property in the given cell with the
760:   porosity backwards in the specified direction.

762:   Input parameters:
763: + prop - Property to evaluate.
764: . idir - Direction index.
765: - icell - Cell index.

767:   Level: advanced.
768: M*/
769: #define PROP_BACKW(prop, idir, icell) \
770:   (prop->array[Input.ndim * icell + idir] * Local.porosity[2 * idir][icell])
771: /*M
772:   PROP_FORW - Gets the value of a property in the given cell with the
773:   porosity forwards in the specified direction. NOTE: Use ONLY with
774:   with properties with the same degrees of freedom as dimensions in
775:   the problem (dof == Input.ndiom).

777:   Input parameters:
778: + prop - Property to evaluate.
779: . idir - Direction index.
780: - icell - Cell index.

782:   Level: advanced.
783: M*/
784: #define PROP_FORW(prop, idir, icell) \
785:   (prop->array[Input.ndim * Local.icell_neighb[2 * idir + 1][icell] + idir] * \
786:       Local.porosity[2 * idir + 1][icell])

788: /*M
789:   COEF_TRANS_IMP - Gets the transient coefficient for the given
790:   transient order.

792:   Input parameters:
793: . norder - Transient order.

795:   Level: advanced

797: .seealso TransientOrder
798: M*/
799: #define COEF_TRANS_IMP(norder) (norder == EUL1 ? (1.0) : \
800:     norder == EUL2 ? (1.5) : \
801:     norder == ADM2 ? (2.0) : (2.4))
802: /*M
803:   COEF_TRANS_EXP1 - TODO document me!!

805:   Input parameters:
806: . norder - Transient order.

808:   Level: advanced

810: .seealso TransientOrder
811: M*/
812: #define COEF_TRANS_EXP1(norder) (norder == EUL2 ? (2) : \
813:     COEF_TRANS_IMP(norder))
814: /*M
815:   COEF_TRANS_EXP2 - TODO document me!!

817:   Input parameters:
818: . norder - Transient order.

820:   Level: advanced

822: .seealso TransientOrder
823: M*/
824: #define COEF_TRANS_EXP2(norder) (norder == EUL2 ? (-0.5) : 0)
825: /*M
826:   ALPHA_TRANS_MI - TODO document me!!

828:   Input parameters:
829: + coef_trans -
830: . idir - Direction index.
831: - icell - Cell index.

833:   Level: advanced
834: M*/
835: #define ALPHA_TRANS_MI(coef_trans, idir, icell) \
836:   (Interp.linear[idir][icell] * VALUE_PROP(Rho, \
837:   Local.icell_neighb[2 * idir][icell]) * \
838:   Geom.Volume[Local.icell_neighb[2 * idir][icell]] * \
839:   VALUE_PROP(Omica, Local.icell_neighb[2 * idir][icell]) * \
840:   coef_trans / Input.deltat + (1 - Interp.linear[idir][icell]) * \
841:   VALUE_PROP(Rho, icell) * Geom.Volume[icell] * \
842:   VALUE_PROP(Omica, icell) * coef_trans / Input.deltat)

844: #define PropGetArray(prop) \
845:   ((prop != PETSC_NULL && prop->storage == ARRAY) ? \
846:       VecGetArray(prop->values, &prop->array) : 0)

848: #define PropRestoreArray(prop) \
849:   ((prop != PETSC_NULL && prop->storage == ARRAY) ? \
850:       VecRestoreArray(prop->values, &prop->array) : 0)

852: #endif /* MACROS_H_ */