[FXC-5449] allow varying refinements on axisymmetric body faces#1882
[FXC-5449] allow varying refinements on axisymmetric body faces#1882alexxu-flex wants to merge 19 commits intomainfrom
Conversation
…ying-refinement-faces
…ying-refinement-faces
…ying-refinement-faces
| ... entities=[cylinder, box, axisymmetric_body, sphere], | ||
| ... spacing=1*fl.u.cm | ||
| ... spacing=1*fl.u.cm, | ||
| ... face_spacing={ |
There was a problem hiding this comment.
This is too nested and confusing. We need to redesign the interface.
There was a problem hiding this comment.
//User interface
face_spacing={
axisymmetric_body.segments[1] : 0.2*fl.u.cm
}
// Storage side
"face_spacing":{
("entioty_id":"$axisymmetric_body.private_attribute_id", "segment_index": 1) : {"value": 0.2, "units":"cm"}
}
There was a problem hiding this comment.
Then you need a Pydantic model for the "segment" class.
It will be similar relationship between Windtunnel farfield and the windtunnel ghost surfaces.
class Segment(BaseModel):
type_name:Literal["Segment"]
entity_id:str
segment_index: int =pd.Field(min=..., )…ying-refinement-faces
…ying-refinement-faces
|
|
||
|
|
||
| @final | ||
| class Face(pd.BaseModel): |
There was a problem hiding this comment.
Face will be reserved for geometry concepts. It is a reserved word.
| "profile_curve[i] and profile_curve[i+1]. Faces without overrides use the default `spacing`.", | ||
| ) | ||
|
|
||
| @pd.field_validator("face_spacing", mode="before") |
There was a problem hiding this comment.
Let's not use before validators unless really necessary.
Why don't we do this instead?
face_spacing: Optional[Dict[AxisSymmetricSegment, LengthType.Positive]] = pd.Field(And then we have:
class AxisSymmetricSegment(Flow360BaseModel):
entity_id: str
segment_index: pd.PositiveIntso the axisymmetric_body.face(2) returns an AxisSymmetricSegment instance?
Then we do not need this complicate and fragile before validator?
|
|
||
| return self | ||
|
|
||
| @pd.model_validator(mode="after") |
There was a problem hiding this comment.
make this a contextual validator. You can then retrieve the axisymmetric body instance by querying the entity registry.
Take a look at param_info.get_entity_registry() and registry.find_by_type_name_and_id()
…ying-refinement-faces
…ying-refinement-faces
…ute/Flow360 into alexxu/varying-refinement-faces
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Note
Medium Risk
Modifies meshing parameter schema/serialization and volume-meshing translation for
AxisymmetricBodyrefinements; mistakes could change generated mesh spacing or break backward/round-trip compatibility.Overview
Adds per-segment spacing overrides for
UniformRefinementonAxisymmetricBodyvia a newAxisymmetricSegmentkey type and optionalface_spacingmapping.Updates volume-meshing translation to emit dense
faceSpacingsarrays for axisymmetric bodies (derived from sparse overrides) while keeping other entity refinements unchanged, and adds contextual validation plus round-trip/translator tests for the new behavior.Generalizes
Flow360BaseModel.preprocessrecursion to handle nesteddictstructures (in addition to lists/models) for unit conversion and preprocessing.Written by Cursor Bugbot for commit 4b64c60. This will update automatically on new commits. Configure here.