@@ -671,12 +671,13 @@ class ForceOutput(_OutputBase):
671671 Example
672672 -------
673673
674- Define :class:`ForceOutput` to output total CL and CD on multiple wing surfaces.
674+ Define :class:`ForceOutput` to output total CL and CD on multiple wing surfaces and a BET disk .
675675
676676 >>> wall = fl.Wall(name = 'wing', surfaces=[volume_mesh['1'], volume_mesh["wing2"]])
677+ >>> bet_disk = fl.BETDisk(...)
677678 >>> fl.ForceOutput(
678- ... name="force_output_wings ",
679- ... models=[wall],
679+ ... name="force_output ",
680+ ... models=[wall, bet_disk ],
680681 ... output_fields=["CL", "CD"]
681682 ... )
682683
@@ -722,7 +723,7 @@ def preprocess_single_model(model, validation_info):
722723 or validation_info .physics_model_dict is None
723724 or validation_info .physics_model_dict .get (model ) is None
724725 ):
725- raise ValueError ("The model does not exist in the models list." )
726+ raise ValueError ("The model does not exist in simulation params' models list." )
726727 physics_model_dict = validation_info .physics_model_dict [model ]
727728 model = pd .TypeAdapter (ForceOutputModelType ).validate_python (physics_model_dict )
728729 return model
@@ -733,6 +734,19 @@ def preprocess_single_model(model, validation_info):
733734 processed_models .append (preprocess_single_model (model , validation_info ))
734735 return processed_models
735736
737+ @pd .field_validator ("models" , mode = "after" )
738+ @classmethod
739+ def _check_duplicate_models (cls , value ):
740+ """Ensure no duplicate models are specified."""
741+ model_ids = []
742+ for model in value :
743+ model_id = model if isinstance (model , str ) else model .private_attribute_id
744+ if model_id not in model_ids :
745+ model_ids .append (model_id )
746+ continue
747+ raise ValueError ("Duplicate models are not allowed in the same `ForceOutput`." )
748+ return value
749+
736750 @pd .field_validator ("models" , mode = "after" )
737751 @classmethod
738752 def _check_output_fields_with_volume_models_specified (cls , value , info : pd .ValidationInfo ):
0 commit comments