JuliaApproximation / ApproxFunExamples

Examples for using ApproFun.jl
MIT License
24 stars 7 forks source link

Heat equation with nonconstant coefficient #9

Open ignace-computing opened 3 years ago

ignace-computing commented 3 years ago

Hello. Do you currently have support for the heat equation with non-constant coefficients?

\frac{\partial u}{\partial t} =  \frac{\partial}{\partial x} \left( k(x) \frac{\partial u}{\partial x} \right),

or, alternatively,

\frac{\partial u}{\partial t} =\frac{\partial^2}{\partial x^2} \left( k(x) u \right),

where u(x,t) is the solution and k(x) is the variable coefficient.

Thank you for considering this question.

dlfivefifty commented 3 years ago

I believe that works fine

ignace-computing commented 3 years ago

Great. Could you please give me some hints (to an example?), to show how this is possible? Thanks!

dlfivefifty commented 3 years ago

Pretty straight forward if you look at

https://github.com/JuliaApproximation/ApproxFunExamples/blob/master/PDEs/Rectangle%20PDEs.ipynb

Check out for example the convection example. Using an operator like Dt-Dx*(k*Dx) should work