tudelft3d / city4cfd Goto Github PK
View Code? Open in Web Editor NEWReconstruction of 3D city models for urban flow simulations
License: GNU General Public License v3.0
Reconstruction of 3D city models for urban flow simulations
License: GNU General Public License v3.0
Amazing work! Is there any already generated public dataset for tasks like building classification?
I have successfully used the code for creating a city model. However, I am having trouble with using the model for CFD using Ansys.
I can not use the output directly for the modeling, since I need the fluid volume. But extracting the fluid volume does not work. I think that is because when I load the result in Ansys the city model consist of surfaces instead of solid bodies.
I was wondering if it is possible to make from the output solid bodies, which I can use to extract the fluid volume, or if there is another solution to fix this problem.
OS: Ubuntu 22.04.2 LTS
[ 63%] Building CXX object CMakeFiles/city4cfd.dir/src/Building.cpp.o
[ 64%] Building CXX object CMakeFiles/city4cfd.dir/src/Config.cpp.o
[ 65%] Building CXX object CMakeFiles/city4cfd.dir/src/ImportedBuilding.cpp.o
[ 67%] Building CXX object CMakeFiles/city4cfd.dir/src/LoD12.cpp.o
[ 68%] Building CXX object CMakeFiles/city4cfd.dir/src/Map3d.cpp.o
[ 69%] Building CXX object CMakeFiles/city4cfd.dir/src/PointCloud.cpp.o
[ 70%] Building CXX object CMakeFiles/city4cfd.dir/src/PolyFeature.cpp.o
/home/fernandj/tools/City4CFD/src/PolyFeature.cpp:36:10: fatal error: CGAL/Barycentric_coordinates_2/Triangle_coordinates_2.h: No such file or directory
36 | #include <CGAL/Barycentric_coordinates_2/Triangle_coordinates_2.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/city4cfd.dir/build.make:188: CMakeFiles/city4cfd.dir/src/PolyFeature.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:169: CMakeFiles/city4cfd.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
There was a minor error during compilation in my Ubuntu 20.04.
Error:
City4CFD/src/io.cpp:227:80: error: invalid conversion from ‘OGRGeometry*’ to ‘OGRPolygon*’ [-fpermissive]
OGRPolygon *inputPolygon =inputMultipolygon->getGeometryRef(currentPolygon);
I found that the error is coming from pointer call in line 227 in io.cpp file. The problem goes away if we fix the pointer call to this:
OGRPolygon *inputPolygon=inputMultipolygon->getGeometryRef(currentPolygon)->toPolygon();
May be problem is specific to my machine/compiler. Just commenting here in case someone else faces the same issue.
Hello,
I noticed that City4CFD validates the configuration file when the "lod" key is missing. However, it then fails right after with a vague error message. The configuration I am using is as follows:
{
"point_clouds" :
{
"ground": "pointcloud/ground.txt"
},
"polygons" : [
{
"type": "Building",
"path": "polygons/buildings.geojson",
"unique_id": "fid",
"height_attribute": "b3_h_max"
},
{
"type": "SurfaceLayer",
"path": "polygons/vegetation.geojson"
},
{
"type": "SurfaceLayer",
"path": "polygons/water.geojson"
}
],
"point_of_interest": [93898,436173],
"influence_region": null,
"domain_bnd": null,
"top_height": 300,
"bnd_type_bpg": "Round",
"bpg_blockage_ratio": false,
"buffer_region": 20,
"reconstruct_boundaries": true,
"terrain_thinning": 10,
"smooth_terrain": {
"iterations": 1,
"max_pts": 100000
},
"building_percentile": 90,
"edge_max_len": 5,
"output_file_name": "Mesh",
"output_format": "obj",
"output_separately": true,
"output_log": true,
"log_file": "logFile.log"
}
This config gives the following error:
#==============================================================#
# __ #
# __ |''| #
# |""| |''| _ /|__ #
# __|""| |''|_| | | |""|/\_ #
# |''|""| |''|'| __| |""|'''| _____ #
# _ _ |''|""|^|''|'||""| |""|'''| |"""""| #
# |"|"| |''|""|||''|'||""| |""|'''| |"""""| #
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
# ____ _ _ ___________________________ #
# / ___| /_\ | |_ _ _ __ ____/___ ____/___ __ \ #
# | | |"| | __| | | | | _ / __ /_ __ / / / #
# | |___ |"| | |_ | |_| | 4 / /___ _ __/ _ /_/ / #
# \____| |"| \__| \__, | \____/ /_/ /_____/ #
# |___/ #
# #
#==============================================================#
City4CFD Copyright (C) 2021-2023 3D Geoinformation Research Group, TU Delft
Work directory: "~/cfd_trial"
Validating JSON configuration file...Configuration file is valid!
Program failed! Reason: [json.exception.invalid_iterator.214] cannot get value
End
I used a water layer for the imprinting, with the setting to flatten the surface.
But it seems that some water surfaces are flat, but some are not. image below uses calc to show the Z-coor on the water layer.
Any idea how to fix this?
{
"point_clouds" :
{
"ground": "point_cloud/ground_in.ply"
},
"polygons" : [
//{
// "type": "SurfaceLayer",
// "path": "polygons/Vegetation.geojson",
// "layer_name" : "Vegetation"
//},
{
"type": "SurfaceLayer",
"path": "polygons/water3.geojson",
//"path": "polygons/water2.dxf",
"layer_name": "Water",
"flatten_surface": true, // Optional - set all points of the surface layer to the same height
"flatten_vertical_border": false, // Optional - enforce vertical walls between terrain
"surface_percentile": 30 // Percentile of all points of the surface layer to set the height, required if flatten_surface is true
}
],
"import_geometries": {
"path": "import_buildings/buildings.ply",
"advantage": true,
"true_height": true,
"lod": "1.3"
},
"point_of_interest": [0, 0], //[96250, 436900],
"influence_region": 500,
"domain_bnd": null,
"bnd_type_bpg": "Round", // Round, Rectangle, Oval. Matters only if using BPG
"top_height": 150,
"flow_direction": [1, 0],
"buffer_region": 0,
"reconstruct_boundaries": false,
"terrain_thinning": 50,
"smooth_terrain": {
"iterations": 3,
"max_pts": 1000000
},
"flat_terrain": false, // Optional - make terrain flat
"lod": "1.2",
"building_percentile": 90,
"edge_max_len": 5,
"output_file_name": "Mesh",
"output_format": "stl",
"output_separately": true,
"output_log": true,
"log_file": "logFile.log"
}
Hey,
I used city4cfd to create the geometry over a rowing course (bosbaan, amstelveen). It worked very good, until I wanted to make my domain boundaries smaller, now the water is not created anymore in the output file. First, my domain boundaries were around 300m around the water, and I decreased it to approximately 200m. Is there a way that I can make my domain boundaries smaller and still get a water layer in the output?
Thank you in advance,
Emilie
This what I get in the Ubuntu terminal. I'm really desperate with the use of this program, can someone help me out?????????
This is what the output file looks like, as you may understand it shouldn't be like this:
wilai@Laias-Laptop:~$ ~/City4CFD/build/city4cfd /home/wilai/config_bpg.json --output_dir /home/wilai/results
#==============================================================#
# __ #
# __ |''| #
# |""| |''| _ /|__ #
# __|""| |''|_| | | |""|/\_ #
# |''|""| |''|'| __| |""|'''| _____ #
# _ _ |''|""|^|''|'||""| |""|'''| |"""""| #
# |"|"| |''|""|||''|'||""| |""|'''| |"""""| #
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
# ____ _ _ ___________________________ #
# / ___| /_\ | |_ _ _ __ ____/___ ____/___ __ \ #
# | | |"| | __| | | | | _ / __ /_ __ / / / #
# | |___ |"| | |_ | |_| | 4 / /___ _ __/ _ /_/ / #
# \____| |"| \__| \__, | \____/ /_/ /_____/ #
# |___/ #
# #
#==============================================================#
City4CFD Copyright (C) 2021-2023 3D Geoinformation Research Group, TU Delft
Work directory: "/home/wilai"
Validating JSON configuration file...Configuration file is valid!
INFO: Did not find any ground points! Will calculate ground as a flat surface.
WARNING: Ground elevation of buildings can only be approximated. If you are using point cloud to reconstruct buildings, building height estimation can be wrong.
Reading building points
Points read: 1691666
Reading polygons
Reading polygon file: /home/wilai/files_city4CFD/real_buildings.geojson type: GeoJSON
CRS information: EPSG code: 3857
Polygons read: 6436
Creating flat terrain
Smoothing terrain
Smoothing terrain...done
Attaching point cloud points to buildings
Defining influence region
Number of building geometries in the influence region: 62
Removing extra terrain points
Reconstructing buildings
Number of successfully reconstructed buildings: 62
INFO: Domain boundaries not defined in config. Calculating with BPG.
Calculating blockage ratio for flow direction (1 1)
Blockage ratio is: -nan
Reconstructing terrain
Lifting polygon edges to terrain elevation
Number of polygons to constrain: 0
Preparing triangulation
[==================================================] 100%
Triangulating...done
Imprinting polygons
[==================================================] 100%
Creating terrain mesh
Reconstructing boundaries
Outputting surface meshes
Folder: "/home/wilai/results"
Creating log file 'logFile.log'
Outputting failed building reconstructions to 'failedReconstructions.geojson'
Program executed in 6.11155 s
End
Hi!
I have to work with city4CFD for my graduation project. I have basic experience with programing or these type of softwares, so I have been struggling in getting everything I need to prepare the CFD data, and I've been stuck on the same issue for days.
This is the error I got after I input: ~/City4CFD/build/city4cfd /home/wilai/config_bpg.json --output_dir /home/wilai/results
This is the file config_bpg.json I got:
{
"timeStep": 0.01,
"simulationDuration": 10,
"convergenceCriteria": 0.000001,
"point_of_interest": [
85376,
446125
],
"influence_region": 0,
"domain_bnd": "Rectangle",
"dimensions": {
"length": 10,
"width": 50,
"height": 30
},
"top_height": 100,
"geometryFile": "/home/wilai/COW/COW.stl",
"meshSize": 0.1,
"meshRefinementLevels": 2,
"fluidDensity": 1000,
"fluidViscosity": 0.001,
"inletVelocity": 1,
"outletPressure": 0,
"wallFriction": 0.005,
"numericalMethod": "FiniteVolume",
"turbulenceModel": "k-epsilon",
"solverIterations": 1000,
"output_format": "stl",
"output_file_name": "COW.stl",
"output_separately": false,
"outputFrequency": 100,
"bnd_type_bpg": "Rectangle",
"flow_direction": [
1,
1
],
"building_percentile": 0.000001,
"edge_max_len": 0.000001
}
I cannot compile the software on OpenSUSE Leap 15.3. CMake works fine without any errors, but the compilation fails. I tried compiling with 10 cores, FYI. I'm attaching both logs of CMake and make.
log.make.txt
log.cmake.txt
The errors seem to originate due to the lines
Line 337 in 99ace13
Line 245 in 99ace13
Replacing the two lines with
#pragma omp parallel
seems to give a successful compilation, but running the TUDcampus example case throws a segmentation fault error. Any help would be appreciated
Would it be possible to just reconstruct terrain and water? no buildings?
city4CFD is only creating terrain.obj and buildings.obj and nothing for the water. Here is the config file:
I have tried:
The point cloud for the terrain to include the water (height=0)
The point cloud not including the removing the water points.
With the same result
{
"point_clouds" :
{
"ground": "terrain_clean.xyz"
//"ground": "water.xyz"
},
"polygons" : [
{
"type": "Building",
"path": "bld_test.geojson",
"unique_id": "Name",
"height_attribute": "height",
"height_attribute_advantage": true
},
{
"type": "SurfaceLayer",
"path": "waterRegion.geojson",
"layer_name": "Water"
}
],
"point_of_interest": [0, 0],
"influence_region": "influenceRegion.geojson",
"domain_bnd": "domain.geojson",
"top_height": 150,
"flow_direction": [1, 1],
"buffer_region": 40,
"reconstruct_boundaries": false,
"terrain_thinning": 10,
"smooth_terrain": {
"iterations": 1,
"max_pts": 100000
},
"lod": "1.2",
"building_percentile": 90,
"edge_max_len": 2,
"output_file_name": "Mesh",
"output_format": "obj",
"output_separately": true,
"output_log": true,
"log_file": "logFile.log"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.