Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Obstruction masks are off by one cell/node (obstructions one cell too thick, cell-centred slice plane can be wrong)

Đã đóng
#132 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
22/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
data

Hướng nghiên cứu

Start in Mesh.get_obstruction_mask_slice() and get_obstruction_mask, where the slice plane is rebuilt with coordinate_to_index(..., cell_centered=True) and the OBST bounds get the +1 offset for cell-centred masks. Reproduce with an OBST at 0.1 m and a cell-centred slice, then compare the masked cells against the slice data plane. Done means the mask uses the integer plane from the SLCC header and matches the data plane, the OBST cell range is corrected, and tests assert which cells are masked, not only shapes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Found while reviewing #131, verified on FDS runs: the input file from #89 (two of its meshes at 0.1 m) and a small test case with a 2D and a 3D cell-centred slice and an obstruction at 0.1 m.

1. Cell-centred 2D slices can be masked with the wrong cell plane (depends on float rounding)

Mesh.get_obstruction_mask_slice() rebuilds the slice plane from the slice's extent via coordinate_to_index(..., cell_centered=True). FDS writes a cell-centred slice as SLCC … k k and fdsreader stores the extent of node k, which lies exactly between cell k-1 and cell k (0-based). The slice data belongs to the lower cell k-1: in a test run, a 2D cell-centred slice at PBZ=-1.05 (SLCC … 10 10) is identical to layer 9 of a 3D cell-centred slice (max difference 0.0) and differs from layer 10.

Which cell coordinate_to_index picks for that tie is decided by float32 rounding of the coordinates, so the result is sometimes right and sometimes wrong:

&SLCF … CELL_CENTERED .smv extent z mask plane (centre) slice data plane (centre)
PBZ=-2.55 (case from #89) SLCC … 35 35 −2.50 cell 35 (−2.45) ❌ cell 34 (−2.55)
PBZ=-1.05 (test run) SLCC … 10 10 −1.00 cell 9 (−1.05) ✅ cell 9 (−1.05)
PBZ=-0.45 (top of mesh, #89) SLCC … 56 56 −0.40 cell 55 (−0.45) ✅ cell 55 (−0.45)

When it goes wrong, the slice is masked with the obstruction layout of the neighbouring cell layer.

2. Cell-centred masks block one cell beyond the obstruction

get_obstruction_mask uses x1 : max(x2 + c, x1 + 1) with c = 1 for cell-centred masks. OBST bound indices are node indices, so the obstruction covers cells x1 … x2-1; the +1 adds the gas cell above/behind it on every axis.

Example: OBST XB=15.6,16.2,… (bound indices x = (31, 37)) blocks cell centres 15.65 … 16.25, i.e. 7 cells instead of 6. Same in a separate test run: OBST XB=0.3,0.7,… at 0.1 m blocks cell centres 0.35 … 0.75. Obstructions look one cell thicker with to_global(masked=True), as described in #89 ("Obstructions appear thicker than expected").

3. Node-based masks include the lower-face nodes but not the upper-face nodes

With c = 0 the mask covers nodes x1 … x2-1: for the same OBST, nodes 15.6 … 16.1 are masked, 16.2 is not (test run: XB=0.3,0.7 masks nodes 0.3 … 0.6, not 0.7). The masked outline is shifted towards the lower corner on each axis.

Suggested direction

Instead of rebuilding the plane from a float extent, keep the integer plane index from the slice header (SLCC … k k) on the SubSlice and use it directly (node k for node-based, cell k-1 for cell-centred). Convert OBST node bounds consistently: cells x1 … x2-1, nodes x1 … x2 (or decide explicitly whether face nodes count as obstructed). This removes the class of bugs that also caused #89 (empty mask at the top of a mesh below zero).

While at it: for 2D slices get_obstruction_mask_slice builds the (n_t, nx, ny, nz) mask of the whole mesh and keeps one plane (≈ 262 MB for one 67×70×56 mesh with 1000 timesteps). Building only the needed plane would avoid that.

Tests should place an obstruction and assert which plane/cells are masked, including an interior cell-centred slice. The current regression tests for #89 and #125 only check shapes and points strictly inside the obstruction.

Note: fixing this changes to_global(masked=True) results for existing users and should be mentioned in the release notes.

Ngôn ngữ chính
Python
Star
76
Fork
28
Merge trung bình
16 giờ 49 phút
Pull request đã merge (30 ngày)
28

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của FireDynamics/fdsreader

Tất cả issue của FireDynamics/fdsreader

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.