
This is a preprocessing program that generates geometry and meshes using digital topographic maps for analyzing wind environments and pollutant dispersion with computational fluid dynamics (CFD).
All components are implemented using open-source software.
The preprocessing workflow consists of three stages: importing terrain and building data, generating three-dimensional geometry, and constructing the mesh. - Geometry data: Digital topographic maps provided in API format by the National Geographic Information Institute follow standard Geographic Information System (GIS) formats. The open-source Python library OsGeo, used with QGIS, is utilized to extract and process geometric information from GIS data.
- Geometry generation and processing: This stage includes loading 3D geometry data, performing boolean operations between geometries, and exporting the processed geometry to a mesh generation tool.
- Mesh generation: The mesh is generated using snappyHexMesh, a mesh generation utility in the open-source software OpenFOAM.
๐น Terrain Geometry Generation The following steps are performed to generate a three-dimensional surface mesh from digital topographic maps.
Continuous digital topographic maps provided by the National Geographic Information Institute are used. Information is obtained by reading the F10000.shp file. The data is converted into Python objects using OsGeo.
- Extraction of data points
The position and elevation values of contour points, stored in the form of multi-line strings in the digital topographic map, are extracted.
- Elevation calculation using linear interpolation
New points representing the entire terrain are defined using the extracted points. These new points are generated in a grid aligned along the x and y directions, with spacing specified by the user. The elevation values of the generated grid points are calculated using two-dimensional linear interpolation from the surrounding contour points.
The terrain is translated so that the lowest elevation (z-coordinate) becomes zero. Additionally, the terrain is adjusted so that the z-values gradually decrease before the terrain boundary is reached.
The points are converted into a surface mesh using the VTK library (in STL or OBJ format).
Includes recent changes not reflected in existing digital topographic maps or civil engineering updates planned for the future.
 Contour lines and grid point examples using QGIS
|  examples of surface shapes User environment of a shape generation program using digital topographic maps |
๐น Building Geometry Generation Building footprint data is extracted from digital topographic maps to generate three-dimensional geometries, and building information is identified using associated metadata. The process is carried out through the following steps:
- Importing building footprint data
Building information is read from the B0010000.shp file of the continuous digital topographic map and converted into Python objects.
- Extraction of building floor information
The number of floors or related building height information is extracted.
- Extraction of surface data
Surface data representing the building footprint is extracted.
- Extraction of coordinate data
The coordinates of each point defining the building footprint are extracted.
- Geometry construction using OpenCascade
Points, edges, and surfaces are generated using the OpenCascade library.
The surfaces are extruded to a specified height to create three-dimensional building geometries. Case study of shape generation – near the Dongtan Tunnel on the Gyeongbu Expressway, 4×4 km

Check building information using building metadata
๐น Additional Structure GenerationLarge structures required for modeling, such as tanks or large pipes, which are not included in the digital topographic map, as well as geometric models of pollutant emission sources, can be added. Geometric primitives such as spheres, cylinders, cubes, and pipes can be generated for this purpose. Example of creating additional structures
๐นMesh Generation
The overall computational domain is constructed as a hexahedral mesh using the blockMesh utility of the open-source software OpenFOAM. A three-dimensional mesh that includes terrain and structures is automatically generated with minimal user input using snappyHexMesh, a mesh generation utility in OpenFOAM.

Example of creating a 3D mesh |