Skip to content

Commit 1455d1a

Browse files
committed
Bump version, update readme/changelog, add tests
1 parent c8638ec commit 1455d1a

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# [1.7.1]
8+
### Changed
9+
- Bugfix: wrong grading propagation on inverted wires
10+
711
# [1.7.0]
812
### Added
913
- Automatic grading:

examples/bug.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import numpy as np
2+
3+
import classy_blocks as cb
4+
5+
box = cb.Box([0, 0, 0], [1, 1, 1])
6+
7+
base_face = box.bottom_face
8+
neighbour_face = base_face.copy().translate([4, 0, 0])
9+
common_face = base_face.copy().rotate(np.pi/2, [0, 1, 0]).translate([2, 0, 2])
10+
11+
left_loft = cb.Loft(base_face, common_face)
12+
right_loft = cb.Loft(neighbour_face, common_face.copy().shift(2).invert())
13+
14+
for axis in range(3):
15+
left_loft.chop(axis, start_size=0.05, total_expansion=5)
16+
17+
right_loft.chop(2, count=10)
18+
19+
mesh = cb.Mesh()
20+
mesh.add(left_loft)
21+
mesh.add(right_loft)
22+
23+
mesh.write("case/system/blockMeshDict", debug_path="debug.vtk")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "classy_blocks"
3-
version = "1.7.0"
3+
version = "1.7.1"
44
description = "Python classes for easier creation of openFoam's blockMesh dictionaries."
55
readme = "README.md"
66
license = { file = "LICENSE" }

tests/test_bugs/__init__.py

Whitespace-only changes.

tests/test_bugs/test_grading.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import unittest
2+
from typing import get_args
3+
4+
import numpy as np
5+
6+
import classy_blocks as cb
7+
from classy_blocks.cbtyping import DirectionType
8+
9+
10+
class GradingBugTests(unittest.TestCase):
11+
def test_invert_grading(self):
12+
# Bug case; two blocks with separate bottom faces share the same top face.
13+
# Grading in one direction must be inverted
14+
# /|\
15+
# / / \ \
16+
# / / \ \
17+
# / / \ \
18+
# /____/ ^ \____\
19+
# base common neighbour
20+
21+
box = cb.Box([0, 0, 0], [1, 1, 1])
22+
23+
base_face = box.bottom_face
24+
neighbour_face = base_face.copy().translate([4, 0, 0])
25+
common_face = base_face.copy().rotate(np.pi / 2, [0, 1, 0]).translate([2, 0, 2])
26+
27+
left_loft = cb.Loft(base_face, common_face)
28+
right_loft = cb.Loft(neighbour_face, common_face.copy().shift(2).invert())
29+
30+
for axis in get_args(DirectionType):
31+
left_loft.chop(axis, start_size=0.05, total_expansion=5)
32+
33+
right_loft.chop(2, count=10)
34+
35+
mesh = cb.Mesh()
36+
mesh.add(left_loft)
37+
mesh.add(right_loft)
38+
39+
mesh.assemble()
40+
mesh.block_list.assemble()
41+
42+
self.assertEqual(mesh.blocks[0].format_grading(), "simpleGrading ( 5 5 5 )")
43+
self.assertEqual(mesh.blocks[1].format_grading(), "simpleGrading ( 0.2 5 1 )")

0 commit comments

Comments
 (0)