Code Monkey home page Code Monkey logo

pdspectr's Introduction

This package is a pseudospectral PDE solver for some speccific stiff equations.

When solving a PDE in pseudosepctral methods, it is quite common that it can be finally reduced to the form like this

$$ \frac{\partial}{\partial t}\hat{\phi}= A \hat{\phi}+ B(\hat{phi}) $$

where $A$ is a linear stiff part and $B$ is a nonlinear but (hopefully) non-stiff part.

This package is designed to be as compatible with the latest scipy as possible.

User can initialize the ODE with the customized class Linear and NonLinear of differential operators.

For example

from pdspectr.utils import stiff_solve_ivp
from pdspectr.pseudo_spectral import Linear, NonLinear
from pdspectr.ETDRK2 import ETDRK2

# region for periodic boudary condition
L = 60
T = 10

# initialize a linear operator of form -(d/dx)^3 q(x) phi(x) over L
L1 = Linear(-1, [(3, qsample)], L)

degrees1 = [(1, 2)]
# initialize a Nonlinear operotor of the form  -3 * (d/dx) phi(x)^2
NL1 = NonLinear(-3, degrees1, L)

def A(t, phihat):
    return L1(phihat)

def B(t, phihat):
    return NL1(phihat)

sol = stiff_solve_ivp(A, B, [0, T], fhat, ETDRK2, max_step=dt)

pdspectr's People

Contributors

ldxiao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.