Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ def get_volume_meshing_json(input_params: SimulationParams, mesh_units):

if isinstance(zone, AutomatedFarfield):
translated["farfield"] = {
"planarFaceTolerance": meshing_params.defaults.planar_face_tolerance
"planarFaceTolerance": meshing_params.defaults.planar_face_tolerance,
"relativeSize": zone.relative_size,
}
if zone.method == "quasi-3d-periodic":
translated["farfield"]["type"] = "quasi-3d"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"faces": {},
"farfield": {
"planarFaceTolerance": 1e-06,
"relativeSize": 100.0,
"type": "quasi-3d"
},
"refinementFactor": 1.0,
"volume": {
"firstLayerThickness": 1e-03,
"gapTreatmentStrength": 0.0,
"growthRate": 1.25
}
}
23 changes: 23 additions & 0 deletions tests/simulation/translator/test_volume_meshing_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
MeshingParams,
)
from flow360.component.simulation.meshing_param.volume_params import (
AutomatedFarfield,
AxisymmetricRefinement,
CustomZones,
RotationVolume,
Expand Down Expand Up @@ -557,3 +558,25 @@ def test_surface_mesh_user_defined_farfield_disallow_any_ghost():
)
with pytest.raises(pd.ValidationError):
PassiveSpacing(entities=[GhostCircularPlane(name="symmetric")], type="projected")


def test_farfield_relative_size():
with SI_unit_system:
param = SimulationParams(
meshing=MeshingParams(
defaults=MeshingDefaults(
boundary_layer_first_layer_thickness=1e-3, boundary_layer_growth_rate=1.25
),
volume_zones=[AutomatedFarfield(method="quasi-3d", relative_size=100.0)],
)
)
translated = get_volume_meshing_json(param, u.m)
ref_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"ref",
"volume_meshing",
"ref_param_to_json_legacy_farfield_relative_size.json",
)
with open(ref_path, "r") as fh:
ref_dict = json.load(fh)
assert compare_values(translated, ref_dict)