Commit cdbabfdf authored by Praetorius, Simon's avatar Praetorius, Simon

updated the list of expressions and the vorshop slides 00, 01, and 02

parent 36c428c0
......@@ -65,6 +65,7 @@ AMDiS developed around 2005. Basis: C-library *ALBERTA*. Now: an object-oriented
All slides and source code, as well as exercise material can be found in a git repository:
```
# Get the repository
cd ~/Desktop
git clone https://gitlab.mn.tu-dresden.de/spraetor/amdis_workshop_16.git ...
... amdis_workshop
......@@ -163,13 +164,15 @@ https://hub.docker.com/r/mathiwr/amdis-1.1.dev
Everything necessary is collected and composed in a docker image.
## Setup AMDiS in PC lab
- Start applications `Docker` and `Terminal`
- Use docker image: `mathiwr/amdis-1.1.dev:debian9`
- Mount local directory: `~/Desktop`
- Mount local directory: `~/Desktop/amdis_workshop`
- Work in terminal: `bash`
```
docker pull mathiwr/amdis-1.1.dev
docker run -it -v ~/Desktop:/Desktop mathiwr/amdis-1.1.dev:debian9 bash
docker pull mathiwr/amdis-1.1.dev:debian9
docker run -it -v ~/Desktop/amdis_workshop:/amdis_workshop ...
... mathiwr/amdis-1.1.dev:debian9 bash
```
</textarea>
......
......@@ -16,8 +16,6 @@
<body>
<textarea id="source">
class: center, middle
# Session 1
## Wednesday Nov 28
- **Scalar linear second order PDEs**
......@@ -69,10 +67,10 @@ plus some boundary terms from the boundary conditions.
What data/information do you need to formulate your problem?
1. Description of your **domain** `\(\Omega\)` + a **triangulation** `\(\mathcal{T}_h\)` of the domain --> `Mesh`
2. (Discrete) Function-space `\(V_h\)`, or its **basis-functions** respectively.
2. (Discrete) Function-space `\(V_h\subset V\)` with `\(N := dim(V_h)\)`, or its **basis-functions** respectively.
- `P1` := Lagrange elements with polynomial degree `\(p=1\)`, e.g.
\\[
V_h = \\{ v\in H^1(\Omega)\,:\, v|\_T\in\mathbb{P}\_p(T),\,\forall T\in\mathcal{T}\_h(\Omega)\\}
V_h = \\{ v\in C^0(\Omega)\,:\, v|\_T\in\mathbb{P}\_p(T),\,\forall T\in\mathcal{T}\_h(\Omega)\\}
\\]
- `P1+bubble` := `P1` + center bubble-function
......@@ -81,7 +79,7 @@ What data/information do you need to formulate your problem?
3. **Solution** vector `\((u_i)\equiv u\in V_h^{(1)}\)`, called `DOFVector`
\\[
u(x) = \sum\_i u\_i\phi\_i(x),\quad\text{with}\;\\{\phi_i\\}\text{ a basis of }V^{(1)}
u(x) = \sum\_{i=0}^{N-1} u\_i\phi\_i(x),\quad\text{with}\;\\{\phi_i\\}\text{ a basis of }V\_h^{(1)}
\\]
---
......@@ -167,6 +165,8 @@ with `initialize(flag)`
- creates corresponsing finite-element spaces
- creates, estimators, markers, solvers, ...
`flag` determines what to initialize (or what to adopt from another problem). Here, initialize everything.
---
# Example 1
......@@ -210,11 +210,13 @@ addZOT(opF, 1.0); // <f, theta>, f=1
```
### Add operators to the problem
Apply an operator to test- [and trialfunction] identified by component numbers.
```
prob.addMatrixOperator(opL, 0, 0);
prob.addVectorOperator(opF, 0);
```
with the number `0` corresponds to the 0th unknown in the 0th equation. We have only one block and thus, this is always 0. More about block systems later.
with the number `0` corresponds to the 0th unknown in the 0th equation. We have only one block and thus, this is always 0.
---
......@@ -241,7 +243,7 @@ prob.addVectorOperator(opF, 0);
prob.addDirichletBC(nr, 0, 0, new Constant(0.0));
```
with `nr` a boundary number specified in the mesh, and `Constant`
a predefined functor, that returns `0` always.
a predefined functor that returns `0` always.
---
......@@ -319,16 +321,15 @@ add_executable("poisson" src/poisson.cc)
target_link_libraries("poisson" AMDiS)
```
- CMake requires variable `AMDIS_DIR` to point to directory, that contains the file `AMDiSConfig.cmake`. This
- CMake requires variable `AMDIS_DIR` to point to directory that contains the file `AMDISConfig.cmake`. This
is set automatically in Docker container.
- See [Link](http://goo.gl/kVe0Z2) for documentation of cmake commands
### Compile
```
cd DIR
mkdir build && cd build
cmake [-DAMDIS_DIR=...] DIR
make [poisson]
mkdir build && cd build # out-of-source build
cmake [-DAMDIS_DIR=...] DIR # configure the build process
make [poisson] # compile the executable
```
where `DIR=..` contains the `CMakeLists.txt` file.
......
......@@ -32,7 +32,7 @@
---
# Working with discrete functions
Finite-Element function `\(u_h\)`, a linear combination of basis-functions `\(\phi_i\)`:
Finite-Element function `\(u_h\in V_h = span\{\phi_i\}\)`, a linear combination of basis-functions `\(\phi_i\)`:
\\[
u\_h(x) = \sum\_i u\_i \phi\_i(x) = \sum\_j u\_{i\_T(j)} \hat{\phi}_j(\lambda\_T(x)),
\\]
......@@ -109,6 +109,34 @@ U << 0.5*( pow<2>(valueOf(C) * (1.0 - valueOf(C))
---
### Example:
Let `\(C\)` and `\(U\)` be of type `DOFVector<double>`:
\\[
U(x\_T(\lambda)) := \frac{1}{2}\left(C(x\_T(\lambda))^2\,(1-C(x\_T(\lambda)))^2 + \frac{1}{\epsilon}\|\nabla C(x\_T(\lambda))\|^2\right)
\\]
Assign expression on rhs to DOFVector `\(U\)`:
```
U << 0.5*( pow<2>(valueOf(C) * (1.0 - valueOf(C))
+ (1.0/eps) * unary_dot(gradientOf(C)) );
```
---
### Example:
Let `\(C\)` and `\(U\)` be of type `DOFVector<double>`:
\\[
\hat{U}(\lambda) := \frac{1}{2}\left(\hat{C}(\lambda)^2\,(1-\hat{C}(\lambda))^2 + \frac{1}{\epsilon}\|\Lambda^{-T}\_T\nabla\_\lambda \hat{C}(\lambda))\|^2\right)
\\]
Assign expression on rhs to DOFVector `\(U\)`:
```
U << 0.5*( pow<2>(valueOf(C) * (1.0 - valueOf(C))
+ (1.0/eps) * unary_dot(gradientOf(C)) );
```
---
# Working with the discrete solution
- Reduce the `DOFVector`, i.e. calc integrals, norms:
```
......
......@@ -37,18 +37,18 @@ In the following table operations are listed that can be applied to elemental ex
| `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)` | Der Cosinus, Sinus, bzw. Tangens der Auswertung des Terms T. |
| `acos(T), asin(T), atan(T)` | Der Arkus-Cosinus, Arkus-Sinus, bzw. Arkus Tangens der Auswertung des Terms T. |
| `atan2(T1, T2)` | Der Arkus-Tangens 2 = atan(T1 / T2). |
| `cosh(T), sinh(T), tanh(T)` | Der Cosinus-Hyperbolicus, Sinus-Hyperbolicus, bzw. Tangens-Hyperbolicus der Auswertung des Terms T. |
| `acosh(T), asinh(T), atanh(T)` | Der Arkus Cosinus-Hyperbolicus, Arkus Sinus-Hyperbolicus, Arkus Tangens-Hyperbolicus der Auswertung des Terms T. |
| `max(T1, T2), min(T1, T2)` | Das Maximum/Minimum der Auswertungen von T1, bzw. T2. |
| `abs_(T), signum(T)` | Der Absolutbetrag von T, bzw. das Vorzeichen (`T < 0 => signum(T) := -1, T>0 => signum(T) := 1, T==0 => signum(T) := 0`) |
| `clamp(T, lo, hi)` |
| `ceil(T), floor(T)` | die kleines ganze Zahl größer, bzw. die größte ganze Zahl kleiner als Wert von T |
| `function_(F, T1, T2, T3, ...)` | Die Anwendung eines Funktors F auf die Auswertung der Terme T1,T2,... | If `T` compares less than `lo`, returns `lo`; otherwise if `hi` compares less than `T`, returns `hi`; otherwise returns `T`
| `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,...` |
Ein Funktor ist dabei eine Klasse mit folgender Struktur:
A functor is a class with the following structure:
```c++
struct Functor : public FunctorBase
{
......@@ -58,29 +58,30 @@ struct Functor : public FunctorBase
value_type operator()(const T1::value_type&, const T2::value_type&, ...) const { return (...); }
};
```
Die Argumente, die an die Funktion `getDegree` übergeben werden sind die Polynomgrade der Terme:
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(), ...)
```
### Vektor-/Matrix-Ausdrücke
Für vektor- bzw. matrixwertige Term, wie z.B. `gradientOf(DV)` gibt es eine Reihe von Ausdrücken / Operationen, die im Folgenden aufgelistet sind. Dabei bezeichnet `V` eine vektorwerte Expression und `M` eine matrixwertige Expressions.
### Vektor-/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 |
| ---------- | --------- |
| `+, -` | Elementare arithmetische Ausdrücke (Elementweise) |
| `unary_dot(V)` | Skalarprodukt eines vektorwertigen Terms mit sich selbst: `result = V^H * V`. |
| `dot(V1, V2)` | Skalarprodukt zweier vektorwertigen Terme: `result = V1^H * V2`. |
| `one_norm(V)` | Die 1-Norm eines Vektors `result = sum_i(abs(V_i))`. |
| `one_norm(M)` | Die 1-Norm einer Matrix `result = max_j(sum_i(abs(M_ij)))`. |
| `two_norm(V)` | Die 2-Norm eines Vektors `result = sqrt(V^H * V)`. |
| `p_norm<p>(V)` | Die p-Norm eines Vektors `result = [sum_i(abs(v_i)^p)]^(1/p)`. |
| `cross(V1, V2)` | Kreuzprodukt zweier vektorwertigen Terme: `result = V1 x V2`. |
| `diagonal(V)` | Diagonalmatrix aus einträgen eines vektorwertigen Terms: `matrix = diagonal(V)`. |
| `outer(V1, V2)` | Äußeres Produkt (dyadisches Produkt / Tensorprodukt) zweier vektorwertigen Terme: `matrix = V1 * V2^T`. |
| `trans(M)` | Das Transponierte eines matrixwertigen Terms: `result = M^T`. |
| `at(V, i)` | Zugriff auf eine Komponente eines Vektors: `result = V_i`. |
| `at(M, i, j)` | Zugriff auf eine Komponente einer Matrix: `result = M_ij`. |
| `+, -` | 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`. |
Subproject commit af1c8568b5158284b56e49d052c6df6a33a8487c
Subproject commit 46df70941b96c72c9c9b6478625e421453a05244
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment