voxcity.simulator_gpu.solar.domain.Domain

class voxcity.simulator_gpu.solar.domain.Domain(nx: int, ny: int, nz: int, dx: float = 1.0, dy: float = 1.0, dz: float = 1.0, origin: Tuple[float, float, float] = (0.0, 0.0, 0.0), origin_lat: float | None = None, origin_lon: float | None = None, rotation_angle: float = 0)

3D computational domain for solar radiation simulation.

The domain uses a regular grid aligned with VoxCity indices: - x (first index i/u): Row direction, increases toward North - y (second index j/v): Column direction, increases toward East - z (third index k): Vertical, increases Ground to Sky

nx, ny, nz

Number of grid cells in each direction

dx, dy, dz

Grid spacing in meters

origin

(x, y, z) coordinates of domain origin

nx
ny
nz
dx = 1.0
dy = 1.0
dz = 1.0
origin = (0.0, 0.0, 0.0)
origin_lat
origin_lon
rotation_angle = 0
x_min = 0.0
x_max
y_min = 0.0
y_max
z_min = 0.0
z_max
cell_volume = 1.0
topo_top
is_solid
is_tree
lad
plant_top
n_surfaces
set_flat_terrain(height: float = 0.0)

Set flat terrain at given height.

initialize_terrain(height: float = 0.0)

Alias for set_flat_terrain.

set_terrain_from_array(terrain_height: numpy.ndarray)

Set terrain from 2D numpy array of heights.

Parameters:

terrain_height – 2D array (nx, ny) of terrain heights in meters

add_building(x_range: Tuple[int, int] | None = None, y_range: Tuple[int, int] | None = None, z_range: Tuple[int, int] | None = None, *, x_start: int | None = None, x_end: int | None = None, y_start: int | None = None, y_end: int | None = None, height: float | None = None)

Add a rectangular building to the domain.

Can be called with either range tuples or individual parameters:

Parameters:
  • x_range – (i_start, i_end) grid indices

  • y_range – (j_start, j_end) grid indices

  • z_range – (k_start, k_end) grid indices

Or with keyword arguments:

x_start, x_end: X grid indices y_start, y_end: Y grid indices height: Building height in meters (z_range computed from this)

set_lad_from_array(lad_array: numpy.ndarray)

Set Leaf Area Density from 3D numpy array.

Parameters:

lad_array – 3D array (nx, ny, nz) of LAD values (m^2/m^3)

set_from_voxel_data(voxel_data: numpy.ndarray, tree_code: int = -2, solid_codes: list | None = None)

Set domain from a 3D voxel data array.

Parameters:
  • voxel_data – 3D numpy array with voxel class codes

  • tree_code – Class code for trees (default -2)

  • solid_codes – List of codes that are solid (default: all non-zero except tree_code)

add_tree_box(x_range: Tuple[int, int], y_range: Tuple[int, int], z_range: Tuple[int, int], lad_value: float = 1.0)

Add a box-shaped tree canopy region to the domain.

This is a simpler alternative to add_tree() for rectangular tree regions.

Parameters:
  • x_range – Grid index ranges (start, end)

  • y_range – Grid index ranges (start, end)

  • z_range – Grid index ranges (start, end)

  • lad_value – Leaf Area Density value (m^2/m^3)

add_tree(center: Tuple[float, float] | None = None, height: float | None = None, crown_radius: float | None = None, crown_height: float | None = None, trunk_height: float | None = None, max_lad: float = 1.0, *, center_x: float | None = None, center_y: float | None = None, lad: float | None = None)

Add a simple tree with cylindrical trunk and spherical crown.

Parameters:
  • center – (x, y) position in meters

  • height – Total tree height in meters (optional, computed from crown+trunk)

  • crown_radius – Radius of crown in meters

  • crown_height – Height of crown sphere in meters

  • trunk_height – Height of trunk (no leaves) in meters

  • max_lad – Maximum LAD at crown center

Or with keyword arguments:

center_x, center_y: Position in meters lad: Alias for max_lad

get_cell_indices(point: voxcity.simulator_gpu.solar.core.Point3) taichi.math.ivec3

Get grid cell indices for a point.

get_cell_center(i: taichi.i32, j: taichi.i32, k: taichi.i32) voxcity.simulator_gpu.solar.core.Point3

Get center coordinates of grid cell.

is_inside(point: voxcity.simulator_gpu.solar.core.Point3) taichi.i32

Check if point is inside domain.

is_cell_solid(i: taichi.i32, j: taichi.i32, k: taichi.i32) taichi.i32

Check if cell is solid (building or terrain).

get_max_dist() float

Get maximum ray distance (domain diagonal).

get_lad(i: taichi.i32, j: taichi.i32, k: taichi.i32) taichi.f32

Get LAD value at cell.