hexed 0.3.0
 
Loading...
Searching...
No Matches
Notation and conventions

This page defines non-standard notation and conventions used in the theory and implementation of Hexed. If the meaning of a number or variable is unclear or ambiguous, look here for guidance. Also, please try to maintain these conventions when contributing to the code.

Units and physical quantities

  • Unless otherwise specified, all quantities are dimensional in the applicable SI units (i.e., derived from m, kg, s, K).
  • Unless otherwise specified, all angles are radian. Note, however, the radian is a concept for measuring angles, not an SI base unit (the "unit" rad is technically a dimensionless constant equal to 1).
  • If you need to perform any unit conversions or reference physical constants, please use the values defined in hexed::constants, which are based on formal exact definitions (as opposed to approximations to some number of digits). In practice, of course, this isn't that important, but some obsessive part of my brain wants to know that all unit conversions are perfectly consistent up to machine precision.
  • If an extensive thermodynamic quantity (e.g., mass, volume, energy, as opposed to an intensive quantity like temperature or pressure) is specified without a reference quantity, it means per unit volume. For example, "energy" specified without other context will be in units of \( J/m^3 \).
    • As a result, "mass" and "density" are synonymous. In fact, prefer "mass" so that all the conserved variables (momentum, mass, energy) are consistently extensive.
  • Stagnation quantities shall be referred to as such. The word "total" shall not be used to indicate stagnation quantities. To clarify, for any thermodynamic variable, the stagnation value of that variable is the value it would take if the material in question were isentropically decelerated to zero velocity. For energy-type variables, "total" refers to the sum of internal (static) and kinetic components. With that in mind, please recall the following results of basic aerodynamics:
    • The stagnation pressure is not in general equal to the sum of static and dynamic pressures; this is an approximation which is accurate in the limit as \( M \to 0 \).
    • The total energy \( e_t = \rho e + \frac12 \rho v^2 \) is not equal to the stagnation energy, which for a CPG is given by \( e_0 = c_v T \left(1 + \frac{\gamma - 1}{2} M^2\right) \).
    • The total enthalpy \( h_t = \rho h + \frac12 \rho v^2 \) is equal to the stagnation enthalpy \( h_0 \).

State vector

The flow state vector (often simply referred to as state) consists of the conserved variables. It has components [momentum, mass, total energy] (a.k.a. [ \( \rho \vec{v} \), \( \rho \), \( \rho e + \frac12 \rho v^2 \)]). E.g., in 3D that is [momentum0 ( \(x\)-direction), momentum1 ( \(y\)-direction), momentum2 ( \(z\)-direction), mass, total energy].

This order is different from most codes, which use the order (mass, momentum, energy). The order for Hexed was chosen because it groups the vector and scalar quantities together and because the \(i\)th component of the state vector is equal to the \(i\)th component of momentum. The latter makes the code for certain formulae cleaner.

Terminology

Hexed uses some terms that are non-standard, or at least not completely universal. They are defined as follows:

  • kernel: A performance-critical function performs some of the core numerical operations.
  • The row size of a polynomial basis is its degree + 1. I.e. the number of rows of quadrature points in each dimension, which equals the number of coefficients in the 1D case. It is usually more convenient to talk about the row size than the degree, as it is more directly related to the actual code implementation. The row size is not to be confused with the number of quadrature points, which depends on the dimensionality. E.g., a 4th degree basis in 3 dimensions has row size 5 and 125 quadrature points.
  • node: An interpolation node for a basis of Lagrange (interpolating) polynomials. Hexed uses a collocated nodal scheme, so these coincide with the quadrature points.
  • vertex: A single point shared by a collection of elements. Not to be confused with "node".

Abbreviations

Some common abbreviations are defined as follows, in alphabetical order.

  • con: connection
  • def: deformed
  • dim: dimension
    • i_dim specifically serves to identify which of the coordinate axes is referenced in some operation.
  • elem: mesh element
  • ener: energy
  • enth: enthalpy
  • heat_rat: ratio of heat capacities. Often denoted \( \gamma \) ("gamma") in thermodynamics.
  • i_: index of ...
    • If this is an index in a nested loop, the inside loops may use j_ and k_.
  • n_: number of ...
  • pos: position
  • pres: pressure
  • qpoint: "quadrature point"
  • _sq: ... squared
  • stag: stagnation
  • veloc: velocity
  • vert: vertex

Storage order

Although C++ arrays and Eigen matrices can be useful for storing multidimensional array data, it is often necessary to access data via a pointer and a flat index. In that case, observe the following conventions.

  • To define the layout of data in contiguous memory in the code, row-major array indexing syntax shall be used. For example, the line
    double* some_data; // Layout: [i_some_thing][i_other_thing]
    indicates that some_data points to a block of doubles of size n_some_thing*n_other_thing, and that access to this array should look like some_data[i_some_thing*n_other_thing + i_other_thing].
  • Data that is associated with locations in physical space, including vertices and quadrature points, is stored as an array where each array index corresponds to one physical coordinate. That is, the first index corresponds to the \(x\)-coordinate, the second to the \(y\)-coordinate, etc. Thus, when specifying memory layout, [i_qpoint] means the following, depending on the dimensionality:

    • 1D: [i_row]
    • 2D: [i_row][j_row]
    • 3D: [i_row][j_row][k_row]

    where 0 <= i_row < row_size. For example, for a 3D Cartesian element, if you are looking at the position of the i_qpointth quadrature point, then i_qpoint += 1 will change only the \(z\)-coordinate, i_qpoint += row_size will change only \(y\), and i_qpoint += row_size*row_size will change only \(x\).

  • Be careful of the fact that C++ storage order is row-major, whereas Eigen matrices are column-major by default.