postgkyl.apply

postgkyl.apply(data, fn, *, num_quad=None, inplace=False, tag=None, label=None)

Apply fn pointwise via quadrature: modal -> quad -> fn -> modal.

The explicit spelling of nonlinear pointwise operations on DG data (e.g. d.apply(np.sqrt)): evaluate at Gkeyll’s basis quadrature nodes, apply fn to the values, and project back. The result stays modal and gkyl-native. Explicit num_quad selects a uniform Gauss rule with that many points per direction for de-aliasing.

Parameters:
  • data – Native modal dataset to transform.

  • fn – Python callable applied to the quadrature-point values.

  • num_quad – Optional Gauss points per direction; omitted uses Gkeyll’s rule.

  • inplace – Mutate and return data instead of creating a dataset.

  • tag – Optional tag for the returned dataset.

  • label – Optional label for the returned dataset.

Returns:

A modal dataset containing the projected pointwise result.

Raises:

ValueError – If data is not native modal data or lacks basis metadata.