# Grid Generator

## Introduction

Cartesian methods differ in that they are non-body-fitted. Hexahedral cells in the domain consist of a set of right parallelepipeds and the (normally) orthogonal grid system may extend through solid wall boundaries within the computational domain. The method then removes, or flags, cells which are completely internal to the geometry and identifies those cells which intersect the solid walls. The remaining cells are considered general volume mesh elements. Fundamentally, Cartesian approaches trade the case-specific problem of generating a body-fitted surface mesh for the more general problem of computing and characterizing intersections between hexahedral cells and the surface geometry.

This work documents a new method for rapid and robust Cartesian mesh generation for a surface level geometry. The new algorithm adopts a novel strategy which first inspects the vertices to extract the cutted surface before proceeding with the further grid generation in a second phase. The main task there is the determination of the intersection point of straight lines with the surface. The intersection algorithm is based on a robust root finder which consistently handles geometric degenaracies.

For surface geometries given by other data structures an intermediate level set description has to be found, which relies on an algorithm which determines if a given point is inside or outside of an obstacle. This idea is applied for the grid generation of an urban building configuration, where each individual building is described by a polyhedron.

As input to the CFD code ASAM the grid generator must supply the free face area of the six faces of the parallelepiped and the free volume.

## Computation of the cut cells

The algorithm consists of the following stages, where you should visualize the Cartesian Grid as a wire frame consisting of vertices and edges.

1. Divide the vertices in the two parts where one of them is the set of all vertices which are outside of the orography.
2. Flag all edges where the two end points lie in different parts.
3. Determine the intersection point of this edges with the level set.
4. Compute the free face area for all faces which have intersecting edges by a numerical quadrature rule.
5. Compute the free volume for all cells which have intersecting edges by a numerical quadrature rule.
6. Determine the intersecting polygons for visualization.

Stages of the cut cell computation:

Possible intersection configurations between the hexahedral and the cutting surface:

For applications with different resolution in the simulation the dividing interface requires a special treatment. To enforce flux continuity the free face area of the coarse cell has to be equal to the sum of the possible two fine face areas, $F^C=F_1^F+F_2^F\,$. The face areas therefore determined for the fine cells and than summed up for the coarse cell.

## Whitch of Agnesi

 Figure A: Cartesian cut cell grid of a whitch of Agnesi. The blocks are colored in blue.

A classical test for atmospheric models is the flow over bell shaped mountains like the whitch of
Agnesi which is given by the level set function

$\phi(x,y,z)=z-\frac{H}{1+(x/a)^2+(y/b)^2}\,$

where $H\,$ is the height of the mountain and $a\,$ and $b\,$ are
the half width in $x\,$ and $y\,$ direction. Figure A show a small example where
the computational domain is decomposed in B blocks of different resolution. Where in Figure A the summit
of the hill is located at $x=0\,$, in the following Figure B the summit is shifted to the right
and the resolution of the hill near the summit decreases.

 Figure B: Cartesian cut cell grid of a whitch of Agnesi, where the summit of the hill is located in different regions of the resolution.

## Cartesian cut cell grids for buildings

A building is described by a set of polygonal faces, which is boundary representation with absolute coordinates. There are a lot of different data structures of this type like CityGML, 3D ESRI shape specification, the SKP format of Google Earth, and so on. For convex buildings the distance to the building surface can simply be computed as the minimum of the distances to all faces forming the building, which can be further generalized to a group of buildings. For a simple building with a pitched roof the data structures looks like

1
8
4 4 4 4 4 3 4 3
w w w w r r r r
-0.2  1.0  1.0 -0.2     -0.2 -0.2 -0.2 -0.2     0.0d0 0.0d0 1.0 1.0
1.0  1.0  1.0    1.0   -0.2  1.0  1.0 -0.2     0.0     0.0    1.0 1.0
1.0 -0.2 -0.2  1.0      1.0  1.0  1.0  1.0     0.0     0.0    1.0 1.0
-0.2 -0.2 -0.2 -0.2      1.0 -0.2 -0.2  1.0     0.0     0.0    1.0 1.0
-0.2  1.0  0.6  0.2     -0.2 -0.2  0.4  0.4     1.0     1.0    2.2 2.2
1.0  1.0  0.6     -0.2  1.0  0.4     1.0  1.0  2.2
1.0 -0.2  0.2  0.6      1.0  1.0  0.4  0.4     1.0     1.0    2.2  2.2
-0.2 -0.2  0.2      1.0 -0.2  0.4     1.0  1.0  2.2

Building with pitch roof (see description above) with increasing grid solution:

## City of Leipzig, Eisenbahnstrasse

To accompany the aerosol number measurement activities in the Eisenbahnstrasse and its surrounding a three dimensional city model is prepared in cooperation with the Department of Geography of the Martin--Luther--University in Halle. By combining orthophotos and cadastre information about the floor plan of each building a half automatic system will be installed to extract building heights and roof forms. An old representation of part of the Eisenbahnstrasse is visualized with the new grid generator in Figure C. Part of the forthcoming work can be seen in the Figures D and E.

 Figure C: Cartesian cut cell grid for a simplified representation of a part of the Eisenbahnstrasse. Figure D: Floor plan of the Eisenbahnstrasse in the City of Leipzig from a two dimensional shape file. Figure E: Area of the Eisenbahnstrasse in the City of Leipzig, Orthophoto overlaid with the two dimensional shape file of the floor plan

## Two dimensional street canyon

The simulation show the influence of the ratio of the height of the two buildings which form the street canyon on the position and number of vortices in the canyon. For a ratio of 0.5 two vortices are formed in the main street canyon where for a ratio 0.67 only one vortex is visible. The transition between these two configurations appears at a ratio of approximately 0.64. The computations were performed with periodic boundary condition in the horizontal direction, a resolution of 1 m, and a driving wind at the upper boundary of 3 m/s.

Two dimensional street canyon with different ratios of building height, $r=0.64\,$ left, $r=0.5\,$ middle, $r=0.67\,$ right.