Skip to content

Commit 86b6bcf

Browse files
committed
Remove unnecessary str input for ForceOutput and StoppingCriterion
1 parent 209de73 commit 86b6bcf

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

flow360/component/simulation/outputs/outputs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ class ForceOutput(_OutputBase):
689689
description="List of force coefficients. Including CL, CD, CFx, CFy, CFz, CMx, CMy, CMz. "
690690
"For surface forces, their SkinFriction/Pressure is also supported, such as CLSkinFriction and CLPressure."
691691
)
692-
models: List[Union[ForceOutputModelType, str]] = pd.Field(
692+
models: List[ForceOutputModelType] = pd.Field(
693693
description="List of surface/volume models whose force contribution will be calculated.",
694694
)
695695
moving_statistic: Optional[MovingStatistic] = pd.Field(
@@ -740,7 +740,7 @@ def _check_duplicate_models(cls, value):
740740
"""Ensure no duplicate models are specified."""
741741
model_ids = []
742742
for model in value:
743-
model_id = model if isinstance(model, str) else model.private_attribute_id
743+
model_id = model.private_attribute_id
744744
if model_id not in model_ids:
745745
model_ids.append(model_id)
746746
continue

flow360/component/simulation/run_control/stopping_criterion.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ class StoppingCriterion(Flow360BaseModel):
6969
description="The field to be monitored. This field must be "
7070
"present in the `output_fields` of `monitor_output`."
7171
)
72-
monitor_output: Union[MonitorOutputType, str] = pd.Field(
73-
description="The output to be monitored."
74-
)
72+
monitor_output: MonitorOutputType = pd.Field(description="The output to be monitored.")
7573
tolerance: ValueOrExpression[Union[UnytQuantity, float]] = pd.Field(
7674
description="The tolerance threshold of this criterion."
7775
)
@@ -150,8 +148,6 @@ def _check_single_point_in_probe_output(cls, v):
150148
@classmethod
151149
def _check_field_exists_in_monitor_output(cls, v, info: pd.ValidationInfo):
152150
"""Ensure the monitor field exist in the monitor output."""
153-
if isinstance(v, str):
154-
return v
155151
monitor_field = info.data.get("monitor_field", None)
156152
if monitor_field not in v.output_fields.items:
157153
raise ValueError("The monitor field does not exist in the monitor output.")

0 commit comments

Comments
 (0)