Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ShengChenBNU opened this issue Sep 21, 2022 · 5 comments

Comments

@ShengChenBNU
Copy link

  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)?

@mikaem
Copy link
Member

mikaem commented Sep 21, 2022

  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.

@ShengChenBNU
Copy link
Author

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!

@mikaem
Copy link
Member

mikaem commented Sep 22, 2022

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.

@ShengChenBNU
Copy link
Author

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

@mzqr
Copy link

mzqr commented Aug 3, 2024

For the second question, if it's not possible to find a symbolic variable to represent the coefficient, in other words, if c(x) can only be represented by some discrete points, is there still a solution

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants