Skip to content

Conversation

@alexxu-flex
Copy link
Collaborator

@alexxu-flex alexxu-flex commented Nov 11, 2025

Python client support for analytic wind tunnel farfield (see https://github.com/flexcompute/compute/pull/2849)

  • Created classes for WindTunnelFarfield and floor types
  • Updated pipeline in __init__, meshing/params.py, translators, primitives.py, and validation/validation_simulation_params.py to support WindTunnelFarfield
  • Updated pipeline in entity_info.py, models/surface_models.py, outputs/outputs.py and primitives.py to support defining wind tunnel boundaries as WindTunnelGhostSurfaces, which must be handled differently from GhostSurfaces
  • Added tests: end to end case, parameter validation, translator (surface, volume, solver)
  • Added util: Range and PositiveRange properties in unit_system.py for shared checks

common_ghost_surfaces = [
GhostSurface(name="windTunnelInlet"),
GhostSurface(name="windTunnelOutlet"),
GhostSurface(name="windTunnelLeft"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might overlap with symmetric?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would it overlap?

"WindTunnelGhostSurface", frozen=True
)
# For frontend: list of floor types that use this boundary patch, or ["all"]
used_by: List[str] = pd.Field(default_factory=lambda: ["all"], frozen=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do list of literals to avoid typo etc?

if floor_string == "FullyMovingFloor":
return common_ghost_surfaces
if floor_string == "CentralBelt":
return common_ghost_surfaces + [WindTunnelGhostSurface(name="windTunnelCentralBelt")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we somehow unify the definition of these surfaces? Otherwise there will be inconsistency for example this line already differs from central_belt() property.

One proposal is to change this function to only return all the surfaces? Do we use it with floor_string not being "all" anywhere?

Then the property functions above would reference here the surface? For example:

    @property
    def rear_wheel_belts(self) -> WindTunnelGhostSurface:
        """Returns the rear wheel belts for WheelBelts floor type."""
        if not isinstance(self.floor_type, WheelBelts):
            raise Flow360ValueError(
                "Rear wheel belts for wind tunnel farfield "
                "is only supported if floor type is `WheelBelts`."
            )
        return self.get_valid_ghost_surfaces()[2 or some Enum]

Or implement what you think is the best.


@pd.model_validator(mode="after")
def _validate_wheel_belts_ranges(self):
# pylint says too many branches if it's combined with the above
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this line.

)
private_attribute_dict: Optional[Dict] = pd.Field(None)

entities: EntityListAllowingGhost[Surface, WindTunnelGhostSurface] = pd.Field(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to invoke EntityListAllowingGhost? Non of the additonal validators apply here.

Union[GhostSphere, GhostCircularPlane, WindTunnelGhostSurface],
pd.Field(discriminator="private_attribute_entity_type_name"),
]
],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma needed? If not remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants