... | ... | @@ -456,7 +456,9 @@ For more details we refer to [Zönnchen and Köster, 2018](https://www.sciencedi |
|
|
|
|
|
### Example 1 (Uniform ring)
|
|
|
|
|
|
In this example we use the mi
|
|
|
The following code snippet generates a mesh using the standard EikMesh algorithm for a simple curved geometry.
|
|
|
The geometry is defined by the distance function d(x) = ||x-c|-0.5|-0.4, where c = (1,1) to be the center of the ring. The inner radius is 0.2 and the outer 1.0. The edge length function is h(x) = h0 = 0.1.
|
|
|
|
|
|
```java
|
|
|
VRectangle bound = new VRectangle(-0.1, -0.1, 2.2, 2.2);
|
|
|
IDistanceFunction d_r = IDistanceFunction.createRing(1, 1, 0.2, 1.0);
|
... | ... | @@ -466,24 +468,47 @@ meshImprover.generate(); |
|
|
```
|
|
|
|
|
|
#### Result:
|
|
|
The result for h0 = 0.3, 0.1 and 0.05.
|
|
|
|
|
|
![uniform_ring](uploads/f70853ddb85fdd6b7b976a90454ef157/uniform_ring.png)
|
|
|
|
|
|
### Example 2 (Uniform mesh)
|
|
|
### Example 2 (Subtract rectangle from disc)
|
|
|
|
|
|
Additionally we can add a list of geometrical shapes which are part of the boundary. In case of Pedestrian Dynamics those shapes may represent real world obstacles like walls:
|
|
|
Distance functions can be combined.
|
|
|
|
|
|
```java
|
|
|
PEikMeshGen<EikMeshPoint, Double, Double> meshImprover = new PEikMeshGen<>(
|
|
|
boundary,
|
|
|
h0,
|
|
|
Arrays.asList(new VRectangle(0.25, 0.25, 0.5, 0.5)),
|
|
|
(x, y) -> new EikMeshPoint(x, y, false));
|
|
|
VRectangle bound = ...
|
|
|
VRectangle rect = new VRectangle(0.5, 0.5, 1, 1);
|
|
|
IDistanceFunction d_c = IDistanceFunction.createDisc(0.5, 0.5, 0.5);
|
|
|
IDistanceFunction d_r = IDistanceFunction.create(rect);
|
|
|
IDistanceFunction d = IDistanceFunction.substract(d_c, d_r);
|
|
|
double edgeLength = 0.03;
|
|
|
var meshImprover = new PEikMeshGen<EikMeshPoint, Double, Double>(
|
|
|
d,
|
|
|
p -> edgeLength + 0.5 * Math.abs(d.apply(p)),
|
|
|
edgeLength,
|
|
|
bound,
|
|
|
Arrays.asList(rect),
|
|
|
(x, y) -> new EikMeshPoint(x, y, false));
|
|
|
```
|
|
|
|
|
|
Line 1 defines a bounding box containing the mesh domain.
|
|
|
The second line defines a hole and is transformed into a distance function ``d_rec`` in line 4.
|
|
|
The disc is defined by the distance function d_disc constructed in line 3.
|
|
|
By subtracting d_rect from d_disc we construct
|
|
|
|
|
|
d(x) = d_comb(x) = max(d_disc, -d_rec)
|
|
|
|
|
|
****Remark****: Even if the geometry is defined by ``d_comb``, the ``VRectangle`` ``rect`` is an argument of EikMesh.
|
|
|
This is optional but it will automatically inserts fix points at the corners of the rectangle which improves the mesh quality. Furthermore, in line 9 we use a non-constant edge length function
|
|
|
|
|
|
h(x) = h_{min} + 0.3 * |d_comb(x)|.
|
|
|
#### Result:
|
|
|
<img src="uploads/00fb6492c91f257fe18aeaabda9f5fce/rectUniformMeshHole.png" alt="Uniform rect mesh with hole" width="200"/>
|
|
|
The result for h0 = 0.1, 0.03 and 0.01.
|
|
|
|
|
|
### Example 3 (Adaptive mesh)
|
|
|
<img src="uploads/deabaceadffaa1285a4115f8e652d226/discAdaptiveMesh.png" alt="Adaptive disc mesh" width="200"/>
|
|
|
|
|
|
### Example 3 (Subtract rectangle from disc)
|
|
|
|
|
|
We can not only define our own distance function d and edge length function h but crucially h can depend on d:
|
|
|
|
... | ... | @@ -508,9 +533,6 @@ PEikMeshGen<EikMeshPoint, Double, Double> meshImprover = new PEikMeshGen<>( |
|
|
meshImprover.generate();
|
|
|
```
|
|
|
|
|
|
#### Result:
|
|
|
<img src="uploads/deabaceadffaa1285a4115f8e652d226/discAdaptiveMesh.png" alt="Adaptive disc mesh" width="200"/>
|
|
|
|
|
|
## Videos
|
|
|
|
|
|
To get a good understanding of how EikMesh works, we constructed some videos of the meshing process which can be found at [vadere.org](http://www.vadere.org/the-eikmesh-library/). |
|
|
\ No newline at end of file |