Understanding and implementing the tau method for boundary conditions in Dedalus
The generalized tau method is a system for imposing boundary conditions when solving partial differential equations using polynomial spectral methods. It consists of explicitly adding tau terms to the PDE which introduce degrees of freedom that allow the problem to be solved exactly over polynomials.
Most PDEs we wish to solve do not have exact polynomial solutions. Instead, we seek polynomial solutions that approximate the true solution. The tau method makes these modifications explicit in the problem specification by adding tau terms to the equations.
Consider the simple equation:∂xu(x)−u(x)=0,x∈[0,1]u(0)=1The exact solution is u(x)=ex, but we seek an approximate polynomial solution. The generalized tau method modifies the PDE to be:∂xu(x)−u(x)+τP(x)=0where τ is an undetermined constant and P(x) is a specified polynomial.
If P(x) is a polynomial of degree N, then the modified equation has an exact polynomial solution uN(x) that is also of degree N.
When solving a system of nonsingular PDEs, the number of tau terms and boundary conditions will generally match the total number of derivatives in the system. This is most easily counted by converting the system to first-order form.
Consider linearized 2D incompressible hydrodynamics with velocity u=(u,v), pressure p, and forcing f=(f,g). The domain is periodic in x and bounded in y∈[−1,1] with no-slip conditions.The equations in first-order form for y-derivatives:uy−∂yu+τ1(x)P(y)=0vy−∂yv+τ2(x)P(y)=0∂xu+vy=0∂tu−ν(∂x2u+∂yuy)+∂xp+τ3(x)P(y)=f∂tv−ν(∂x2v+∂yvy)+∂yp+τ4(x)P(y)=g
We have four y-derivatives and four boundary conditions, so we need four tau terms.
Dedalus v3 supports equations with arbitrary differential order. We can eliminate the first-order-reduction variables to recover the original second-order equations, but containing the same tau corrections:∂xu+∂yv−τ2(x)P(y)=0∂tu−ν(∂x2u+∂y2u)+∂xp+τ3(x)P(y)−ντ1(x)∂yP(y)=f∂tv−ν(∂x2v+∂y2v)+∂yp+τ4(x)P(y)−ντ2(x)∂yP(y)=gThis system has the same solution as the first-order system, but is more efficient to solve.
The Lift operator handles the specification of and multiplication by the tau polynomial P(y). It multiplies its argument by the specified mode/element of a selected basis.
# For Cartesian domains with Chebyshev baseslift_basis = ybasis.derivative_basis(1) # Chebyshev U basislift = lambda A: d3.Lift(A, lift_basis, -1) # Use highest mode U_{N-1}(y)
The choice of tau polynomial affects the conditioning and accuracy of the solution. For Chebyshev bases, using the highest mode in the Chebyshev-U basis (via the derivative basis) is recommended.
In disk and ball geometries, the radial dimension has only a single (outer) boundary. Second-order elliptic and parabolic equations generally only need one boundary condition and one tau term:
# Fields for disk problemp = dist.Field(name='p', bases=disk_basis)u = dist.VectorField(coords, name='u', bases=disk_basis)tau_u = dist.VectorField(coords, name='tau_u', bases=phi_basis) # Only one tau termtau_p = dist.Field(name='tau_p')# Substitutionslift = lambda A: d3.Lift(A, disk_basis, -1)# Problemproblem = d3.IVP([p, u, tau_u, tau_p], namespace=locals())problem.add_equation("div(u) + tau_p = 0")problem.add_equation("dt(u) - nu*lap(u) + grad(p) + lift(tau_u) = f")problem.add_equation("u(r=1) = 0")problem.add_equation("integ(p) = 0")
For disk and ball bases, the Lift operator automatically handles the mode-dependent tau polynomials under the hood.