numerische-str-code issueshttps://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues2021-06-16T10:46:39+02:00https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/37Test Case: Poiseuille Flow2021-06-16T10:46:39+02:00Moritz LeibauerTest Case: Poiseuille Flowhttps://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/36Test Case: Coutte Flow2021-06-16T10:46:59+02:00Moritz LeibauerTest Case: Coutte Flowhttps://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/35Curved Grid: Iterative Solving2021-06-16T10:13:30+02:00Moritz LeibauerCurved Grid: Iterative SolvingTask 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/34Curved Grid: Boundary Conditions2021-06-16T10:13:43+02:00Moritz LeibauerCurved Grid: Boundary ConditionsTask 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/33Contures2021-06-16T10:12:46+02:00Moritz LeibauerContures![Bildschirmfoto_2021-06-15_um_14.22.57](/uploads/b7c6efb668d0b6cd99f3c95de9f865e9/Bildschirmfoto_2021-06-15_um_14.22.57.png)
Given the accuracies of our equations being only of 2nd order, we need to define our boundaries in such a way,...![Bildschirmfoto_2021-06-15_um_14.22.57](/uploads/b7c6efb668d0b6cd99f3c95de9f865e9/Bildschirmfoto_2021-06-15_um_14.22.57.png)
Given the accuracies of our equations being only of 2nd order, we need to define our boundaries in such a way, that the derivatives stay within 2nd order.
Therefore $`h_u(x)`$ and $`h_o(x)`$ must be chosen in such a way, that they suffise the following equation: $`h_o(x) - h_u(x) = \text{const}`$Task 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/32Curved Grid2021-06-16T10:12:52+02:00Moritz LeibauerCurved Grid![Bildschirmfoto_2021-06-15_um_11.33.49](/uploads/d512911c6b0e7629ce9a31d60df897c7/Bildschirmfoto_2021-06-15_um_11.33.49.png)
![Bildschirmfoto_2021-06-15_um_11.39.07](/uploads/38e34052e14be169a4faa051777e3239/Bildschirmfoto_2021-06-15_u...![Bildschirmfoto_2021-06-15_um_11.33.49](/uploads/d512911c6b0e7629ce9a31d60df897c7/Bildschirmfoto_2021-06-15_um_11.33.49.png)
![Bildschirmfoto_2021-06-15_um_11.39.07](/uploads/38e34052e14be169a4faa051777e3239/Bildschirmfoto_2021-06-15_um_11.39.07.png)
```math
\Delta \xi = 1, \ \Delta \eta = 1
```
With:
```math
\xi = \xi(x) = \frac{x - x_u}{x_o - x_u}
```
```math
\eta = \eta(x,y) = \frac{y - h_u(x)}{h_o(x) - h_u(x)}
```
And respectively:
```math
x = x(\xi) = x_u + \xi \cdot (x_o - x_u)
```
```math
y = y(\xi, \eta) = h_u(x(\xi)) + \eta \cdot \left( h_o(x(\xi)) - h_u(x(\xi)) \right)
```
## Derivatives:
![Bildschirmfoto_2021-06-15_um_14.00.30](/uploads/101d3eaae28ed17681b3a20e6f5e8bca/Bildschirmfoto_2021-06-15_um_14.00.30.png)
![Bildschirmfoto_2021-06-15_um_14.07.36](/uploads/cad73e149207f290ecc24724ebdf83cd/Bildschirmfoto_2021-06-15_um_14.07.36.png)
```math
\left(\frac{\delta \xi}{\delta x}\right)_{i,j} = \frac{\xi(x_{i, j} + \Delta x, y_{i, j}) - \xi(x_{i, j} - \Delta x, y_{i, j})}{2 \Delta x}
```
```math
\left(\frac{\delta \xi}{\delta y}\right)_{i,j} = \frac{\xi(x_{i, j}, y_{i, j} + \Delta y) - \xi(x_{i, j}, y_{i, j} - \Delta y)}{2 \Delta y}
```
```math
\left(\frac{\delta \eta}{\delta x}\right)_{i,j} = \frac{\eta(x_{i, j} + \Delta x, y_{i, j}) - \eta(x_{i, j} - \Delta x, y_{i, j})}{2 \Delta x}
```
```math
\left(\frac{\delta \eta}{\delta y}\right)_{i,j} = \frac{\eta(x_{i, j}, y_{i, j} + \Delta y) - \eta(x_{i, j}, y_{i, j} - \Delta y)}{2 \Delta y}
```
## Conture Conditions
```math
\frac{dh}{dx} = \frac{h(x_{i+1,j}) - h(x_{i-1,j})}{x_{i+1,j} - x_{i-1,j}} = \frac{\frac{\delta \Phi}{\delta y}}{\frac{\delta \Phi}{\delta x}} = \frac{\left( \frac{\delta \Phi}{\delta \xi} \frac{\delta \xi}{\delta y} + \frac{\delta \Phi}{\delta \eta} \frac{\delta \eta}{\delta y} \right)}{\left( \frac{\delta \Phi}{\delta \xi} \frac{\delta \xi}{\delta x} + \frac{\delta \Phi}{\delta \eta} \frac{\delta \eta}{\delta x} \right)}
```
### South, North
![Bildschirmfoto_2021-06-15_um_15.14.24](/uploads/a905404f64b277098c26adc550e64e0a/Bildschirmfoto_2021-06-15_um_15.14.24.png)
```math
\left( \frac{\delta \Phi}{\delta \xi} \right)_{i,j} = \frac{\Phi_{i+1,j} - \Phi_{i-1,j}}{2 \Delta \xi}
```
South Conture:
```math
\left( \frac{\delta \Phi}{\delta \eta} \right)_{i,j} = \frac{- \Phi_{i,j+2} + 4 \Phi_{i,j+1} - 3 \Phi_{i,j}}{2 \Delta \eta}
```
North Conture:
```math
\left( \frac{\delta \Phi}{\delta \eta} \right)_{i,j} = \frac{\Phi_{i, j-2} - 4 \Phi_{i, j-1} + 3 \Phi_{i, j} }{2 \Delta \eta}
```
### East, West
![Bildschirmfoto_2021-06-15_um_15.15.58](/uploads/52f62cc17173d15ead7154c239d82537/Bildschirmfoto_2021-06-15_um_15.15.58.png)
```math
\left( \frac{\delta \Phi}{\delta \eta} \right)_{i,j} = \frac{\Phi_{i,j+1} - \Phi_{i,j-1}}{2 \Delta \eta}
```
West Conture:
```math
\left( \frac{\delta \Phi}{\delta \xi} \right)_{i,j} = \frac{- \Phi_{i+2,j} + 4 \Phi_{i+1,j} - 3 \Phi_{i,j}}{2 \Delta \xi}
```
East Conture:
```math
\left( \frac{\delta \Phi}{\delta \xi} \right)_{i,j} = \frac{\Phi_{i-2, j} - 4 \Phi_{i-1, j} + 3 \Phi_{i, j} }{2 \Delta \xi}
```
### Corners
![Bildschirmfoto_2021-06-15_um_15.51.19](/uploads/b0ef6dcf6b012ede9de44a5774d32932/Bildschirmfoto_2021-06-15_um_15.51.19.png)Task 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/31Iterative Solving2021-09-12T21:23:21+02:00Moritz LeibauerIterative SolvingAusgehend von der Laplace-Gleichung:
```math
\frac{\delta^2 \Phi}{\delta x^2} + \frac{\delta^2 \Phi}{\delta y^2} = 0
```
und den Differenzengleichungen für die 2. Ableitungen:
```math
\frac{\delta^2 \Phi}{\delta x^2} = \frac{\Phi_{i+1,...Ausgehend von der Laplace-Gleichung:
```math
\frac{\delta^2 \Phi}{\delta x^2} + \frac{\delta^2 \Phi}{\delta y^2} = 0
```
und den Differenzengleichungen für die 2. Ableitungen:
```math
\frac{\delta^2 \Phi}{\delta x^2} = \frac{\Phi_{i+1,j} - 2 \Phi_{i,j} + \Phi_{i-1,j} }{\Delta x^2}, \frac{\delta^2 \Phi}{\delta y^2} = \frac{\Phi_{i,j+1} - 2 \Phi_{i,j} + \Phi_{i,j-1} }{\Delta y^2}
```
und der daraus folgenden Beziehung:
```math
\frac{\Phi_{i+1,j} - 2 \Phi_{i,j} + \Phi_{i-1,j} }{\Delta x^2} + \frac{\Phi_{i,j+1} - 2 \Phi_{i,j} + \Phi_{i,j-1} }{\Delta y^2} = 0
```
lässt sich die folgende Differenzengleichung für den Wert an der Stelle $`i,j`$ im Iterationsschritt $`\nu + 1`$ aufstellen:
```math
\Phi^{\nu +1}_{i,j} = \frac{\left(\Phi_{i+1,j} + \Phi_{i-1,j}\right) \cdot \Delta y^2 + \left(\Phi_{i,j+1} + \Phi_{i,j-1}\right) \cdot \Delta x^2}{2 \cdot \left(\Delta x^2 + \Delta y^2 \right)}
```
<details><summary>Herleitung</summary>
```math
\frac{\Phi_{i+1,j} - 2 \Phi_{i,j} + \Phi_{i-1,j} }{\Delta x^2} + \frac{\Phi_{i,j+1} - \Phi_{i,j} + \Phi_{i,j-1} }{\Delta y^2} = 0
```
```math
\left(\Phi_{i+1,j} - 2 \Phi_{i,j} + \Phi_{i-1,j}\right) \cdot \Delta y^2 + \left(\Phi_{i,j+1} - \Phi_{i,j} + \Phi_{i,j-1}\right) \cdot \Delta x^2 = 0
```
```math
\left(\Phi_{i+1,j} + \Phi_{i-1,j}\right) \cdot \Delta y^2 + \left(\Phi_{i,j+1} + \Phi_{i,j-1}\right) \cdot \Delta x^2 = 2 \Phi_{i,j} \cdot \left(\Delta x^2 + \Delta y^2 \right)
```
```math
\Phi_{i,j} = \frac{\left(\Phi_{i+1,j} + \Phi_{i-1,j}\right) \cdot \Delta y^2 + \left(\Phi_{i,j+1} + \Phi_{i,j-1}\right) \cdot \Delta x^2}{2 \cdot \left(\Delta x^2 + \Delta y^2 \right)}
```
</details>
Verallgemeinert lässt sich dies zu folgender Algebraischen Gleichung umstellen:
```math
\Phi^{\nu +1}_{i,j} = \frac{c_1 \Phi_{i-1,j-1} + c_2 \Phi_{i-1,j} + c_3 \Phi_{i-1,j+1} + c_4 \Phi_{i,j-1} + c_5 \Phi_{i,j+1} + c_6 \Phi_{i+1,j-1} + c_7 \Phi_{i+1,j} + c_8 \Phi_{i+1,j+1} } {z}
```
mit:
```math
c_1 = 0
```
```math
c_2 = \Delta y^2
```
```math
c_3 = 0
```
```math
c_4 = \Delta x^2
```
```math
c_5 = \Delta x^2
```
```math
c_6 = 0
```
```math
c_7 = \Delta y^2
```
```math
c_8 = 0
```
```math
z = 2 \cdot \left(\Delta x^2 + \Delta y^2 \right)
```
![Bildschirmfoto_2021-06-02_um_12.18.56](/uploads/4d5fa15f008dd195577c293f914f264c/Bildschirmfoto_2021-06-02_um_12.18.56.png)
### Jacobi
![Bildschirmfoto_2021-06-02_um_12.38.22](/uploads/9c751d0338382733c97a7716e98a2a72/Bildschirmfoto_2021-06-02_um_12.38.22.png)
### Gauß-Seidel
![Bildschirmfoto_2021-06-02_um_12.38.48](/uploads/82412447320b7493557d30ffb892337b/Bildschirmfoto_2021-06-02_um_12.38.48.png)
## Boundary Constraints:
For a simple 3x3 grid the following relations can be conceived. The boundary cells can be computed from Neumann boundary conditions, while the inner cell has to be determined iteratively.
![Bildschirmfoto_2021-06-14_um_22.38.49](/uploads/2baf042d19ea2177c8278802e081884d/Bildschirmfoto_2021-06-14_um_22.38.49.png)Task 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/30Stagnant Flow2021-06-16T10:12:29+02:00Moritz LeibauerStagnant Flow```math
\Phi(x,y) = a(x^2 - y^2)
```
```math
\Psi(x,y) = 2axy
``````math
\Phi(x,y) = a(x^2 - y^2)
```
```math
\Psi(x,y) = 2axy
```Task 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/29Incompressible Fluids With Const. Viskosities2021-06-16T10:12:12+02:00Moritz LeibauerIncompressible Fluids With Const. Viskositiesfrom:
```math
\frac{\delta \vec{v}}{\delta t} + \left( \vec{v} \cdot grad \right) \vec{v} = - \frac{1}{\rho} grad \ p + \nu \Delta \vec{v} + \vec{g}
```
follows:
```math
div \ grad \ \Phi = 0
```
and thus in cartesian coordinates:
```m...from:
```math
\frac{\delta \vec{v}}{\delta t} + \left( \vec{v} \cdot grad \right) \vec{v} = - \frac{1}{\rho} grad \ p + \nu \Delta \vec{v} + \vec{g}
```
follows:
```math
div \ grad \ \Phi = 0
```
and thus in cartesian coordinates:
```math
\frac{\delta \Phi^2}{\delta x^2} + \frac{\delta \Phi^2}{\delta y^2} = 0
```
and equally in x,y-coordinates:
```math
\frac{\delta \Psi^2}{\delta x^2} + \frac{\delta \Psi^2}{\delta y^2} = 0
```Task 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/28Velocities and Pressure2021-06-16T10:12:36+02:00Moritz LeibauerVelocities and Pressureu and v velocities can be computed by the following equations:
```math
u = \frac{\delta \Phi}{\delta x} = \frac{\delta \Psi}{\delta y}
```
```math
v = \frac{\delta \Phi}{\delta y} = -\frac{\delta \Psi}{\delta x}
```
and pressure:
```ma...u and v velocities can be computed by the following equations:
```math
u = \frac{\delta \Phi}{\delta x} = \frac{\delta \Psi}{\delta y}
```
```math
v = \frac{\delta \Phi}{\delta y} = -\frac{\delta \Psi}{\delta x}
```
and pressure:
```math
c_p = \frac{\Delta p}{\frac{\rho}{2} v_{ref}^2} = \frac{p - p_{ref}}{\frac{\rho}{2} v_{ref}^2} = \frac{-\frac{\rho}{2} v^2 - \left(-\frac{\rho}{2} v_{ref}^2\right)}{\frac{\rho}{2} v_{ref}^2} = 1 - \frac{v^2}{v_{ref}^2}
```
with $`p = p_{dyn}`$ and $`v_{ref} = \sqrt{u_\infty^2 + v_\infty^2}`$, $`p_{ref} = p_\infty`$Task 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/27Parallel Flow2021-06-16T10:12:18+02:00Moritz LeibauerParallel Flow![Bildschirmfoto_2021-06-14_um_21.39.45](/uploads/2b41591c4db6ddac2c331141d0ec6682/Bildschirmfoto_2021-06-14_um_21.39.45.png)
In parallel flow, the flow velocities can be split into a u and y component the follow x and y. <br>
The follo...![Bildschirmfoto_2021-06-14_um_21.39.45](/uploads/2b41591c4db6ddac2c331141d0ec6682/Bildschirmfoto_2021-06-14_um_21.39.45.png)
In parallel flow, the flow velocities can be split into a u and y component the follow x and y. <br>
The following equations can be derived for the potential $`\Phi`$, flow $`\Psi`$, x-velocity $`u`$ and y-velocity $`v`$. $`u_\infty`$ and $`v_\infty`$ thereby are the velocity components far enough from the regarded space that can be assumed to be constant.
```math
\Phi(x,y) = u_\infty x + v_\infty y
```
```math
\Psi(x,y) = u_\infty y - v_\infty x
```Task 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/26Differential Equations2021-06-16T10:12:08+02:00Moritz LeibauerDifferential EquationsIf we want to compute a numerical solution for the given problem we need to compute differential derivatives for each cell. These can be obtained by regarding the values of the neighboring cells.
![Bildschirmfoto_2021-06-14_um_14.55.49]...If we want to compute a numerical solution for the given problem we need to compute differential derivatives for each cell. These can be obtained by regarding the values of the neighboring cells.
![Bildschirmfoto_2021-06-14_um_14.55.49](/uploads/51d73ce16bdb3975b86338b6e8fdf692/Bildschirmfoto_2021-06-14_um_14.55.49.png)
In 2D however we need to keep the other direction static. <br>
From Taylor we obtain the following equations for a cartesian grid:
```math
\left(\frac{\delta \Phi}{\delta x} \right)_{i,j} = \frac{\Phi(x_{i+1},y_j) - \Phi_(x_{i-1},y_j)}{x_{i+1} - x_{i-1}} = \frac{\Phi(x_{i+1},y_j) - \Phi_(x_{i-1},y_j)}{2 \Delta x}
```
```math
\left(\frac{\delta \Phi}{\delta y} \right)_{i,j} = \frac{\Phi(x_{i},y_{j+1}) - \Phi(x_{i},y_{j-1})}{y_{j+1} - y_{j-1}} = \frac{\Phi(x_{i},y_{j+1}) - \Phi(x_{i},y_{j-1})}{2 \Delta y}
```
```math
\left( \frac{\delta^2 \Phi}{\delta x^2} \right)_{i,j} = \frac{\Phi(x_{i+1},y_j) - 2 \Phi(x_{i},y_j) + \Phi(x_{i-1},y_j) }{(x_{i+1} - x_{i}) \cdot (x_{i} - x_{i-1})} = \frac{\Phi(x_{i+1},y_j) - 2 \Phi(x_{i},y_j) + \Phi(x_{i-1},y_j) }{\Delta x^2}
```
```math
\left( \frac{\delta^2 \Phi}{\delta y^2} \right)_{i,j} = \frac{\Phi(x_{i},y_{j+1}) - 2 \Phi(x_{i},y_{j}) + \Phi(x_{i},y_{j-1}) }{(y_{j+1} - y_{j}) \cdot (y_{j} - y_{j-1})} = \frac{\Phi(x_{i},y_{j+1}) - 2 \Phi(x_{i},y_{j}) + \Phi(x_{i},y_{j-1}) }{\Delta y^2}
```
### One-Sided Derivatives
This works fine for inner cells, though for boundary cells we sometimes need to compute one-sided derivatives:
<details><summary>Derivation</summary>
Taylor of 2nd order:
```math
T_{f(x,a)} = \sum_{n=0}^{\infty} \frac{f^{n}(a)}{n!}(x-a)^n = f(a) + f'(a)(x-a) + \frac{f''(a)}{2}(x-a)^2 + ...
```
```math
\Phi_{i, nY-1} = \Phi_{i, nY} + \left( \frac{\delta \Phi}{\delta \eta} \right)_{i,nY} \cdot (-\Delta \eta) + \frac{1}{2} \left( \frac{\delta^2 \Phi}{\delta \eta^2} \right)_{i,nY} \cdot (-\Delta \eta)^2
```
```math
\Phi_{i, nY-2} = \Phi_{i, nY} + \left( \frac{\delta \Phi}{\delta \eta} \right)_{i,nY} \cdot (-2 \Delta \eta) + \frac{1}{2} \left( \frac{\delta^2 \Phi}{\delta \eta^2} \right)_{i,nY} \cdot (-2 \Delta \eta)^2
```
```math
4 \Phi_{i, nY-1} - \Phi_{i, nY-2} = 4 \Phi_{i, nY} - \Phi_{i, nY} - 4 \left( \frac{\delta \Phi}{\delta \eta} \right)_{i,nY} \Delta \eta + 2 \left( \frac{\delta \Phi}{\delta \eta} \right)_{i,nY} \Delta \eta
```
```math
\left( \frac{\delta \Phi}{\delta \eta} \right)_{i,nY} = \frac{\Phi_{i, nY-2} - 4 \Phi_{i, nY-1} + 3 \Phi_{i, nY} }{2 \Delta \eta}
```
</details>
![Bildschirmfoto_2021-06-14_um_15.29.50](/uploads/be1deac43fb28355241de223641191b9/Bildschirmfoto_2021-06-14_um_15.29.50.png)
```math
\text{west: } \left( \frac{\delta \Phi}{\delta x} \right)_{i,j} = \frac{- \Phi(x_{i+2}) + 4 \Phi(x_{i+1}) - 3 \Phi(x_{i})}{2 \Delta x}
```
```math
\text{east: } \left( \frac{\delta \Phi}{\delta x} \right)_{i,j} = \frac{\Phi(x_{i-2}) - 4 \Phi(x_{i-1}) + 3 \Phi(x_{i})}{2 \Delta x}
```
And respectively for y:
```math
\text{north: } \left( \frac{\delta \Phi}{\delta y} \right)_{i,j} = \frac{- \Phi(y_{j+2}) + 4 \Phi(y_{j+1}) - 3 \Phi(y_{j})}{2 \Delta y}
```
```math
\text{south: } \left( \frac{\delta \Phi}{\delta y} \right)_{i,j} = \frac{\Phi(y_{j-2}) - 4 \Phi(y_{j-1}) + 3 \Phi(y_{j})}{2 \Delta y}
```Task 1https://git.rwth-aachen.de/moritz.lei/numerische-str-code/-/issues/25Grid Creation & Boundary Conditions2021-06-16T10:11:38+02:00Moritz LeibauerGrid Creation & Boundary Conditions## Grid
In order to create a numerical simulation, we first need to define discrete grid within the space where we want to compute the wanted values.
![Bildschirmfoto_2021-06-14_um_14.11.33](/uploads/6d1e483f623c9f6bfe74257e2fd93ba8/Bild...## Grid
In order to create a numerical simulation, we first need to define discrete grid within the space where we want to compute the wanted values.
![Bildschirmfoto_2021-06-14_um_14.11.33](/uploads/6d1e483f623c9f6bfe74257e2fd93ba8/Bildschirmfoto_2021-06-14_um_14.11.33.png)
Within the created grid each discrete cell (i,j) is assigned a position (x,y).
From this grid we can derive a subdivision of the area of interest into single discrete cells. Each cell thereby is seen as having constant values.
![Bildschirmfoto_2021-06-14_um_14.11.55](/uploads/2b141589a6f6076828b23091130da195/Bildschirmfoto_2021-06-14_um_14.11.55.png)
With number of steps in i and j-direction $`I`$ and $`J`$ and step widths: $`\Delta i = \frac{1}{I - 1}`$ and $`\Delta j = \frac{1}{J - 1}`$
## Cell Types
There are two types of cells: "Inner Cells" and "Boundary Cells"
### Inner Cells
Inner cells are of unknown state and have to be computed.
### Boundary Cells
Boundary cells are defined by given dependancies that link the regarded subspace to other outer conditions. Therefore values of boundary cells can be computed outside of the numerical solving algorithms.
#### Dependancies
There are two types of boundary dependancies: "Dirichlet" and "Neumann" conditions.
![Bildschirmfoto_2021-06-14_um_14.32.43](/uploads/f942f397cd2d7b48a074fb01b1f8b1d2/Bildschirmfoto_2021-06-14_um_14.32.43.png)
##### Dirichlet Conditions
Dirichlet conditions are defined by a known state of the regarde scalars value. Thus they define cells outside of the solved grid for which the scalar values can be directly computed.
##### Neumann Conditions
Sometimes the states of the boundary cells can not directly be computed, but we can conceive restrictions about their derivatives. These restrictions are known as Neumann conditions and can be visualized as dependancies of the boundary cells outer edges. When using Neumann conditions all cells' scalar values have to be computed, though the equations for the boundary and inner cells differ.Task 1