2D Rayleigh-Benard in vorticity-streamfunction formulation #18
Description
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 :
- Homogeneous dirichlet conditions for on both walls
- Bihamonic boundary conditions for on both walls as well.
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 the NonlinearRHS
ones. First, about LinearRHS
: 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.