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

1. Solver for multidimensional problem 2. Product with variable coefficients

ShengChenBNU opened this issue · comments

  1. The one dimensional problem is easy to solve the matrix system Au=f by A.solve(f), however, the high dimensional problems quite different. Does it exist an easy method to solve the high dimensional problem? Do you have a tutorial?

  2. Do we have an operator to compute the inner product (cu,v) with variable coefficient c(x)?

  1. The one dimensional problem is easy to solve the matrix system Au=f by A.solve(f), however, the high dimensional problems quite different. Does it exist an easy method to solve the high dimensional problem? Do you have a tutorial?

There are numerous demo programs for high-dimensional problems. Just survey the demo folder. If you mean problems with non-periodic boundary conditions in more than one direction, then look at poisson2ND.py.

  1. Do we have an operator to compute the inner product (cu,v) with variable coefficient c(x)?

Variable coefficients are straight-forward. See, for example, OrrSommerfeld_eigs.py.

Great! I've successfully written the code for 2d Helmholtz equation -\Delta u + lam(x,y) u =f(x,y) by following your suggestions. Thanks a lot!
However, a new issue arises in numerical implementing when substituting the variable coefficient lam(x,y), e.g. lam(x,y)=sy.exp(x+y) in the equation. In my view, this problem may be caused by the inner product inner(v, lamu) due to Gaussian quadrature now is not accurate for vlam*u. Do you have any efficient technique to solve it?
With my best regards!

You can do the inner products with adaptive quadrature, or exact integration.

inner(v, lam*u, assemble='adaptive')
inner(v, lam*u, assemble='exact')

Exact may take too long time, depends on whether sympy can easily do the integration or not.

Thank you so much.
You're absolutely right! It takes too long time.