Is it possible to use a variable coefficient "a" in PDE Toolbox with parabolic solver?
5 views (last 30 days)
Show older comments
Hi all,
I will try to explain my doubt in the better way possible:
I'm trying to solve the reaction-diffusion equation with PDE Toolbox (Matlab) with non-constant coefficients, the syntax to get the solution (u) is:
parabolic - Solve parabolic PDE problem
This MATLAB function produces the solution to the FEM formulation of the scalar PDE problem:
u1 = parabolic(u0,tlist,b,p,e,t,c,a,f,d)|
c,a,f,d are the coefficients of the parabolic equation:
d(∂u/∂t)−∇⋅(c∇u)+au=f,
But I want something like this:
u=parabolic(u0,tlist,b,p,e,t,c,@coeffunction,f,d);
where @coeffunction is a function handle which corresponds to the coefficient "a".
My question is: Anyone knows if is it possible to specify "a" as a variable coefficient which varies during the execution of the solver? i.e. If my problem is defined between two times (t0,tf), I want that "a" takes different discrete values during the process of solve (I mean during the execution of parabolic).
Thanks
0 Comments
Accepted Answer
Alan Weiss
on 17 Jun 2016
The answer is, it depends on your MATLAB version. According to the release notes, in R2012b and later, the a coefficient can me a function of u and its gradient, as well as of x and y. The documentation describes how to represent your coefficients as string functions, or in functional form.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
3 Comments
Alan Weiss
on 17 Jun 2016
I think that you have a few misapprehensions:
- tlist does NOT contain the only times that parabolic might sample. It contains the range of times that are sampled, and the solution times that are reported, but the solver might sample any point in between the first and last points in tlist. So your coefficient function has to be defined for any time in that range.
- a should not be a cell array. You have to give a in the form that is documented, meaning a scalar for a single PDE, or the correct form in case you have a system of PDEs.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
More Answers (1)
See Also
Categories
Find more on Eigenvalue Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!