问题
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