betaFeedback

WorksPhysics and Astronomy

Pade: A code for protoplanetary disk turbulence based on Pade differencing

Abstract

The Pade code has been developed to treat hydrodynamic turbulence in protoplanetary disks. It solves the compressible equations of motion in cylindrical coordinates. Derivatives are computed using non-diffusive and conservative fourth-order Pade differencing, which has higher resolving power compared to both dissipative shock-capturing schemes used in most astrophysics codes, as well as non-diffusive central finite-difference schemes of the same order. The fourth-order Runge-Kutta method is used for time stepping. A previously reported error-corrected Fargo approach is used to reduce the time step constraint imposed by rapid Keplerian advection. Artificial bulk viscosity is used when shock-capturing is required. Tests for correctness and scaling with respect to the number of processors are presented. Finally, efforts to improve efficiency and accuracy are suggested.

Introduction

This paper presents a code called Padé, developed to simulate hydrodynamic turbulence in protoplanetary disks. The code uses a Padé/compact finite-difference scheme [18]. Such schemes have spectral-like resolving power. This means that they approach the ability of a spectral method to compute derivatives exactly for all wave numbers that the mesh can support. In particular, for advection problems they have zero diffusive error (as do all central finite-difference schemes) and have small dispersion error across the wavenumber range. Thus they have the ability to more accurately treat the dynamics of the small scales supported by the mesh and produce energy spectra that have a wider inertial (power-law) range for turbulent flows.

On the other hand, most astrophysical codes employ Godunov-type schemes that were an elegant and mathematically supported breakthrough for capturing shock-waves. Such schemes employ non-central upwinded finite-difference or flux reconstruction schemes with a smart non-linear dissipation that is necessary for capturing shocks, but which leads to excessive dissipation of vortical and other smooth features such as density waves. To fix this issue there have been attempts along many directions which include hybrid methods [1, 31], non-linear filtering [42], and vorticity-preserving schemes [19, 33, 34]. Since shocks have not been observed in protoplanetary disk turbulence to date, we can side step the issue. For treating shock waves that are not too strong, the Padé code provides an optional artificial bulk viscosity treatment [9, 22]. This is not as elegant or oscillation free as Godunov methods, but is designed to apply a diffusivity only where the divergence ∇⋅u\nabla\cdot\mathbf{u} is strong.

Corresponding author: Karim Shariff

[email protected],

The development of the Padé code was motivated by the discovery in the last two decades of a number of mechanisms for the generation of hydrodynamic turbulence in protoplanetary disks; see Lesur et al. [20] for a comprehensive review. These include the vertical shear instability (VSI), convective over-stability (COS), and the zombie vortex instability (ZVI). Each is most strongly amplified for a different range of Ωtthermal\Omega t_{\mathrm{thermal}}, the time scale for radiative relaxation of temperature fluctuations back to the background (normalized by the orbital frequency, Ω\Omega). VSI is most strongly amplified when Ωtthermal≪1\Omega t_{\mathrm{thermal}} \ll1, COS when Ωtthermal∼1\Omega t_{\mathrm{thermal}} \sim1, and ZVI when Ωtthermal≫1\Omega t_{\mathrm{thermal}} \gg1. Turbulence can also be driven by the magneto-rotational instability (MRI) in the radially inner and outer regions of protoplanetary disks where ionization is sufficient.

As mentioned earlier, most astrophysical codes that are applied to protoplanetary disks use dissipative shock-capturing methods. These codes include Athena (Stone et al. [39]), Athena++ (Stone et al. [40]), Pluto (Mignone et al. [27]), and Fargo3D (Benítez-Llambay & Masset [4]). The highest order scheme provided in Athena and Athena++ is the third order PPM (Piecewise Parabolic Method). The highest order scheme in Pluto is a fifth order WENO (Weighted Essentially Non-Oscillatory) finite difference shock-capturing scheme denoted WENOZ FD in the Pluto manual (Mignone [26], pg. 93). Fargo3D employs a staggered mesh such that the scalar variables, density and internal energy per unit volume, are cell-centered while vector quantities, velocity and magnetic field, are located at the centers of cell faces. The computation of fluxes at cell faces employs upwinded interpolation which is necessarily dissipative. Time advancement uses operator splitting whereby different sets of terms contributing to the time rate of change of flow quantities are time-advanced separately, one after the other.

The one exception to the use of dissipative shock-capturing scheme is the Pencil code (Brandenburg et al. [8]) which uses sixth-order central differencing. Central schemes, including the Padé scheme, produce oscillations at the Nyquist wavenumber of the mesh. To overcome this, Pencil uses a dissipative fifth order upwind biased scheme, while Padé uses a filter with a sharp cut-off (§ 3.3).

The rest of the paper presents the equations solved (§ 2), computational schemes (§ 3), various tests (§ 4), and closing remarks (§ 5). Code availability is described after the acknowledgements.

Equations discretized

Transport equations

The code solves the equations for mass and momentum (radial, angular, and vertical) transport written in as close to flux-divergence form as possible in cylindrical coordinates

∂ρ∂t+∂∂z(ρuz)+1r∂∂r(rρur)+1r∂∂ϕ(ρuϕ)=0,(1)\frac{\partial\rho}{\partial t}+\frac{\partial}{\partial z}(\rho u_z)+\frac{1}{r}\frac{\partial}{\partial r}(r\rho u_r)+\frac{1}{r}\frac{\partial}{\partial\phi}(\rho u_\phi)=0, \tag*{(1)}
∂∂t(ρur)+∂∂z(ρuruz)+1r∂∂r[r(p+ρur2)]+1r∂∂ϕ(ρuϕur)−ρuϕ2r=pr+ρgr+Frv,(2)\frac{\partial}{\partial t}(\rho u_r)+\frac{\partial}{\partial z}(\rho u_r u_z)+\frac{1}{r}\frac{\partial}{\partial r}\left[r(p+\rho u_r^2)\right]+\frac{1}{r}\frac{\partial}{\partial\phi}(\rho u_\phi u_r)-\frac{\rho u_\phi^2}{r}=\frac{p}{r}+\rho g_r+F_r^{\mathrm{v}}, \tag*{(2)}
∂∂t(ρuϕ)+∂∂z(ρuϕuz)+1r∂∂r(rρuϕur)+1r∂∂ϕ(p+ρuϕ2)=rFϕv,(3)\frac{\partial}{\partial t}(\rho u_\phi)+\frac{\partial}{\partial z}(\rho u_\phi u_z)+\frac{1}{r}\frac{\partial}{\partial r}(r\rho u_\phi u_r)+\frac{1}{r}\frac{\partial}{\partial\phi}(p+\rho u_\phi^2)=rF_\phi^{\mathrm{v}}, \tag*{(3)}
∂∂r(ρuz)+∂∂z(p+ρuz2)+1r∂∂r(rρuzur)+1r∂∂ϕ(ρuzuϕ)=ρgz+Fzv.(4)\frac{\partial}{\partial r}(\rho u_z)+\frac{\partial}{\partial z}(p+\rho u_z^2)+\frac{1}{r}\frac{\partial}{\partial r}(r\rho u_z u_r)+\frac{1}{r}\frac{\partial}{\partial\phi}(\rho u_z u_\phi)=\rho g_z+F_z^{\mathrm{v}}. \tag*{(4)}

Here Fv\mathbf{F}^{\mathrm{v}} represents an optional viscous force given in Appendix § 6. Implementation of characteristic boundary conditions requires calculation of the flux Jacobian, and to make the flux look similar to that in Cartesian coordinates, the term −∂p/∂r-\partial p/\partial r that normally appears on the right-hand-side of the radial momentum equation (2) was moved into the radial advective flux on the left-hand-side. This is accomplished by adding the quantity

1r∂∂r(rp)=1r(r∂p∂r+p)=∂p∂r+pr,(5)\frac{1}{r}\frac{\partial}{\partial r}(rp)=\frac{1}{r}\left(r\frac{\partial p}{\partial r}+p\right)=\frac{\partial p}{\partial r}+\frac{p}{r}, \tag*{(5)}

to both sides of ((2)), which results in the source term p/rp/r on the right-hand-side.

For the locally isothermal option, the pressure is computed as p=ρci2(r)p=\rho c_i^2(r) where ci(r,z)c_i(r,z) is the local isothermal sound speed. For the non-isothermal option we have

p=(γ−1)eint,(6)p=(\gamma-1)e_{\mathrm{int}}, \tag*{(6)}

where einte_{\mathrm{int}} is the internal energy (per unit volume). The rationale for using the internal energy instead of its sum with the kinetic energy is given in our work on the Fargo method ([36]. The transport equation for einte_{\mathrm{int}} is

∂eint∂t+∂∂z(eintuz)+1r∂∂r(reintur)+1r∂∂ϕ(eintuϕ)=−p∇⋅u⃗+Qν−∇⋅q⃗cond.(7)\frac{\partial e_{\mathrm{int}}}{\partial t}+\frac{\partial}{\partial z}(e_{\mathrm{int}}u_z)+\frac{1}{r}\frac{\partial}{\partial r}(r e_{\mathrm{int}}u_r)+\frac{1}{r}\frac{\partial}{\partial\phi}(e_{\mathrm{int}}u_\phi)=-p\nabla\cdot\vec{u}+Q^{\nu}-\nabla\cdot\vec{q}_{\mathrm{cond}}. \tag*{(7)}

The first term on the right-hand-side of (7) is the pressure-dilatation term which causes heating under compression. The dilatation is given by

∇⋅u⃗=∂uz∂z+1r∂∂r(rur)+1r∂uϕ∂ϕ(8)\nabla\cdot\vec{u}=\frac{\partial u_z}{\partial z}+\frac{1}{r}\frac{\partial}{\partial r}(r u_r)+\frac{1}{r}\frac{\partial u_\phi}{\partial\phi} \tag*{(8)}

The last two terms Qν−∇⋅q⃗condQ^{\nu}-\nabla\cdot\vec{q}_{\mathrm{cond}} on the right-hand-side of (7) represent viscous heating and conductive heat transfer, respectively. They are activated only if viscous terms are activated; their form is given in Appendix § 6.

The variables evolved at each grid point are q⃗=(ρ,ρur,ρuϕr,ρuz,eint)\vec{q}=(\rho,\rho u_r,\rho u_\phi r,\rho u_z,e_{\mathrm{int}}). When spatial derivatives are approximated by Padé finite-differences (discussed below), one obtains a system of ODEs for the time rate of change, ∂tq⃗\partial_t\vec{q} of q⃗\vec{q} at each grid point. This system is evolved using the fourth-order Runge-Kutta method. Note that we do not employ operator splitting whereby different sets of terms in ∂tq⃗\partial_t\vec{q} are time evolved separately one after another; this would produce a splitting error which we do not incur.

Currently, the main source of gravity in the code is from a mass MM at the origin so that

gr=−GMRrR,gz=−GMRzR,R≡(r2+z2)1/2,(9)g_r=-\frac{GM}{R}\frac{r}{R},\quad g_z=-\frac{GM}{R}\frac{z}{R},\quad R\equiv\left(r^2+z^2\right)^{1/2}, \tag*{(9)}

which are pre-computed. The code also allows other simple choices such as uniform gzg_z and the thin disk version of (9).

Fargo

The Fargo method was introduced by Masset [24] to alleviate the time step restriction resulting from fast Keplerian advection. Shariff & Wray [36] improved its accuracy by first noting that underlying the method is a transformation of the azimuthal coordinate ϕ\phi

ϕ′=ϕ−Ω‾(r)(t−t0),(10)\phi'=\phi-\overline{\Omega}(r)(t-t_0), \tag*{(10)}
r′=r,(11)r'=r, \tag*{(11)}
t′=t,(12)t'=t, \tag*{(12)}

for the duration of a time step, t0<t≤t0+Δtt_0<t\leq t_0+\Delta t. Here Ω‾(r)\overline{\Omega}(r) is a prescribed rotation rate that one wishes to subtract from determining the time step. At the end of the time step, one brings the flow field back to original coordinates by performing a shift using an FFT. The chain-rule for differentiation then implies that every tt and rr derivative in the transport equations carries an additional term:

∂∂t=∂∂t′−∂ϕ′∂t∂∂ϕ′=∂∂t′−Ω‾(r)∂∂ϕ′,(13)\frac{\partial}{\partial t}=\frac{\partial}{\partial t'}-\frac{\partial\phi'}{\partial t}\frac{\partial}{\partial\phi'}=\frac{\partial}{\partial t'}-\overline{\Omega}(r)\frac{\partial}{\partial\phi'}, \tag*{(13)}
∂∂r=∂∂r′−∂ϕ′∂r∂∂ϕ′=∂∂r′−(t−t0)∂Ω‾∂r∂∂ϕ′,(14)\frac{\partial}{\partial r}=\frac{\partial}{\partial r'}-\frac{\partial\phi'}{\partial r}\frac{\partial}{\partial\phi'}=\frac{\partial}{\partial r'}-(t-t_0)\frac{\partial\overline{\Omega}}{\partial r}\frac{\partial}{\partial\phi'}, \tag*{(14)}
∂∂ϕ=∂∂ϕ′.(15)\frac{\partial}{\partial\phi}=\frac{\partial}{\partial\phi'}. \tag*{(15)}

The second term in ∂/∂t\partial/\partial t serves to remove Ω‾(r)\overline{\Omega}(r) from the azimuthal advection velocity, therefore, it no longer influences the time step. To see how this works, consider the transformed mass transport equation (1):

∂ρ∂t′+1r∂∂ϕ′(ρuϕ′)+1r[∂∂r′+χ](rρur)+∂∂z(ρuz)=0,(16)\frac{\partial\rho}{\partial t'}+\frac{1}{r}\frac{\partial}{\partial\phi'}(\rho u'_\phi)+\frac{1}{r}\left[\frac{\partial}{\partial r'}+\chi\right](r\rho u_r)+\frac{\partial}{\partial z}(\rho u_z)=0, \tag*{(16)}

where

uϕ′=uϕ−Ω‾(r)r(17)u'_\phi=u_\phi-\overline{\Omega}(r)r \tag*{(17)}

is a shifted velocity that results in a less restrictive time step. In (16), the symbol χ\chi denotes the operator

χ=−(t−t0)∂Ω‾∂r∂∂ϕ′.(18)\chi=-(t-t_0)\frac{\partial\overline{\Omega}}{\partial r}\frac{\partial}{\partial\phi'}. \tag*{(18)}

It arises from the second term on the right-hand-side of the last member of (14), and must be added to every rr derivative in the transport equations; the code refers to it as the ‘extra operator.’ The extra operator χ\chi is missing in the original implementation [24]: its neglect results in an error of O(Δt)O(\Delta t). The original implementation also “integerizes” the prescribed Ω‾(r)\overline{\Omega}(r) to allow a shift of the flow field by an integer number of grid intervals in ϕ\phi at the end of a time step. The integer shift jumps at certain radial locations and this results in additional error at those locations.

This code provides options to completely or partially revert to Masset’s original algorithm if desired. In particular, integer shifting can be selected as opposed to the more accurate real-valued shifting. Also, inclusion of the extra operator χ\chi can be suppressed. At the end of each time step, the flow field is shifted back to original coordinates. Real-valued shifting is performed using an FFT from the FFTW library [11].

Following publication of Shariff & Wray [36], we were contacted by Prof. Pablo Benítez Llambay (Universidad Adolfo Ibáñez, Chile) who is a main developer of Fargo3d. He pointed out that Fargo3d performs advection by operator splitting, and therefore there is no coordinate transformation requiring chain-rule terms. For instance, consider the continuity equation with only ϕ\phi advection for simplicity:

∂ρ∂t+1r∂∂ϕ(ρuϕ)=0,(19)\frac{\partial\rho}{\partial t}+\frac{1}{r}\frac{\partial}{\partial\phi}\left(\rho u_{\phi}\right)=0, \tag*{(19)}

with the decomposition

uϕ=Ω‾(r)r+uϕ′.(20)u_{\phi}=\overline{\Omega}(r)r+u'_{\phi}. \tag*{(20)}

In the operator splitting approach, ρ\rho is first partially evolved according to advection by the residual velocity uϕ′u'_{\phi},

1r∂∂ϕ(ρuϕ′),(21)\frac{1}{r}\frac{\partial}{\partial\phi}\left(\rho u'_{\phi}\right), \tag*{(21)}

whose time step restriction is not severe. Next, the term Ω‾(r)∂ϕρ\overline{\Omega}(r)\partial_{\phi}\rho, representing advection by Keplerian flow, is treated in Fargo3d by real-valued shifting (Colin McNally, Queen Mary Univ. of London, Private Communication). Thus, it is true that no coordinate transformation is implied. However, operator splitting has O(Δt2)O(\Delta t^2) error which is of the same order as the error made by dropping the extra chain-rule terms. Thus, it would appear that for higher order time integration schemes, chain-rule terms are necessary for consistency.

Artificial pressure for shock-capturing

Padé schemes, like spectral schemes, are not designed to capture shocks. However, one may encounter shocks in protoplanetary disks. Examples include the infall accretion shock [30], and bow shocks due to solid bodies moving supersonically relative to the gas. For these reasons, the code allows for an optional treatment of shocks using artificial bulk viscosity [9, 22]. This method results in an artificial pressure, partp_{\mathrm{art}}, which is then added to the physical pressure. The actual calculation of partp_{\mathrm{art}} is

part=−βΔ∇⋅u⃗,(22)p_{\mathrm{art}}=-\beta_{\Delta}\nabla\cdot\vec{u}, \tag*{(22)}

where βΔ\beta_{\Delta} is the artificial bulk viscosity. Note that artificial pressure is positive in regions of compression (dilatation ∇⋅u⃗<0\nabla\cdot\vec{u}<0) and negative in regions of expansion. The artificial bulk viscosity is made sensitive to the dilatation as follows:

βΔ=Capℓgrid2∣∇⋅u⃗∣,(23)\beta_{\Delta}=C_{\mathrm{ap}}\ell_{\mathrm{grid}}^{2}\lvert\nabla\cdot\vec{u}\rvert, \tag*{(23)}

were CapC_{\mathrm{ap}} is a user specified coefficient and the grid size squared is

ℓgrid2={Δz2,in 1D;rΔϕΔr,in the planar case;(rΔϕΔrΔz)2/3,in 3D.(24)\ell_{\mathrm{grid}}^{2}= \begin{cases} \Delta z^{2}, & \text{in 1D};\\ r\Delta\phi\Delta r, & \text{in the planar case};\\ (r\Delta\phi\Delta r\Delta z)^{2/3}, & \text{in 3D}. \end{cases} \tag*{(24)}

Since the absolute value function is not smooth, the Padé filter (§ 3.3) with ϵfilter=0.2\epsilon_{\mathrm{filter}}=0.2 is applied to βΔ\beta_{\Delta}. The artificial pressure term imposes a time step constraint appropriate for a viscous (second derivative) term. The time step must satisfy

(λap)max⁡Δt<CFL,(25)(\lambda_{\mathrm{ap}})_{\max}\Delta t<\mathrm{CFL}, \tag*{(25)}

where (λap)max⁡(\lambda_{\mathrm{ap}})_{\max} is the maximum eigenvalue of the bulk viscosity operator and CFL is the Courant-Friedrichs-Lewy limit specified by the user. For the fourth-order Runge-Kutta method, CFL <8< \sqrt{8} for stability. The maximum eigenvalue is estimated as

(λap)max⁡=(π2βΔρℓgrid2)max⁡,(26)(\lambda_{\mathrm{ap}})_{\max} = \left(\frac{\pi^2\beta_{\Delta}}{\rho\ell_{\mathrm{grid}}^2}\right)_{\max}, \tag*{(26)}

where a factor of π\pi comes from assuming that each numerical derivative has spectral accuracy. Recall that βΔ∝ℓgrid2\beta_{\Delta} \propto\ell_{\mathrm{grid}}^2 so the grid size actually drops out in (26). For the shock-tube and density wave test cases we report below, this eigenvalue was a factor of 1.08 and 1.61 larger, respectively, than the eigenvalue for the Euler terms.

Numerics

Padé differentiation

The motivation for Padé differencing (also referred to as compact differencing) is its high resolving power (§ 3.2); see Lele [18] for a comprehensive presentation and various extensions. The idea and initial development of such schemes is due to the Czech born astronomer and numerical analyst Zdeněk Kopal around 1959; see the bibliographical notes (item IX-C) in his book [16]. The basic idea, developed in Chapter 9 of the book, is to write the exact first derivative operator as an exact function of the central difference operator. This operator function is first expanded in a truncated Taylor polynomial, which results in a conventional difference scheme. The key idea, however, is to next obtain a rational polynomial approximation (known as a Padé approximant) to the Taylor series. It is known that Padé1 approximants to ordinary functions have a greater range of accuracy and radius of convergence than a Taylor series. In the present case, one obtains difference schemes with better resolving power. The simplest scheme, and the one we use both in the interior of non-periodic domains and for periodic domains is

αfj−1′+fj′+αfj+1′=a2h(fj+1−fj−1),(27)\alpha f'_{j-1} + f'_j + \alpha f'_{j+1} = \frac{a}{2h}(f_{j+1} - f_{j-1}), \tag*{(27)}

where hh is the uniform grid spacing, α=1/4\alpha= 1/4 and a=3/2a = 3/2. Equations (27) constitute a tridiagonal system of equations along each line of data in the mesh. The system is solved efficiently using the Thomas algorithm, which is simply Gaussian elimination applied to a tridiagonal matrix. Since Gaussian elimination is recursive, namely, operating on row jj depends on the result of row j−1j-1, the memory cache cannot be preloaded with the required data. Similarly, any available vectorization hardware cannot be engaged by the compiler. To overcome this, we follow the standard practice of having each step of the Thomas algorithm inner-loop over a bundle of independent inversions for different grid lines of the mesh. Equation (27) is fourth-order accurate, i.e., its truncation error is O(h4)\mathcal{O}(h^4). To allow for non-uniform meshes, numerical differentiation is performed with respect to the continuous grid index variable ξ\xi (such that ξj=j\xi_j = j and h=1h = 1), and the chain rule is used, e.g.,

∂f∂z=∂f∂ξ(dzdξ)−1.(28)\frac{\partial f}{\partial z} = \frac{\partial f}{\partial\xi}\left(\frac{d z}{d \xi}\right)^{-1}. \tag*{(28)}

Kopal’s operator calculus is abstruse and unwieldy, but once the basic form of Padé schemes is recognized, an easier approach to develop them is to simply write down a specific form with a desired grid-point stencil, and obtain the unknown coefficients by setting the Taylor series error to zero at various orders. This is the approach followed in Lele [18] who developed a number of extensions, including resolving power optimization, boundary schemes, higher derivatives, conservation, and filtering.

For robustness, it is desirable that a code maintain positivity of density and internal energy. Negative values can arise in strongly evacuated regions for low-order schemes, and near very strong discontinuities for higher order schemes; see, for example, Hu et al. (2013) who present a simple method for ensuring positivity for finite-difference schemes that can be written as a difference of numerical fluxes. The present method does not guarantee positivity, however, the code has not encountered difficulties for problems of subsonic turbulence for which it is intended. In the future, it may be possible to implement the method of Hu et al. (2013) using the “reconstruction by primitive function” trick ([13, 37]), which is also discussed in Merriman [25]. In this method, one obtains numerical fluxes by differentiating the primitive function; this differentiation would be performed using the Padé scheme.

Resolving power of Padé differencing

The advantage of Padé schemes is, first of all, their compactness: for (27), for instance, fourth-order accuracy is obtained with a stencil width of three rather than four in the case of standard central differencing. More importantly, they have better resolving power than standard central differencing. This means that for the same formal order of accuracy, they provide an accurate derivative up to higher wave numbers. This is quantified by the so-called effective wave number analysis: substitute

fj=exp⁡(ikxj)andfj′=ikeff(k)exp⁡(ikxj),0≤k≤πh,(29)f_j = \exp(ikx_j) \quad\text{and} \quad f'_j = ik_{\mathrm{eff}}(k)\exp(ikx_j), \quad0 \leq k \leq\frac{\pi}{h}, \tag*{(29)}

into (27) to obtain the effective wavenumber keff(k)k_{\mathrm{eff}}(k). Figure 1a displays the effective wavenumber for various schemes and shows that the fourth-order Padé scheme has better resolving power than a conventional sixth order scheme. In general, keff(k)k_{\mathrm{eff}}(k) is complex and its imaginary part represents numerical dissipation of the scheme. The fact that keff(k)k_{\mathrm{eff}}(k) is real for central schemes means that they have dispersion error but no dissipation error (for periodic boundary conditions). As as example of how to use the effective wavenumber diagram, we estimate by eye that the highest wavenumber for which we can trust the 4th order Padé scheme is kh=1.5kh = 1.5 which implies that the smallest number of grid points per wavelength for which the scheme is accurate is about four.

Figure 1. (a) Effective wavenumber for various difference schemes. (b) Transfer function, T(k)T(k), for the Padé filter. The grid spacing is hh. The limit kh=πkh = \pi corresponds to the Nyquist mode which has wavelength 2h2h.

Padé filtering

It is known that in the presence of non-linearity or non-uniform grids, Padé schemes produce small 2Δ2\Delta waves at every time step which can grow if not controlled; this is true for conventional central schemes as well. Our remedy is to apply a minimum amount of Padé filtering ([18 §C.2]) which has a sharp cut-off and targets the very highest wave numbers. We also use Padé filtering as an implicit sub-grid treatment; this is discussed in §4 where we use it for this purpose in an axisymmetric simulation of vertical shear instability (VSI).

We use the fourth-order filter of Lele [18] which for periodic boundary conditions, or in the interior of non-periodic domains, has the form

aUj−1+Uj+aUj+1=P(uj−2+uj+2)+Q(uj−1+uj+1)+Ruj,(30)aU_{j-1}+U_j+aU_{j+1}=P(u_{j-2}+u_{j+2})+Q(u_{j-1}+u_{j+1})+Ru_j, \tag*{(30)}

where UjU_j are the filtered uju_j. The conditions for fourth-order accuracy are:

a=−12+2Q,R=12(2+3a−3Q),P=14(a−Q).(31)a=-\frac{1}{2}+2Q,\qquad R=\frac{1}{2}(2+3a-3Q),\qquad P=\frac{1}{4}(a-Q). \tag*{(31)}

The reader can verify that there is no filtering when Q=1/2Q=1/2. To specify the strength of the filter, the code uses the parameter ϵfilter\epsilon_{\mathrm{filter}} such that

Q=12−14ϵfilter.(32)Q=\frac{1}{2}-\frac{1}{4}\epsilon_{\mathrm{filter}}. \tag*{(32)}

The transfer function T(k)T(k) of the filter versus wavenumber can be obtained by substituting uj=eikxju_j=e^{ikx_j} and Uj=T(k)eikxjU_j=T(k)e^{ikx_j} (with xj=jhx_j=jh) into (30). Figure 1b shows T(k)T(k) for various values of ϵfilter\epsilon_{\mathrm{filter}}. Axisymmetric simulations for ϵfilter\epsilon_{\mathrm{filter}} values ranging from 0.01 to 0.125 will be presented in § 4.5.

For non-periodic boundaries, we use the boundary treatment developed by Alan Wray (private communication) that is conservative, i.e., it preserves

∑j=1Nujhj.(33)\sum_{j=1}^{N}u_jh_j. \tag*{(33)}

The formulae applied at j=2j=2 and N−1N-1 are

BU1+CU2+DU3=Eu1+Fu2+Gu3+Hu4,(34)BU_1+CU_2+DU_3=Eu_1+Fu_2+Gu_3+Hu_4, \tag*{(34)}
BUN+CUN−1+DUN−2=EuN+FuN−1+GuN−2+HuN−3.(35)BU_N+CU_{N-1}+DU_{N-2}=Eu_N+Fu_{N-1}+Gu_{N-2}+Hu_{N-3}. \tag*{(35)}

with

B=2a,C=1+a,D=a,E=14(7a+Q),F=14(4+7a−3Q),G=14(a+3Q),H=14(a−Q)(36)B=2a,\quad C=1+a,\quad D=a,\quad E=\frac{1}{4}(7a+Q),\quad F=\frac{1}{4}(4+7a-3Q),\quad G=\frac{1}{4}(a+3Q),\quad H=\frac{1}{4}(a-Q) \tag*{(36)}

The boundary values u1u_1 and uNu_N are unchanged.

The first item of Table IX in Lele [18] lists the the leading order truncation error for the filter (30):

U(x)=[1+116(1−2a)h4∂4/∂x4+⋯ ]u(x).(37)U(x)=\left[1+\frac{1}{16}(1-2a)h^4\partial^4/\partial x^4+\cdots\right]u(x). \tag*{(37)}

Next consider the expression

u(x,t+Δt)=(1+ν4Δt∂4/∂x4)u(x),(38)u(x,t+\Delta t)=(1+\nu_4\Delta t\partial^4/\partial x^4)u(x), \tag*{(38)}

which represents application of an Euler step to

∂u∂t=ν4∂4u∂x4(39)\frac{\partial u}{\partial t}=\nu_4\frac{\partial^4u}{\partial x^4} \tag*{(39)}

Comparing (37) and (38) gives

ν4=116(1−2a)h4Δt.(40)\nu_4=\frac{1}{16}(1-2a)\frac{h^4}{\Delta t}. \tag*{(40)}

Hence, to leading order, Padé filtering corresponds to fourth-order hyperviscosity. Substituting the first member of (31) and (32) into (40) gives

ν4=116ϵfilterΔth4.(41)\nu_4=\frac{1}{16}\frac{\epsilon_{\mathrm{filter}}}{\Delta t}h^4. \tag*{(41)}

Equation (40) implies that as the time step is reduced ϵfilter\epsilon_{\mathrm{filter}} should be reduced. It should be noted that the matrix associated with the Padé filter becomes ill-conditioned for very small values of ϵfilter\epsilon_{\mathrm{filter}} and a sufficiently large number of grid points. To alleviate this, the filter is applied every NfilterN_{\mathrm{filter}} time steps (rather than after every step) and with ϵfilter\epsilon_{\mathrm{filter}} increased by NfilterN_{\mathrm{filter}}. In that case one should replace Δt\Delta t with ΔtNfilter\Delta tN_{\mathrm{filter}} in (41).

Boundary schemes and global conservation

At the end points of a non-periodic direction (j=1j=1 and NN), the scheme (27) involves values and derivatives outside the domain. Therefore, at j=1j=1 and NN we use the third-order one-sided scheme from equation (4.1.1) in Lele [18]:

f1′+α1f2′=h−1(a1f1+b1f2+c1f3),(42)f'_1+\alpha_1f'_2=h^{-1}(a_1f_1+b_1f_2+c_1f_3), \tag*{(42)}
fN′+α1fN−1′=−h−1(a1fN+b1fN−1+c1fN−2),(43)f'_N+\alpha_1f'_{N-1}=-h^{-1}(a_1f_N+b_1f_{N-1}+c_1f_{N-2}), \tag*{(43)}

with

α1=2,a1=−15/16,b1=2,andc1=1/2.(44)\alpha_1=2,\quad a_1=-15/16,\quad b_1=2,\quad\text{and}\quad c_1=1/2. \tag*{(44)}

According to a theorem for hyperbolic initial boundary value problems, one can reduce the order of accuracy at the boundary by one without affecting the global order of accuracy (Gustafsson [12]). The scheme used at the interior points j∈[2,N−1]j\in[2,N-1] is (27).

We wish the finite-difference scheme to possess a discrete conservation property. Specifically, we require that a discrete version of the Leibniz integral rule be satisfied: a numerical integral of the numerical derivative should reduce to a difference of boundary values. This is achieved for a Padé scheme as described in Lele [18] and Brady & Livescu [7]. Its application to the present scheme is described in Appendix § 7. Briefly, the condition to be satisfied is that the row entries in columns 2 to N−1N-1 of matrix BB must have a weighted sum of zero. Here BB is the matrix representation of the right-hand-side of (27):

Af′=1hBf.(45)Af' = \frac{1}{h}Bf. \tag*{(45)}

Appendix § 7 shows that this condition is satisfied for the present boundary scheme. An alternate way to obtain conservation is the “reconstruction by primitive function” trick referred to above.

Data partitioning for parallelization

Since an entire line of data along xx is needed to compute a Padé derivative along xx, for any direction xx, we employ the pencil data structure. Each processor is assigned a pencil of data that can be thought of as a long brick with the long side along the direction of differentiation. Most of the work is done with zz-pencils (i.e., with zz as the long direction). This work includes initialization, output, and, time integration sub-steps. To compute rr derivatives, we perform a so-called “transpose” such that each processor also has rr pencils, and similarly for ϕ\phi derivatives. The flowfield arrays with zz, rr, and ϕ\phi pencilling, respectively, are dimensioned as follows:

q              (sr:er, sphi:ephi, nz, ndof)       ! pencil along z
q_r_space      (sphi:ephi, sz_r:ez_r, ndof, nr)    ! pencil along r
q_phi_space    (sr:er, sz_phi:ez_phi, ndof, nphi)  ! pencil along phi

Here ndof refers to the number of degrees of freedom (number of flow variables) at each grid-point and the other dimensions can be read, for example, as follows: sz_r:ez_r—starting zz index to ending zz index for an rr pencil. Partitioning and transpose routines were taken from Alan Wray’s Stellarbox code.

Tests

Convergence for two-dimensional advection

Here we solve the equation for a scalar, f(z,ϕ,t)f(z,\phi,t), uniformly advecting in the zz and ϕ\phi directions:

∂f∂t+∂f∂z+∂f∂ϕ=0,z∈[0,2π), ϕ∈[0,2π),(46)\frac{\partial f}{\partial t}+\frac{\partial f}{\partial z}+\frac{\partial f}{\partial\phi}=0,\quad z\in[0,2\pi),\ \phi\in[0,2\pi), \tag*{(46)}

with periodic boundary conditions and the initial condition

f(z,ϕ,0)=1+12sin⁡2zsin⁡2ϕ.(47)f(z,\phi,0)=1+\frac{1}{2}\sin2z\sin2\phi. \tag*{(47)}

The CFL is fixed at unity and the number of grid points nzn_z and nϕn_\phi is varied. Figure 2 plots the rms error at t=6πt=6\pi compared with the exact solution at t=6πt=6\pi. The rate of convergence is seen to be fourth-order.

Figure 2. Convergence for two-dimensional advection.

One-dimensional Euler equations with shocks

Figure 3 presents two test cases for the one-dimensional Euler equations which was run in the code’s zz direction by suppressing the other two. Both tests employed nz=512n_z=512 grid points and artificial pressure (with CAp=2C_{Ap}=2) to capture shocks. Figure 3a shows the solution (solid line) to the 1D shock-tube problem with initial conditions to the left and right of the diaphragm (located at x=0.8x=0.8) as follows:

Figure 3. 1D Euler equation tests. (a)–(c) : Shock tube. (a) Density. (b) Pressure. (c) Velocity. (d) Mach 3 shock propagating into density waves ([37]). The result of the present code is compared with the WENO5-Roe method. For both tests the coefficient of artificial pressure Cap=2C_{\mathrm{ap}} = 2 and Pade/compact filter strength ϵfilter=0.05\epsilon_{\mathrm{filter}} = 0.05 (applied at the end of every step). CFL = 1.

(ρL,uL,pL)=(8,0,10/γ),(ρR,uR,pR)=(1,0,1/γ),(48)(\rho_L,u_L,p_L)=(8,0,10/\gamma),\qquad(\rho_R,u_R,p_R)=(1,0,1/\gamma), \tag*{(48)}

with zero velocity everywhere and γ=1.4\gamma=1.4. The computed solution is accurate; however, small oscillations are present in the post-shock region.

Shu & Osher [37] introduced the problem of a Mach 3 shock propagating through density waves as way of testing a method’s ability to both capture shocks and resolve non-shock wavy features without excessive dissipation. The initial condition is:

(ρ,u,p)={(3.857143,2.629369,10.33333),x<4;(1+0.2sin⁡5z,0,1),x≥4.(49)(\rho,u,p)= \begin{cases} (3.857143,2.629369,10.33333), & x<4;\\ (1+0.2\sin5z,0,1), & x\ge4. \end{cases} \tag*{(49)}

The result of this test is shown in Figure 3 where the baseline comparison (dashed line) was obtained using a fifth-order WENO scheme with nz=1600n_z = 1600 points, the Roe flux, and reconstruction along characteristics. The present code performs very well.

Kelvin-Helmholtz instability

Here we consider the benchmark for viscous Kelvin-Helmholtz instability with a density gradient starting with smooth initial conditions constructed by Lecoanet et al. [17]. The full domain size is Lx×Lz=1×2L_x \times L_z = 1 \times2, however, only the lower half of the zz domain will be shown, since the rest is shift-symmetric. The resolution is nx×nzn_x \times n_z with nz=2nxn_z = 2n_x. It should be noted that L2016 write the heat conductivity as k=ρχk = \rho\chi, where χ\chi is the heat diffusivity. The actual definition (which Padé uses) is k=ρχcpk = \rho\chi c_p. Therefore, to match L2016 we needed to divide our kk by cpc_p which equals 5/25/2 for the set-up of L1016, which assumes that the gas constant R=cp−cv=1R = c_p - c_v = 1 and γ≡cp/cv=5/3\gamma\equiv c_p/c_v = 5/3. We chose time step Δt\Delta t so that the Courant-Friedrichs-Lewy number was 1.5. We initially applied the Padé filter after every step with ϵfilter=0.0025\epsilon_{\mathrm{filter}} = 0.0025, however, the associated matrix becomes ill-conditioned for very small values of ϵfilter\epsilon_{\mathrm{filter}} when the number of grid points is sufficiently large. To alleviate this, the strength of the Padé filter was applied every 40 time steps with ϵfilter=0.10\epsilon_{\mathrm{filter}} = 0.10. The simulation was run on a laptop with an Apple M2 Pro chip using 8 cpus. The cpu time per step was 0.3 s.

Figure 4a shows the density field at t=6t = 6 obtained from Padé with nx=1024n_x = 1024. It is compared with the result of L2016 obtained using their pseudo spectral code Dedalus with nx=4096n_x = 4096; we thank Prof. D. Lecoanet (Northwestern Univ.) for sending us the data. The agreement is very good.

Taylor-Couette flow

A natural test case in cylindrical coordinates is Taylor-Couette flow, i.e., viscous flow driven by rotating inner and outer cylinders with radii rir_i and ror_o, respectively. The corresponding rotation rates are Ωi\Omega_i and Ωo\Omega_o giving corresponding rotational speeds Ui≡ΩiriU_i \equiv\Omega_i r_i and Uo≡ΩoroU_o \equiv\Omega_o r_o. Two of the four non-dimensional parameters are the inner and outer Reynolds numbers Rei≡Uid/ν\mathrm{Re}_i \equiv U_i d/\nu and Reo≡Uorid/ν\mathrm{Re}_o \equiv U_o r_i d/\nu, where d=ro−rid = r_o - r_i is the gap width. The third and fourth non-dimensional parameters are the ratio η≡ri/ro\eta\equiv r_i/r_o, and the non-dimensional vertical domain size λ≡Lz/d\lambda\equiv L_z/d.

The present code solves the compressible equations while most simulations reported in the literature are for incompressible flow. To approximate incompressible simulations the rotational Mach number of the inner cylinder is set to 0.1, the equation of state is isothermal, and isothermal boundary conditions are applied at the two walls. The initial density is set to a uniform value ρ0\rho_0. Code units are such that Ui=d=ρ0=1U_i = d = \rho_0 = 1.

Torques, GiG_i and GoG_o, per unit axial length exerted on the fluid by the inner and outer cylinders, respectively, are computed as diagnostics.

torque=area averaged shear stress×r×area.(50)\text{torque} = \text{area averaged shear stress} \times r \times\text{area}. \tag*{(50)}

The area averaged shear stress is given by

τrϕ=⟨μr∂∂r(uϕr)⟩(51)\tau_{r\phi} = \left\langle\mu r \frac{\partial}{\partial r}\left(\frac{u_\phi}{r}\right)\right\rangle \tag*{(51)}

where μ\mu is the dynamic viscosity and ⟨.⟩\langle. \rangle denotes an average over the surface. Therefore,

Gi=−2πri3⟨∂∂r(μuθr)⟩r=ri(52)G_i = -2\pi r_i^3 \left\langle\frac{\partial}{\partial r}\left(\mu\frac{u_\theta}{r}\right)\right\rangle_{r=r_i} \tag*{(52)}
Go=+2πro3⟨∂∂r(μuθr)⟩r=ro(53)G_o = +2\pi r_o^3 \left\langle\frac{\partial}{\partial r}\left(\mu\frac{u_\theta}{r}\right)\right\rangle_{r=r_o} \tag*{(53)}

The negative sign in (52) arises from the fact that at r=rir = r_i, the normal to the fluid surface is in the −r-r direction. For steady flow, conservation of angular momentum implies that GiG_i and GoG_o must be equal and opposite in sign. We first consider two axisymmetric cases that produce a steady flow with counter-rotating vortices. The inner cylinder rotates at angular velocity Ωi\Omega_i while the outer cylinder is fixed. Each case was run using a 32×3232 \times32 grid (nr×nzn_r \times n_z) with

Density fields for the Kelvin–Helmholtz instability benchmark

Figure 4. Density field at t=6t = 6 for the Kelvin-Helmholtz instability benchmark of Lecoanet et al. [17]. (a) Padé code with nx=1024n_x = 1024. (b) Pseudo-spectral Dedalus code with nx=4096n_x = 4096. Data provided by D. Lecoanet.

ϵfilter=0.005\epsilon_{\mathrm{filter}} = 0.005. The first two entries of Table 1 shows that the computed torque per unit length agrees with previous published results. Marcus [23] uses units in which ρ0=d=Ωri=1\rho_0 = d = \Omega r_i = 1. Moser et al. [28] use the same units but normalize GG by ρ0ν2\rho_0\nu^2 where ν=μ/ρ0\nu= \mu/\rho_0. The values in Table 1 use the same conventions.

η≡ri/ro\eta\equiv r_i/r_oLz/dL_z/dRe⁡i\operatorname{Re}_iGiG_iGoG_oPublished GiG_iRef.
0.8752.5139.223.3485-3.34823.3539Marcus [23]
0.501.98878.81485-14851487Moser et al. [28]

Table 1. Computed torques GiG_i and GoG_o per unit axial length exerted on the fluid by the inner and outer cylinders, respectively, for steady axisymmetric Taylor-Couette flow. These values are compared with values obtained in the cited references. The values are normalized differently in the two references as described in the text.

Finally, a case of 3D unsteady counter-rotating Taylor-Couette flow is considered following Dong [10]. The inner and outer cylinders rotate counter-clockwise and clockwise, respectively with Re⁡i=−Re⁡o=500\operatorname{Re}_i = -\operatorname{Re}_o = 500, η=0.5\eta= 0.5 and Lz/d=2πL_z/d = 2\pi. Dong [10] defines the non-dimensional torque coefficient for the inner cylinder as

(CT)i=Gi12πρ0Ui2ri2Lz(54)(C_T)_i = \frac{G_i}{\frac{1}{2}\pi\rho_0 U_i^2 r_i^2 L_z} \tag*{(54)}

and similarly for the outer cylinder. The number of grid points is 48×96248 \times96^2 (nr,nz,nϕn_r, n_z, n_\phi) and the strength of the Padé filter was set to ϵfilter=0.005\epsilon_{\mathrm{filter}} = 0.005. Figure 5a and Figure 5b shows the radial velocity in a meridional and horizontal plane and reveals the three-dimensionality of the flow. Figure 5c shows the torque coefficients for the inner and outer cylinders after the flow has reached statistical stationarity. The values agree with those shown in Figure 3 of Dong [10].

Figure 5. Counter-rotating Taylor-Couette flow at Rei=−Reo=500\mathrm{Re}_{i}=-\mathrm{Re}_{o}=500 following Dong [10]. The mesh is 48×96248 \times96^{2} (nr×nz×nϕn_{r} \times n_{z} \times n_{\phi}). (a) & (b) Radial velocity contours at Uit/d=798.8U_{i}t/d=798.8. (a) The meridional plane ϕ=0\phi=0. (b) Horizontal plane at mid-height (z=πz=\pi) to show that the flow is three-dimensional. (c) Torque coefficients (black) compared with curves (red) digitized from Dong [10]'s Figure 3 and shifted backward in time by UiΔt/d=802U_{i}\Delta t/d=802. The negative of the torque coefficient is plotted for the outer cylinder.

Vertical shear instability and the effect of varying the strength of the Padé filter

Here we present results for axisymmetric vertical shear instability (VSI) at an early stage of evolution following the set up of Nelson et al. [29]. Detailed results will be presented in a forthcoming publication which will also include 3D results. The parameters of the set-up are given in Table 2. A locally isothermal equation of state

ParameterValue
Orbital period, T0T_{0}, at r0r_{0}1
Density, ρ0\rho_{0}, at r0r_{0}1
Scale height, H0H_{0}, at r0r_{0}1
Density exponent, pp−3/2-3/2
Temperature exponent, qq−1-1
Disk aspect ratio, H0/r0H_{0}/r_{0}0.10
Radial domain (including sponge), [rmin⁡/H0,rmax⁡/H0][r_{\min}/H_{0},r_{\max}/H_{0}][6.5,13.5][6.5,13.5]
Vertical domain (including sponge), [zmin⁡/H0,zmax⁡/H0][z_{\min}/H_{0},z_{\max}/H_{0}][−3.5,3.5][-3.5,3.5]
Width of sponge at domain border, δsponge/H0\delta_{\mathrm{sponge}}/H_{0}0.5
Decay period, tsponget_{\mathrm{sponge}}, for sponge20 time steps
Number of grid points, nr×nzn_{r} \times n_{z}5122512^{2}
Strength of Padé filter, ϵfilter\epsilon_{\mathrm{filter}}0.01–0.125

Table 2. Parameters for the axisymmetric vertical shear instability run. H0H_{0} is the disk scale height at mid-radius and was set to unity. Subscript ‘0’ refers to a quantity evaluated at mid-radius.

p=ρci2(r),(55)p = \rho c_i^2(r), \tag*{(55)}

is used which represents the case of infinitely rapid relaxation of temperature to the basic state. The square of the sound speed, which is proportional to the temperature, is specified as a power-law:

ci2(r)=c02(r/r0)q,(56)c_{i}^{2}(r)=c_{0}^{2}\left(r/r_{0}\right)^{q}, \tag*{(56)}

where the temperature exponent q=−1q=-1, r0r_{0} is the mid-radius of the computational domain, and c0c_{0} is chosen to make the scale height H0≡H(r0)=1H_{0}\equiv H(r_{0})=1.

Zero normal velocity boundary conditions are applied at all four domain edges. Each edge abuts a sponge region of width δsponge=0.5H0\delta_{\mathrm{sponge}}=0.5H_{0} where the flow relaxes back to the basic state with a characteristic period tsponget_{\mathrm{sponge}} given in the table.

Figure 6 shows the azimuthal vorticity, ωϕ\omega_{\phi} at t/T0=37t/T_{0}=37 which is just after saturation of the linear phase of the instability. We caution the reader that the statistically stationary state is quite different and reached much later at t/T0≈350t/T_{0}\approx350; this will be reported in a later publication. The result of using three different values for the strength, ϵfilter\epsilon_{\mathrm{filter}},

Azimuthal vorticity for $\epsilon_{\mathrm{filter}}=0.01$

(a) Azimuthal vorticity, t/T0=37t/T_0=37, ϵfilter=0.01\epsilon_{\mathrm{filter}}=0.01.

Azimuthal vorticity on the mesh for $\epsilon_{\mathrm{filter}}=0.01$

(b) Azimuthal vorticity, t=37t=37, ϵfilter=0.01\epsilon_{\mathrm{filter}}=0.01.

Azimuthal vorticity for $\epsilon_{\mathrm{filter}}=0.04$

(c) Azimuthal vorticity, t/T0=37t/T_0=37, ϵfilter=0.04\epsilon_{\mathrm{filter}}=0.04.

Azimuthal vorticity on the mesh for $\epsilon_{\mathrm{filter}}=0.04$

(d) Azimuthal vorticity, t=37t=37, ϵfilter=0.04\epsilon_{\mathrm{filter}}=0.04.

Azimuthal vorticity for $\epsilon_{\mathrm{filter}}=0.125$

(e) Azimuthal vorticity, t/T0=37t/T_0=37, ϵfilter=0.125\epsilon_{\mathrm{filter}}=0.125.

Azimuthal vorticity on the mesh for $\epsilon_{\mathrm{filter}}=0.125$

(f) Azimuthal vorticity, t=37t=37, ϵfilter=0.125\epsilon_{\mathrm{filter}}=0.125.

Figure 6. Effect of varying the strength of the Padé filter, ϵfilter\epsilon_{\mathrm{filter}} when the Padé filter is used as an implicit sub-grid scale treatment for an axisymmetric VSI simulation. Completely white pixels are where ωϕ\omega_\phi exceeds the range of the legend. The mesh size is 5122512^2. The plots in the right-hand column are intended to show the level of numerical 2Δ2\Delta oscillations which appear as sawtooth features.

of the Padé filter is shown. The azimuthal vorticity consists of pairs of shear layers of opposite sign which induce up and down jets of vertical velocity (Figure 7a) that are characteristic of VSI ([29]). The shear layers roll up into discrete eddies via the Kelvin-Helmholtz instability. It is important to note that VSI also produces shear layers with ∂δuϕ/∂r\partial\delta u_\phi/\partial r shear, i.e., radial gradients of perturbation angular velocity. These are shown in Figure 7b which plots the azimuthal velocity perturbation, δuϕ\delta u_\phi, and shows that is it about 2/32/3 the value of the vertical velocity perturbation. This shear will also be subject to Kelvin-Helmholtz instability, however, it will be modified by the presence of mean Keplerian shear.

Vertical velocity and perturbation azimuthal velocity

Figure 7. (a) Vertical velocity for the axisymmetric vertical shear instability simulation using a 5122512^2 mesh. The units of velocity are scale heights (H0H_0) per orbit time (T0T_0). (b) Similarly, the perturbation azimuthal velocity.

We now discuss how a user should choose the filter strength, ϵfilter\epsilon_{\mathrm{filter}}. Direct numerical simulations (DNS) of turbulent flow are performed with molecular viscosity and all the scales of the turbulence down to the dissipation scale are well resolved. In this case, the very minimum value of ϵfilter\epsilon_{\mathrm{filter}} should be chosen. For instance in the Taylor-Couette simulations we chose ϵfilter=0.005\epsilon_{\mathrm{filter}} = 0.005.

However, the Reynolds number in protoplanetary disks is too large for numerical simulations to be able to resolve all the turbulent scales. Therefore, some treatment of the unresolved scales is required. For engineering and geophysical flows, the most common practice is to use an explicit model for the sub-grid stresses, the simplest being the Smagorinsky model. Another approach, followed for all protoplanetary disk simulations to date, is to simply let the dissipation inherent in the numerical method damp scales near the grid cut-off. This procedure is referred to as implicit large-eddy simulation (ILES) and was first articulated by Boris et al. [6]. Comparison with direct numerical simulations (DNS, in which all scales are resolved) have since shown that it is accurate (Ritos et al. [32]). In our approach, we use the dissipation provided by the Padé filter as an implicit sub-grid treatment. To leading order, the Padé filter corresponds to a fourth-order hyperviscosity; see equation (30) in Shariff & Wray [36] and the discussion following it.

When the Padé filter is used an ILES treatment, ϵfilter\epsilon_{\mathrm{filter}} should be chosen to balance the desire to capture as wide a range of small scales possible (with a fixed grid size) by lowering ϵfilter\epsilon_{\mathrm{filter}}, while at the same not allowing too much energy to pile-up in 2Δ2\Delta waves. For illustration, Figure 6 shows the result of varying the strength, ϵfilter\epsilon_{\mathrm{filter}}, of the filter on the vorticity field. The reader may refer back to Figure 1b which shows the filter transfer function for different ϵfilter\epsilon_{\mathrm{filter}} choices. The left hand column of plots in Figure 6 shows that with reduced ϵfilter\epsilon_{\mathrm{filter}} more finer scales of the flow are resolved. The right-hand column of plots zoom in to a square region with sides equal to HH. For the lowest filter strength (ϵfilter=0.01\epsilon_{\mathrm{filter}} = 0.01), 2Δ2\Delta (sawtooth) oscillations can be observed in thin vortex layers oriented at 45∘45^\circ to the mesh. For ϵfilter=0.04\epsilon_{\mathrm{filter}} = 0.04 and 0.1250.125, smaller amplitude oscillations are present in one vorticity layer whose width is about one grid diagonal, which is very thin indeed. These oscillations are not visually detectable in plots of the velocity field even for ϵfilter=0.01\epsilon_{\mathrm{filter}} = 0.01. We conclude that 0.1250.125 would be a conservative choice for ϵfilter\epsilon_{\mathrm{filter}}.

Finally, we would like to discuss some physical effects that manifest as diffusivity represented by the filter is reduced and the effective resolution is increased. (a) The rolled-up vortices are smaller and there are more of them. This is explained as follows. The shear-layer thickness, δ\delta, is reduced with smaller diffusivity. The most amplified Kelvin-Helmholtz (KH) wavelength λ≈2πδ\lambda\approx2\pi\delta is therefore also reduced, and with it the size of the vortices. The number of vortices increases because there are more waves per unit length. (b) The shear-layer vorticity increases. We have that ωϕ∼ΔU/δ\omega_\phi\sim\Delta U/\delta where ΔU\Delta U, the jump in velocity across each shear layer, is independent of diffusivity. Therefore a reduction in δ\delta with diffusivity leads to increased ωϕ\omega_\phi. (c) The rolled-up vortices appear earlier. The KH growth-rate ∝ΔUkmax⁡\propto\Delta U k_{\max}, where kmax⁡k_{\max} is the most amplified wavenumber. Since kmax⁡k_{\max} increases with reduced thickness, the KH vortices develop earlier with reduced diffusivity. (d) The vorticity in the the rolled-up vortex cores increases. For each vortex we have ωϕ∼Γ/area\omega_\phi\sim\Gamma/\mathrm{area}, where Γ∼ΔUλ\Gamma\sim\Delta U\lambda is its circulation. Since the vortex area ∼λ2\sim\lambda^2, we get that ωϕ∼ΔU/λ\omega_\phi\sim\Delta U/\lambda which increases since λ\lambda decreases.

3D vertical shear instability: comparison of Fargo and non-Fargo runs

In Shariff & Wray [36] a comparison (with plots of error) was made between runs with and without the Fargo treatment for the case of two co-rotating vortices in a razor thin disk. Here, we perform a similar comparison for 3D vertical shear instability (VSI). The simulation was first run till t/T0=300.27t/T_0 = 300.27 with Fargo activated. Next runs were made with and without Fargo for one orbital period (T0T_0) at mid-radius. The run parameters are the same as for the axisymmetric run presented in Table 2. The only differences are a resolution of 512×512×1024512 \times512 \times1024 (nr×nz×nϕn_r \times n_z \times n_\phi) with an azimuthal domain of ϕ∈[0,2π)\phi\in[0, 2\pi), and a Padé filter strength of ϵfilter=0.125\epsilon_{\mathrm{filter}} = 0.125. For the non-Fargo run, the Padé filter was applied every other time step due to the fact that this run required about twice as many time steps as the run with Fargo.

Figure 8 compares the vertical vorticity (δωz\delta\omega_z) perturbation (relative to the basic state) in the z/H0=2z/H_0 = 2 plane after a time of 0.5T00.5T_0, i.e., at t/T0=300.77t/T_0 = 300.77. Here T0T_0 is the orbital period at the mid-radius of the computational domain. The difference in the two solutions at this time is very small. Due to the chaotic nature of the flow, the error due to the different time steps, Δt\Delta t, chosen for the two simulations grows with time and differences become more apparent. The CFL number was chosen to be 1.5 and based on this, the time step selected by the code for the non-Fargo run was Δt/T0=2.25×10−4\Delta t/T_0 = 2.25 \times10^{-4}. This choice was constrained by Keplerian advection. For the Fargo run, the code selected Δt/T0=5.49×10−4\Delta t/T_0 = 5.49 \times10^{-4} for the same CFL number which represents a better than factor of two improvement. In the run with Fargo, the choice of time step was constrained by the characteristic-wave speed and grid size in the radial direction. The cpu time for the non-Fargo and Fargo runs was 1.50 and 1.76 seconds per step. This represents a 17.3% overhead for a more than factor of two gain in time step. The Intel Broadwell processor was used for these runs.

Perturbation vertical vorticity in the horizontal plane for runs with and without Fargo

Figure 8. A portion of the horizontal plane (r,ϕ)(r,\phi) cutting through the disc at z/H0=2z/H_0 = 2 comparing perturbation vertical vorticity, δωz\delta\omega_z, for a 3D VSI run with and without Fargo. Each run was started at t/T0=300.27t/T_0 = 300.27 and run for 0.5T00.5T_0 up to t/T0=300.77t/T_0 = 300.77. (a) With Fargo. (b) Without Fargo.

We close with a brief description of the physics observed in the 3D VSI runs. The Keplerian mean flow is counter-clockwise in Figure 8 and the vertical vorticity perturbation consists of layers of cyclonic δωz\delta\omega_z (red bands) which induce across them, a positive jump in specific angular momentum, jϕ=uϕrj_\phi= u_\phi r as rr increases. These layers are formed by the vertical transport of basic state angular momentum by the vertical jets that are the main feature of VSI. This will be discussed in more detail in a forthcoming paper. In between the cyclonic layers, one observes weaker and more diffuse anti-cyclonic δωz\delta\omega_z which reduces jϕj_\phi compared to the basic state. In the inner portion of the disk, anti-cyclonic δωz\delta\omega_z structures take the form of smaller aspect ratio structures.

Parallel scaling tests for 3D vertical shear instability runs

Following the suggestion of the referee, the efficiency η\eta of the code is defined as the ratio of the useful work to the resources consumed. The useful work is the number NgridN_{\mathrm{grid}} of grid points evolved while the resources consumed is the cpu time tcput_{\mathrm{cpu}} (per time step in secs.) times the number of cores, NcoresN_{\mathrm{cores}}. We also include the ratio Δtactual/ΔtFargo\Delta t_{\mathrm{actual}}/\Delta t_{\mathrm{Fargo}} to account for the reduced time step in non-Fargo runs:

η≡Ngrid/217tcpuNcoresΔtactualΔtFargo,(57)\eta\equiv\frac{N_{\mathrm{grid}}/2^{17}}{t_{\mathrm{cpu}}N_{\mathrm{cores}}}\frac{\Delta t_{\mathrm{actual}}}{\Delta t_{\mathrm{Fargo}}}, \tag*{(57)}

where we have normalized the number of grid points to 2172^{17}. When there is perfect scaling, η\eta should be a constant as NcoresN_{\mathrm{cores}} is increased.

All the tests in this sub-section were performed using Intel Haswell nodes which use the E5-2680V3 (Xeon) processor. The variable MPI_IB_RAILS used by the InfiniBand network was set to 2; this causes two InfiniBand (IB) fabrics to be used for communication and results in reduced cpu time. Figure 9a and Figure 9b plot η\eta for a 3D vertical shear instability (VSI) setup with Fargo activated; therefore the ratio Δtactual/ΔtFargo\Delta t_{\mathrm{actual}}/\Delta t_{\mathrm{Fargo}} in (57) equals unity.

Figure 9. Scaling tests for the 3D vertical shear instability (VSI) set-up performed using the Intel Haswell nodes. The environment variable MPI_IB_RAILS used by the InfiniBand network was set to 2 for all runs. (a) Efficiency, η\eta, for the weak scaling test where the problem size per processor is fixed. (b) Efficiency for the strong scaling test where the total problem size is fixed at nr×nz×nϕ=512×512×1024n_r \times n_z \times n_\phi= 512 \times512 \times1024. (c) Efficiency, η\eta, with Fargo deactivated. The measure, η\eta, accounts for the decrease in time step when Fargo is deactivated.

Figure 9a is for a weak scaling test in which the grid size per core is kept fixed while NcoresN_{\mathrm{cores}} is increased. In other words, both NcoresN_{\mathrm{cores}} and the total grid size increase simultaneously. In the present test, the number of grid points for the one core run is 64×32×6464 \times32 \times64 (nr×nz×nϕn_r \times n_z \times n_\phi) and each direction is successively doubled in resolution as NcoresN_{\mathrm{cores}} doubles. Figure 9a plots two curves, one which used the actual cpu time (solid) and another (dashed) for which the time taken to perform transposes was subtracted out. Both curves show an initial rapid decrease in η\eta up to Ncores=8N_{\mathrm{cores}} = 8. The main cause of this is likely the fact that each Xeon processor in a Haswell node has 12 cores which share a single memory and level 3 cache. Contention for both resources increases as the number of cores increases from 1 to 12. Therefore, we focus on the region Ncores≥12N_{\mathrm{cores}} \ge12. At Ncores=2048N_{\mathrm{cores}} = 2048, the efficiency has decreased to 38% of its value at Ncores=16N_{\mathrm{cores}} = 16. When the cpu time for transposes is subtracted out, the efficiency remains relatively flat. This indicates that the loss in efficiency is due to communication intensive transposes. Indeed, the fraction of time (not shown) taken for transposes increases from 0.38 to 0.73 as NcoresN_{\mathrm{cores}} increases from 16 to 2048.

Figure 9b is for a strong scaling test in which the total problem size is fixed at 512×512×1024512 \times512 \times1024 (nr×nz×nϕn_r \times n_z \times n_\phi) and the number of cores is varied. At Ncores=2048N_{\mathrm{cores}} = 2048, the efficiency has decreased to 67% of its value at Ncores=64N_{\mathrm{cores}} = 64. The cpu fraction taken for transposes increases from 0.57 to 0.73 (not shown) in this range. When the cpu time for transposes is subtracted out, the efficiency increases slowly. This is explained as follows. In the strong test, the total number of memory fetches is constant with increasing NcoresN_{\mathrm{cores}}, however, the number of cache hits (when needed data is found to be already in cache) is likely to be statistically higher since the number of cache slots per fetch is higher with more cores.

Figure 9c compares the efficiency of the Fargo versus the non-Fargo scheme. It shows that there is at least a factor of 3.7 advantage to using Fargo, i.e., the overhead of the Fargo method is more than compensated by an increase in time step.

In conclusion, the all-to-all communication of transposes leads to a significant loss in efficiency as the number of cores is increased. To reduce this communication overhead, an effort is underway to use a parallel Padé algorithm Kim et al. [15].

Closing Remarks

A code has been developed that uses a fourth-order Padé scheme to simulate hydrodynamic turbulence in protoplanetary disks. Padé schemes are non-dissipative and have high resolving power. Thus, with the same grid resolution, they are better able to fine scale vortical features compared to the dissipative shock capturing schemes employed in most astrophysics codes. They also have better resolving power then central finite difference schemes of the same order.

Suggested improvements are as follows. (i) To eliminate communication intensive transposes, consider using parallel tridiagonal matrix algorithms Kim et al. [15], and the references therein) which require much less communication. Kim et al. [15] demonstrate good scaling as the number of cores is increased. (ii). For simulations that require long radial domains (more than ≈6\approx6 scale heights) it would be better to use spherical rather than cylindrical coordinates. An option for this could be provided. (iii) The sixth-order tridiagonal Padé scheme

αfj−1′+fj′+αfj+1′=a2h(fj+1−fj−1)+b4h(fj+2−fj−2),(58)\alpha f'_{j-1} + f'_j + \alpha f'_{j+1} = \frac{a}{2h}(f_{j+1} - f_{j-1}) + \frac{b}{4h}(f_{j+2} - f_{j-2}), \tag*{(58)}

with α=1/3\alpha= 1/3, a=14/9a = 14/9, and b=1/9b = 1/9 could be implemented. (iv) The capability to track Lagrangian solid particles could be provided. (v) An intercomparison effort with other codes could be performed.

The code is available at https://github.com/NASA-Planetary-Science/Pade-disk-code and https://zenodo.org/records/11114378. The citation for Zenodo is Shariff [35].

I am grateful to Alan Wray (NASA Ames) for providing several routines that have been used in Padé, including directional transposes, tridiagonal solvers, and the Padé filter. He also helped to explain features observed in the scaling tests. I am grateful to Jeff Cuzzi (NASA Ames) for performing the internal review and for his encouragement, Debanjan Sengupta (New Mexico State Univ., Las Cruces) for performing the internal review and suggesting the weak scaling test; Orkan Umurhan (SETI Inst.) for his encouragement and advice on the vertical shear instability runs, Prof. Ali Mani (Stanford Univ.) for advice on the implementation of artificial bulk viscosity, and Prof. Daniel Lecoanet (Northwestern Univ.) for providing the result of the Kelvin-Helmholtz test case run with Dedalus. Finally, I thank the referee for many useful suggestions that improved the paper. This work was partly supported by NASA’s Internal Scientist Funding Model (ISFM) through the “Origins” group in NASA Ames’ Space Science Division.

Molecular viscous force, viscous heating, and heat conduction

The code provides the option to add terms that represent molecular viscosity and heat conduction. Similar terms arise in models of sub-grid turbulence. For these we have coded the models due to Smagorinsky [38] and Vreman [41]. However, since we have not tested them, this section describes the implementation for the molecular/laminar case only. If the Fargo option has been activated, Fargo chain-rule is applied wherever needed.

Viscous force

The viscous stress tensor is

Tij=2μSij+(μb−23μ)Skkδij,(59)T_{ij} = 2\mu S_{ij} + \left(\mu_b - \frac{2}{3}\mu\right)S_{kk}\delta_{ij}, \tag*{(59)}

where μ\mu and μb\mu_b are the shear and bulk viscosities, respectively, and

Sij=12(∂jui+∂iuj)(60)S_{ij} = \frac{1}{2}\left(\partial_j u_i + \partial_i u_j\right) \tag*{(60)}

is the strain rate tensor.

Equation (A1) is implemented in subroutine laminar_stress_and_heat_flux. The components of the strain tensor (which is symmetric) are computed in subroutine strain_tensor as follows

Szz=∂zuz,Sϕz=12(∂zuϕ+1r∂ϕuz),Szr=12(∂ruz+∂zur),(61)S_{zz} = \partial_z u_z,\quad S_{\phi z} = \frac{1}{2}\left(\partial_z u_\phi+ \frac{1}{r}\partial_\phi u_z\right),\quad S_{zr} = \frac{1}{2}\left(\partial_r u_z + \partial_z u_r\right), \tag*{(61)}
Srr=∂rur,Srϕ=12(1r∂ϕur+∂ruϕ−uϕr),Sϕϕ=1r∂ϕuϕ+urr.(62)S_{rr} = \partial_r u_r,\quad S_{r\phi} = \frac{1}{2}\left(\frac{1}{r}\partial_\phi u_r + \partial_r u_\phi- \frac{u_\phi}{r}\right),\quad S_{\phi\phi} = \frac{1}{r}\partial_\phi u_\phi+ \frac{u_r}{r}. \tag*{(62)}

The above expressions are from Aris [2] and agree with Batchelor [3].

The viscous force is the divergence of the viscous stress tensor and given by Aris [2] for orthogonal coordinates as follows (in his notation):

Fiv=T(ij,j)=hih1h2h3∂∂xj[h1h2h3hihjT(ij)]+hihjhk{jki}T(jk),(no sum on i).(63)F_i^{\mathrm{v}} = T_{(ij,j)} = \frac{h_i}{h_1h_2h_3}\frac{\partial}{\partial x_j}\left[\frac{h_1h_2h_3}{h_i h_j}T_{(ij)}\right] + \frac{h_i}{h_jh_k}\left\{^{i}_{jk}\right\}T_{(jk)},\quad\text{(no sum on }i\text{)}. \tag*{(63)}

Here (x1,x2,x3)=(r,ϕ,z)(x_1,x_2,x_3)=(r,\phi,z) and corresponding scale factors are h1=hr=1h_1=h_r=1, h2=hϕ=rh_2=h_\phi=r, and h3=hz=1h_3=h_z=1. The quantities in braces are Christoffel symbols and the only non-zero ones are

{122}={212}=rand{221}=−r.(64)\left\{^{2}_{12}\right\}=\left\{^{2}_{21}\right\}=r\quad\text{and}\quad\left\{^{1}_{22}\right\}=-r. \tag*{(64)}

The symbolic algebra package maxima was used to verify the correctness of Aris’ expression (A5) by writing Cartesian velocities in terms of cylindrical quantities (velocities and coordinates) and computing Cartesian viscous forces in terms of cylindrical quantities using the chain rule throughout. These can be be rotated to obtain the forces in cylindrical coordinates in terms of cylindrical quantities and compared with (A5). The relevant maxima script can be found in check_Aris.mac in the Symbolic_algebra sub-directory.

The final expressions for the viscous force area:

Fzv=1r[∂r(rTzr)+∂ϕ(Tzϕ)+∂z(rTzz)],(65)F_z^{\mathrm{v}} = \frac{1}{r}\left[\partial_r(rT_{zr})+\partial_\phi(T_{z\phi})+\partial_z(rT_{zz})\right], \tag*{(65)}
Frv=1r[∂r(rTrr)+∂ϕ(Trϕ)+∂z(rTrz)]−1rTϕϕ,(66)F_r^{\mathrm{v}} = \frac{1}{r}\left[\partial_r(rT_{rr})+\partial_\phi(T_{r\phi})+\partial_z(rT_{rz})\right]-\frac{1}{r}T_{\phi\phi}, \tag*{(66)}
Fϕv=∂r(Tϕr)+1r∂ϕ(Tϕϕ)+∂z(Tϕz)+2rTϕr.(67)F_\phi^{\mathrm{v}} = \partial_r(T_{\phi r})+\frac{1}{r}\partial_\phi(T_{\phi\phi})+\partial_z(T_{\phi z})+\frac{2}{r}T_{\phi r}. \tag*{(67)}

These agree with the expressions given on p. 739B of Bird et al. [5].

Viscous heating

The equation for total energy e=eint+ρuiuie = e_{\mathrm{int}} + \rho u_i u_i (per unit volume) has a term for the work done by shear stresses [21 p. 335],

Wshear=∂∂xj(Tijui).(68)W^{\mathrm{shear}} = \frac{\partial}{\partial x_j}(T_{ij}u_i). \tag*{(68)}

For the internal energy equation which we solve, we must subtract the kinetic energy dissipation:

D=ui∂∂xjTij.(69)D = u_i\frac{\partial}{\partial x_j}T_{ij}. \tag*{(69)}

This gives the viscous heating term for the internal energy

Qv=Wshear−D=Tij∂ui∂xj.(70)Q^{\mathrm{v}} = W^{\mathrm{shear}} - D = T_{ij}\frac{\partial u_i}{\partial x_j}. \tag*{(70)}

Now TijT_{ij} is symmetric so only the symmetric part of ∂jui\partial_j u_i survives. Then substituting the constitutive equation (A1) for TijT_{ij} into (A12) one obtains

Qv=2μSijSij+(μb−23μ)Skk2.(71)Q^{\mathrm{v}} = 2\mu S_{ij}S_{ij} + \left(\mu_b - \frac{2}{3}\mu\right)S_{kk}^{2}. \tag*{(71)}

Heat conduction

The flux of internal energy due to molecular conductivity is given by Fourier’s law:

q⃗cond=−kcv∇(cvT),(72)\vec{q}_{\mathrm{cond}} = -\frac{k}{c_v}\nabla(c_vT), \tag*{(72)}

where we have multiplied and divided by cvc_v inside and outside the gradient, respectively. This assumes that cvc_v is constant, i.e., that we have a calorically perfect gas. Now cvTc_vT is simply eint/ρe_{\mathrm{int}}/\rho, and using the definition of the Prandtl number Pr⁡≡μcp/k\operatorname{Pr} \equiv\mu c_p/k we get

kcv=μγPr⁡.(73)\frac{k}{c_v} = \frac{\mu\gamma}{\operatorname{Pr}}. \tag*{(73)}

Discrete conservation

Theory

Here we describe how to choose boundary schemes to ensure that the overall scheme possesses a discrete conservation property. We follow Lele [18] and Brady & Livescu [7] and offer two clarifications: (1) There is a distinction between provisional and final weights; the weights given in §4.2 of Lele [18] are provisional. (2) The weights cannot be specified a priori and must be determined as part of the solution. Specifically, one needs to verify that the final weights provide a reasonable discrete conservation law. In general, the final weights will not correspond exactly to a quadrature rule.

For a system of partial differential equations in more than one dimension, we compute derivatives of fluxes along each direction separately. Hence, it is sufficient to consider the one-dimensional partial differential equation

∂u∂t+∂f∂x,x∈[0,L].(74)\frac{\partial u}{\partial t} + \frac{\partial f}{\partial x}, \qquad x \in[0,L]. \tag*{(74)}

Upon integration over the domain, (B16) gives the conservation law:

ddt∫0Lu(x,t) dx=f(0)−f(L).(75)\frac{d}{dt}\int_0^L u(x,t)\,dx = f(0)-f(L). \tag*{(75)}

Padé differencing applied to (B16) should possess a discrete analog of (B17); in its absence, a long time solution can drift and fail to achieve statistical stationarity. Padé difference schemes have the form

Af′=Bf.(76)A\mathbf{f}' = B\mathbf{f}. \tag*{(76)}

where AA and BB are banded matrices and henceforth, lower case bold letters will be used to denote column vectors. We now state a result that was stated by Lele [18] without a proof, which was later provided by Brady & Livescu [7].

Proposition 1. To obtain a discrete analog of (B17), columns 2 through N−1N-1 of matrix BB must have a weighted sum of zero, i.e.,

wTbi=0for i∈[2,N−1],(77)\mathbf{w}^{T}\mathbf{b}_{i}=0 \quad\text{for } i\in[2,N-1], \tag*{(77)}

where w\mathbf{w} is a column vector of weights and bi\mathbf{b}_{i} is the iith column of matrix BB. The weights w\mathbf{w} are provisional; final weights will be given below.

Remark. Not all the weights, w\mathbf{w}, can be specified a priori but must be obtained as part of the process of satisfying (B19).

Proof. We assume that grid points xix_i, i=1,…,Ni=1,\ldots,N have been laid out according to a smooth analytic mapping x(ξ)x(\xi) such that ξi=i\xi_i=i, i.e., ξ\xi is a smooth grid index variable. In implementations, it is convenient to take derivatives with respect to ξ\xi and then use the chain rule:

(∂f∂x)i=(∂f∂ξ)i(dξdx)i.(78)\left(\frac{\partial f}{\partial x}\right)_i=\left(\frac{\partial f}{\partial\xi}\right)_i\left(\frac{d\xi}{dx}\right)_i . \tag*{(78)}

For simplicity we use the notation

fi′(ξ)≡(∂f∂ξ)i,hi−1=(dξdx)i.(79)f_i'(\xi)\equiv\left(\frac{\partial f}{\partial\xi}\right)_i,\qquad h_i^{-1}=\left(\frac{d\xi}{dx}\right)_i . \tag*{(79)}

Then the spatially discretized version of (B17) is

duidt+1hi∑j,k[A−1]ijBjkfk=0.(80)\frac{du_i}{dt}+\frac{1}{h_i}\sum_{j,k}[A^{-1}]_{ij}B_{jk}f_k=0. \tag*{(80)}

Defining the vector U=[h1u1,h2u2,…,hNuN]T\mathbf{U}=[h_1u_1,h_2u_2,\ldots,h_Nu_N]^T, we can write (B22) as

AdUdt+Bf=0.(81)A\frac{d\mathbf{U}}{dt}+B\mathbf{f}=0. \tag*{(81)}

A weighted sum is applied to (B23) to mimic the integration in (B17):

ddtwTAU=−wTBf.(82)\frac{d}{dt}\mathbf{w}^{T}A\mathbf{U}=-\mathbf{w}^{T}B\mathbf{f}. \tag*{(82)}

Following Brady & Livescu [7], let B=[b1,b2,…,bN]B=[\mathbf{b}_1,\mathbf{b}_2,\ldots,\mathbf{b}_N] where bi\mathbf{b}_i denotes the iith column vector of the matrix BB. Now

wTB=wT[b1,b2,…,bN],(83)\mathbf{w}^{T}B=\mathbf{w}^{T}[\mathbf{b}_1,\mathbf{b}_2,\ldots,\mathbf{b}_N], \tag*{(83)}
=[wTb1,wTb2,…,wTbN],(84)=[\mathbf{w}^{T}\mathbf{b}_1,\mathbf{w}^{T}\mathbf{b}_2,\ldots,\mathbf{w}^{T}\mathbf{b}_N], \tag*{(84)}
Equation not extracted
(85)

so that

wTBf=∑i=1NwTbifi.(86)\mathbf{w}^{T}B\mathbf{f}=\sum_{i=1}^{N}\mathbf{w}^{T}\mathbf{b}_if_i. \tag*{(86)}

Hence (B24) can be written

ddtwTAU=−wTb1f1−wTbNfN−∑i=2N−1wTbifi.(87)\frac{d}{dt}\mathbf{w}^{T}A\mathbf{U}=-\mathbf{w}^{T}\mathbf{b}_1f_1-\mathbf{w}^{T}\mathbf{b}_Nf_N-\sum_{i=2}^{N-1}\mathbf{w}^{T}\mathbf{b}_if_i. \tag*{(87)}

In order to arrive at a discrete conservation law analogous to (B17), let us try imposing

∑i=2N−1wTbifi=0.(88)\sum_{i=2}^{N-1}\mathbf{w}^{T}\mathbf{b}_if_i=0. \tag*{(88)}

For (B30) to be true for arbitrary fif_i we must have that

wTbi=0for i∈[2,N−1].(89)\mathbf{w}^{T}\mathbf{b}_i=0 \quad\text{for } i\in[2,N-1]. \tag*{(89)}

In other words we want columns 2 through N−1N-1 of the matrix BB to have a weighted sum of zero.

We now show, finally, that the trial condition (B31) does indeed lead to a discrete conservation law. Equation (B31) gives the set of conditions one uses to solve for the provisional weights. Then (B29) becomes

ddtw~TU=−wTb1f1−wTbNfN,(90)\frac{d}{dt}\widetilde{\mathbf{w}}^{T}\mathbf{U}=-\mathbf{w}^{T}\mathbf{b}_{1}f_{1}-\mathbf{w}^{T}\mathbf{b}_{N}f_{N}, \tag*{(90)}

where we have defined a new set of weights

w~T=wTA.(91)\widetilde{\mathbf{w}}^{T}=\mathbf{w}^{T}A. \tag*{(91)}

Now wTb1\mathbf{w}^{T}\mathbf{b}_{1} is a number and if we use the same boundary schemes and quadrature weights at the left and right boundaries then −wTb1=+wTbN-\mathbf{w}^{T}\mathbf{b}_{1}=+\mathbf{w}^{T}\mathbf{b}_{N} and we can divide (B32) by it. Finally, putting back Ui=uihiU_i=u_i h_i (B32) we get the desired discrete conservation law

ddt∑i=1Nw~ihiui=f1−fN,(92)\frac{d}{dt}\sum_{i=1}^{N}\widetilde{w}_i h_i u_i=f_1-f_N, \tag*{(92)}

where the final weights are

w^=−wTAwTb1.(93)\widehat{\mathbf{w}}=-\frac{\mathbf{w}^{T}A}{\mathbf{w}^{T}\mathbf{b}_{1}}. \tag*{(93)}

Note that this expression is homogeneous in the provisional weights w\mathbf{w}. Hence we may scale the provisional weights as we wish when we solve equations (B31) to determine them. In particular, it it is convenient to choose them to be unity in the interior of the domain.

Application to the present differentiation scheme

We consider matrix entries near the left end of the domain; the weights near the right end are obtained by symmetry. Referring back to § 3.4, the first five columns of the right-hand-side matrix of the present Padé scheme are

B=(a1b1c1−a^0a^−a^0a^−a^0a^−a^0−a^),(94)B= \begin{pmatrix} a_1 & b_1 & c_1 & & \\ -\widehat{a} & 0 & \widehat{a} & & \\ & -\widehat{a} & 0 & \widehat{a} & \\ & & -\widehat{a} & 0 & \widehat{a} \\ & & & -\widehat{a} & 0 \\ & & & & -\widehat{a} \end{pmatrix}, \tag*{(94)}

where we have defined a^=a/2\widehat{a}=a/2. The condition that the weighted sum of the fifth column equals zero implies that w4=w6w_4=w_6 which we set equal to unity. The same holds true for the rest of the interior weights. The condition on the fourth column implies that w3=w5w_3=w_5 which we also set equal to unity. Using the fact that w3=1w_3=1, the second column gives the condition

w1b1−a^=0,(95)w_1b_1-\widehat{a}=0, \tag*{(95)}

or

w1=a^/b1=(3/4)/2=3/8.(96)w_1=\widehat{a}/b_1=(3/4)/2=3/8. \tag*{(96)}

The third column gives

w1c1+w2a^−w4a^=0.(97)w_1c_1+w_2\widehat{a}-w_4\widehat{a}=0. \tag*{(97)}

Using known information, we get

w2=1−c1/b1=3/4.(98)w_2=1-c_1/b_1=3/4. \tag*{(98)}

We now have all the provisional weights.

The final weights are obtained from (B35) where the first four columns of the LHS matrix for the present scheme is

A=(1α10α1αα1αα1α)(99)A= \begin{pmatrix} 1 & \alpha_1 & 0 & \\ \alpha& 1 & \alpha& \\ & \alpha& 1 & \alpha\\ & & \alpha& 1 \\ & & & \alpha \end{pmatrix} \tag*{(99)}

Hence (B35) gives the final weights as

w^1=−w1+w2αw1a1−w2a^=38(100)\widehat{w}_1 = -\frac{w_1 + w_2\alpha}{w_1a_1 - w_2\widehat{a}} = \frac{3}{8} \tag*{(100)}
w^2=−w1α1+w2+w3αw1a1−w2a^=76(101)\widehat{w}_2 = -\frac{w_1\alpha_1 + w_2 + w_3\alpha}{w_1a_1 - w_2\widehat{a}} = \frac{7}{6} \tag*{(101)}
w^3=−w2α+w3+w4αw1a1−w2a^=2324(102)\widehat{w}_3 = -\frac{w_2\alpha+ w_3 + w_4\alpha}{w_1a_1 - w_2\widehat{a}} = \frac{23}{24} \tag*{(102)}
w^j=−wj−1α+wj+wj+1αw1a1−w2a^=1,j∈[4,N−3].(103)\widehat{w}_j = -\frac{w_{j-1}\alpha+ w_j + w_{j+1}\alpha}{w_1a_1 - w_2\widehat{a}} = 1,\qquad j \in[4,N-3]. \tag*{(103)}

It is interesting that w^1+w^2+w^3=5/2\widehat{w}_1 + \widehat{w}_2 + \widehat{w}_3 = 5/2 which would be the case for trapezoidal rule and indeed the three weights approximate the weights 1/2, 1, and 1 for trapezoidal rule.

References

  1. [1]Adams, N., & Shariff, K. 1996, JChPh, 127, 27, doi: https://doi.org/10.1006/jcph.1996.0156
  2. [2]Aris, R. 1989, Vectors, Tensors, and the Basic Equations of Fluid Mechanics (New York: Dover)
  3. [3]Batchelor, G. 1967, An Introduction to Fluid Dynamics (Cambridge, UK: Cambridge Univ. Press)
  4. [4]Benítez-Llambay, P., & Masset, F. S. 2016, ApJS, 223, 11, doi: 10.3847/0067-0049/223/1/11
  5. [5]Bird, R., Stewart, W., & Lightfoot, E. 1960, Transport phenomena (New York: John Wiley & Sons, Inc.)DOI
  6. [6]Boris, J. P., Grinstein, F. F., Oran, E. S., & Kolbe, R. L. 1992, Fluid Dyn. Res., 10, 199, doi: 10.1016/0169-5983(92)90023-PDOI
  7. [7]Brady, P., & Livescu, D. 2019, Computers & Fluids, 183, 84, doi: https://doi.org/10.1016/j.compfluid.2018.12.010
  8. [8]Brandenburg, A., Johansen, A., Bourdin, P., et al. 2021, J. Open Source Soft., 6, 2807, doi: 10.21105/joss.02807DOI
  9. [9]Cook, A. W., & Cabot, W. H. 2005, J. Comp. Phys., 203, 379, doi: 10.1016/j.jcp.2004.09.011DOI
  10. [10]Dong, S. 2008, J. Fluid Mech., 615, 371–399, doi: 10.1017/S0022112008003716DOI
  11. [11]Frigo, M., & Johnson, S. 2005, Proceedings of the IEEE, 93, 216
  12. [12]Gustafsson, B. 1981, SIAM J. Num. Anal., 18, 179, doi: 10.1137/0718014DOI
  13. [13]Harten, A., Engquist, B., Osher, S., & Chakravarthy, S. 1987, J. Comp. Phys., 71, 231, doi: https://doi.org/10.1016/0021-9991(87)90031-3
  14. [15]Kim, K.-H., Kang, J.-H., Pan, X., & Choi, J.-I. 2021, Comp. Phys. Comm., 260, 107722, doi: https://doi.org/10.1016/j.cpc.2020.107722
  15. [16]Kopal, Z. 1961, Numerical Analysis (London: Chapman & Hall)
  16. [17]Lecoanet, D., McCourt, M., Quataert, E., et al. 2016, MNRAS, 455, 4274, doi: 10.1093/mnras/stv2564DOI
  17. [18]Lele, S. 1992, J. Comp. Phys., 103, 16
  18. [19]Lerat, A., Falissard, F., & Sides, J. 2007, JChPh, 225, 635, doi: https://doi.org/10.1016/j.jcp.2006.12.025
  19. [20]Lesur, G., Ercolano, B., Flock, M., et al. 2022, in Protostars and Planets VII, ed. S. Inutsuka, Y. Aikawa, T. Muto, K. Tomida, & M. Tamura (Astro. Soc. of the Pacific), 465–500. https://arxiv.org/abs/2203.09821
  20. [21]Liepmann, H., & Roshko, A. 2001, Elements of Gasdynamics (Dover Publications)
  21. [22]Mani, A., Larsson, J., & Moin, P. 2009, J. Comp. Phys., 228, 7368, doi: doi.org/10.1051/aas:2000116
  22. [23]Marcus, P. S. 1984, J. Fluid Mech., 146, 65–113, doi: 10.1017/S0022112084001774DOI
  23. [24]Masset, F. 2000, ApJS, 141, 165, doi: 10.1051/aas:2000116DOI
  24. [25]Merriman, B. 2003, J. Sci. Comp., 19, 309, doi: 10.1023/A:1025312210724DOI
  25. [26]Mignone, A. 2021, Pluto Users Guide, Available at http://plutocode.ph.unito.it/userguide.pdf
  26. [27]Mignone, A., Bodo, G., Massaglia, S., et al. 2007, ApJS, 170, 228, doi: 10.1086/513316DOI
  27. [28]Moser, R., Moin, P., & Leonard, A. 1983, JChPh, 52, 524, doi: https://doi.org/10.1016/0021-9991(83)90006-2
  28. [29]Nelson, R. P., Gressel, O., & Umurhan, O. M. 2013, MNRAS, 435, 2610, doi: 10.1093/mnras/stt1745
  29. [30]Neufeld, D. A., & Hollenbach, D. J. 1994, ApJ, 428, 170, doi: 10.1086/174230DOI
  30. [31]Pirozzoli, S. 2002, JChPh, 178, 81, doi: https://doi.org/10.1006/jcph.2002.7021
  31. [32]Ritos, K., Kokkinakis, I., & Drikakis, D. 2018, Computers & Fluids, 173, 307, doi: https://doi.org/10.1016/j.compfluid.2018.01.030
  32. [33]Seligman, D., & Laughlin, G. 2017, ApJ, 848, 54, doi: 10.3847/1538-4357/aa8e45DOI
  33. [34]Seligman, D., & Shariff, K. 2019, ApJ, 877, 113, doi: 10.3847/1538-4357/ab13a7DOI
  34. [35]Shariff, K. 2024, Pade: A code for protoplanetary disk turbulence based on Pade differencing., 1.0, Zenodo, doi: 10.5281/zenodo.11114378DOI
  35. [36]Shariff, K., & Wray, A. 2018, ApJS, 238, 12, doi: 10.3847/1538-4365/aad907DOI
  36. [37]Shu, C.-W., & Osher, S. 1989, J. of Comp. Phys., 83, 32, doi: 10.1016/0021-9991(89)90222-2DOI
  37. [38]Smagorinsky, J. 1963, Mon. Weather Rev., 91
  38. [39]Stone, J., Gardiner, T., Teuben, P., Hawley, J., & Simon, J. 2008, ApJS, 178, 137, doi: 10.1086/588755DOI
  39. [40]Stone, J., Tomida, K., White, C., & Felker, K. 2020, ApJS, 249, 4, doi: 10.3847/1538-4365/ab929bDOI
  40. [41]Vreman, A. W. 2004, Phys. Fluids, 16, 3670, doi: 10.1063/1.1785131DOI
  41. [42]Yee, H., & Sjögreen, B. 2018, Computers & Fluids, 169, 331, doi: https://doi.org/10.1016/j.compfluid.2017.08.028

Paper details

vlnc:W_p5nz2rm4
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents