X0_expressions.html 6.91 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
<!DOCTYPE html>
<html>
  <head>
    <title>AMDiS - Adaptive Multi-Dimensional Simulations</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <style type="text/css">
      @import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
      @import url(https://fonts.googleapis.com/css?family=Raleway);
      @import url(https://fonts.googleapis.com/css?family=Ubuntu);
      @import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
      @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
    </style>
    <!--<link rel="stylesheet" type="text/css" href="style_display.css" />-->
    <link rel="stylesheet" type="text/css" href="style_print2.css" />
  </head>
  <body>
    <textarea id="source">

## List of Expressions
### Terminal/elemental epressions

In the following table, a `DV` represents a pointer or reference to a `DOFVector<T>` of some value type `T`:

| Expression      | Semantics                     |
| --------------- | ----------------------------- |
| `valueOf(DV)`   | Evaluation of a DOFVector in local coordinates |
| `gradientOf(DV)`| Evaluation of the gradient of a DOFVector in local coodinates |
| `derivativeOf(DV, i)` | Evaluation of the partial derivative of a DOFVector w.r.t. component i |
| `hessianOf(DV)` | Evaluation of the hessian of a DOFVector, i.e. `H_ij = d_i(d_j(DV))` |
| `laplacianOf(DV)` | Evaluation of the Lacplacian of a DOFVector, i.e. `L = sum_i(d_i(d_i(DV)))` |
| `componentOf(DV, i)` | The i-th Component of a (vector valued) DOFVector |
| `X(), X(i)` | The global coordinate `x(lambda)` of the local coordinate `lambda`, or its i-th component. |
| `N(b), N(b,i)` | The outer boundary normal vector, w.r.t. the boundary face wiht nr `b`, or its i-th component. |
| `M(), M(i)` | The surface normal vector (element normal) for surface grids, or its i-th component. |
| `constant(c), c` | A constant numeric value |
| `constant<C>()` | A constant numeric value evaluable at compile time. Useful for symbolic differentiation, see below. |
| `ref_(c)` | A reference wrapper of a dynamic numeric value. |

The expression `valueOf(DV)` can also be applied to vector or matrices of DOFVectors.:

| Expression | Semantics |
| ---------- | --------- |
| `valueOf(DV)` | Evaluation of a DOFVector in local coordinates |
| `valueOf(vector<DV<T>>)` | Results in a `vector<T>` with values from the DOFVectors evaluated in the local coordinates. |
| `valueOf(matrix<DV<T>>)` | Results in a `matrix<T>` with values from the DOFVectors evaluated in the local coordinates |
| `valueOf<Name>(X)` | An expression with a name, i.e. a unique type `Name`. Usefull for symbolic differentiation. |

---

### Operations on expressions
In the following table operations are listed that can be applied to elemental expressions or combination of those. In the list `T` and `Tn` represent an expression (term) and `F` represents a funktor-objekt (see below).

| Expression | Semantics |
| ---------- | --------- |
| `+, -, *, /` | Arithmetic operations |
| `pow<p>(T)` | The p-th power of an expression. |
| `sqrt(T)` | The square-root of an expression |
| `exp(T)` | The exponential function applied to the evaluated expression |
| `log(T)` | The natural logarithm applied to an evaluated expression. |
| `cos(T), sin(T), tan(T)` | Cosine, sine, and tangens applied to an evaluated expression. |
| `acos(T), asin(T), atan(T)` | Arccosine, Arcsine, and arctangent applied to an evaluated expression |
| `atan2(T1, T2)` | The atan2 function, i.e. arctan(T1 / T2). |
| `cosh(T), sinh(T), tanh(T)` | Hyperbolic cosine, hyperbolic sine, and hyperbolic tangent. |
| `acosh(T), asinh(T), atanh(T)` | Inverse hyperbolic functions applied to an evaluated expression. |
| `max(T1, T2), min(T1, T2)` | The maximum/minimum of two evaluated expressions T1 and T2. |
| `abs_(T), signum(T)` | The absolute value and the sign (`T < 0 => signum(T) := -1, T>0 => signum(T) := 1, T==0 => signum(T) := 0`) |
| `clamp(T, lo, hi)` | Applies the `std::clamp` function locally to the evaluated expression `T`, where `lo` and `hi` are fixed values. |
| `ceil(T), floor(T)` | Round down or up the evaluated expression. |
| `function_(F, T1, T2, T3, ...)` | Apply a functor to the evaluated expressions `T1,T2,...` |

---

A functor is a class with the following structure:
```c++
struct Functor : public FunctorBase
{
  typedef (...) value_type;
  int getDegree(int d1, int d2, ...) const { return (...); }

  value_type operator()(const T1::value_type&, const T2::value_type&, ...) const { return (...); }
};
```
or any valid function object in c++. When it is derived from `FunctorBase` one can specify an polynomial degree of the functor, relative to
the polynomial degrees of the arguments passed to the functor, i.e. the polynomial degrees of the passed expressions.
The `getDegree()` functor is then evaluated in the following form:
```c++
getDegree(T1.getDegree(), T2.getDegree(), ...)
```

---

### Vector-/Matrix-Expressions
For vector- and matrix-valued expressions, like, e.g., `gradientOf(DV)` one can apply functions that act on the vectors/matrices on
evaluation. In the following list, the notation `V` refers to a vector expressions and `M` to a matrix expression:

| Expression | Semantics |
| ---------- | --------- |
| `+, -` | Arithmetic operations (elementwise) |
| `unary_dot(V)` | Scalarprodukt (dorproduct) of a vector with itself: `result = V^H * V`. |
| `dot(V1, V2)` | Scalarprodukt (dorproduct) of two vectors: `result = V1^H * V2`. |
| `one_norm(V)` | The 1-norm of a vectors `result = sum_i(abs(V_i))`. |
| `one_norm(M)` | The 1-norm of a matrix `result = max_j(sum_i(abs(M_ij)))`. |
| `two_norm(V)` | The 2-norm of a vector `result = sqrt(V^H * V)`. |
| `p_norm<p>(V)` | The p-norm of a vector `result = [sum_i(abs(v_i)^p)]^(1/p)`. |
| `cross(V1, V2)` | Crossproduct of two vectors: `result = V1 x V2`. |
| `diagonal(V)` | Diagonal matrix with diagonal entries of the passed vector: `matrix = diagonal(V)`. |
| `outer(V1, V2)` | Outer product (dyadic product / tensorproduct) of two vectors: `matrix = V1 * V2^T`. |
| `trans(M)` | The transposed matrix: `result = M^T`. |
| `at(V, i)` | Access a component of a vector: `result = V_i`. |
| `at(M, i, j)` | Access a component of a matrix: `result = M_ij`. |


    </textarea>
    <script src="lib/remark.js" type="text/javascript"></script>
    <script type="text/javascript" src="MathJax/MathJax.js?config=TeX-AMS_HTML"></script>

    <script type="text/javascript">
      var slideshow = remark.create({
        ratio: "4:3",
        highlightLanguage: "cpp"
      });

      // Setup MathJax
      MathJax.Hub.Config({
          tex2jax: {
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
          }
      });
      MathJax.Hub.Queue(function() {
          $(MathJax.Hub.getAllJax()).map(function(index, elem) {
              return(elem.SourceElement());
          }).parent().addClass('has-jax');
      });

      MathJax.Hub.Configured();
    </script>
  </body>
</html>