-
Notifications
You must be signed in to change notification settings - Fork 70
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
Support (f::Fun)(::Domain) for restricting a function to a sub domain #414
Comments
The README is for the development version, which hasn't been tagged yet. The syntax Fun((x,y)->g(x,y),∂(d)) |
Thanks, dlfivefifty!
The error messages in both cases are: Thanks for your help! |
What version of Julia are you on? You can you also try on development. The tagged version of PDE solving is less robust. (There was a major revamp.) Pkg.checkout(“ApproxFun”,”development”)
d=Interval()^2
f=Fun((x,y)->exp(-(x^2+3*y^2))*cos(5*pi*x+7*pi*y),∂(d))
u = linsolve([Dirichlet(d); Δ+500I],[f;0.];tolerance=1E-7) Note that it is necessary to specify the tolerance as otherwise the solution time will be too long (the solver is still being optimized.) |
If you require multiple RHS, you can do the following the make subsequent solves faster: d=Interval()^2
f=Fun((x,y)->exp(-(x^2+3*y^2))*cos(5*pi*x+7*pi*y),∂(d))
QR=qrfact([Dirichlet(d); Δ+500I])
@time u = linsolve(QR,[f;0.];tolerance=1E-7) # 2.392173s
@time u = linsolve(QR,[f;0.];tolerance=1E-7) # 0.009747s |
The julia version I have is: 0.5.0.
Then, I got the same error as I reported earlier. |
No this is on 0.6. 0.5 has some outstanding bugs with conflicting packages which I suspect you are running into. You would have to delete your .julia folder to fix it.
|
Well, I just installed julia version 0.6.0-dev.1178, and did exactly what you suggested including installing the developmental version of ApproxFun.
ERROR: MethodError: Cannot |
0.6 is not supported
|
Sorry, I made a typo. I meant to say “No, this is on 0.5"
|
OK, I remembered in the last tagged version it uses complex numbers instead of x, y. So try this: f=Fun(z->(x=real(z);y=imag(z);exp(-(x^2+3*y^2))*cos(5*pi*x+7*pi*y)),∂(d))
Δ = Laplacian(d)
u = pdesolve([dirichlet(d);Δ+500I],[f;0.],200) |
Or, on development in Julia 0.5, you can try moving your .julia folder aside. |
Sorry for the typo....really annoying one. |
Well, before I installed 0.6, I tried the developmental version of ApproxFun as you suggested, and as I reported earlier, I got the error. |
Yes. In case (1) you might be able to get away with not moving away .julia. There's been several people who've reported weird bugs where moving away .julia fixes it. I believe it's due to the open issue JuliaLang/julia#18465 but that's just a guess. |
Note that (1) and (2) have very different solvers. The solver in (1) is faster if you are changing The solver in (1) has since been moved to https://github.com/ApproxFun/PDESchurFactorization.jl but has not been fixed up for the current development version. |
Ah, for (2) you might have to also do |
Thanks a lot! |
I'll try to tag it by next week. I was hoping to speed up the solution to Fourier PDEs first, but I think that will have to be postponed. |
Thanks! When you commit the tagged version next week, what I should do with the development version I just installed on OS X via |
help?> Pkg.free
free(pkg)
Free the package pkg to be managed by the package manager again. It calls
Pkg.resolve() to determine optimal package versions after. This is an
inverse for both Pkg.checkout and Pkg.pin.
You can also supply an iterable collection of package names, e.g.,
Pkg.free(("Pkg1", "Pkg2")) to free multiple packages at once. |
Hello. I want to solve the Helmholtz equation on the square [-1,1] x [-1,1] with the Dirichlet or Neumann boundary conditions where the boundary values are prescribed by the boundary value of a given 2D function. For example, let's use a Gabor function of the form:
Now, I want to use the boundary values of this function
g
to solve the Helmholtz equation. Following the example in README.md, I tried:However, it generates the following error at the 2nd line. What should I do?
Thanks!
PS: By the way, there is a typo in the Helmholtz solver example in README.md.
The third line above in README.md says:
But
Dirichlet
should be replaced bydirichlet
; otherwise it causes an error.Here is the error generated by:
MethodError: no method matching start(::ApproxFun.PiecewiseInterval{Complex{Float64}})
Closest candidates are:
start(!Matched::SimpleVector) at essentials.jl:170
start(!Matched::Base.MethodList) at reflection.jl:258
start(!Matched::IntSet) at intset.jl:184
...
in append_any(::ApproxFun.PiecewiseInterval{Complex{Float64}}, ::Vararg{ApproxFun.PiecewiseInterval{Complex{Float64}},N}) at ./essentials.jl:98
in evaluate(::ApproxFun.Fun{ApproxFun.TensorSpace{Tuple{ApproxFun.Chebyshev{ApproxFun.Interval{Float64}},ApproxFun.Chebyshev{ApproxFun.Interval{Float64}}},ApproxFun.RealBasis,2},Float64}, ::ApproxFun.PiecewiseInterval{Complex{Float64}}) at /Users/xxx/.julia/v0.5/ApproxFun/src/Fun/Fun.jl:141
in (::ApproxFun.Fun{ApproxFun.TensorSpace{Tuple{ApproxFun.Chebyshev{ApproxFun.Interval{Float64}},ApproxFun.Chebyshev{ApproxFun.Interval{Float64}}},ApproxFun.RealBasis,2},Float64})(::ApproxFun.PiecewiseInterval{Complex{Float64}}, ::Vararg{ApproxFun.PiecewiseInterval{Complex{Float64}},N}) at...
The text was updated successfully, but these errors were encountered: