-
Notifications
You must be signed in to change notification settings - Fork 42
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
2D Rayleigh-Benard in vorticity-streamfunction formulation #18
Comments
Dear JC, Very cool that you are implementing this using shenfun:-) Just so as you know, I recently added two very efficient 3D Rayleigh Benard solvers here and here. A demo running these solvers is here Regarding your questions about |
I was expecting something along these lines (particularly about the integrators), but thanks anyway for the rapid answer. I will work out the weak formulation for the linearized equations first tomorrow as I get to the lab, and implement the linearized solver just to make sure everything works out and I will see for the nonlinear term later on. As for the solver you have already implemented, I already took a look at them and they seem pretty cool indeed. The reason I want to write my own version is to make it a bit more readable for students (or colleagues) not as well versed into python as we can be :-] |
Great:-) A 2D R-B with vorticity-streamfunction formulation would make for a great demo I think. A time-dependent inhomogeneous flow is currently sorely missed. The spectralDNS solvers are in deed to complex, because all bits and pieces are torn apart for speed. |
Hi However, note that all matrices in the system, the biharmonic, stiffness and mass matrix, they all should have fast implementations of the matvec. So you could split it up and do each term by itself. See |
I've pushed matvecs to both Biharmonic and Helmholtz solvers. They're not all optimal, but it should work for all axes and dimensions. |
Awesome! I will actually fork and install shenfun locally rather than going through conda. |
Just a quick fix in Legendre. But these matrices are very sparse and all have highly efficient matvecs anyway. Just the Chebyshev matrices that require some effort really. |
Either I am missing something, or there might be a small issue with the matrix-vector product. Starting from the 2D Poisson-Dirichlet example, here is what I did to test
I would expect EDIT: In Ipython, my very first command is obviously |
Ok. It's probably due to inhomogeneous boundary conditions. Those require adjustments that I did not consider yet. Could you please test with zero bcs? Don't have my computer. |
I ran the same test with the 1D Poisson solver and homogeneous dirichlet boundary conditions. Here is the output:
It indeed seems like the problem comes from the boundary conditions, whether they are homogeneous or not. |
Yes. The last two items are from bcs. There should be no error for a homogeneous case. Did you try that? |
That test was for homogeneous boundary conditions. I modified the example as
Basically, the last two entries of |
The thing is, it's not really an error. Those last two items of the |
Hi Mikael.
Based on shenfun, I have been able to implement a fairly efficient solver for two-dimensional decaying turbulence in a doubly-periodic domain which I eventually plan to use for part of my lectures. I am now willing to use shenfun again to implement a two-dimensional Rayleigh-Bénard solver using a vorticity-streamfunction formulation and I have a few questions. Before getting there, here are the equations I am interested in :
where is the out-of-plane vorticity, is the streamfunction and is the deviation from the linear temperature profile. The set of boundary conditions needed to close the system are the following :
Finally, all variables are periodic in the horizontal direction. The problem we consider is thus the canonical two-dimensional Rayleigh-Bénard convection with solid isothermal walls.
As far as my understanding of shenfun goes, here is basically what I need to do then :
I can use the same Fourier basis for all three variables, i.e.
F = Basis(N[1], family='F', dtype='D', domain=(-np.pi, np.pi))
I then need to define the appropriate Chebyshev basis for each variable as
C_vorticity = Basis(N[0], family='C', domain=(0, 1))
C_temperature = Basis(N[0], family='C', domain=(0, 1), bc='dirichlet')
C_stream = Basis(N[0], family='C', domain=(0, 1), bc='biharmonic')
Given these different bases, I can then define the appropriate TensorProductSpaces as
V_vorticity = TensorProductSpace(comm, (C_vorticity, F) **{'planner_effort': 'FFTW_PATIENT'}, axes=(0, 1))
V_temperature = TensorProductSpace(comm, (C_temperature, F) **{'planner_effort': 'FFTW_PATIENT'}, axes=(0, 1))
V_stream = TensorProductSpace(comm, (C_stream, F) **{'planner_effort': 'FFTW_PATIENT'}, axes=(0, 1))
Finally, I can create the VectorProductSpace for my state vector as
Q = VectorTensorProductSpace([V_vorticity, V_temperature])
If all of this is correct, I then have two questions, one related to the
LinearRHS
function, and the other to theNonlinearRHS
ones. First, aboutLinearRHS
: given my VectorTensorProductSpace Q, how can I create the linear operator( where I assume that I treat and explicitly in the
NonlinearRHS
function)?If creating such a block-diagonal linear operator is currently doable in shenfun, which type of linear solver does shenfun then uses to invert it considering the two different TensorProductSpaces used?
Thanks a lot,
JC
EDIT : I may have mixed some signs, but you get the points anyway.
The text was updated successfully, but these errors were encountered: