Server-side subsample: extract at most N points from field_data and solution_variable_data (SVARs)

Aperta
#5,547 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Start by tracing SurfaceFieldDataRequest and fields.field_data, then inspect fields.solution_variable_data.get_data and their tests to understand how data is extracted and streamed. The issue proposes optional sampling for both paths, with a configurable size and possibly seed and method; define behavior that returns at most N points while preserving the current full-data default, then verify both extraction paths.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement new feature
❓ Problem statement

For large cases, clients often need only a random (or stratified) sample of N points for downstream work (e.g. ML inference), but today both APIs force a full-zone transfer, then the user must subsample in NumPy.

1. fields.field_data / SurfaceFieldDataRequest (e.g. SurfaceDataType.Vertices)
  • Every requested surface zone returns all vertices.
  • On cases with many wall zones (or very large walls), full extract can be slow, memory-heavy, or destabilize Fluent (e.g. cortex faults) even when only N points are needed afterward.
2. fields.solution_variable_data.get_data (SVARs, e.g. SV_CENTROID)
  • For huge fluid zones (O(1e8) cells), the payload is multi‑GB.
  • In practice the gRPC stream can fail or return incomplete/None-like data, so clients cannot even reach a post-hoc np.random.choice subsample.
Why current behavior is insufficient
  • Over-fetch: API always materializes the full array client-side.
  • No server-side N: there is no first-class n_max / sample_size / stride on these requests.
  • Fragile at scale: full SV_CENTROID for main fluid zones is often the blocker for production workflows that only need a representative sample.

We need the sample to be taken in Fluent (or on the nodes) before/during streaming, not after a successful full download.

To reproduce :

vol = solver.fields.solution_variable_data.get_data(
    variable_name="SV_CENTROID",
    zone_names=[z],
    domain_name=domain,
)[z]
pts = np.asarray(vol).reshape(-1, 3)  # fails or OOMs on huge zones
💡 Proposed solution

Add optional server-side sampling to both extract paths so the client can request at most N points (default: current behavior = all).

A. Field data (surfaces)

Extend SurfaceFieldDataRequest (and/or get_field_data) with something like:

SurfaceFieldDataRequest(
    surfaces=[...],
    data_types=[SurfaceDataType.Vertices],  # and ideally FaceCentroids later
    sample_size=1_000_000,   # or n_max=
    sample_seed=42,          # optional, for reproducibility
    sample_method="random",  # or "stride" / "uniform"
)
Lingua principale
Python
Stelle
550
Fork
86
Merge medio
2g 1h
PR unite (30g)
58

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ansys/pyfluent

Tutte le issue di ansys/pyfluent

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.