Improved Approximation of Phase-Space Densities on Triangulated Domains Using Discrete Flow Mapping with p-Refinement

We consider the approximation of the phase-space flow of a dynamical system on a triangulated surface using an approach known as Discrete Flow Mapping. Such flows are of interest throughout statistical mechanics, but the focus here is on flows arising from ray tracing approximations of linear wave equations. An orthogonal polynomial basis approximation of the phase-space density is applied in both the position and direction coordinates, in contrast with previous studies where piecewise constant functions have typically been applied for the spatial approximation. In order to improve the tractability of an orthogonal polynomial approximation in both phase-space coordinates, we propose a careful strategy for computing the propagation operator. For the favourable case of a Legendre polynomial basis we show that the integrals in the definition of the propagation operator may be evaluated analytically with respect to position and via a spectrally convergent quadrature rule for the direction coordinate. A generally applicable spectral quadrature scheme for integration with respect to both coordinates is also detailed for completeness. Finally, we provide numerical results that motivate the use of p-refinement in the orthogonal polynomial basis.


Introduction
The long-time evolution of dynamical systems is often studied by modelling the propagation of a density distribution ρ in phase-space [16], in particular when the dynamics are ergodic.Conservation of energy (or probability) leads to a phase-space continuity equation known as the generalized Liouville equation where V is the vector field defining the underlying dynamical system thus The solutions of this dynamical system X (τ ) = φ τ (X (0)) are trajectories in phase-space, where φ τ is the associated flow map.Such models lie at the heart of statistical mechanics and have a wide range of applications including particle tracking in fluids [5,36], interface tracking in atmospheric sciences [35], the simulation of molecular dynamics [31] as well as illumination or rendering problems in computer graphics [21] or, more generally, the geometrical optics/geometrical acoustics limit of linear wave equations [37].
The method of characteristics leads to an expression for the solution of the generalised Liouville equation in terms of the flow map φ τ .A density ρ is transported along trajectories given by φ τ under the action of a linear transfer operator L τ known as the Frobenius-Perron operator [12] ρ(X, τ ) A number of transfer operator based methods have been developed for computing phasespace densities in practical applications.Domain based transfer operator approaches, for example, start by subdividing the phase-space into distinct cells and considering transition rates between these phase-space regions.One of the most common approaches of this type is Ulam's method [26,41].Other methods include wavelet and spectral methods for the infinitesimal Frobenius-Perron operator [15,20], eigenfunction expansion methods [4] and periodic orbit techniques [12,27].For a discussion of convergence properties of the Ulam method see [1,2].However, such methods have only found a fairly limited range of applicability, with difficulties arising due to the high-dimensionality of the phase-space.
In this work we consider the case where V describes a Hamiltonian system, and hence the divergence operator in the generalised Liouville equation (1) reduces to the Poisson bracket as ∇ • (Vρ) = {ρ, H }, where H is the associated Hamiltonian.This class of problems is particularly interesting since it includes, as an important case, short wavelength asymptotic approximations for solving linear wave equations in terms of their underlying ray dynamics.Note that for homogeneous domains with a constant wave speed, and thus a constant and conserved phase-space volume, then the right side of Eq. (3) evaluates to ρ(φ −τ (X ), 0).In this context, direct "deterministic" methods based on directly tracking swarms of trajectories in phase-space have proved very popular.Such methods are often collectively referred to as ray tracing, see for example [6].Methods related to ray tracing but tracking the timedynamics of interfaces in phase-space, such as moment methods and level set methods, have been developed in [14,28,32,43,44] amongst others.Direct physics-preserving finite difference discretisations of the Liouville equation have also been proposed in Refs.[19,42].These methods are best suited to problems with relatively low reflection orders (or problems in one space dimension) and have found applications in acoustics, seismology and optical illumination problems.
Direct ray and interface tracking methods are, however, unsuitable for the modelling of long time dynamics in bounded domains Ω ⊂ R 2 .Here, the dynamics (regular or chaotic) depend heavily on the geometry of the boundary of Ω; multiple reflections of the rays often lead to complicated folding patterns of the associated level-surfaces and an exponential increase in the number of branches that need to be considered.In this regime, the modelling becomes more tractable if one considers the long time stationary solutions to the Liouville equation given by {ρ, H } = 0.
In particular, simplified statistical models emerge under additional ergodicity and mixing assumptions on the ray dynamics.A popular tool in the context of vibro-acoustic modelling is Statistical Energy Analysis (SEA) (see for example [29,30]).A related method for electromagnetic waves is the random coupling model (see [17] and references therein).In SEA, a built-up structure is divided into a set of subsystems and ergodicity of the underlying ray dynamics as well as quasi-equilibrium conditions are imposed.The result is a model where the density in each subsystem is a single degree of freedom, leading to greatly simplified equations based only on flow rates (or coupling loss factors) between subsystems.
The assumptions necessary for an SEA treatment are often hard to verify a priori, or are only justified when averaging over an ensemble of similar structures; for example, structures originating from the same production line that are "identical" up to manufacturing tolerances.The limits of SEA have been discussed by Langley and Le Bot amongst others [3,[23][24][25]38].
In order to extend the statistical approaches described above, we consider numerical schemes for solving the stationary Liouville equation ( 4) without further assumptions on the nature of the trajectory dynamics.The so-called Dynamical Energy Analysis (DEA) introduced in [37] is based on numerically solving a reformulation of the integral equation (3).In this reformulation, the time-dependent flow map φ τ is replaced with a boundary map φ that transports trajectories between intersections with the boundary of a finite sub-structure Ω j ⊂ Ω, j = 1, . . ., N .Here N can be considered as the number of sub-systems so that which mirrors an SEA treatment of the problem.Replacing φ τ with φ simplifies the Frobenius Perron operator (3) to a boundary integral operator, with the resulting advantage of a reduction in the dimensionality.The explicit time-dependence of the density is lost, but the long time stationary behaviour can be recovered by summing over infinitely many iterates of the boundary operator.A trigonometric polynomial basis approximation of the density ρ on the boundary phase-space of each Ω j projects ρ onto finite dimensional space, which corresponds to an SEA model at zeroth order.At higher order the approximation incorporates the geometry dependent ray dynamics, relaxing the underlying ergodicity and quasi-equilibrium assumptions of SEA.
A number of approaches have been suggested in order to obtain efficient discretizations of the boundary operator in DEA.A boundary element method for the stationary Liouville equation (4) was proposed in [9,10], which extended the DEA approach to larger multicomponent structures and three-dimensional applications.It is worth emphasizing here that since the density ρ lives in phase-space, it also needs to be discretized in the direction (or momentum) coordinate.A global orthogonal polynomial basis approximation has typically been used for this purpose.One advantage of a full phase-space formulation such as DEA is that problems due to caustics where ray trajectories focus on a single point in position space are avoided.In phase-space the rays do not intersect since their momentum coordinates are distinct, and it is only after projecting down onto position space that the caustics become apparent; for an example of a DEA simulation including caustics see [11].Hence caustics do not affect the convergence of the boundary integral model itself, only the post-processing step to compute the density distribution within the solution domain.
A major advantage of DEA is that the choice of subsystem division is no longer critical, since the SEA assumptions related to this criticality have been removed.In fact, one can use the elements of a mesh as substructures in DEA providing huge flexibility and a wealth of potential applications.Applying DEA on the same meshes used for finite element models in industrial applications means that the end-user can access mid-to-high frequencies without the need for extensive remodelling, as would be required for SEA.In Ref. [11] it was shown that local, piecewise constant spatial approximations of the density on the edges of a triangulated surface could be efficiently computed using semi-analytic techniques, which exploit the local geometric simplicity.In this so-called Discrete Flow Mapping (DFM) approach, the trajectory flow is approximated by a discretized flow across a mesh.The technique has since been extended to general convex polygonal mesh elements and to industrial scale applications [8].
Whilst DFM employs orthogonal polynomial approximations of the density in the direction coordinate, the spatial approximation has thus far been limited to piecewise-constant local approximations on the edges of the mesh elements, or subdivisions of those edges, in order to compute the boundary operator using fast semi-analytic methods.This can lead to poor accuracy, particularly in problems with high dissipation where the solutions are dominated by the initial density.In this work, we discuss a p-refinement strategy in both position and direction to gain an improved approximation of the phase-space density on a prescribed mesh.To facilitate the efficient implementation of such a strategy we have derived semi-analytic integration formulae for the projection of the boundary integral operator onto a higher order orthogonal polynomial basis.Here, the integration with respect to the spatial coordinate is performed analytically and the integration with respect to the direction coordinate is done numerically.In fact, a carefully designed strategy for computing the arising multi-dimensional integrals is crucial for the efficient implementation of the method on large meshes.We show in this paper that a direct approach to the analytic spatial integration using the repeated application of the integration by parts rule leads to highly unstable results.However, an indirect approach using the recurrence relations of the Legendre polynomials can be shown to give a stable representation for the integral in terms of modified Bessel functions.Furthermore, an efficient computation of the integrals, independently of the choice of orthogonal polynomial basis functions, is possible using a 2D adaptive and spectrally convergent quadrature method.In this case one can exploit the smoothness of the integrands in the boundary operator over appropriately defined subsets.
The remainder of the paper is structured as follows: in Sect. 2 we detail the boundary version of the Frobenius-Perron operator (3) as a model for propagating an initial phasespace density to give a solution to the stationary Liouville equation (4).In Sect. 3 we describe the finite dimensional approximation of the phase-space density in both the position and direction coordinates.The computational procedure for obtaining the discretized boundary integral operator is described, including three approaches for computing the spatial integrals: an unstable direct formula, a stable recursion formula and a spectral quadrature method.Finally, in Sect. 4 we give a selection of numerical results; we reproduce the well-known decay rate for propagation into free space and perform computations on several bounded domain configurations with varying degrees of symmetry and complexity.
Fig. 1 Left the boundary map φ(s, p s ) and the phase-space coordinates (s, p s ) on the boundary Γ .Right the multi-domain boundary map φ i, j (s j , p j ) taking the phase-space coordinates (s j , p j ) on the boundary ∂Ω j to the phase-space coordinates (s i , p i ) on ∂Ω i

Propagating Phase-Space Densities via Integral Operators
In this section we describe the propagation of a phase-space density via integral operators in polygonal multi-domain problems, for example, triangle meshes.We begin by introducing a boundary map φ and a boundary integral operator B. We then discuss how an initial boundary density can be obtained from a point source and how the final stationary density can be computed from the Neumann series for the operator B.

Boundary Integral Operators
Consider a polygonal domain Ω ⊂ R 2 with boundary Γ and the phase-space coordinates Y s = (s, p s ) on Γ as illustrated in the left plot of Fig. 1.Here s parametrizes Γ and p s denotes the direction component tangential to Γ at s. Figure 1 also depicts the boundary map φ(s, p s ) = (s , p s ), which takes (s, p s ) to a point s ∈ Γ with direction p s .We may write this simply as X s = φ(Y s ).In general, the form of the boundary map φ depends on the specific problem.In our considerations, φ obeys the law of (specular) reflection.
A phase-space density ρ is transported from the phase-space on the boundary to the next boundary intersection via the boundary integral operator [11] B Note that for w ≡ 1, this operator corresponds to the Perron-Frobenius operator (3) for the boundary map φ.The weighting term w is introduced to incorporate absorption factors as well as reflection/transmission coefficients.
In this paper we are concerned with modelling the Hamiltonian ray dynamics of position r and momentum (slowness vector) p.The Hamiltonian of the trajectory equations is H = c|p| = 1, where c is the phase velocity.Conservation of energy defines the integration limits for p s ∈ (−c −1 , c −1 ), since p s is the tangential component of the direction p.Thus the (double) integral in ( 5) is over Γ × (−c −1 , c −1 ).We note that this corresponds to the Hamiltonian for the ray trajectories obtained in the geometrical optics limit for the reduced wave (or Helmholtz) Eq. [14] u + k 2 u = 0, (6) with k = ω/c the acoustic wavenumber at angular frequency ω.
The stationary density on the boundary Γ induced by a given initial boundary density ρ Γ 0 can be obtained from a Neumann series via where B n models trajectories undergoing n reflections at the boundary and I is the identity operator.Once the stationary density ρ Γ is found, the interior density ρ Ω can then be obtained by projecting down onto position space in Ω using [9] ρ Ω (r Here r ∈ Ω is a prescribed solution point and r s denotes the Cartesian coordinates of the point s ∈ Γ .The angle ϑ(s, r) is formed between the normal vector to Γ at s and the direction vector pointing towards the point r from the point s ∈ Γ .

Source Terms
In this section we describe how to obtain an initial density ρ Γ 0 from a point source at r 0 ∈ Ω emanating trajectories continuously in all directions.Starting from the high frequency asymptotics for the fundamental solution of the reduced wave Eq. ( 6) in R 2 , ρ Γ 0 is derived from the acoustic energy density where u is interpreted as the velocity potential in a fluid medium of density ρ f .We then obtain a phase-space source density ρ 0 by lifting ε to phase-space with a direction vector p 0 , corresponding to the direction coming from r 0 .Applying this and replacing u in (9) with the high frequency fundamental solution of (6) yields [9] where H 1 0 is the zeroth order Hankel function of the first kind.In the high frequency limit, the energy density (10) decays in all directions according to |r − r 0 | −1 .Considering (10) in the high frequency limit, it can be shown [9] that the initial boundary density distribution from the source point r 0 is where p s 0 denotes the component of p 0 tangential to Γ .The resulting boundary density (11) is equivalent to the source density on the boundary producing the same interior density as the original source distribution (10).

Multi-domain Problems
A generalization to multi-domain problems such as triangle meshes with sub-domains Ω j , j = 1, . . ., N , is straightforward by introducing a multi-domain boundary map φ i, j and a weight function w i, j describing the flow from the boundary of the domain Ω j to the boundary of the domain Ω i , see the right plot of Fig. 1.Note that Ω = ∪ N j=1 Ω j becomes the union of all sub-domains and Γ becomes the union of all sub-domain boundaries thus Γ = ∪ N j=1 ∂Ω j .Each sub-domain Ω j has its own phase-space boundary coordinates (s j , p j ).We then define the boundary integral operator B i, j , which transports the phase-space density ρ Γ from the boundary phase-space of Ω j to the boundary phase-space of Ω i as illustrated in the right plot of Fig. 1.If the properties of two neighboring domains Ω j and Ω i are different, for example if c i = c j , where c i is the propagation speed in Ω i (likewise for c j in Ω j ), then the weight function w i, j will account for the probability of transmission or reflection at the common edge.Note that the case of transporting the density within a sub-domain is included in this formulation when i = j.The operator B is then constructed from the set of inter-domain operators B i, j .In order to obtain a discrete representation of the phase-space density ρ Γ and the operator B i, j , we consider a finite basis approximation as described in the next section.

Discretization
In this section we discuss the discretization of the boundary operator as well as computational issues associated with the efficient and fast implementation of DFM on triangle meshes.We detail how the two-dimensional integral in space and direction can be separated and provide analytical formulae for the spatial integral.We note that a direct approach to evaluating the spatial integral analytically is unstable in general for non-constant spatial basis functions.An alternative stable iterative approach is presented instead and compared with an efficient, and widely applicable, spectrally convergent quadrature strategy.We conclude this section by outlining a computational algorithm for DFM with p-refinement on triangle meshes.
The finite dimensional representation of ρ Γ is given by a basis approximation of the form where N j is the number of the boundary elements for Ω j , N s is the order of the basis expansion in space and N p is the order of the basis expansion in direction.Note that the values of N s and N p may vary depending on the sub-domain Ω j .However, for simplicity in the sequel we only consider triangle meshes with one boundary element per edge (N j ≡ 3 for all j) and we take constant values for N s and N p .Refinement of the spatial approximation can therefore take place via both increasing N s and refining the triangle mesh.The summand in (12) comprises a product of the unknown expansion coefficients ρ ( j,l,m,n) , the basis functions Pl m in the spatial coordinate and the basis functions Pn in the direction coordinate.We assume that both sets of basis functions (space and direction) are orthonormal, and that Pl m is smooth within the lth boundary element and Pn is smooth on (−c −1 , c −1 ).
In this work we concentrate on the case when Pl m is given by a scaled Legendre polynomial of the form where t ∈ [−1, 1) is a parametrization of the lth boundary element of Ω j , with length A l, j , defined here as a function of s j ∈ [ κ<l A κ, j , A l, j + κ<l A κ, j ).Also, P m denotes the Legendre polynomial of degree m and χ l (s j ) is an indicator function taking the value 1 when s j is in the lth element of Ω j , and zero otherwise.We likewise focus on the case when Pn is given by the scaled Legendre polynomial: Note that the Legendre polynomials represent a particularly convenient choice due to their simple orthogonality relation, their spectral convergence for sufficiently smooth approximants and their ease of calculation using a recurrence relation.Later we shall see that this choice also permits highly efficient semi-analytic integration routine.However, we will also describe a fully numerical and spectrally convergent quadrature algorithm for any smooth orthonormal basis choice in order to demonstrate the broader scope and applicability of the proposed methodology.
A Galerkin projection of the operator B i, j on to the orthonormal basis in the expansion (12) leads to a matrix representation B with entries given by where I and J denote the multi-indices I = (i, l , m , n ) and J = ( j, l, m, n), respectively.The factor α m ,n is a scaling required for orthonormality; for a Legendre polynomial basis then α m ,n = (2m + 1)(2n + 1)/4.We have introduced the notation , and φ = (φ s , φ p ) has been used to separate the boundary map into spatial and directional components.Since the expansion (12) represents a local density approximation and the transfer of energy is only between connected subdomains, B is a block-sparse matrix for large N .The coefficients of the expansion ( 12) can be found by solving the linear system ρ = (I − B) −1 ρ 0 , which corresponds to the discretized form of Eq. (7).Here ρ 0 and ρ represent the coefficients of the expansions of ρ Γ 0 and ρ Γ , respectively, when projected onto the finite dimensional basis.Note that for I − B to be invertible, absorption/dissipation must be included in the weights w i, j .Once ρ has been computed and substituted into (12), then the interior density ρ Ω can be computed using (8).

DFM with p-Refinement on Triangle Meshes
We now describe a strategy for computing the entries of the transfer matrix B, given in (14), on the elements of a triangle mesh.Note that the integration over the direction coordinate p j can instead be performed with respect to the angle θ j between the normal vector to Γ at s j and the outgoing trajectory direction using the relation p j = c −1 j sin(θ j ).We will assume that the weight function w i, j can be written in the form where the factor μ describes the rate of dissipation along the direction of propagation.Here we write φ s (Y j ) = s i for brevity and d(s i , s j ) is the Euclidean distance between the points represented by s i and s j .The function λ i, j gives the reflection/transmission probability, which may be derived from the underlying wave equation by assuming continuity of the pressure and velocity for an incident plane wave [13].Writing the specific acoustic impedance in Ω i as z i = ρ f i c i , the product of the fluid density and the propagation speed inside Ω i , then one obtains the transmission probability Fig. 2 Left the evolution of trajectories through a triangulated mesh, including reflection and transmission angles θ r and θ t , respectively.Right admissible ranges for the spatial integration defined using s * j The reflection/transmission probability function is then defined as λ i, j (θ j ) = λ t (θ j ) for i = j, and λ j, j (θ j ) = 1 − λ t (θ j ).Note that in (15) above, θ r and θ t are the θ j -dependent reflection and transmission angles, respectively; see the left plot of Fig. 2.
In what follows we denote s j as the coordinate on the initial edge, we label quantities associated with the edge connected to the initial edge in the counter-clockwise direction by '+' and we label quantities associated to the third edge by '−'.We find where ϕ ± are the interior angles of Ω j between the edge containing s j and the two possible destination edges, as shown in the left plot of Fig. 2. The transmission angles θ ± t are obtained from the reflection angles θ ± r using Snell's law where the minus sign comes from the fact that θ ± t ∈ (−π/2, π/2) is defined in the local coordinates of the neighboring triangle Ω i .
For c i > c j , the transmission angle θ ± t in Snell's law ( 16) is only defined for θ j in the interior of the set Θ where Total internal reflection (λ t = 0) takes place for θ j / ∈ Θ, and this should be taken into account when integrating λ t over θ j .The convergence of numerical quadrature rules can be adversely affected by the branch points of arcsin at ±1 in the Snell's law expression for θ t (16) when Θ c := [−π/2, π/2] \ Θ is non-empty.Furthermore, separating the integral with respect to θ j into a sum of integrals over Θ and Θ c is necessary, but not sufficient to address this issue.For integration over Θ c we may simply set λ t = 0, but since the branch points are located at the boundary between Θ and Θ c , problems still arise for the integration over Θ.Note that from (16) we obtain and hence the branch points in formula ( 15) are located at zeros of the square root in (17).
A change of variables from θ j to the transmission angle θ ± t can be employed to avoid these branch points.Explicitly, we use that Thus where the term under the square root in the denominator of λ(θ ± t ) is strictly positive for any value of θ ± t since c i > c j .The integration limits for the new integration variable θ ± t can then be found by considering the minimal and maximal θ j ∈ Θ.
We now consider the integration with respect to position s j , which will be performed before integrating over θ j and hence we integrate over a direction dependent domain of the form (s min (θ j ), s max (θ j )).Consider edge number l ∈ {1, 2, 3} of the triangle Ω j with length A l, j , represented by the edge AB in the right plot of Fig. 2. Then s j ∈ [ κ<l A κ, j , A l, j + κ<l A κ, j ) := [s A , s B ) on that edge and the admissible ranges for the spatial integration are given by for trajectories transported to the − edge, and for trajectories transported to the + edge.We define the position s * j (θ j ) to be the starting point of the trajectory on the lth edge, which is mapped to the vertex of Ω j opposite to the edge l (shown as vertex C in Fig. 2).We also enforce that min The behaviour of s * j as a function of θ j will be important when considering the integral over θ j .In particular, note that for θ j −(π/2) + ϕ + then s * j = s B and trajectories only map to the − edge.Likewise, for θ j (π/2) − ϕ − , then s * j = s A and trajectories only map to the + edge.For the intermediate case, −(π/2) + ϕ + < θ j < (π/2) − ϕ − , then s * j is a linear function of θ j and takes values along the interior of the edge l.Owing to these abrupt changes from constant to linear behavior, s * j (θ j ) is not smooth at the points θ j = −(π/2) + ϕ + and θ j = (π/2) − ϕ − .This leads to a natural subdivision of the range of integration for θ j given by and a corresponding splitting for the numerical integration over θ j .Note that the integral over either the first or last of these sub-intervals (20) will always be equal to zero, depending on whether the propagation is to the + or − edge, respectively, since the corresponding spatial integration will have equal lower and upper limits.Note that these subdivisions are always applied, in contrast with the subdivisions at points of total internal reflection discussed before, which are only applied when c i > c j .In summary, the entries of the matrix B (14) can be rewritten in the form: where p i = c −1 i sin(θ i ) and θ i = θ r if i = j, or θ i = θ t otherwise.The distance d(s i , s j ) and the value of s i both depend on whether the ray hits the previous or the next neighboring edge (oriented counter-clockwise) independently whether i = j or not.In fact, in any convex polygonal sub-domain Ω j , one can show via geometrical arguments that both d(s i , s j ) and s i are linear functions of s j .After all subdivisions we re-scale each of the sub-integrals over θ j and s j , required for computing (21), and write them in the following general form In principle, we could now compute I using any quadrature method, and since care has been taken to preserve smoothness of the integrand, then a spectrally convergent method would be preferable.The efficiency of computing I in ( 22) can be further increased if I m,m (θ ) can be evaluated analytically as suggested for the case of piecewise constant spatial basis functions in [11].We discuss this in the following section for the case when the spatial basis functions are chosen as scaled Legendre polynomials.

Exact Spatial Integration
In this section we present two formulae that can be used to evaluate the spatial integral I m,m (θ ) in ( 22) exactly when Pl m (s j ) are given by scaled Legendre polynomials and we have prescribed a fixed value of θ .Hence a(θ ) and b(θ ) may be considered as constants and g m,m (s, θ) is a product of Legendre polynomials of the form g m,m (s, θ) = P m (a 1 s + b 1 )P m (a 2 s + b 2 ).Henceforth, we omit θ from the notation when referring to these quantities, writing them as a, b and g(s).The integral I m,m (θ ) may be computed directly using integration by parts as where the superscript (i) denotes the ith derivative.Note that the spatial derivatives of the Legendre polynomials can be evaluated via a recursive relationship, and that for m = m = 0, the integral has the relatively simple form I 0,0 (θ ) = (e as+b /a)| 1 −1 as used in [11].Unfortunately, the formula ( 23) is numerically unstable for general m and m (see Fig. 3), since the coefficients in the expansion grow with each derivative.Thus the total sum is highly sensitive to round-off errors.In addition, the coefficients a, b, a 1 , b 1 , a 2 and b 2 are geometry and dissipation rate dependent meaning that ( 23) may be stable in some mesh elements, but unstable in others.
An alternative approach is to derive a recursive formula using the properties of g(s) = P m (a 1 s + b 1 )P m (a 2 s + b 2 ).In particular, one can show for each fixed value of θ that either Applying this relation together with the definition of ŝ in the right-hand expression for I m,m above yields Applying the Legendre polynomial recurrence relationship once more to s P m (s), we obtain a recurrence relationship for I m,m (θ ) with m, m = 0, 1, 2, . . .as The above recurrence formula may be initiated using the following integral relation: which can be derived from ( [18], Eq. 7.243-5) and where I m+1/2 is the modified Bessel function of the first kind.The computational implementation in the present work has been performed in MATLAB, where we make use of the existing functions for computing the modified Bessel functions.Alternatively, the values of I m,0 can be computed using the recursion relation for the Legendre polynomial derivatives.Unfortunately, the resulting recursion relation for I m,0 is unstable in the forward direction.However, it may be performed in the backward direction using continued fractions as detailed in Sect.6.6.2 of Ref. [34].We illustrate the numerical instability of the direct formula ( 23) by computing I m,m (θ ) for θ ∈ (−1, 1) on a unit sided equilateral triangle with a specified initial edge (due to symmetry the result will be independent of this choice).In Fig. 3, the direct formula ( 23) is compared against the recursive solution (25) and a numerical solution using Clenshaw-Curtis quadrature [39] for different combinations of the polynomial degrees m and m .In both examples we set the dissipation rate to be μ = 0.005 and the propagation speed as c = 1.
The left plot of Fig. 3 shows the case m = 2 and m = 0, where all three approaches compute the same values for the integral to double precision.The numerical integration was performed using three integration subregions θ j ∈ (−π/2, −π/6] ∪ (−π/6, π/6) ∪ [π/6, π/2) as described in (20) since ϕ ± = π/3.The lack of smoothness of the integral I m,m (θ ) at the numerical integration subdivision points θ = 2θ j /π = ±1/3 is also clear in Fig. 3, emphasizing the motivation for performing this subdivision.The right plot of Fig. 3 shows the case when m = m = 2, which gives rise to large deviations between the direct formula and other two methods.Note that, in general, the discrepancy increases when the degree of the basis functions is increased and/or the dissipation factor μ is decreased.The right plot of Fig. 3 shows that the direct formula ( 23) is already numerically unstable for relatively low degree basis functions.For the MATLAB implementation here, we find that using the recursive formula (25) is typically between two and three times faster than applying the spectral quadrature method.In order to demonstrate the flexibility of the method in accommodating general smooth orthonormal basis approximations in (12), we propose an efficient adaptive quadrature strategy in the following section.

Efficient Adaptive Quadrature Rule
In this section we describe the spectrally converging adaptive quadrature strategy that we use to compute the integral entries of the matrix B (21) for general smooth orthonormal basis functions Pl m (s j ) and Pn ( p j ).Note that whenever possible, it is preferable to adopt analytic spatial integration strategies for reasons of computational efficiency.However, in order to demonstrate the wider applicability of the proposed methodology, and for completeness, we detail a rapidly converging fully numerical strategy.We propose an adaptive Clenshaw-Curtis method [39,40] and note that spectral convergence property depends crucially on the regularity of the integrand.Preservation of the rapid convergence property is the main motivation for the integral subdivision strategy discussed in Sect.3.1.
The subdivision of the integral with respect to θ j ensures that integrands are smooth, or even analytic, in a large region of the complex plane.This leads to spectral convergence with a low number of quadrature points in both dimensions, which means that pre-computing and storing the Clenshaw-Curtis quadrature nodes and weights is feasible.In addition, Clenshaw-Curtis quadrature is progressive since the set of nodes for a (2M + 1)-point quadrature rule includes all the nodes of an (M + 1)-point rule allowing the repeated use of previously computed data.The result from a (2M + 1)-point rule is compared with the result from an (M + 1)-point rule and the code terminates when a desirable tolerance level is achieved.The complete algorithm for the computation of a single entry of the matrix B (21) with fixed I = (i, l , m , n ) and J = ( j, l, m, n) is as follows.
1. Let α = 0 and fix M 0 + 1 as an initial number of scaled Clenshaw-Curtis quadrature nodes.Define a prescribed tolerance level tol for the accuracy of any quadrature rules.2. Calculate the M α + 1 values of θ j prescribed by the Clenshaw-Curtis quadrature nodes, then perform the following operations for each value of θ j : -compute the reflection/transmission angle θ i as described in the text immediately after Eq. ( 21); -compute the basis functions Pn ( p j ) and Pn ( p i ).For a Legendre polynomial basis this can be done using Eq. ( 13) and the recurrence (24); -compute the probability function λ i, j (θ j ) as described in the text immediately after Eq. ( 15); -find the admissible ranges (s min (θ j ), s max (θ j )) for the integration with respect to s j using Eqs.( 18) and ( 19).
3. If Pl m (s j ) are scaled Legendre polynomials, then compute the spatial integral analytically as described in Sect.3.2.Otherwise: (a) Let β = 0 and fix m 0 + 1 as an initial number of scaled Clenshaw-Curtis quadrature nodes.(b) Calculate the m β + 1 values of s j prescribed by the Clenshaw-Curtis quadrature nodes, then perform the following operations for each value of s j : -compute the point s i and the distance d(s i , s j ) using the geometry of the mesh and the vector prescribed by (s j , p j ).On a triangle mesh one can directly compute d as a linear function of s j using the sine rule; -compute the orthogonal polynomial basis functions Pl m (s j ) and Pl m (s i ).The computation will depend on the chosen basis.(c) Compute the integral over s j appearing in Eq. ( 21) using m β quadrature nodes.If the tolerance tol has not been reached, then add one to β, let m β = 2 β m 0 and return to step (b).If tol has been reached then proceed to step 4.

4.
Compute the integral over θ j appearing in Eq. ( 21) using M α quadrature nodes.If the tolerance tol has not been reached, then add one to α, let M α = 2 α M 0 and return to step 2. If tol has been reached then use the computed value as an entry of the matrix B.
Note that for a Legendre polynomial basis, the best strategy is to pre-compute the basis functions up to the maximum order considered whenever possible due to the use of a recurrence formula.The relevant steps in the algorithm above would then be replaced by a call to the pre-computed values whenever these are available.The spectral convergence of the proposed quadrature scheme is demonstrated in "Appendix".We apply the above steps with tol= 10 −12 to obtain the numerical results in the next section.

Numerical Results
In this section we primarily study numerical examples which demonstrate the improvement in the phase-space density approximation due to p-refinement in space, since this is the new contribution of this work.We have studied the effects of mesh refinement and higher order approximations in the direction basis in our initial work on DFM [11].We first study the convergence of DFM for a free space propagation problem, which motivates the use of higher order basis approximations in space.We then consider the problem of computing the energy density in the vicinity of a point source for a dissipative system, including the effect of higher order spatial approximations and local mesh refinement.A closed cavity with a point source at different locations is then considered, and as a final example we model a coupled twocavity system with piecewise constant propagation speeds.All meshes shown in the results that follow were generated using the DistMesh mesh generator for MATLAB [33].

Free Space Propagation
The ray tracing approximation of the energy density ρ emanating from a point source at r = r 0 in two-dimensional free-space may be obtained from (10) as where R = |r − r 0 |.Discrete flow mapping is a smoothed ray tracing algorithm in the same way as DEA and, in general, only retrieves the full ray-tracing solution in the limit where N s and N p tend to infinity [37].Figure 4 indicates the convergence of DFM to the ray tracing solution (26), where the triangle mesh has complete transmission (λ t = 1) across all edges in order to replicate free-space.In these computations we have chosen parameters ω = 100π, c = 1, ρ f = 1 and μ = 0.The plotted values are computed at the centroid of each triangle and are presented on a logarithmic scale.
In the right plot of Fig. 4 we show the averaged relative error for the energy density computed by DFM with different orders of approximation in space, and a fixed order in direction.The relative error values are averaged over annular segments with radial width Δ R = 1, as indicated by the white dashed lines in the left plot of Fig. 4. Note that we have excluded the average error in the circular segment containing the source point since the DFM result here is just the direct (and exact) source contribution.Clearly, as the order of the spatial approximation N s increases, the error is correspondingly decreasing.The approximation in direction is fixed with a relatively large choice of N p = 300, since the free-space problem only gives propagation in a single direction, radially outward from the source.As such, the analytic solution in phase-space will behave as a delta-distribution in the direction coordinate, making it challenging to model using a polynomial basis.An identical value for the direction basis order was used in all cases for consistency, and to clearly show the convergence related to increasing the spatial approximation order only.The estimated order of convergence (EOC) when the number of degrees of freedom is doubled by changing from N s = 0 to N s = 1 ranges between 1.8 in the closest annular segment to the source point and around 3.5 in the furthest away two segments.Here the EOC is computed via for N s = 0.For the increase from 2 to 3 degrees of freedom per element edge (N s = 1 to N s = 2), we compute EOC(1), which increases compared with EOC(0) to around 3.5 close to the source and to 5 in the most far field sector.Finally, for the increase from N s = 2 to N s = 3, EOC(2) does not simply increase further from the source as before.In the closest sector to the source the EOC has reduced to 1.5 and likewise, in the two furthest away sectors we see a similar reduction in the EOC to around 3. However, in the intermediate sectors between R = 2 and R = 4 we see an increase in the EOC to as high as 8.4 for the segment from R = 2 to R = 3.The saturation of the error at around 3e−4 when N s = 3 suggests that here we are close to the maximum accuracy possible on this triangulation with N p = 300.The example shown in Fig. 4 has a relatively small and simple mesh.A basis order of N p = 300 would be computationally infeasible for complex built-up engineering applications.However, the directional dependence of the energy density in complex structures is often relatively smooth due to multiple reflections and irregular geometry, which makes such a large choice of N p unnecessary.In general, engineering applications will also require the study of dissipative problems and hence we now change the dissipation factor to be μ = 1 in the free-space radiation problem considered above.Figure 5 shows the numerical solution for this problem with N p = 12 and with either a constant or a quadratic spatial basis.
The lower right plot of Fig. 5 shows the ray tracing solution (26) with an additional dissipation factor for consistency with the DFM calculation.The energy density predicted by a DFM simulation with N s = 0 and N p = 12 is shown in the upper left plot.Spurious localization and shadowing effects arise due to the piecewise constant approximation in space introducing discontinuities at the vertices of the mesh.The upper right plot of Fig. 5 shows another DFM simulation on the same mesh, but here with N s = 2 and N p = 12.The circular symmetry of the energy density shown in the exact solution has been preserved showing a distinct qualitative improvement from the piecewise constant approximation.The higher order simulation leads to an approximate doubling of the computation time, but even so, the simulations presented here took less than 30 s.
The shadowing effects produced in the upper left plot of Fig. 5 can also be reduced by applying local mesh refinement near the source point.The lower left plot of Fig. 5 shows that the local mesh refinement strategy, which was implemented using a mesh density function h(R) = 0.01 exp(0.5 √ R) in DistMesh [33], does indeed improve the approximation of the energy density.However, this improvement comes at the cost of a significant increase in computational time from under 30 s for each of the simulations on the coarse mesh with 283 elements to around 5 min for the simulation on the locally refined mesh with 5859 elements.Hence, in order to obtain qualitatively similar results and to preserve the circular symmetry inherent in the problem, applying local mesh refinement leads to a more substantial increase in computational time than instead using a quadratic spatial basis approximation.

Closed Cavity Simulation
We perform numerical simulations on a closed polygonal cavity taken from Ref. [22].In Fig. 6, we have placed a source point inside the cavity at (10,5); whereas in Fig. 7, the source point is located on the boundary at (2.5, 7).The total number of mesh elements is 538 and we take ω = 100π, c = 1 and ρ f = 1 for all computations.
Figure 6 shows the predicted energy density for different approximation orders N s and N p , and with dissipation rate μ = 0.5.The upper left plot of Fig. 6 shows the result with a piecewise approximation in space and N p = 12 direction.Localized energy stripes near the source point are again evident, as they were in the free space propagation problem.The upper right plot of Fig. 6 shows the same calculation, but now with N s = 2.We notice that the circular symmetry around the source has been restored for only a modest increase in the computational time from around 30-45 s.The lower plots of Fig. 6 show the results of higher order simulations in both the space and the direction basis approximations with a maximum computational time of 6 min.The results are visually similar to those with N s = 2 and N p = 12.The sequence of plots in Fig. 6 demonstrate the convergence of DFM for increasing N s and the gain in accuracy that can be achieved by applying spatial approximations with N s 2 close to a source point.
The density distribution inside a cavity will depend on a number of factors including the geometry, the source point location and the damping.Figure 7 shows the result of moving the source point to the boundary and increasing the damping to μ = 1.Notice the clear difference between the energy density in the upper and lower parts of the cavity.The result in the left plot was computed using a piecewise constant approximation in space, and shows a sudden jump between the energy densities in the upper and lower regions.In the right plot we observe a smoother decay from the lower region to the upper region as a result of increasing the spatial approximation order.Therefore the right plot better captures the wave energy transmitted indirectly from the source to the upper part of the cavity due to reflections at the lower boundary.Hence, a higher order spatial approximation can restore symmetry and reduce spurious shadowing effects in both the near-and far-field of a point source excitation.
In all the numerical examples considered so far, the propagation has been through a homogeneous medium.We conclude this section by considering the case of a coupled twocavity system with differing propagation speeds in each cavity.

Coupled Two-Cavity System
Consider the two-cavity system shown in the left plot of Fig. 8 as considered in Ref. [7].The source point is located at (−0.4, 0.5) and the energy density is computed for N s = 2 and N p = 24, with hysteretic damping applied via μ j = ωη/(2c j ), η = 0.01, ω = 100π and ρ f j = k −2 j for j = 1, 2, . . ., N .We have taken N = 1184 and set the propagation speeds to be c j = 0.5 when Ω j is within the left cavity (x < 0) and c j = 1 otherwise.The total energy in each cavity is given by ρ Ω (r) dr, where ρ Ω is the interior density (8) and the subscripts of P specify the cavity.
The right plot of Fig. 8 shows the ratio P left /P right for five different frequency values.We compare the results of the DFM algorithm presented here for various orders of approximation with the DEA results given in [7].The spectral convergence of the integrals arising in the DFM computation for this example is demonstrated in "Appendix".The DEA results use a 6 th order Chebyshev basis approximation along each edge of the polygonal cavity, and the same order of approximation globally in direction.The right plot of Fig. 8 also shows the results of 21 finite element method (FEM) simulations for the associated Helmholtz equation wave problem at an equi-spaced range of frequencies within ±5 Hz of the center frequencies used in the DEA and DFM computations.The FEM computations are performed using discontinuous Galerkin methods as reported in [7].
The results shown in the right plot of Fig. 8 demonstrate a good agreement between the DFM and the DEA results, particularly for lower damping (i.e.lower frequencies).We note that for finer triangle meshes than the one employed here (larger N ), the results of the three DFM simulations become indistinguishable.For the mesh in the computations here, however, there is a considerable improvement when N s is increased from 0 to 2. The DFM results with N s = 2 and N p = 12 or N p = 24 agree well with the DEA result and lie towards the center of the range of FEM wave problem results.The computational times for these results were approximately 95 s per frequency when N s = 0, 150 s per frequency when N s = 2, N p = 12 and 550 s per frequency when N s = 2, N p = 24.Note that this compares favourably with the computational times for the DEA method reported in [7]; the 6th order DEA result shown in Fig. 8 took around 3000 s per frequency to compute.

Discussion: Computational Costs and Scaling
The computational costs of running a MATLAB based DFM code for the numerical experiments in this paper have been reported in the previous subsections.The times quoted are for non-optimised code running on a 3.4 GHz processor and without taking advantage of the fact that DFM is embarrassingly parallel with respect to the number of mesh elements.The cost of the algorithm as a whole is dominated by the cost of computing the entries of the matrix B and so scales with the number of non-zero entries of this matrix.As the problem size grows, the costs associated with solving the linear system become more significant, particularly in the case of low dissipation, but this still plays a relatively minor role for the examples presented here.An important advantage of the method over conventional numerical solvers for the Helmholtz equation when the wavenumber k becomes large is that the computational costs scale independently of k.
The approximate scaling of the algorithm as the number of degrees of freedom is increased is linear with respect to the number of mesh cells, since each triangular mesh element only transmits rays to a maximum of three other cells with which it shares a direct physical connection (as well as possible reflections into the same element).The scaling is less favourable with respect to the basis approximation order, and approximately scales as O(N 2 s N 2 p ).However, we note that our results demonstrate a significant increase in accuracy for a moderate increase in the order of the spatial basis approximation from N s = 0 to N s = 2.In order to achieve the quadratic scaling of the algorithm with respect to the basis order in practice, then optimised integration routines such as the semi-analytic spectral methods described in Sect.3.3 are crucial.Otherwise, the computational costs associated with the quadrature would also grow with the basis order in a sub-optimal manner.The results shown in Sect. 4 therefore demonstrate that DFM with p-refinement using semi-analytic integration and spectrally convergent quadrature is an efficient method for predicting energy distributions in complex structures.

Conclusions
A Discrete Flow Mapping algorithm with p-refinement in phase-space has been presented for approximating phase-space densities on triangulated domains.In particular, this is the first study incorporating orthogonal polynomial basis approximations of any specified order N s ≥ 0 in position space.The additional computational cost resulting from the higher order spatial approximations has been minimised by a careful evaluation of the propagation operator using semi-analytic integration methods for a Legendre polynomial basis, or full spectral quadrature in general.The numerical results presented verify the approach and demonstrate that for practical applications, a moderate increase in the order of the spatial approximation from N s = 0 to N s = 2 can be sufficient to improve the qualitative nature of the numerical solution.
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/),which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Appendix: Spectrally Convergent Quadrature in Phase-Space
In this appendix we demonstrate the spectral convergence of the adaptive quadrature algorithm outlined in Sect.3.3 using quadrature for both integrals.Consider two triangles connected along the line x = 0 as shown in Fig. 9.These triangles are taken from the mesh of the coupled two-cavity system shown in Fig. 8.We give sample calculations for rays originating on the edge marked AB in Fig. 9, and hitting the edge BC.We fix the polynomial degrees in (21) to be m = m = 2 and n = n = 12.Then subdividing the integration domain for the direction integral as outlined in Sect.3.1, we obtain the following four sub-intervals: The first subdivision comes from the splitting (20), and the other subdivisions are necessary since the extremal values of the interval I (3) correspond to branch points of the formula for θ t obtained from Snell's law (16).The integrals over I (1) , I (2) and I (4) are restricted to values of θ j for which total internal reflection takes place (λ t = 0).For the integration over I (3) we have both reflection and transmission, and the integration is performed with respect to θ + t as described in Sect.3.1.
The spectral convergence of the quadrature for the direction integration is shown in the left plot of Fig. 10.The plot shows the relative errors, where a numerical solution with 2 12 + 1 quadrature nodes is used in the place of an exact solution.Notice that the integrals with total internal reflection (over I (1) , I (2) , and I (4) ) converge faster than the integrals with a nonconstant transmission probability function λ t .In the right plot of Fig. 10, we also demonstrate the spectral convergence of the spatial quadrature.We consider the spatial integrals with four fixed θ j values.The choices of θ j shown in the plot correspond to the central value for each sub-interval.Note that the relative error for these integrals has already reached single precision with just 8 quadrature nodes, and double precision with 16 quadrature nodes.This rapid convergence means that the computational cost depends most crucially on the efficiency of the direction coordinate integration, since this specifies how many spatial integrals must be evaluated.The spatial integration efficiency could only practically be improved by the use of exact spatial integration formulae, such as (23), or (25) for N s > 0.

Fig. 4
Fig. 4 Left energy propagation from the point source at the origin with N s = 3 and N p = 300.Right the absolute error of the energy density averaged over annular segments of width Δ R = 1 (indicated by the white dashed lines in the left plot).Parameter values for both sub-plots: ω = 100π , c = 1, ρ f = 1 and μ = 0

Fig. 5 1 Fig. 6 Fig. 7
Fig. 5 Energy density (on a logarithmic scale) in a circular region of dissipative free-space with a point source at the origin (marked with a black star).Upper left simulation results with N s = 0 and N p = 12.Upper right simulation results with N s = 2 and N p = 12.Lower left simulation result with a locally refined mesh near the source point with N s = 0 and N p = 12.Lower right exact energy density plotted on the original (coarse) mesh.Parameter values: ω = 100π , c = 1, ρ f = 1 and μ = 1

Fig. 8
Fig. 8 Simulations in a two-cavity system with propagation speeds c j = 0.5 if x < 0 and c j = 1 otherwise, fluid densities ρ f j = k −2 j , and with hysteretic damping μ j = ωη/(2c j ), η = 0.01 and j = 1, 2, . . ., N .Left energy density (on a logarithmic scale) in a coupled cavity system with source point (−0.4,0.5) (marked with a black star), ω = 100π and with N s = 2 and N p = 24.Right comparison of the energy ratio P left /P right for different values of N s and N p in DFM compared with both DEA, and with 21 FEM simulations for the related wave problem at an equi-spaced range of frequencies within ±5 Hz of the 'center' frequencies used for the DEA and DFM computations