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

Two inhomogeneous directions? #16

Closed
loiseaujc opened this issue May 30, 2018 · 6 comments
Closed

Two inhomogeneous directions? #16

loiseaujc opened this issue May 30, 2018 · 6 comments

Comments

@loiseaujc
Copy link

Hej Mikael,

I have successfully written as small python code for two-dimensional turbulence using shenfun. I am planning to move on to a fully three-dimensional channel flow, and maybe eventually a duct flow. In that matter, it is written in the abstract of the shenfun paper:

With the shenfun Python module (github.com/spectralDNS/shenfun) an effort is made towards automating the implementation of the spectral Galerkin method for simple tensor product domains, consisting of (currently) one non-periodic and any number of periodic directions.

Do you have any plan of adding eventually multiple (say just two to begin with) inhomogeneous directions? That would be extremely valuable for people interested in confined flows (e.g. lid-driven cavity flows or duct flow to mention just two of them).

Thanks a lot anyway for developing shenfun. A really cool package!

@mikaem
Copy link
Member

mikaem commented May 31, 2018

Hej Sean-Christophe
Thanks a lot for your feedback:-) Have you seen this 2D demo with 2 inhomogeneous directions? The problem with 2 inhomogeneous directions is to create good linear algebra solvers. I have created one for two Dirichlet Legendre bases, but that's about it. Everything else should work out of the box, like transforms and projections, but the solvers are quite a bit more complicated than in 1D. See Shen's papers and the sections about 2D. The solver implemented for the demo corresponds to sec 2.2 in the first Shen reference. So there's no technical issue or problem really, it's just to find the time to actually do it:-)

@mikaem
Copy link
Member

mikaem commented Jan 3, 2019

Hi,

Just wanted to make a note that with PR #21 there is now a generic solver for 2 inhomogeneous directions (see link). The solver makes use of sparse linear algebra from scipy, but is not highly optimized for speed. The solver is direct but the factorizations are (for now) not stored as would be efficient for multiple solves. Can be easily added later.

Some demos are::

@loiseaujc
Copy link
Author

Happy New Year!

Awesome! Thanks a lot for the update! Haven't had time to keep working on my Rayleigh-Benard code, but I'll keep you updated once I have a working version.

@mikaem
Copy link
Member

mikaem commented Jan 9, 2019

Great:-) I have also (slowly) been adding some more documentation, which may be of help in understanding how things actually work:-)
I also have a new Rayleigh-Bénard video. It's actually a 3D simulation using an optimized spectralDNS solver (which is using shenfun), and I'm waiting to get more CPU-hours such that I can run it with higher resolution. This one is 128x256x256.

@mikaem mikaem closed this as completed Apr 7, 2019
@stefmech
Copy link

stefmech commented Dec 2, 2021

Hey Mikael,

thank you for providing such a cool package! For me it would be quite interesting to have a solver for 3 non-periodic directions (Legendre, Chebyshev). Are there any plans to extend this functionality?

@mikaem
Copy link
Member

mikaem commented Dec 3, 2021

Hi @stefmech

Three non-periodic directions are actually already possible. There may be limited possibilities in terms of linear algebra, but I just verified that this works:

from shenfun import *
import matplotlib.pyplot as plt
D = FunctionSpace(16, 'L', bc=(0, 0))
T = TensorProductSpace(comm, (D, D, D))
u = TrialFunction(T)
v = TestFunction(T)
B = inner(u, v)
Bd = B.diags()
plt.spy(Bd, markersize=0.5)

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

3 participants