How to use a variable coefficient in PDE Toolbox to solve a parabolic equation (Matlab)

最后都变了- 提交于 2019-12-12 18:13:08

问题


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), 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 this:

u=parabolic(u0,tlist,b,p,e,t,c,@coeffunction,f,d);

u0 is the initial solution, tlist is a vector array of times where I record the solution, b corresponds to boundary conditions, (p,e,t) are the elements of the mesh, and @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 have a dependency with tlist?


回答1:


Although not the PDE toolbox, the FEATool Matlab FEM toolbox allows entering and solving PDEs with nonlinear and time dependent coefficients. Equation and boundary expressions can be defined as constants or string expressions (including time, dependent variables, derivatives, space dimension coordinates, and even external user defined Matlab functions). For example coefficients can be defined as

fea.coef = { 'coef1' [] [] 42 ;
             'coef2' [] [] '2*u-ux^2+sin(2*pi*t)' ;
             'coef3' [] [] 'my_fun(t)' };

where now coef1-coef3 can be used freely in the equations and boundary conditions. This answer shows one heat transfer example illustrating this approach.

In your case with a reaction-diffusion equation you could possibly just use the Matlab GUI as convection-diffusion-reaction PDE equations are pre-defined as enter

u*t

as the reaction source term for the corresponding R coefficient. And if you then prefer working with m-script files you can just export the GUI model as a FEA model .m text file.



来源:https://stackoverflow.com/questions/37864981/how-to-use-a-variable-coefficient-in-pde-toolbox-to-solve-a-parabolic-equation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!