next up previous contents index
Next: 5.4 Comments Up: 5.3 Naming conventions Previous: 5.3.3 Names of modules,   Contents   Index

5.3.4 Variable names

As variable names are ``more local'' than subroutine or module names and the naming conventions vary even more, depending on author and date.

Mathematical conventions should be used as guide lines (e.g., gamma for $\gamma$ or Gamma1 for $\Gamma_1$). CamelCase and/or underscores can be used to make variable names easier to read.

Variable names in often used structues (e.g., the box structure) should be used as guide for further names (see, e.g., Sect. 8.1 and Sect. 8.3). The individual components of vector quantities (axes, velocities, magnetic-field components) don't get individual letters but indices 1, 2, 3 for the respective spatial dimension. So far, these stand for the $x$, $y$, and $z$ direction. But these names should be avoided, leaving the possibility of - for instance - spherical coordinates open. Names of basic quantities are, e.g., rho, v1, ei for density $\rho$, velocity $\V {1}$ in $x_1$ direction, and internal energy $\ei $ per mass unit. The centering of variables can be indicated by c for cell-centered quantities and b for boundary-centered quantities (as in xc1 or xb1). As cell centering is the default the c is often omitted (as in rho or ei).

Names of quantities that are simple combinations of existing quantities are often constructed as combinations, as, e.g., rhov1 for the momentum rho*v1, instead of inventing an entirely unrelated name (as, e.g., m1). The name of an energy tells abouts its components, e.g., eikg = ei + ek + eg (sum of internal, kinetic, and potential energy per mass unit). Likewise, rhoeikg = rhoei + rhoek + rhoeg (sum of internal, kinetic, and potential energy per volume). The convention of combining names obviously has limits for more complex functions (as, e.g., fluxes). Due to the lack of a sufficient number of letters in the alphabet loop indices don't all get their individual letters, either. Instead, they look like i1, i2, i3, iquc, inu, idir, itime. The lower grid index is m, the upper is n. So, cell-centered quantities (in the absence of ghost cells) go from m to n, whereas boundary-centered quantities go from m to n+1.


next up previous contents index
Next: 5.4 Comments Up: 5.3 Naming conventions Previous: 5.3.3 Names of modules,   Contents   Index