Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation on the Tau polynomials in the Tutorial 3 #310

Open
navdeeprana opened this issue Nov 28, 2024 · 1 comment
Open

Improve documentation on the Tau polynomials in the Tutorial 3 #310

navdeeprana opened this issue Nov 28, 2024 · 1 comment

Comments

@navdeeprana
Copy link

The current documentation provides the code for the tau polynomials as

# Tau polynomials
tau_basis = xbasis.derivative_basis(2)
p1 = dist.Field(bases=tau_basis)
p2 = dist.Field(bases=tau_basis)
p1['c'][-1] = 1
p2['c'][-2] = 2

There is no explanation of the choice of tau_basis or the manual setting of the elements of p1 and p2. This should be clarified. I can do the work and open a pull request with some pointers on the explanation.

@navdeeprana
Copy link
Author

After reading the documentation on the tau method and checking out other examples, I have come up with the following modified implementation, which is closer to the discussion of the tau method.

...
dx = lambda A: d3.Differentiate(A, xcoord)
d2x = lambda A: dx(dx(A))
tau1, tau2 = dist.Field(name="tau1"), dist.Field(name="tau2")
lift_basis = xcoords.derivative_basis(1)
lift = lambda A : d3.Lift(A, lift_basis, -1)
problem = d3.IVP([u, tau1, tau2], namespace=locals())
problem.add_equation("dt(u) - u - (1+1j*b)*d2x(u) + lift(tau1) + dx(lift(tau2)) = - (1+1j*c) * magsq_u * u")
problem.add_equation("u(x='left') = 0")
problem.add_equation("u(x='right') = 0")
...

Here's the output

image

I can modify the tutorial if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant