spectralDNS / shenfun

High performance computational platform in Python for the spectral Galerkin method

Home Page:http://shenfun.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chebyshev Biharmonic BCs

preiter93 opened this issue · comments

Hi,

very much like this Project!

Here is a small bug I've encountered
Using biharmonic BCs in combination with Chebyshev bases (like in the Rayleigh Benard demo), shenfun raises a not implemented error:

from shenfun import *
VB = FunctionSpace(100, 'Chebyshev', bc="biharmonic")

I fixed it by adding string recognition to the chebyshev bases part in forms/arguments.py (line 234):

    if isinstance(bc, (tuple, dict)):
        key, par['bc'] = _process_bcs(bc, domain)

    elif bc is None:
        key = ''
    #------------------------------------------
    elif isinstance(bc, str):
        if bc.lower() == 'biharmonic':  
            key = "LDLNRDRN"
        else:
            raise NotImplementedError
    #------------------------------------------
    else:
        raise NotImplementedError

Best regards

Hi,
Thanks a lot for the report, much appreciated:-) It's difficult to keep all demos up to date, and since the interface for the boundary conditions recently changed, the biharmonic function space should now use either 'bc=(a, b, c, d)', or 'bc = {'left': [('D', a), ('N', c)], 'right': [('D', b), ('N', d)]}', as written here. BTW, it's not allowed to use bc='dirichlet' or bc='neuman' anymore either.

Hi,

thanks a lot for the fast reply!
It indeed works with

bc = {'left': [('D', 0), ('N', 0)], 'right': [('D', 0), ('N', 0)]}
self.B0 = FunctionSpace(N[0], family, quad=quad, bc=bc)