Skip to main content

This library implements Kreiss-Lopatinskii determinant for numerical scheme with boundary

Project description

This is the architecture for the package "boundaryscheme" : https://pypi.org/project/boundaryscheme/

boundaryscheme

Package Python to use numerical scheme with boundaries which is described in the PhD manuscript

P. Le Barbenchon, Étude théorique et numérique de la stabilité GKS pour des schémas d'ordre élevé en présence de bords, PhD, 2023.

Package documentation

https://plebarbenchon.github.io/boundaryscheme

Easy installation for the PyPI version

pip install boundaryscheme

Installation for the GitHub version

git clone https://github.com/PLeBarbenchon/boundaryscheme.git
cd boundaryscheme
pip3 install -r requirements.txt
pip3 install -e .
python3 examples/draw_detKLcurve.py

Example

import matplotlib.pyplot as plt

from boundaryscheme.schemes import BeamWarming
from boundaryscheme.boundaries import SILW
import boundaryscheme.pyplot as bsplt

bsplt.detKLcurve(BeamWarming, SILW(2,3),lambdacursor = True)
plt.show()

mygif

Creation of a scheme

To compute the scheme $U_{j}^{n+1} = \dfrac{1}{3}U_{j-1}^n + U_j^n -\dfrac{1}{6} U_{j+1}^n - \dfrac{1}{6}U_{j+2}^n$ with a boundary $B$, write

S = Scheme([1/3,1,-1/6,-1/6],1, B) 

To compute the scheme depending on a parameter $\lambda$, create a Python class using the following formulation:

class Name(Scheme):
    """This is a class to represent ...

    :param lamb: The Courant number, i.e  a.dt/dx where "a" is the velocity, "dt" the time discretization and "dx" the space discretization
    :type lamb: float
    :param boundary: Boundary condition, defaults to Dirichlet()
    :type boundary: class:`Boundary`, optional
    :param sigma: Gap between the mesh and the boundary condition, defaults to 0
    :type sigma: float, optional
    """

    def __init__(self, lamb, boundary=Dirichlet(), sigma=0, **kwargs):
        """Constructor method"""
        self.sigma = sigma
        self.lamb = lamb
        self.inter = #write the list of the coefficients of the scheme
        self.center = #write the index of the center of the scheme
        self.CFL = #give the CFL condition
        super().__init__(inter=self.inter, center=self.center, boundary=boundary, sigma=sigma, **kwargs)

    def shortname(self):
        """Name method"""
        return "Name"

For example, to compute the scheme $U_{j}^{n+1} = \dfrac{\lambda}{3}U_{j-1}^n + \lambda^2 U_j^n -\dfrac{1}{6} U_{j+1}^n - \dfrac{\lambda}{6}U_{j+2}^n$ with a boundary $B$, write

class Name(Scheme):
    def __init__(self, lamb, boundary=Dirichlet(), sigma=0, **kwargs):
        self.sigma = sigma
        self.lamb = lamb
        self.inter = [lamb/3, lamb**2, -1/6, -lamb/6]
        self.center = 1
        self.CFL = #give the CFL condition
        super().__init__(inter=self.inter, center=self.center, boundary=boundary, sigma=sigma, **kwargs)

    def shortname(self):
        """Name method"""
        return "Name"

Citing

The code is citable via Zenodo. Please cite as:

P. Le Barbenchon, boundaryscheme: package Python for numerical schemes with boundaries. 2023. DOI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boundaryscheme-2.4.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

boundaryscheme-2.4-py2-none-any.whl (20.4 kB view details)

Uploaded Python 2

File details

Details for the file boundaryscheme-2.4.tar.gz.

File metadata

  • Download URL: boundaryscheme-2.4.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for boundaryscheme-2.4.tar.gz
Algorithm Hash digest
SHA256 c4e688303def3c04b3f01ecadb7d8bef252778e34701d79932b4fd8a26885f0d
MD5 c2fdaeeb99753b8ce3bbd18b68432bd7
BLAKE2b-256 773a47f773af8a555ff8778c4d7ebdfc11a337d4df469e8a1836af15592d2534

See more details on using hashes here.

File details

Details for the file boundaryscheme-2.4-py2-none-any.whl.

File metadata

File hashes

Hashes for boundaryscheme-2.4-py2-none-any.whl
Algorithm Hash digest
SHA256 6cd353c4797278e0fbf9411690da45a0249d6c83d00d5024277c747da880298b
MD5 02978ebd6a8abe4c830a641c6ee987f8
BLAKE2b-256 5fd853986d7b658e2d635b23efc7e1e93ecdf2ed7a27d82a9d18c2bd77e7f275

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page