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

Role of BCBasis and BoundaryValues #54

Open
sebglane opened this issue May 18, 2020 · 1 comment
Open

Role of BCBasis and BoundaryValues #54

sebglane opened this issue May 18, 2020 · 1 comment

Comments

@sebglane
Copy link
Contributor

sebglane commented May 18, 2020

I would like to implement inhomogeneous mixed Dirichlet-Neumann BCs. Homogeneous mixed BCs are already available for example by using the class DirichletNeumannBasis. There are two types of classes which seem to handle the inhomogeneous Dirichlet BCs in shenfun: BCBasis and BoundaryValues. My question is whether both classes require a modification or if it is sufficient to modify BCBasis only.

Furthermore, it is not clear if both classes only work for the Dirichlet BCs or also for the mixed cases. All of the ansatz spaces are constructed such that the functions \phi_{N-2} and \phi_{N-1} fulfill the inhomogeneous BCs. All other functions fulfill homogeneous BCs. Thus, for u(x=-1)=a and u(x=1)=b, the coefficients are given by c_{N-2}=a and c_{N-1}=b. This relation regarding the coefficients also applies for the mixed BCs. Therefore, it seems to me that it is sufficient to modify BoundaryValues only.

I would be great if someone could clarify what is the purpose of the different classes such that I can try extend them for the mixed cases.

@mikaem
Copy link
Member

mikaem commented May 19, 2020

Briefly, there are two classes now that can handle non-homogeneous boundary conditions. The regular Dirichlet, which is using BCBasis Legendre and BCBasis Chebyshev, and the Biharmonic bases using BCBiharmonic Chebyshev and BCBiharmonic Legendre. So for each function space with nonzero boundary conditions there is a new tailored class, subclassed from [SpectralBase]. The Dirichlet boundary conditions adds two new basis functions, whereas the biharmonic adds four. The additional basis functions contribute to forward and backward transforms, as well as when solving equations. The contributions are computed with the BoundaryValues class. See, e.g., forward with self.bc.add_mass_rhs(u).

Note that for a new class it should be sufficient to add a new class like BCBasis, with the basis functions needed to get the desired boundary conditions.

Setting boundary conditions is trivial for 1D problems, but much more involved for higher dimensional problems. To understand that I think it can be useful to look at the Rayleigh-Bénard demo.

I have not looked into non-homogeneous Neumann boundary conditions yet, but they can probably be implemented in a similar fashion as the Dirichlet/Biharmonic by adding a few basis functions with non-homogeneous boundary conditions.

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

2 participants