SOLWEIG-GPU: GPU-Accelerated Thermal Comfort Modeling Framework for Urban Digital Twins

Documentation Status PyPI version Python versions GitHub stars

SOLWEIG-GPU is a high-performance implementation of the Solar and Longwave Environmental Irradiance Geometry (SOLWEIG) model, designed for calculating Sky View Factor (SVF), mean radiant temperature (Tmrt), Universal Thermal Climate Index (UTCI), shadows, and short and long-wave radiation in urban environments.

The original SOLWEIG model was developed to calculate TMRT over small geographical areas in cities. At this spatial scale, given the time required for computation, the model can be run on CPUs. However, for city-scale thermal comfort estimation, the model should be accelerated using a GPU. Specifically, the calculation of the SVF (the most time-consuming step), TMRT, and UTCI can be processed on a GPU.

Currently, a tool exists that computes SVF on GPU (gpusvf). However, it utilizes Python to read the inputs and write the output rasters, whereas the SVF calculation on the GPU is performed by interfacing with a C-language code. Thus, there was a need for a Python-based end-to-end framework to run SOLWEIG on a GPU. Our framework is implemented in PyTorch, which enables automatic selection of the GPU when available.

Features

  • GPU Acceleration: Leverages CUDA/PyTorch for 10-100x speedup over CPU

  • Large Domain Support: Handles city-scale simulations through intelligent tiling

  • Multiple Data Sources: Supports ERA5, WRF, and custom meteorological inputs

  • Complete 3D Geometry: Accounts for buildings, vegetation, and terrain

  • Parallel Processing: Multi-core CPU processing for wall calculations

  • High Accuracy: Implements SOLWEIG 2022a (will upgrade to 2025a) algorithms with anisotropic radiation

Quick Start

Installation

# Using conda (recommended)
conda create -n solweig python=3.10
conda activate solweig
# Install dependencies via conda
conda install -c conda-forge gdal pytorch timezonefinder matplotlib sip
pip install PyQt5
conda install -c conda-forge cudnn #If GPU is available
pip install solweig-gpu
# if you have older versions installed
pip install --upgrade solweig-gpu

Basic Usage

from solweig_gpu import thermal_comfort

thermal_comfort(
    base_path='/path/to/data',
    selected_date_str='2020-08-13',
    tile_size=1000,
    use_own_met=True,
    own_met_file='met_data.txt'
)

Documentation

Indices and tables