• m2_351667
    了解作者
  • 473.9KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-15 00:01
    上传日期
React扩散求解器 状态 前Alpha。 单元测试通过了,但是覆盖范围还不完整,集成测试也没有完成。 目的 这个软件包解决了一个简单的问题:二维React扩散动力学。 具体来说,它解决了PDE系统 在此,每种化学物质用下标i表示,物理参数D i , βi和γij是时空常数。 注意,不假定上述方程式中类似索引的求和; 仅执行显式求和。 坐标是笛卡尔坐标,边界条件是周期性的。 安装 要安装,您可以使用pip。 pip install rdsolver 您的浏览器在放置图形时可能会遇到问题,因此您应该像这样启动Jupyter笔记本: jupyter notebook --NotebookApp.iopub_data_rate_limit=10000000 方法 为了解决PDE,我使用频谱微分和可变时间步长隐式/显式(VSIMEX)时间步长,方法是使用Crank-Nicholson / A
rdsolver-master.zip
  • rdsolver-master
  • notebooks
  • asdm_example.ipynb
    250.8KB
  • .gitignore
    44B
  • imgs
  • RD_PDE.png
    15.3KB
  • rdsolver
  • rd.py
    27.9KB
  • utils.py
    14.8KB
  • __init__.py
    243B
  • models.py
    5KB
  • viz.py
    12.1KB
  • .gitignore
    11B
  • sandbox
  • travis_pypi_setup.py
    4KB
  • tox.ini
    537B
  • examples.ipynb
    900.7KB
  • tests
  • test_rd.py
    21.5KB
  • test_utils.py
    14.5KB
  • MANIFEST.in
    257B
  • requirements.txt
    42B
  • .travis.yml
    559B
  • LICENSE
    1KB
  • setup.cfg
    405B
  • setup.py
    1.4KB
  • README.md
    4KB
  • .gitignore
    96B
内容介绍
# Reaction-Diffusion Solver [![Build Status](https://travis-ci.org/justinbois/rdsolver.svg?branch=master)](https://travis-ci.org/justinbois/rdsolver) ## Status **Pre-alpha. Unit tests are passing, but coverage is not complete nor are integration tests.** ## Purpose This package solves a simple problem: reaction diffusion dynamics in two dimensions. Specifically, it solves the system of PDEs ![RD PDE](imgs/RD_PDE.png) Here, each chemical species is indicated by the subscript *i* and the physical parameters *D<sub>i</sub>*, *β<sub>i</sub>*, and *γ<sub>ij</sub>* are constants in space and time. Note that summation over like indices in the above equation is not assumed; only the explicit summation is performed. The coordinates are Cartesian and the boundary conditions periodic. ## Installation To install, you can use pip. ``` pip install rdsolver ``` Your browser may have problems rending the graphics, so you should launch your Jupyter notebook like this: ``` jupyter notebook --NotebookApp.iopub_data_rate_limit=10000000 ``` ## Method To solve the PDEs, I use spectral differentiation with variable time step implicit/explicit (VSIMEX) time stepping using a Crank-Nicholson/Adams-Bashforth method. The cons of this approach appear below, and the pros are best understood by considering why these methods are chosen. #### Why IMEX? Reaction-diffusion equations can be stiff, which makes explicit time stepping really slow. So, if we can do implicit stepping, we can take much larger steps because implicit methods have a more amenable stability region. The problem is that nonlinear problems make implicit time stepping difficult because we would have to solve a system of nonlinear equations to make time steps. A typical way around this is to linearize the equations and take steps according to the linearized model. Instead, imagine that the right hand side of the PDEs have a linear stiff part and a nonlinear part that is not so stiff. We could then do implicit time stepping on the linear part (which involves solving a *linear* system of equations) and explicit time stepping on the nonlinear part. This is typically what we have in reaction-diffusion equations. The diffusive part is stiff, and the chemical reaction part is not. In the system of equations solved here, we have split out the linear parts given by the diffusion terms and the spontaneous production and degradation terms that are common in biological application from the remainder of the nonlinear reaction terms, given by the function *f<sub>i</sub>*(*c*<sub>1</sub>, *c*<sub>2</sub>, ...). So, for each time step, we step implicitly for the linear terms using a Crank-Nicholson step and explicitly for the nonlinear terms using an Adams-Bashforth step. #### Why variable step size? By taking steps of variable size, we can take bigger steps when the solution is not changing much, and shorter steps when it is, allowing us to resolve the dynamics without wasting steps. I use a PID controller to adjust step size to hit a (small) target relative change in the solution for each step. The primary reference for the VSIMEX method is Wang and Ruuth, *J. Comput. Math.*, **26**, 838-855, 2008. #### Why spectral methods? There are two major bonuses to using spectral methods. First, the solution of the linear system in the implicit time step becomes trivial. This makes the time stepping **much** more efficient. Second, spectral methods give very accurate derivatives with fewer grid points. In turn, the fewer grid points results in faster time stepping. We can do non-periodic boundary conditions with spectral methods by computing on Chebyshev grids, which is a future enhancement. For now, we limit the solutions to periodic domains. #### Cons to spectral methods There are a few important watch-outs when using spectral methods. First, the initial conditions need to be chosen carefully. Importantly, you cannot just make random perturbations. The functions must be strictly periodic and smooth. Along the same lines, spectral methods will fail if there are very sharp changes in the concentration profile.
评论
    相关推荐