Skip to content

Commit

Permalink
Change waves example to use Legendre
Browse files Browse the repository at this point in the history
  • Loading branch information
kburns committed Jul 31, 2022
1 parent 2a8162c commit 8de2b1e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/evp_1d_waves_on_a_string/waves_on_a_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
a plot of the relative error of the eigenvalues. It should take just
a few seconds to run (serial only).
We use a Chebyshev basis to solve the EVP:
We use a Legendre basis to solve the EVP:
s*u + dx(dx(u)) = 0
u(x=0) = 0
u(x=Lx) = 0
Expand All @@ -31,7 +31,7 @@
# Bases
xcoord = d3.Coordinate('x')
dist = d3.Distributor(xcoord, dtype=dtype)
xbasis = d3.Chebyshev(xcoord, size=Nx, bounds=(0, Lx))
xbasis = d3.Legendre(xcoord, size=Nx, bounds=(0, Lx))

# Fields
u = dist.Field(name='u', bases=xbasis)
Expand All @@ -44,10 +44,11 @@
lift_basis = xbasis.derivative_basis(1)
lift = lambda A: d3.Lift(A, lift_basis, -1)
ux = dx(u) + lift(tau_1) # First-order reduction
uxx = dx(ux) + lift(tau_2)

# Problem
problem = d3.EVP([u, tau_1, tau_2], eigenvalue=s, namespace=locals())
problem.add_equation("s*u + dx(ux) + lift(tau_2) = 0")
problem.add_equation("s*u + uxx = 0")
problem.add_equation("u(x=0) = 0")
problem.add_equation("u(x=Lx) = 0")

Expand Down

0 comments on commit 8de2b1e

Please sign in to comment.