Skip to content

Commit be082a9

Browse files
piotrklubabenflexcomputeclaude
authored
Renamed type_name to wall_function_type in WallFunction (#1899)
Co-authored-by: benflexcompute <ben@flexcompute.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1e4a444 commit be082a9

File tree

9 files changed

+57
-17
lines changed

9 files changed

+57
-17
lines changed

flow360/component/simulation/framework/updater.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,17 @@ def _rename_in_entity(entity):
778778
return params_as_dict
779779

780780

781+
def _to_25_9_3(params_as_dict):
782+
"""Rename ``type_name`` to ``wall_function_type`` in ``use_wall_function`` dicts."""
783+
for model in params_as_dict.get("models", []):
784+
if model.get("type") != "Wall":
785+
continue
786+
wall_fn = model.get("use_wall_function")
787+
if isinstance(wall_fn, dict) and "type_name" in wall_fn:
788+
wall_fn["wall_function_type"] = wall_fn.pop("type_name")
789+
return params_as_dict
790+
791+
781792
VERSION_MILESTONES = [
782793
(Flow360Version("24.11.1"), _to_24_11_1),
783794
(Flow360Version("24.11.7"), _to_24_11_7),
@@ -800,6 +811,7 @@ def _rename_in_entity(entity):
800811
(Flow360Version("25.9.0"), _to_25_9_0),
801812
(Flow360Version("25.9.1"), _to_25_9_1),
802813
(Flow360Version("25.9.2"), _to_25_9_2),
814+
(Flow360Version("25.9.3"), _to_25_9_3),
803815
] # A list of the Python API version tuple with their corresponding updaters.
804816

805817

flow360/component/simulation/models/surface_models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ class WallFunction(Flow360BaseModel):
341341
342342
>>> fl.Wall(
343343
... entities=volume_mesh["fluid/wall"],
344-
... use_wall_function=fl.WallFunction(type_name="InnerLayer"),
344+
... use_wall_function=fl.WallFunction(wall_function_type="InnerLayer"),
345345
... )
346346
347347
====
348348
"""
349349

350-
type_name: Literal["BoundaryLayer", "InnerLayer"] = pd.Field(
350+
wall_function_type: Literal["BoundaryLayer", "InnerLayer"] = pd.Field(
351351
"BoundaryLayer",
352352
description="Type of wall function model. "
353353
+ "'BoundaryLayer' uses integral flat plate boundary layer theory to predict wall shear stress. "
@@ -377,7 +377,7 @@ class Wall(BoundaryBase):
377377
378378
>>> fl.Wall(
379379
... entities=volume_mesh["8"],
380-
... use_wall_function=fl.WallFunction(type_name="InnerLayer"),
380+
... use_wall_function=fl.WallFunction(wall_function_type="InnerLayer"),
381381
... )
382382
383383
- :code:`Wall` with wall function and wall rotation:

flow360/component/simulation/translator/solver_translator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ def boundary_spec_translator(model: SurfaceModelTypes, op_acoustic_to_static_pre
15901590
if isinstance(model, Wall):
15911591
if model.use_wall_function is not None:
15921592
boundary["type"] = "WallFunction"
1593-
boundary["wallModelType"] = model.use_wall_function.type_name
1593+
boundary["wallModelType"] = model.use_wall_function.wall_function_type
15941594
else:
15951595
boundary["type"] = "NoSlipWall"
15961596
if model.velocity is not None:

flow360/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
version
33
"""
44

5-
__version__ = "25.9.2b1"
5+
__version__ = "25.9.3b1"
66
__solver_version__ = "release-25.8"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "flow360"
3-
version = "v25.9.2b1"
3+
version = "v25.9.3b1"
44
description = "Flow360 Python Client"
55
authors = ["Flexcompute <support@flexcompute.com>"]
66

tests/simulation/params/test_validators_params.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def test_wall_function_type_interface():
298298
# True is converted to WallFunction() with default BoundaryLayer and logs deprecation warning
299299
wall = Wall(surfaces=[surface], use_wall_function=True)
300300
assert wall.use_wall_function == WallFunction()
301-
assert wall.use_wall_function.type_name == "BoundaryLayer"
301+
assert wall.use_wall_function.wall_function_type == "BoundaryLayer"
302302

303303
# False is converted to None and logs deprecation warning
304304
wall = Wall(surfaces=[surface], use_wall_function=False)
@@ -308,26 +308,26 @@ def test_wall_function_type_interface():
308308
wall = Wall(surfaces=[surface])
309309
assert wall.use_wall_function is None
310310

311-
# WallFunction with default type_name
311+
# WallFunction with default wall_function_type
312312
wall = Wall(surfaces=[surface], use_wall_function=WallFunction())
313-
assert wall.use_wall_function.type_name == "BoundaryLayer"
313+
assert wall.use_wall_function.wall_function_type == "BoundaryLayer"
314314

315315
# WallFunction with InnerLayer
316-
wall = Wall(surfaces=[surface], use_wall_function=WallFunction(type_name="InnerLayer"))
317-
assert wall.use_wall_function.type_name == "InnerLayer"
316+
wall = Wall(surfaces=[surface], use_wall_function=WallFunction(wall_function_type="InnerLayer"))
317+
assert wall.use_wall_function.wall_function_type == "InnerLayer"
318318

319319
# SlaterPorousBleed conflict applies to all wall function types
320320
message = "Using `SlaterPorousBleed` with wall function is not supported currently."
321321
with SI_unit_system, pytest.raises(ValueError, match=re.escape(message)):
322322
Wall(
323323
velocity=SlaterPorousBleed(porosity=0.2, static_pressure=1e5 * u.Pa),
324324
surfaces=[surface],
325-
use_wall_function=WallFunction(type_name="InnerLayer"),
325+
use_wall_function=WallFunction(wall_function_type="InnerLayer"),
326326
)
327327

328-
# Invalid type_name should be rejected by pydantic
328+
# Invalid wall_function_type should be rejected by pydantic
329329
with pytest.raises(pd.ValidationError):
330-
Wall(surfaces=[surface], use_wall_function=WallFunction(type_name="InvalidType"))
330+
Wall(surfaces=[surface], use_wall_function=WallFunction(wall_function_type="InvalidType"))
331331

332332

333333
def test_low_mach_preconditioner_validator(

tests/simulation/test_updater.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,3 +2109,28 @@ def test_updater_to_25_9_2_custom_volume_boundaries_via_updater():
21092109

21102110
assert "boundaries" not in cv
21112111
assert "bounding_entities" in cv
2112+
2113+
2114+
def test_updater_to_25_9_3_rename_wall_function_type_name():
2115+
"""Test 25.9.3 updater renames type_name to wall_function_type in use_wall_function."""
2116+
2117+
params_as_dict = {
2118+
"version": "25.9.2",
2119+
"unit_system": {"name": "SI"},
2120+
"models": [
2121+
{"type": "Wall", "use_wall_function": {"type_name": "BoundaryLayer"}, "name": "w1"},
2122+
{"type": "Wall", "use_wall_function": {"type_name": "InnerLayer"}, "name": "w2"},
2123+
{"type": "Wall", "use_wall_function": None, "name": "w3"},
2124+
{"type": "Wall", "name": "w4"},
2125+
{"type": "Freestream"},
2126+
],
2127+
}
2128+
2129+
params_new = updater("25.9.2", "25.9.3", params_as_dict)
2130+
models = params_new["models"]
2131+
2132+
assert models[0]["use_wall_function"] == {"wall_function_type": "BoundaryLayer"}
2133+
assert models[1]["use_wall_function"] == {"wall_function_type": "InnerLayer"}
2134+
assert models[2]["use_wall_function"] is None
2135+
assert "use_wall_function" not in models[3]
2136+
assert models[4].get("type") == "Freestream"

tests/simulation/translator/test_solver_translator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,10 @@ def test_wall_model_type_translation():
665665
operating_condition=AerospaceCondition.from_mach(mach=0.84),
666666
models=[
667667
Fluid(),
668-
Wall(surfaces=[my_wall], use_wall_function=WallFunction(type_name="InnerLayer")),
668+
Wall(
669+
surfaces=[my_wall],
670+
use_wall_function=WallFunction(wall_function_type="InnerLayer"),
671+
),
669672
Freestream(entities=[my_freestream]),
670673
],
671674
time_stepping=Steady(CFL=RampCFL(initial=5, final=200, ramp_steps=40)),
@@ -681,7 +684,7 @@ def test_wall_model_type_translation():
681684
Fluid(),
682685
Wall(
683686
surfaces=[my_wall],
684-
use_wall_function=WallFunction(type_name="BoundaryLayer"),
687+
use_wall_function=WallFunction(wall_function_type="BoundaryLayer"),
685688
),
686689
Freestream(entities=[my_freestream]),
687690
],

tests/test_current_flow360_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
def test_version():
5-
assert __version__ == "25.9.2b1"
5+
assert __version__ == "25.9.3b1"

0 commit comments

Comments
 (0)