Skip to content

Commit 633afeb

Browse files
fix(FXC-6541): keep default names for UI, write empty string in translator
- Remove Optional from SurfaceOutput.name and TimeAverageSurfaceOutput.name since they always have a string default - Translator writes empty string to solver JSON for default names so the C++ solver falls back to the standard "surface" prefix - Fix surface_output_class type annotations to use Type[] - Restore name="Surface output" in services.py default params - Re-sort service_init ref files for CI compatibility Made-with: Cursor
1 parent ab52ca2 commit 633afeb

11 files changed

Lines changed: 949 additions & 944 deletions

File tree

flow360/component/simulation/outputs/outputs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ class SurfaceOutput(_AnimationAndFileFormatSettings, _OutputBase):
469469
# pylint: disable=fixme
470470
# TODO: entities is None --> use all surfaces. This is not implemented yet.
471471

472-
name: Optional[FileNameString] = pd.Field(
473-
None,
472+
name: FileNameString = pd.Field(
473+
"Surface output",
474474
description="Name of the `SurfaceOutput`. Used as a suffix in output filenames to "
475475
"disambiguate when multiple outputs share the same surface entity. "
476476
"Must be unique across all instances that share the same surface.",
@@ -501,7 +501,7 @@ class SurfaceOutput(_AnimationAndFileFormatSettings, _OutputBase):
501501
@property
502502
def has_default_name(self) -> bool:
503503
"""Whether this output has no custom name assigned."""
504-
return self.name is None
504+
return self.name == type(self).model_fields["name"].default
505505

506506
@contextual_field_validator("entities", mode="after")
507507
@classmethod
@@ -545,8 +545,8 @@ class TimeAverageSurfaceOutput(SurfaceOutput):
545545
====
546546
"""
547547

548-
name: Optional[FileNameString] = pd.Field(
549-
None,
548+
name: FileNameString = pd.Field(
549+
"Time average surface output",
550550
description="Name of the `TimeAverageSurfaceOutput`. Used as a suffix in output filenames "
551551
"to disambiguate when multiple outputs share the same surface entity. "
552552
"Must be unique across all instances that share the same surface.",

flow360/component/simulation/services.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def get_default_params(
195195
reference_geometry = _get_default_reference_geometry(project_length_unit)
196196
operating_condition = AerospaceCondition(velocity_magnitude=dummy_value)
197197
surface_output = SurfaceOutput(
198+
name="Surface output",
198199
entities=[Surface(name="*")],
199200
output_fields=["Cp", "yPlus", "Cf", "CfVec"],
200201
)

flow360/component/simulation/translator/solver_translator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def _translate_single_surface_output(
597597
),
598598
)
599599
surface_output["writeSingleFile"] = output_instance.write_single_file
600-
surface_output["name"] = output_instance.name if output_instance.name is not None else ""
600+
surface_output["name"] = "" if output_instance.has_default_name else output_instance.name
601601
return surface_output
602602

603603

0 commit comments

Comments
 (0)