项目作者: SciML

项目描述 :
Linear operators for discretizations of differential equations and scientific machine learning (SciML)
高级语言: Julia
项目地址: git://github.com/SciML/DiffEqOperators.jl.git
创建时间: 2017-05-16T09:34:59Z
项目社区:https://github.com/SciML/DiffEqOperators.jl

开源协议:Other

下载


DiffEqOperators.jl

Join the chat at https://julialang.zulipchat.com #sciml-bridged
Global Docs

codecov
Build Status
Build status

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages
SciML Code Style

This Package is in the Process of being Deprecated

Alternatives:

README

DiffEqOperators.jl is a package for finite difference discretization of partial
differential equations. It allows building lazy operators for high order non-uniform finite differences in an arbitrary number of dimensions, including vector calculus operators.

For automatic Method of Lines discretization of PDEs, better suited to nonlinear systems of equations and more complex boundary conditions, please see MethodOfLines.jl

For the operators, both centered and
upwind operators are provided,
for domains of any dimension, arbitrarily spaced grids, and for any order of accuracy.
The cases of 1, 2, and 3 dimensions with an evenly spaced grid are optimized with a
convolution routine from NNlib.jl. Care is taken to give efficiency by avoiding
unnecessary allocations, using purpose-built stencil compilers, allowing GPUs
and parallelism, etc. Any operator can be concretized as an Array, a
BandedMatrix or a sparse matrix.

Documentation

For information on using the package,
see the stable documentation. Use the
in-development documentation for the version of
the documentation which contains the unreleased features.

Example 1: Finite Difference Operator Solution for the Heat Equation

  1. using DiffEqOperators, OrdinaryDiffEq
  2. # # Heat Equation
  3. # This example demonstrates how to combine `OrdinaryDiffEq` with `DiffEqOperators` to solve a time-dependent PDE.
  4. # We consider the heat equation on the unit interval, with Dirichlet boundary conditions:
  5. # ∂ₜu = Δu
  6. # u(x=0,t) = a
  7. # u(x=1,t) = b
  8. # u(x, t=0) = u₀(x)
  9. #
  10. # For `a = b = 0` and `u₀(x) = sin(2πx)` a solution is given by:
  11. u_analytic(x, t) = sin(2*π*x) * exp(-t*(2*π)^2)
  12. nknots = 100
  13. h = 1.0/(nknots+1)
  14. knots = range(h, step=h, length=nknots)
  15. ord_deriv = 2
  16. ord_approx = 2
  17. const Δ = CenteredDifference(ord_deriv, ord_approx, h, nknots)
  18. const bc = Dirichlet0BC(Float64)
  19. t0 = 0.0
  20. t1 = 0.03
  21. u0 = u_analytic.(knots, t0)
  22. step(u,p,t) = Δ*bc*u
  23. prob = ODEProblem(step, u0, (t0, t1))
  24. alg = KenCarp4()
  25. sol = solve(prob, alg)