Legendre Filter

Hello everyone.

I would like to evaluate the angular expansion coefficient for the flux in a 1D system.

For example:

order = 3
legendre_filter = openmc.LegendreFilter(order)

flux_g1 = openmc.Tally(name='Flux tally g1')
flux_g1.filters = [mesh_x_Regular, energy_filter_g1, legendre_filter]
flux_g1.scores=['flux']

tallying the flux on a regular mesh with an energy filter and the LegendreFilter of order 3, in the output results I can appreciate for each mesh cell x, the correspondent Legendre expansion (namely, P0, P1 etc…).

May I ask how are they calculated? The 1D Legendre expansion says that:

where the coefficient is the integral:

Are the P0,P1 etc data reported in the OpenMC’s output the blue-highlighted terms in the pictures?

Thanks
Lorenzo